Skip to content

Commit

Permalink
Sort palette nodes by component label (#2277)
Browse files Browse the repository at this point in the history
Fixes #2171

Co-authored-by: Nick Bourdakos <[email protected]>
  • Loading branch information
kiersten-stokes and bourdakos1 authored Nov 5, 2021
1 parent 803e6d4 commit ef4d733
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/pipeline-editor/src/pipeline-hooks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const createMockCategory = (

const createMockComponent = (name: string): Component => {
return {
op: name,
op: 'string',
label: name,
id: 'string',
type: 'execution_node',
inputs: [],
Expand Down
5 changes: 4 additions & 1 deletion packages/pipeline-editor/src/pipeline-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export interface IRuntimeComponent {
node_types: {
op: string;
id: string;
label: string;
type: 'execution_node';
inputs: { app_data: any }[];
outputs: { app_data: any }[];
Expand Down Expand Up @@ -138,7 +139,9 @@ export const sortPalette = (palette: {

for (const components of palette.categories) {
components.node_types.sort((a, b) =>
a.op.localeCompare(b.op, undefined, { numeric: true })
a.label.localeCompare(b.label, undefined, {
numeric: true
})
);
}
};
Expand Down

0 comments on commit ef4d733

Please sign in to comment.