From c5868ae0242c49bf5a1ca387b67b5098757db214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Rosenstr=C3=B6m?= Date: Wed, 23 Oct 2024 15:16:06 +0200 Subject: [PATCH] feat:(cataloging-bulkchanges: allow type match subclasses on mainEntiy --- .../src/components/care/form-builder.vue | 2 +- .../src/components/inspector/entity-form.vue | 4 +- cataloging/src/components/inspector/field.vue | 46 +++++++++++++++++-- .../src/components/inspector/item-local.vue | 6 +-- cataloging/src/resources/json/i18n.json | 4 +- 5 files changed, 51 insertions(+), 11 deletions(-) diff --git a/cataloging/src/components/care/form-builder.vue b/cataloging/src/components/care/form-builder.vue index 355a67419..f9fb022ab 100644 --- a/cataloging/src/components/care/form-builder.vue +++ b/cataloging/src/components/care/form-builder.vue @@ -94,7 +94,7 @@ export default { :is-active="true" :form-data="formData" :locked="!isActive" - :show-pinned="true" + :show-bulkchange-actions="true" /> diff --git a/cataloging/src/components/inspector/entity-form.vue b/cataloging/src/components/inspector/entity-form.vue index 237c21338..f8f90d5ce 100644 --- a/cataloging/src/components/inspector/entity-form.vue +++ b/cataloging/src/components/inspector/entity-form.vue @@ -41,7 +41,7 @@ export default { type: String, default: '', }, - showPinned: { + showBulkchangeActions: { type: Boolean, default: false, } @@ -158,7 +158,7 @@ export default { :field-key="k" :field-value="v" :parent-path="editingObject" - :showPinned="showPinned" + :showBulkchangeActions="showBulkchangeActions" />
diff --git a/cataloging/src/components/inspector/field.vue b/cataloging/src/components/inspector/field.vue
index a9f627ba6..260347afe 100644
--- a/cataloging/src/components/inspector/field.vue
+++ b/cataloging/src/components/inspector/field.vue
@@ -121,7 +121,7 @@ export default {
       type: Boolean,
       default: false,
     },
-    showPinned: {
+    showBulkchangeActions: {
       type: Boolean,
       default: false,
     }
@@ -444,6 +444,9 @@ export default {
     translatePhrase,
     labelByLang,
     capitalize,
+    matchSubClasses(item) {
+      return typeof item['_match'] !== 'undefined' && item['_match'].includes('Subclasses');
+    },
     onLabelClick() {
       this.$store.dispatch('pushInspectorEvent', {
         name: 'field-label-clicked',
@@ -604,6 +607,23 @@ export default {
         });
       }
     },
+    toggleMatchSubClasses() {
+      let update = cloneDeep(get(this.inspector.data, this.parentPath))
+      if (typeof update['_match'] !== 'undefined') {
+        delete update['_match'];
+      } else {
+        update['_match'] = ['Subtypes'];
+      }
+      this.$store.dispatch('updateInspectorData', {
+        changeList: [
+          {
+            path: `${this.parentPath}`,
+            value: update,
+          },
+        ],
+        addToHistory: true,
+      });
+    },
   },
   beforeUnmount() {
     this.$store.dispatch('setValidation', { path: this.path, validates: true });
@@ -845,7 +865,17 @@ export default {
           :field-key="fieldKey"
           :field-value="item"
           :entity-type="entityType"
-          :parent-path="path" />
+          :parent-path="path"/>
+        
+ + {{ translatePhrase('Match subclasses') }} + + +
@@ -937,7 +967,7 @@ export default { :in-array="valueIsArray" :diff="diff" :should-expand="expandChildren || embellished" - :show-pinned="showPinned" + :show-pinned="showBulkchangeActions" /> @@ -1398,6 +1428,16 @@ export default { } } + &-matchSubClasses { + display: flex; + font-size: 12px; + align-items: center; + } + + &-matchSubClassesLabel { + margin-right: 4px; + } + &-actions { display: flex; flex-grow: 1; diff --git a/cataloging/src/components/inspector/item-local.vue b/cataloging/src/components/inspector/item-local.vue index 80ab95777..c12468717 100644 --- a/cataloging/src/components/inspector/item-local.vue +++ b/cataloging/src/components/inspector/item-local.vue @@ -198,8 +198,8 @@ export default { return false; }, isPinned() { - return typeof this.item['_match'] !== 'undefined'; - }, + return typeof this.item['_match'] !== 'undefined' && this.item['_match'].includes('Exact'); + }, isBulkChangeView() { return this.$route.path.includes('bulkchanges'); }, @@ -411,7 +411,7 @@ export default { if (del) { delete update['_match']; } else { - update['_match'] = 'Exact'; + update['_match'] = ['Exact']; } this.$store.dispatch('updateInspectorData', { changeList: [ diff --git a/cataloging/src/resources/json/i18n.json b/cataloging/src/resources/json/i18n.json index 11c5601da..82f01e40e 100644 --- a/cataloging/src/resources/json/i18n.json +++ b/cataloging/src/resources/json/i18n.json @@ -453,7 +453,7 @@ "Preview " : "Förhandsgranskning", "Save bulk change to preview" : "Spara massändring för att förhandsgranska", "No matching records" : "Inga matchande poster", - "Selection from ID list" : "Urval från ID-lista" - + "Selection from ID list" : "Urval från ID-lista", + "Match subclasses" : "Matcha subklasser" } }