mirror of
https://github.com/immich-app/immich.git
synced 2026-07-14 17:11:15 +00:00
chore(web): workflow property ordering (#29261)
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Docker / pre-job (push) Waiting to run
Docker / Build and Push ML (push) Blocked by required conditions
Docker / Re-Tag ML (push) Blocked by required conditions
Docker / Docker Build & Push ML Success (push) Blocked by required conditions
Docker / Re-Tag Server (push) Blocked by required conditions
Docker / Build and Push Server (push) Blocked by required conditions
Docker / Docker Build & Push Server Success (push) Blocked by required conditions
Docs build / pre-job (push) Waiting to run
Docs build / Docs Build (push) Blocked by required conditions
Zizmor / Zizmor (push) Waiting to run
Static Code Analysis / pre-job (push) Waiting to run
Static Code Analysis / Run Dart Code Analysis (push) Blocked by required conditions
Test / pre-job (push) Waiting to run
Test / Test the root workspace (push) Blocked by required conditions
Test / Test & Lint Server (push) Blocked by required conditions
Test / Unit Test CLI (push) Blocked by required conditions
Test / Medium Tests (Server) (push) Blocked by required conditions
Test / Unit Test CLI (Windows) (push) Blocked by required conditions
Test / Lint Web (push) Blocked by required conditions
Test / Test Web (push) Blocked by required conditions
Test / Test i18n (push) Blocked by required conditions
Test / End-to-End Lint (push) Blocked by required conditions
Test / End-to-End Tests (Server & CLI) (push) Blocked by required conditions
Test / End-to-End Tests (Web) (push) Blocked by required conditions
Test / End-to-End Tests Success (push) Blocked by required conditions
Test / Unit Test Mobile (push) Blocked by required conditions
Test / Unit Test ML (push) Blocked by required conditions
Test / .github Files Formatting (push) Blocked by required conditions
Test / ShellCheck (push) Waiting to run
Test / OpenAPI Clients (push) Waiting to run
Test / SQL Schema Checks (push) Waiting to run
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Docker / pre-job (push) Waiting to run
Docker / Build and Push ML (push) Blocked by required conditions
Docker / Re-Tag ML (push) Blocked by required conditions
Docker / Docker Build & Push ML Success (push) Blocked by required conditions
Docker / Re-Tag Server (push) Blocked by required conditions
Docker / Build and Push Server (push) Blocked by required conditions
Docker / Docker Build & Push Server Success (push) Blocked by required conditions
Docs build / pre-job (push) Waiting to run
Docs build / Docs Build (push) Blocked by required conditions
Zizmor / Zizmor (push) Waiting to run
Static Code Analysis / pre-job (push) Waiting to run
Static Code Analysis / Run Dart Code Analysis (push) Blocked by required conditions
Test / pre-job (push) Waiting to run
Test / Test the root workspace (push) Blocked by required conditions
Test / Test & Lint Server (push) Blocked by required conditions
Test / Unit Test CLI (push) Blocked by required conditions
Test / Medium Tests (Server) (push) Blocked by required conditions
Test / Unit Test CLI (Windows) (push) Blocked by required conditions
Test / Lint Web (push) Blocked by required conditions
Test / Test Web (push) Blocked by required conditions
Test / Test i18n (push) Blocked by required conditions
Test / End-to-End Lint (push) Blocked by required conditions
Test / End-to-End Tests (Server & CLI) (push) Blocked by required conditions
Test / End-to-End Tests (Web) (push) Blocked by required conditions
Test / End-to-End Tests Success (push) Blocked by required conditions
Test / Unit Test Mobile (push) Blocked by required conditions
Test / Unit Test ML (push) Blocked by required conditions
Test / .github Files Formatting (push) Blocked by required conditions
Test / ShellCheck (push) Waiting to run
Test / OpenAPI Clients (push) Waiting to run
Test / SQL Schema Checks (push) Waiting to run
* chore(web): workflow property ordering * chore(web): extract schema property sorting to method
This commit is contained in:
parent
c3092b1c2c
commit
99f94a363d
5 changed files with 26 additions and 8 deletions
|
|
@ -278,7 +278,9 @@
|
||||||
"title": "Album IDs",
|
"title": "Album IDs",
|
||||||
"array": true,
|
"array": true,
|
||||||
"description": "Target album IDs",
|
"description": "Target album IDs",
|
||||||
"uiHint": "AlbumId"
|
"uiHint": {
|
||||||
|
"type": "AlbumId"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"albumName": {
|
"albumName": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|
@ -368,14 +370,20 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"title": "Album ID",
|
"title": "Album ID",
|
||||||
"description": "Target album ID",
|
"description": "Target album ID",
|
||||||
"uiHint": "AlbumId"
|
"uiHint": {
|
||||||
|
"type": "AlbumId",
|
||||||
|
"order": 1
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"albumIds": {
|
"albumIds": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"title": "Album IDs",
|
"title": "Album IDs",
|
||||||
"description": "Target album IDs",
|
"description": "Target album IDs",
|
||||||
"array": true,
|
"array": true,
|
||||||
"uiHint": "AlbumId"
|
"uiHint": {
|
||||||
|
"type": "AlbumId",
|
||||||
|
"order": 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,12 @@ const JsonSchemaPropertySchema = z
|
||||||
enum: z.array(z.string()).optional().describe('Valid choices for enum types'),
|
enum: z.array(z.string()).optional().describe('Valid choices for enum types'),
|
||||||
array: z.boolean().optional().describe('Type is an array type'),
|
array: z.boolean().optional().describe('Type is an array type'),
|
||||||
required: z.array(z.string()).optional().describe('A list of required properties'),
|
required: z.array(z.string()).optional().describe('A list of required properties'),
|
||||||
uiHint: z.string().optional(),
|
uiHint: z
|
||||||
|
.object({
|
||||||
|
type: z.string().optional(),
|
||||||
|
order: z.int().optional(),
|
||||||
|
})
|
||||||
|
.optional(),
|
||||||
get properties() {
|
get properties() {
|
||||||
return z.record(z.string(), JsonSchemaPropertySchema).optional();
|
return z.record(z.string(), JsonSchemaPropertySchema).optional();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,8 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const setUiHintValue = (values: string[]) => setValue(schema.array ? values : values[0]);
|
const setUiHintValue = (values: string[]) => setValue(schema.array ? values : values[0]);
|
||||||
|
const getSchemaProperties = (schema: JSONSchemaProperty) =>
|
||||||
|
Object.entries(schema.properties ?? {}).sort((a, b) => (a[1].uiHint?.order ?? 0) - (b[1].uiHint?.order ?? 0));
|
||||||
|
|
||||||
const getBoolean = (defaultValue = false) => getValue<boolean>(defaultValue);
|
const getBoolean = (defaultValue = false) => getValue<boolean>(defaultValue);
|
||||||
const getString = () => getValue<string>();
|
const getString = () => getValue<string>();
|
||||||
|
|
@ -72,11 +74,11 @@
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="flex flex-col gap-4 {root ? '' : 'border-l-4 border-gray-200 ps-2'}">
|
<div class="flex flex-col gap-4 {root ? '' : 'border-l-4 border-gray-200 ps-2'}">
|
||||||
{#each Object.entries(schema.properties ?? {}) as [childKey, childSchema] (childKey)}
|
{#each getSchemaProperties(schema) as [childKey, childSchema] (childKey)}
|
||||||
<Self schema={childSchema} key={childKey} bind:config={getValue, setValue} />
|
<Self schema={childSchema} key={childKey} bind:config={getValue, setValue} />
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{:else if schema.uiHint === 'AlbumId'}
|
{:else if schema.uiHint?.type === 'AlbumId'}
|
||||||
<SchemaAlbumPicker {label} {description} array={schema.array} bind:albumIds={getUiHintValue, setUiHintValue} />
|
<SchemaAlbumPicker {label} {description} array={schema.array} bind:albumIds={getUiHintValue, setUiHintValue} />
|
||||||
{:else if schema.enum && schema.array}
|
{:else if schema.enum && schema.array}
|
||||||
<Field {label} {description}>
|
<Field {label} {description}>
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,10 @@ export type JSONSchemaProperty = {
|
||||||
array?: boolean;
|
array?: boolean;
|
||||||
properties?: Record<string, JSONSchemaProperty>;
|
properties?: Record<string, JSONSchemaProperty>;
|
||||||
required?: string[];
|
required?: string[];
|
||||||
uiHint?: 'AlbumId' | 'AssetId' | 'PersonId';
|
uiHint?: {
|
||||||
|
type?: 'AlbumId' | 'AssetId' | 'PersonId';
|
||||||
|
order?: number;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
);
|
);
|
||||||
const isGhost = $derived(step.id === 'ghost');
|
const isGhost = $derived(step.id === 'ghost');
|
||||||
|
|
||||||
const getUiHint = (key: string) => schema?.properties?.[key]?.uiHint;
|
const getUiHint = (key: string) => schema?.properties?.[key]?.uiHint?.type;
|
||||||
const toIds = (value: unknown): string[] => (Array.isArray(value) ? value.map(String) : [String(value)]);
|
const toIds = (value: unknown): string[] => (Array.isArray(value) ? value.map(String) : [String(value)]);
|
||||||
let dragImage = $state<Element>();
|
let dragImage = $state<Element>();
|
||||||
let isDropTarget = $state(false);
|
let isDropTarget = $state(false);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue