Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.
20 changes: 6 additions & 14 deletions app/web/src/components/AssetDetailsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@
<VButton
:loading="executeAssetTaskRunning"
:loadingText="
editingAsset.schemaVariantId
? 'Updating Asset...'
: 'Creating Asset...'
"
:label="
editingAsset.schemaVariantId ? 'Update Asset' : 'Create Asset'
editingAsset.id ? 'Updating Asset...' : 'Creating Asset...'
"
:label="editingAsset.id ? 'Update Asset' : 'Create Asset'"
:disabled="disabled"
tone="action"
icon="bolt"
Expand Down Expand Up @@ -83,7 +79,7 @@
/>
<VormInput
id="menuName"
v-model="editingAsset.menuName"
v-model="editingAsset.displayName"
type="text"
:disabled="disabled"
label="Display name"
Expand Down Expand Up @@ -150,14 +146,12 @@
ref="executeAssetModalRef"
size="sm"
:title="
editingAsset && editingAsset.schemaVariantId
? 'Asset Updated'
: 'New Asset Created'
editingAsset && editingAsset.id ? 'Asset Updated' : 'New Asset Created'
"
@closeComplete="closeHandler"
>
{{
editingAsset && editingAsset.schemaVariantId
editingAsset && editingAsset.id
? "The asset you just updated will be available to use from the Assets Panel"
: "The asset you just created will now appear in the Assets Panel."
}}
Expand Down Expand Up @@ -222,9 +216,7 @@ const componentTypeOptions = [

const attachModalRef = ref<InstanceType<typeof AssetFuncAttachModal>>();
const assetSchemaVariantId = computed(() =>
props.assetId
? assetStore.assetsById[props.assetId]?.schemaVariantId
: undefined,
props.assetId ? assetStore.assetsById[props.assetId]?.id : undefined,
);

const editingAsset = ref(_.cloneDeep(assetStore.selectedAsset));
Expand Down
6 changes: 2 additions & 4 deletions app/web/src/components/AssetFuncListPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<SidebarSubpanelTitle label="Asset Functions">
<AssetFuncAttachDropdown
v-if="assetStore.selectedAssetId"
:disabled="!assetStore.selectedAsset?.schemaVariantId"
:disabled="!assetStore.selectedAsset?.id"
label="Attach"
@selected-attach-type="openAttachFuncModal"
/>
Expand Down Expand Up @@ -97,9 +97,7 @@ const loadAssetReqStatus = assetStore.getRequestStatus(

const attachModalRef = ref<InstanceType<typeof AssetFuncAttachModal>>();
const assetSchemaVariantId = computed(() =>
props.assetId
? assetStore.assetsById[props.assetId]?.schemaVariantId
: undefined,
props.assetId ? assetStore.assetsById[props.assetId]?.id : undefined,
);

const openAttachFuncModal = (type: "new" | "existing") => {
Expand Down
4 changes: 2 additions & 2 deletions app/web/src/components/AssetListPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
title="Contribute Assets"
label="Contribute to System Initiative"
:loadingText="_.sample(contributeLoadingTexts)"
:preSelectedSchemaVariantId="assetStore.selectedAsset?.schemaVariantId"
:preSelectedSchemaVariantId="assetStore.selectedAsset?.id"
@export-success="onExport"
/>
<Modal ref="exportSuccessModalRef" size="sm" title="Contribution sent">
Expand Down Expand Up @@ -130,7 +130,7 @@ const categorizedAssets = computed(() =>
if (searchString.value.length) {
return (
asset.name.toLocaleLowerCase().includes(searchString.value) ||
asset.menuName?.toLocaleLowerCase().includes(searchString.value)
asset.displayName?.toLocaleLowerCase().includes(searchString.value)
);
}

Expand Down
2 changes: 1 addition & 1 deletion app/web/src/components/FuncEditor/FuncTest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ const dryRunConfig = computed(() => {

const components = computed(() => {
return componentsStore.allComponents.filter(
(c) => c.schemaVariantId === asset.value?.schemaVariantId,
(c) => c.schemaVariantId === asset.value?.id,
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<FuncDetails
v-if="assetStore.selectedFuncId"
:funcId="assetStore.selectedFuncId"
:schemaVariantId="assetStore.selectedAsset?.schemaVariantId"
:schemaVariantId="assetStore.selectedAsset?.id"
singleModelScreen
testPanelEnabled
@detached="onDetach"
Expand Down
63 changes: 25 additions & 38 deletions app/web/src/store/asset.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import { useRouterStore } from "./router.store";

export type AssetId = string;

export interface ListVariantDefsResponse {
variantDefs: ListedVariantDef[];
export interface ListVariantsResponse {
variants: ListedVariant[];
}

export interface InstalledPkgAssetView {
Expand Down Expand Up @@ -70,10 +70,10 @@ export interface DetachedValidationPrototype {
propKind: PropKind;
}

export interface ListedVariantDef {
export interface ListedVariant {
id: AssetId;
name: string;
menuName?: string;
displayName?: string;
category: string;
componentType: ComponentType;
color: string;
Expand All @@ -83,16 +83,15 @@ export interface ListedVariantDef {
updatedAt: IsoDateString;
}

export interface VariantDef extends ListedVariantDef {
export interface Variant extends ListedVariant {
link?: string;
schemaVariantId?: string;
code: string;
types?: string;
hasComponents: boolean;
}

export type Asset = VariantDef;
export type AssetListEntry = ListedVariantDef;
export type Asset = Variant;
export type AssetListEntry = ListedVariant;
export type AssetSaveRequest = Visibility &
Omit<Asset, "createdAt" | "updatedAt" | "variantExists" | "hasComponents">;
export type AssetCreateRequest = Omit<
Expand All @@ -104,7 +103,7 @@ export type AssetCloneRequest = Visibility & { id: AssetId };
const LOCAL_STORAGE_LAST_SELECTED_ASSET_ID_KEY = "si-open-asset-id";

export const assetDisplayName = (asset: Asset | AssetListEntry) =>
(asset.menuName ?? "").length === 0 ? asset.name : asset.menuName;
(asset.displayName ?? "").length === 0 ? asset.name : asset.displayName;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. menuName was very old and we should have refactored it long ago.


export const useAssetStore = () => {
const changeSetsStore = useChangeSetsStore();
Expand Down Expand Up @@ -170,8 +169,8 @@ export const useAssetStore = () => {
assetBySchemaVariantId(): Record<string, Asset> {
const assetsWithSchemaVariantId = _.filter(
this.assets,
(a) => a.schemaVariantId !== undefined,
) as (VariantDef & {
(a) => a.id !== undefined,
) as (Variant & {
schemaVariantId: string;
})[];

Expand All @@ -182,7 +181,7 @@ export const useAssetStore = () => {
setSchemaVariantIdForAsset(assetId: AssetId, schemaVariantId: string) {
const asset = this.assetsById[assetId];
if (asset) {
asset.schemaVariantId = schemaVariantId;
asset.id = schemaVariantId;
this.assetsById[assetId] = asset;
}
},
Expand Down Expand Up @@ -254,7 +253,6 @@ export const useAssetStore = () => {
funcs: [],
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
schemaVariantId: undefined,
hasComponents: false,
};
},
Expand All @@ -269,12 +267,11 @@ export const useAssetStore = () => {
AssetCreateRequest
>({
method: "post",
url: "/variant_def/create_variant_def",
url: "/variant/create_variant",
params: {
...visibility,
..._.omit(asset, [
"id",
"schemaVariantId",
"hasComponents",
"createdAt",
"updatedAt",
Expand All @@ -295,7 +292,7 @@ export const useAssetStore = () => {
>({
method: "post",
keyRequestStatusBy: assetId,
url: "/variant_def/clone_variant_def",
url: "/variant/clone_variant",
params: {
...visibility,
id: assetId,
Expand Down Expand Up @@ -331,7 +328,7 @@ export const useAssetStore = () => {
return new ApiRequest<{ success: boolean }, AssetSaveRequest>({
method: "post",
keyRequestStatusBy: asset.id,
url: "/variant_def/save_variant_def",
url: "/variant/save_variant",
optimistic: () => {
if (isHead) return () => {};

Expand All @@ -347,12 +344,7 @@ export const useAssetStore = () => {
},
params: {
...visibility,
..._.omit(asset, [
"schemaVariantId",
"hasComponents",
"createdAt",
"updatedAt",
]),
..._.omit(asset, ["hasComponents", "createdAt", "updatedAt"]),
},
});
},
Expand All @@ -364,7 +356,7 @@ export const useAssetStore = () => {
id: AssetId;
}
>({
url: "/variant_def/get_variant_def",
url: "/variant/get_variant",
keyRequestStatusBy: assetId,
params: {
id: assetId,
Expand All @@ -377,11 +369,11 @@ export const useAssetStore = () => {
},

async LOAD_ASSET_LIST() {
return new ApiRequest<ListVariantDefsResponse, Visibility>({
url: "/variant_def/list_variant_defs",
return new ApiRequest<ListVariantsResponse, Visibility>({
url: "/variant/list_variants",
params: { ...visibility },
onSuccess: (response) => {
this.assetList = response.variantDefs;
this.assetList = response.variants;
},
});
},
Expand All @@ -405,16 +397,11 @@ export const useAssetStore = () => {
AssetSaveRequest
>({
method: "post",
url: "/variant_def/exec_variant_def",
url: "/variant/exec_variant",
keyRequestStatusBy: assetId,
params: {
...visibility,
..._.omit(asset, [
"schemaVariantId",
"hasComponents",
"createdAt",
"updatedAt",
]),
..._.omit(asset, ["hasComponents", "createdAt", "updatedAt"]),
},
onSuccess: (response) => {
this.executeAssetTaskId = response.taskId;
Expand All @@ -433,21 +420,21 @@ export const useAssetStore = () => {
},
},
{
eventType: "SchemaVariantDefinitionCreated",
eventType: "SchemaVariantCreated",
callback: (data) => {
if (data.changeSetId !== changeSetId) return;
this.LOAD_ASSET_LIST();
},
},
{
eventType: "SchemaVariantDefinitionCloned",
eventType: "SchemaVariantCloned",
callback: (data) => {
if (data.changeSetId !== changeSetId) return;
this.LOAD_ASSET_LIST();
},
},
{
eventType: "SchemaVariantDefinitionSaved",
eventType: "SchemaVariantSaved",
callback: (data) => {
if (data.changeSetId !== changeSetId) return;
this.LOAD_ASSET_LIST();
Expand Down Expand Up @@ -491,7 +478,7 @@ export const useAssetStore = () => {
},
},
{
eventType: "SchemaVariantDefinitionFinished",
eventType: "SchemaVariantFinished",
callback: async ({
taskId,
schemaVariantId,
Expand Down
14 changes: 7 additions & 7 deletions app/web/src/store/realtime/realtime_events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,21 +220,21 @@ export type WsEventPayloadMap = {
secretId: SecretId;
changeSetId: ChangeSetId;
};
SchemaVariantDefinitionCreated: {
schemaVariantDefinitionId: string;
SchemaVariantCreated: {
schemaVariantId: string;
changeSetId: ChangeSetId;
};
SchemaVariantDefinitionCloned: {
schemaVariantDefinitionId: string;
SchemaVariantCloned: {
schemaVariantId: string;
changeSetId: ChangeSetId;
};
SchemaVariantDefinitionFinished: {
SchemaVariantFinished: {
taskId: string;
schemaVariantId: string;
detachedAttributePrototypes: DetachedAttributePrototype[];
};
SchemaVariantDefinitionSaved: {
schemaVariantDefinitionId: string;
SchemaVariantSaved: {
schemaVariantId: string;
changeSetId: ChangeSetId;
};
FuncCreated: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ pub async fn migrate_test_exclusive_schema_katy_perry(ctx: &DalContext) -> Built
.func(resource_payload_to_value_func)
.func(yaml_code_gen_func)
.func(string_code_gen_func)
.func(kp_authoring_schema_func)
.schema(kp_schema)
.build()?;

Expand Down
Loading