Skip to content

Commit ef4d733

Browse files
Sort palette nodes by component label (#2277)
Fixes #2171 Co-authored-by: Nick Bourdakos <[email protected]>
1 parent 803e6d4 commit ef4d733

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/pipeline-editor/src/pipeline-hooks.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ const createMockCategory = (
4545

4646
const createMockComponent = (name: string): Component => {
4747
return {
48-
op: name,
48+
op: 'string',
49+
label: name,
4950
id: 'string',
5051
type: 'execution_node',
5152
inputs: [],

packages/pipeline-editor/src/pipeline-hooks.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export interface IRuntimeComponent {
8585
node_types: {
8686
op: string;
8787
id: string;
88+
label: string;
8889
type: 'execution_node';
8990
inputs: { app_data: any }[];
9091
outputs: { app_data: any }[];
@@ -138,7 +139,9 @@ export const sortPalette = (palette: {
138139

139140
for (const components of palette.categories) {
140141
components.node_types.sort((a, b) =>
141-
a.op.localeCompare(b.op, undefined, { numeric: true })
142+
a.label.localeCompare(b.label, undefined, {
143+
numeric: true
144+
})
142145
);
143146
}
144147
};

0 commit comments

Comments
 (0)