From d03bb63a9b4c94f91b9409ac33d9937ddf424b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Rosenstr=C3=B6m?= Date: Tue, 18 Jun 2024 09:02:53 +0200 Subject: [PATCH 01/11] Allow for adding empty ID on hasComponent entries in items. This matches the current backend implementation which might be subject to change. --- .../src/components/inspector/item-local.vue | 33 +++++++++++++++++++ vue-client/src/resources/json/i18n.json | 3 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/vue-client/src/components/inspector/item-local.vue b/vue-client/src/components/inspector/item-local.vue index 687af16be..77feada37 100644 --- a/vue-client/src/components/inspector/item-local.vue +++ b/vue-client/src/components/inspector/item-local.vue @@ -150,6 +150,12 @@ export default { } return false; }, + canAddId() { + if (this.fieldKey === 'hasComponent' && this.isHolding && !this.item.hasOwnProperty('@id')) { + return true; + } + return false; + }, getPath() { if (this.inArray) { return `${this.parentPath}[${this.index}]`; @@ -352,6 +358,23 @@ export default { } }); }, + addId() { + if (this.canAddId) { + this.$store.dispatch('updateInspectorData', { + changeList: [ + { + path: `${this.path}.@id`, + value: '', + }, + ], + addToHistory: true, + }); + this.$store.dispatch('setInspectorStatusValue', { + property: 'lastAdded', + value: `${this.path}.@id`, + }); + } + }, }, watch: { 'inspector.status.editing'(val) { @@ -608,6 +631,16 @@ export default { {{ translatePhrase("Duplicate entity") }} +
  • + +