|
@@ -217,7 +217,9 @@ class _GuiCoreContext(CoreEventConsumerBase):
|
|
|
return (
|
|
|
scenario_or_cycle.id,
|
|
|
scenario_or_cycle.get_simple_label(),
|
|
|
- self.scenario_by_cycle.get(scenario_or_cycle),
|
|
|
+ sorted(
|
|
|
+ self.scenario_by_cycle.get(scenario_or_cycle, []), key=_GuiCoreContext.sort_by_creation_date
|
|
|
+ ),
|
|
|
_EntityType.CYCLE.value,
|
|
|
False,
|
|
|
)
|
|
@@ -248,7 +250,7 @@ class _GuiCoreContext(CoreEventConsumerBase):
|
|
|
cycles_scenarios.extend(scenarios)
|
|
|
else:
|
|
|
cycles_scenarios.append(cycle)
|
|
|
- return cycles_scenarios
|
|
|
+ return sorted(cycles_scenarios, key=_GuiCoreContext.sort_by_creation_date)
|
|
|
|
|
|
def select_scenario(self, state: State, id: str, payload: t.Dict[str, str]):
|
|
|
args = payload.get("args")
|
|
@@ -667,6 +669,10 @@ class _GuiCoreContext(CoreEventConsumerBase):
|
|
|
if key and key not in _GuiCoreContext.__ENTITY_PROPS:
|
|
|
ent.properties.pop(key, None)
|
|
|
|
|
|
+ @staticmethod
|
|
|
+ def sort_by_creation_date(entity: t.Union[Scenario, Cycle]):
|
|
|
+ return entity.creation_date
|
|
|
+
|
|
|
def get_scenarios_for_owner(self, owner_id: str):
|
|
|
cycles_scenarios: t.List[t.Union[Scenario, Cycle]] = []
|
|
|
with self.lock:
|
|
@@ -685,7 +691,7 @@ class _GuiCoreContext(CoreEventConsumerBase):
|
|
|
cycles_scenarios.extend(scenarios_cycle)
|
|
|
elif isinstance(entity, Scenario):
|
|
|
cycles_scenarios.append(entity)
|
|
|
- return cycles_scenarios
|
|
|
+ return sorted(cycles_scenarios, key=_GuiCoreContext.sort_by_creation_date)
|
|
|
|
|
|
def get_data_node_history(self, datanode: DataNode, id: str):
|
|
|
if (
|