Skip to content

Commit

Permalink
imroved scenarios
Browse files Browse the repository at this point in the history
fixed labels
added sorting
  • Loading branch information
Robert Schüler committed Mar 1, 2024
1 parent 5dfb48c commit ef32d62
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 0 additions & 2 deletions new/src/components/Scenarios/Scenario.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ export function Scenario(props: ScenarioProps) {
scenario={props.scenario}
expanded={expanded}
setExpanded={onExpansionChanged}
summary={props.scenario.classTitle}
className={"className"}
/>

<AccordionDetails aria-label="Scenario Steps">
Expand Down
6 changes: 2 additions & 4 deletions new/src/components/Scenarios/ScenarioHead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export function ScenarioHead(props: {
expanded: boolean;
setExpanded: (expanded: boolean) => void;
reportName?: string;
summary: string;
className: string;
}) {
const AccordionSummary = styled((props: AccordionSummaryProps) => (
<MuiAccordionSummary
Expand All @@ -41,10 +39,10 @@ export function ScenarioHead(props: {
>
<Grid container columnSpacing={1}>
<Grid item>
<Typography color={"grey"}>{props.reportName}</Typography>
<Typography color={"grey"}>{props.scenario.classTitle}</Typography>
</Grid>
<Grid item>
<Typography>{processWords(props.summary)}</Typography>
<Typography>{processWords(props.scenario.description)}</Typography>
</Grid>
<Grid>
<StatusIcon executionStatus={props.scenario.executionStatus} />
Expand Down
12 changes: 11 additions & 1 deletion new/src/components/Scenarios/ScenarioOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ export function ScenarioOverview(props: {
</Grid>
<Grid item xs={12}>
<div style={{ height: "40em" }}>
{filterByStatus(filters.status).map(scenario => (
{filterByStatus(filters.status)
.sort(compareByClassTitleAndDescriptionFn)
.map(scenario => (
<Scenario
reportName={props.reportName}
scenario={scenario}
Expand Down Expand Up @@ -97,3 +99,11 @@ function createStatistics(scenarios: ScenarioModel[]): ReportStatistics {
numSuccessfulScenarios: successfulScenarios.length
};
}

const compareByClassTitleAndDescriptionFn = (a: ScenarioModel, b: ScenarioModel) => {
const sortValueByClassTitle = a.classTitle.localeCompare(b.classTitle);
if (sortValueByClassTitle === 0) {
return a.description.localeCompare(b.description);
}
return sortValueByClassTitle;
}

0 comments on commit ef32d62

Please sign in to comment.