Skip to content

Commit f5138d3

Browse files
authored
Added sorting for new tasks and workflow dropdowns (#1433)
* Added sorting for new tasks and workflow dropdowns * Added changeset * resolve comments
1 parent 6fce71d commit f5138d3

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

.changeset/sweet-wasps-look.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@orchestrator-ui/orchestrator-ui-components': patch
3+
---
4+
5+
1406 Added sorting for new tasks and workflow dropdowns

packages/orchestrator-ui-components/src/components/WfoStartButton/WfoStartTaskComboBox.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ export const WfoStartTaskButtonComboBox = () => {
1818
const { data } = useGetTaskOptionsQuery();
1919
const taskOptions = data?.startOptions || [];
2020

21-
const comboBoxOptions: StartComboBoxOption[] = taskOptions.map(
22-
(option) => ({
21+
const comboBoxOptions: StartComboBoxOption[] = [...taskOptions]
22+
.map((option) => ({
2323
data: {
2424
workflowName: option.name,
2525
},
26-
label: option.description || '',
27-
}),
28-
);
26+
label: option.description ?? option.name,
27+
}))
28+
.sort((taskA, taskB) => taskA.label.localeCompare(taskB.label));
2929

3030
const handleOptionChange = async (selectedProduct: StartComboBoxOption) => {
3131
if (await isEngineRunningNow()) {

packages/orchestrator-ui-components/src/components/WfoStartButton/WfoStartWorkflowComboBox.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,17 @@ export const WfoStartWorkflowButtonComboBox = () => {
1818
const { data } = useGetWorkflowOptionsQuery();
1919
const workflowOptions = data?.startOptions || [];
2020

21-
const comboBoxOptions: StartComboBoxOption[] = workflowOptions.map(
22-
(option) => ({
21+
const comboBoxOptions: StartComboBoxOption[] = [...workflowOptions]
22+
.sort((workflowA, workflowB) =>
23+
workflowA.productName.localeCompare(workflowB.productName),
24+
)
25+
.map((option) => ({
2326
data: {
2427
workflowName: option.workflowName,
2528
productId: option.productId,
2629
},
2730
label: option.productName || '',
28-
}),
29-
);
31+
}));
3032

3133
const handleOptionChange = async (selectedProduct: StartComboBoxOption) => {
3234
if (await isEngineRunningNow()) {

0 commit comments

Comments
 (0)