Skip to content

Commit 7146478

Browse files
authored
Adds derivedFrom attribute to editor (eclipse-basyx#1067)
* Adds derivedFrom attribute to editor * Fixes incorrect Reference Type for Submodel Reference
1 parent b3f69a6 commit 7146478

File tree

7 files changed

+29
-10
lines changed

7 files changed

+29
-10
lines changed

aas-web-ui/src/components/EditorComponents/AASForm.vue

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,18 @@
111111
<!-- Derivation -->
112112
<v-expansion-panel class="border-s-thin border-e-thin" :class="bordersToShow(2)">
113113
<v-expansion-panel-title>Derivation</v-expansion-panel-title>
114-
<v-expansion-panel-text class="pt-2">
115-
<span class="text-subtitleText text-subtitle-2">Coming soon!</span>
114+
<v-expansion-panel-text>
115+
<v-row align="center">
116+
<v-col class="py-0">
117+
<ReferenceInput
118+
v-model="derivedFrom"
119+
label="Derived From"
120+
:default-key-type="aasTypes.KeyTypes.AssetAdministrationShell" />
121+
</v-col>
122+
<v-col cols="auto" class="px-0">
123+
<HelpInfoButton help-type="derivedFrom" />
124+
</v-col>
125+
</v-row>
116126
</v-expansion-panel-text>
117127
</v-expansion-panel>
118128
<!-- Asset -->
@@ -220,6 +230,7 @@
220230
const revision = ref<string | null>(null);
221231
const creator = ref<aasTypes.Reference | null>(null);
222232
const templateId = ref<string | null>(null);
233+
const derivedFrom = ref<aasTypes.Reference | null>(null);
223234
224235
const assetKind = ref<aasTypes.AssetKind>(aasTypes.AssetKind.Instance);
225236
const globalAssetId = ref<string | null>(null);
@@ -302,6 +313,7 @@
302313
displayName.value = AASObject.value.displayName ?? null;
303314
description.value = AASObject.value.description ?? null;
304315
AASCategory.value = AASObject.value.category ?? null;
316+
derivedFrom.value = AASObject.value.derivedFrom ?? null;
305317
if (AASObject.value.administration !== null && AASObject.value.administration !== undefined) {
306318
version.value = AASObject.value.administration.version ?? null;
307319
revision.value = AASObject.value.administration.revision ?? null;
@@ -407,7 +419,7 @@
407419
AASObject.value.administration = administrativeInformation;
408420
}
409421
410-
// TODO: Add optional parameter derivedFrom
422+
AASObject.value.derivedFrom = derivedFrom.value;
411423
412424
// embeddedDataSpecifications are out of scope
413425
// extensions are out of scope
@@ -485,6 +497,7 @@
485497
revision.value = null;
486498
creator.value = null;
487499
templateId.value = null;
500+
derivedFrom.value = null;
488501
assetKind.value = aasTypes.AssetKind.Instance;
489502
globalAssetId.value = null;
490503
specificAssetIds.value = null;

aas-web-ui/src/components/EditorComponents/HelpInfoButton.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
revision: 'Revision of the element.',
5252
creator: 'The subject ID of the subject\nresponsible for making the element.',
5353
templateId: 'Identifier of the template that guided\nthe creation of the element.',
54+
derivedFrom: 'The reference to the AAS the element is derived from.',
5455
semanticId:
5556
'Identifier of the semantic definition of the element called semantic ID\n' +
5657
'or also main semantic ID of the element.',

aas-web-ui/src/components/EditorComponents/InputTypes/ReferenceInput.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,14 @@
5454
label: string;
5555
noHeader?: boolean;
5656
modelValue: aasTypes.Reference | null;
57+
defaultReferenceType?: aasTypes.ReferenceTypes;
58+
defaultKeyType?: aasTypes.KeyTypes;
5759
};
5860
5961
const props = withDefaults(defineProps<Props>(), {
6062
noHeader: false,
63+
defaultReferenceType: aasTypes.ReferenceTypes.ModelReference,
64+
defaultKeyType: aasTypes.KeyTypes.GlobalReference,
6165
});
6266
6367
const emit = defineEmits<{
@@ -117,13 +121,13 @@
117121
118122
function addReferenceKey(): void {
119123
if (referenceValue.value === null) {
120-
referenceValue.value = new aasTypes.Reference(aasTypes.ReferenceTypes.ExternalReference, [
121-
new aasTypes.Key(aasTypes.KeyTypes.GlobalReference, ''),
124+
referenceValue.value = new aasTypes.Reference(props.defaultReferenceType, [
125+
new aasTypes.Key(props.defaultKeyType, ''),
122126
]);
123127
} else if (referenceValue.value.keys === undefined) {
124-
referenceValue.value.keys = [new aasTypes.Key(aasTypes.KeyTypes.GlobalReference, '')];
128+
referenceValue.value.keys = [new aasTypes.Key(props.defaultKeyType, '')];
125129
} else {
126-
referenceValue.value.keys.push(new aasTypes.Key(aasTypes.KeyTypes.GlobalReference, ''));
130+
referenceValue.value.keys.push(new aasTypes.Key(props.defaultKeyType, ''));
127131
}
128132
}
129133

aas-web-ui/src/components/EditorComponents/JsonInsert.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@
201201
}
202202
const aas = instanceOrError.mustValue();
203203
// Create new SubmodelReference
204-
const submodelReference = new aasTypes.Reference(aasTypes.ReferenceTypes.ExternalReference, [
204+
const submodelReference = new aasTypes.Reference(aasTypes.ReferenceTypes.ModelReference, [
205205
new aasTypes.Key(aasTypes.KeyTypes.Submodel, submodel.id),
206206
]);
207207
// Check if Submodels are null

aas-web-ui/src/components/EditorComponents/SubmodelForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@
447447
}
448448
const aas = instanceOrError.mustValue();
449449
// Create new SubmodelReference
450-
const submodelReference = new aasTypes.Reference(aasTypes.ReferenceTypes.ExternalReference, [
450+
const submodelReference = new aasTypes.Reference(aasTypes.ReferenceTypes.ModelReference, [
451451
new aasTypes.Key(aasTypes.KeyTypes.Submodel, submodel.id),
452452
]);
453453
// Check if Submodels are null

aas-web-ui/src/components/EditorComponents/help-links.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"revision": "https://industrialdigitaltwin.io/aas-specifications/IDTA-01001/v3.1/spec-metamodel/datatypes.html#RevisionType",
1717
"creator": "https://industrialdigitaltwin.io/aas-specifications/IDTA-01001/v3.1/spec-metamodel/referencing.html#Reference",
1818
"templateId": "https://industrialdigitaltwin.io/aas-specifications/IDTA-01001/v3.1/spec-metamodel/datatypes.html#Identifier",
19+
"derivedFrom": "https://industrialdigitaltwin.io/aas-specifications/IDTA-01001/v3.1/spec-metamodel/referencing.html#Reference",
1920
"semanticId": "https://industrialdigitaltwin.io/aas-specifications/IDTA-01001/v3.1/spec-metamodel/referencing.html#Reference",
2021
"dataType": "https://industrialdigitaltwin.io/aas-specifications/IDTA-01001/v3.1/spec-metamodel/datatypes.html",
2122
"range-minmax": "https://industrialdigitaltwin.io/aas-specifications/IDTA-01001/v3.1/spec-metamodel/datatypes.html#ValueDataType",

aas-web-ui/src/composables/ClipboardUtil.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export function useClipboardUtil() {
224224
}
225225
const aas = instanceOrError.mustValue();
226226
// Create new SubmodelReference
227-
const submodelReference = new aasTypes.Reference(aasTypes.ReferenceTypes.ExternalReference, [
227+
const submodelReference = new aasTypes.Reference(aasTypes.ReferenceTypes.ModelReference, [
228228
new aasTypes.Key(aasTypes.KeyTypes.Submodel, submodel.id),
229229
]);
230230
// Check if Submodels are null

0 commit comments

Comments
 (0)