Skip to content

Commit

Permalink
Adds further submodel inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronzi committed Jan 10, 2025
1 parent 26c76bd commit ff25f48
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 18 deletions.
21 changes: 16 additions & 5 deletions aas-web-ui/src/components/EditorComponents/AASForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<v-expansion-panel class="border-b-thin border-s-thin border-e-thin" :class="bordersToShow(3)">
<v-expansion-panel-title>Asset</v-expansion-panel-title>
<v-expansion-panel-text>
<SelectInput v-model="assetKind" label="AssetKind" type="assetKind"></SelectInput>
<SelectInput v-model="assetKind" label="Asset Kind" type="assetKind"></SelectInput>
<TextInput
v-model="globalAssetId"
label="Global Asset ID"
Expand Down Expand Up @@ -208,9 +208,7 @@
}
}
async function saveAAS() {
if (AASId.value === null) return;
// Create new Asset Information object
function createAssetInformation(): aasTypes.AssetInformation {
const assetInformation = new aasTypes.AssetInformation(assetKind.value);
// Add optional parameter globalAssetId
Expand All @@ -229,7 +227,10 @@
assetInformation.defaultThumbnail = defaultThumbnail.value;
}
// Create new Administrative Information object
return assetInformation;
}
function createAdministrativeInformation(): aasTypes.AdministrativeInformation {
const administrativeInformation = new aasTypes.AdministrativeInformation();
// Add optional parameter version
Expand All @@ -252,6 +253,16 @@
administrativeInformation.templateId = templateId.value;
}
return administrativeInformation;
}
async function saveAAS(): Promise<void> {
if (AASId.value === null) return;
const assetInformation = createAssetInformation();
const administrativeInformation = createAdministrativeInformation();
// Create new AAS if newShell is true
if (props.newShell || AASObject.value === undefined) {
AASObject.value = new aasTypes.AssetAdministrationShell(AASId.value, assetInformation);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<v-divider></v-divider>
<v-list-item class="pl-0 pt-0">
<v-divider v-if="!noHeader"></v-divider>
<v-list-item v-if="!noHeader" class="pl-0 pt-0">
<template #title>
<div class="text-subtitle-2">{{ label }}</div>
</template>
Expand Down Expand Up @@ -29,10 +29,13 @@
type Props = {
label: string;
noHeader?: boolean;
modelValue: aasTypes.Reference | null;
} & ({ showGenerateIriButton: true; type: string } | { showGenerateIriButton?: false; type?: never });
};
const props = defineProps<Props>();
const props = withDefaults(defineProps<Props>(), {
noHeader: false,
});
const emit = defineEmits<{
(event: 'update:modelValue', value: aasTypes.Reference | null): void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<v-select
v-model="selectedValue"
:items="selectOptions"
label="Category"
:label="label"
variant="outlined"
density="comfortable"
:clearable="clearable"></v-select>
Expand All @@ -16,6 +16,7 @@
type ValueMap = {
category: string;
assetKind: aasTypes.AssetKind;
modellingKind: aasTypes.ModellingKind;
};
type ValueType<T extends keyof ValueMap> = ValueMap[T];
Expand Down Expand Up @@ -52,6 +53,11 @@
{ title: 'Type', value: aasTypes.AssetKind.Type },
{ title: 'Not Applicable', value: aasTypes.AssetKind.NotApplicable },
];
case 'modellingKind':
return [
{ title: 'Instance', value: aasTypes.ModellingKind.Instance },
{ title: 'Template', value: aasTypes.ModellingKind.Template },
];
default:
return [];
}
Expand Down
52 changes: 44 additions & 8 deletions aas-web-ui/src/components/EditorComponents/SubmodelForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
:show-generate-iri-button="true"
type="Submodel" />
<TextInput v-model="submodelIdShort" label="IdShort" />
<SelectInput v-model="submodelKind" label="Modelling Kind" type="modellingKind" />
<MultiLanguageTextInput v-model="displayName" label="Display Name" type="displayName" />
<MultiLanguageTextInput v-model="description" label="Description" type="description" />
<SelectInput
Expand All @@ -37,6 +38,20 @@
<TextInput v-model="templateId" label="Template ID" />
</v-expansion-panel-text>
</v-expansion-panel>
<!-- Semantic ID -->
<v-expansion-panel class="border-s-thin border-e-thin" :class="bordersToShow(2)">
<v-expansion-panel-title>Semantic ID</v-expansion-panel-title>
<v-expansion-panel-text>
<ReferenceInput v-model="semanticId" label="Semantic ID" :no-header="true" />
</v-expansion-panel-text>
</v-expansion-panel>
<!-- Data Specification -->
<v-expansion-panel class="border-b-thin border-s-thin border-e-thin" :class="bordersToShow(3)">
<v-expansion-panel-title>Data Specification</v-expansion-panel-title>
<v-expansion-panel-text>
<span class="text-subtitleText text-subtitle-2">Coming soon!</span>
</v-expansion-panel-text>
</v-expansion-panel>
</v-expansion-panels>
</v-card-text>
<v-divider></v-divider>
Expand Down Expand Up @@ -93,10 +108,11 @@
const editSMDialog = ref(false);
const submodelObject = ref<aasTypes.Submodel | undefined>(undefined);
const openPanels = ref<number[]>([0, 3]);
const openPanels = ref<number[]>([0]);
const submodelId = ref<string | null>(UUID());
const submodelIdShort = ref<string | null>(null);
const submodelKind = ref<aasTypes.ModellingKind | null>(aasTypes.ModellingKind.Instance);
const displayName = ref<Array<aasTypes.LangStringNameType> | null>(null);
const description = ref<Array<aasTypes.LangStringTextType> | null>(null);
const submodelCategory = ref<string | null>(null);
Expand All @@ -106,6 +122,8 @@
const creator = ref<aasTypes.Reference | null>(null);
const templateId = ref<string | null>(null);
const semanticId = ref<aasTypes.Reference | null>(null);
// Computed Properties
const selectedNode = computed(() => aasStore.getSelectedNode); // Get the selected AAS from Store
const selectedAAS = computed(() => aasStore.getSelectedAAS); // Get the selected AAS from Store
Expand Down Expand Up @@ -175,6 +193,7 @@
// Set values of AAS
submodelId.value = submodelObject.value.id;
submodelIdShort.value = submodelObject.value.idShort;
submodelKind.value = submodelObject.value.kind;
displayName.value = submodelObject.value.displayName;
description.value = submodelObject.value.description;
submodelCategory.value = submodelObject.value.category;
Expand All @@ -184,13 +203,11 @@
creator.value = submodelObject.value.administration.creator;
templateId.value = submodelObject.value.administration.templateId;
}
semanticId.value = submodelObject.value.semanticId;
}
}
async function saveSubmodel(): Promise<void> {
if (submodelId.value === null) return;
// Create new Administrative Information object
function createAdministrativeInformation(): aasTypes.AdministrativeInformation {
const administrativeInformation = new aasTypes.AdministrativeInformation();
// Add optional parameter version
Expand All @@ -213,7 +230,16 @@
administrativeInformation.templateId = templateId.value;
}
// Create new Submodel if newSm is true
return administrativeInformation;
}
async function saveSubmodel(): Promise<void> {
if (submodelId.value === null) return;
const administrativeInformation = createAdministrativeInformation();
// TODO: Add embeddedDataSpecifications
if (props.newSm || submodelObject.value === undefined) {
submodelObject.value = new aasTypes.Submodel(submodelId.value);
}
Expand All @@ -228,6 +254,11 @@
submodelObject.value.idShort = submodelIdShort.value;
}
// Add optional parameter kind
if (submodelObject.value.kind === null) {
submodelObject.value.kind = submodelKind.value;
}
// Add optional parameter displayName
if (displayName.value !== null) {
submodelObject.value.displayName = displayName.value;
Expand All @@ -243,9 +274,14 @@
submodelObject.value.administration = administrativeInformation;
}
// embeddedDataSpecifications are out of scope
// Add optional parameter semanticId
if (semanticId.value !== null) {
submodelObject.value.semanticId = semanticId.value;
}
// extensions are out of scope
// SubmodelElements are added when submodels are created
// SupplementalSemanticIds are out of scope
// SubmodelElements are added when they are created
if (props.newSm) {
// Create new Submodel
Expand Down

0 comments on commit ff25f48

Please sign in to comment.