Add priority sidebar order constant and use it for sorting keys in extraSidebarComponent
This commit is contained in:
parent
57d6a78d4e
commit
94122cbe44
2 changed files with 16 additions and 11 deletions
|
|
@ -727,3 +727,14 @@ export const STATUS_BUILD = "Build to validate status.";
|
|||
export const STATUS_BUILDING = "Building...";
|
||||
export const SAVED_HOVER = "Last saved at ";
|
||||
export const RUN_TIMESTAMP_PREFIX = "Last Run: ";
|
||||
|
||||
export const PRIORITY_SIDEBAR_ORDER = [
|
||||
"saved_components",
|
||||
"inputs",
|
||||
"outputs",
|
||||
"prompts",
|
||||
"data",
|
||||
"prompt",
|
||||
"models",
|
||||
"helpers",
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,16 +1,10 @@
|
|||
import { PRIORITY_SIDEBAR_ORDER } from "../../../../constants/constants";
|
||||
|
||||
export function sortKeys(a: string, b: string) {
|
||||
// Define the order of specific keys
|
||||
const order = [
|
||||
"saved_components",
|
||||
"inputs",
|
||||
"outputs",
|
||||
"prompts",
|
||||
"data",
|
||||
"models",
|
||||
"utilities",
|
||||
];
|
||||
const indexA = order.indexOf(a.toLowerCase());
|
||||
const indexB = order.indexOf(b.toLowerCase());
|
||||
|
||||
const indexA = PRIORITY_SIDEBAR_ORDER.indexOf(a.toLowerCase());
|
||||
const indexB = PRIORITY_SIDEBAR_ORDER.indexOf(b.toLowerCase());
|
||||
|
||||
// Check if both keys are in the predefined order
|
||||
if (indexA !== -1 && indexB !== -1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue