Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for "[BUG] Update button in viewer mode in generic SM plugin throwing 405 on click" #76

Merged
merged 4 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
<component
:is="SubmodelElementWrapper"
v-if="SubmodelElementWrapper"
:SubmodelElementObject="SubmodelElement"
:card-style="'outlined'"></component>
:submodel-element-object="SubmodelElement"
:card-style="'outlined'"
:is-editable="isEditable"></component>
</div>
</v-container>
</template>
Expand All @@ -32,7 +33,16 @@
RelationshipElement,
// SubmodelElementWrapper,
},
props: ['annotatedRelationshipElementObject'],
props: {
annotatedRelationshipElementObject: {
type: Object,
default: () => ({}),
},
isEditable: {
type: Boolean,
default: true,
},
},

setup() {
const SubmodelElementWrapper = shallowRef(null) as any;
Expand Down
18 changes: 14 additions & 4 deletions aas-web-ui/src/components/SubmodelElements/Blob.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
variant="outlined"
density="compact"
:hide-details="isTruncated ? false : true"
clearable
:clearable="isEditable"
:readonly="!isEditable"
:hint="isTruncated ? 'Blob string is truncated!' : ''"
persistent-hint
@keydown.enter="updateBlob()"
Expand All @@ -43,7 +44,7 @@
<!-- Update Blob Button -->
<template #append-inner="{ isFocused }">
<v-btn
v-if="isFocused"
v-if="isFocused && isEditable"
size="small"
variant="elevated"
color="primary"
Expand All @@ -59,7 +60,7 @@
</v-list>
<v-divider></v-divider>
<!-- Action Button to upload a File as Blob -->
<v-list nav class="bg-elevatedCard pa-0">
<v-list v-if="isEditable" nav class="bg-elevatedCard pa-0">
<v-list-item>
<template #title>
<!-- Upload-Button -->
Expand Down Expand Up @@ -99,7 +100,16 @@
export default defineComponent({
name: 'Blob',
mixins: [RequestHandling, SubmodelElementHandling],
props: ['blobObject'],
props: {
blobObject: {
type: Object,
default: () => ({}),
},
isEditable: {
type: Boolean,
default: true,
},
},

setup() {
const aasStore = useAASStore();
Expand Down
7 changes: 6 additions & 1 deletion aas-web-ui/src/components/SubmodelElements/Entity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@
SubmodelElementGroup,
},
mixins: [SubmodelElementHandling],
props: ['entityObject'],
props: {
entityObject: {
type: Object,
default: () => ({}),
},
},

setup() {
const aasStore = useAASStore();
Expand Down
18 changes: 14 additions & 4 deletions aas-web-ui/src/components/SubmodelElements/File.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@
variant="outlined"
density="compact"
hide-details
clearable
:clearable="isEditable"
:readonly="!isEditable"
@keydown.enter="updatePath()"
@click:clear="clearPath()"
@update:focused="setFocus">
<!-- Update Path Button -->
<template #append-inner="{ isFocused }">
<v-btn
v-if="isFocused"
v-if="isFocused && isEditable"
size="small"
variant="elevated"
color="primary"
Expand All @@ -69,7 +70,7 @@
</v-list>
<v-divider></v-divider>
<!-- Action Button to upload a File -->
<v-list nav class="bg-elevatedCard pa-0">
<v-list v-if="isEditable" nav class="bg-elevatedCard pa-0">
<v-list-item>
<template #title>
<!-- Upload-Button -->
Expand Down Expand Up @@ -109,7 +110,16 @@
export default defineComponent({
name: 'File',
mixins: [RequestHandling, SubmodelElementHandling],
props: ['fileObject'],
props: {
fileObject: {
type: Object,
default: () => ({}),
},
isEditable: {
type: Boolean,
default: true,
},
},

setup() {
const aasStore = useAASStore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@
variant="outlined"
density="compact"
hide-details
clearable
append-icon="mdi-delete"
:clearable="isEditable"
:readonly="!isEditable"
:append-icon="isEditable ? 'mdi-delete' : undefined"
@click:append="removeEntry(i)"
@update:focused="setFocus($event, value)"
@keydown.enter="updateValue()">
<template #prepend-inner>
<!-- language -->
<v-chip label size="x-small" border>
<span>{{ value.language ? value.language : 'no-lang' }}</span>
<v-icon site="x-small" style="margin-right: -3px">mdi-chevron-down</v-icon>
<v-icon v-if="isEditable" site="x-small" style="margin-right: -3px">
mdi-chevron-down
</v-icon>
<!-- Menu to select the Language -->
<v-menu activator="parent">
<v-menu v-if="isEditable" activator="parent">
<v-list density="compact" class="pa-0">
<v-list-item
v-for="language in languages"
Expand All @@ -40,7 +43,7 @@
<!-- Update Value Button -->
<template #append-inner>
<v-btn
v-if="value.isFocused"
v-if="value.isFocused && isEditable"
size="small"
variant="elevated"
color="primary"
Expand Down Expand Up @@ -68,7 +71,7 @@
</v-list>
<v-divider></v-divider>
<!-- Edit the MultiLanguageProperty -->
<v-list nav class="bg-elevatedCard py-0">
<v-list v-if="isEditable" nav class="bg-elevatedCard py-0">
<v-list-item>
<template #append>
<v-btn
Expand All @@ -95,7 +98,16 @@
export default defineComponent({
name: 'MultiLanguageProperty',
mixins: [RequestHandling],
props: ['multiLanguagePropertyObject'],
props: {
multiLanguagePropertyObject: {
type: Object,
default: () => ({}),
},
isEditable: {
type: Boolean,
default: true,
},
},

setup() {
const aasStore = useAASStore();
Expand Down
21 changes: 19 additions & 2 deletions aas-web-ui/src/components/SubmodelElements/Operation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@
:property-object="variable.value"
:is-operation-variable="true"
:variable-type="variableType.type"
:is-editable="isEditable"
@update-value="updateOperationVariable($event, variable.value)"></Property>
<ReferenceElement
v-else-if="variable.value.modelType === 'ReferenceElement'"
:reference-element-object="variable.value"
:is-operation-variable="true"
:variable-type="variableType.type"
:is-editable="isEditable"
@update-value="
updateOperationVariable($event, variable.value)
"></ReferenceElement>
Expand Down Expand Up @@ -80,7 +82,13 @@
<v-list-item>
<template #append>
<!-- Clear-Button -->
<v-btn size="small" variant="outlined" color="primary" class="mr-3" @click="clearFields()"
<v-btn
v-if="isEditable"
size="small"
variant="outlined"
color="primary"
class="mr-3"
@click="clearFields()"
>clear</v-btn
>
<!-- Execute-Button -->
Expand Down Expand Up @@ -120,7 +128,16 @@
InvalidElement,
},
mixins: [RequestHandling, SubmodelElementHandling],
props: ['operationObject'],
props: {
operationObject: {
type: Object,
default: () => ({}),
},
isEditable: {
type: Boolean,
default: true,
},
},

setup() {
const navigationStore = useNavigationStore();
Expand Down
23 changes: 22 additions & 1 deletion aas-web-ui/src/components/SubmodelElements/Property.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,28 @@
:number-value="propertyObject"
:is-operation-variable="isOperationVariable"
:variable-type="variableType"
:is-editable="isEditable"
@update-value="updateValue"></NumberType>
<BooleanType
v-else-if="propertyObject.valueType == 'xs:boolean'"
:boolean-value="propertyObject"
:is-operation-variable="isOperationVariable"
:variable-type="variableType"
:is-editable="isEditable"
@update-value="updateValue"></BooleanType>
<DateTimeStampType
v-else-if="propertyObject.valueType == 'xs:dateTime'"
:date-time-stamp-value="propertyObject"
:is-operation-variable="isOperationVariable"
:variable-type="variableType"
:is-editable="isEditable"
@update-value="updateValue"></DateTimeStampType>
<StringType
v-else
:string-value="propertyObject"
:is-operation-variable="isOperationVariable"
:variable-type="variableType"
:is-editable="isEditable"
@update-value="updateValue"></StringType>
</v-list>
</v-card>
Expand All @@ -90,7 +94,24 @@
DateTimeStampType,
},
mixins: [RequestHandling, SubmodelElementHandling],
props: ['propertyObject', 'isOperationVariable', 'variableType'],
props: {
propertyObject: {
type: Object,
default: () => ({}),
},
isOperationVariable: {
type: Boolean,
default: false,
},
variableType: {
type: String,
default: 'string',
},
isEditable: {
type: Boolean,
default: true,
},
},

setup() {
const aasStore = useAASStore();
Expand Down
7 changes: 6 additions & 1 deletion aas-web-ui/src/components/SubmodelElements/Range.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@
export default defineComponent({
name: 'Range',
mixins: [RequestHandling, SubmodelElementHandling],
props: ['rangeObject'],
props: {
rangeObject: {
type: Object,
default: () => ({}),
},
},

setup() {
const aasStore = useAASStore();
Expand Down
28 changes: 23 additions & 5 deletions aas-web-ui/src/components/SubmodelElements/ReferenceElement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
variant="outlined"
density="compact"
hide-details
clearable
:clearable="isEditable"
:readonly="!isEditable"
append-icon="mdi-delete"
@click:append="removeReferenceEntry(i)"
@update:focused="setFocus($event)"
Expand All @@ -49,7 +50,7 @@
<span>{{ value.type ? value.type : 'no-selection' }}</span>
<v-icon site="x-small" style="margin-right: -3px">mdi-chevron-down</v-icon>
<!-- Menu to select the Type of Element -->
<v-menu activator="parent">
<v-menu v-if="isEditable" activator="parent">
<v-list density="compact" class="pa-0">
<v-list-item
v-for="elementType in elementTypes"
Expand All @@ -66,7 +67,7 @@
<!-- Update Value Button -->
<template #append-inner>
<v-btn
v-if="value.isFocused"
v-if="value.isFocused && isEditable"
size="small"
variant="elevated"
color="primary"
Expand Down Expand Up @@ -100,7 +101,7 @@
>
<!-- Add new Reference Entry -->
<v-btn
v-if="IsOperationVariable && !IsOutputVariable"
v-if="isEditable && IsOperationVariable && !IsOutputVariable"
size="small"
class="text-buttonText"
color="primary"
Expand All @@ -126,7 +127,24 @@
export default defineComponent({
name: 'ReferenceElement',
mixins: [SubmodelElementHandling],
props: ['referenceElementObject', 'isOperationVariable', 'variableType'],
props: {
referenceElementObject: {
type: Object,
default: () => ({}),
},
isOperationVariable: {
type: Boolean,
default: false,
},
variableType: {
type: String,
default: 'number',
},
isEditable: {
type: Boolean,
default: true,
},
},

setup() {
const aasStore = useAASStore();
Expand Down
Loading