Skip to content

Commit

Permalink
feat:(cataloging-bulkchanges: allow type match subclasses on mainEntiy
Browse files Browse the repository at this point in the history
  • Loading branch information
lrosenstrom committed Oct 23, 2024
1 parent d3a1c46 commit c5868ae
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cataloging/src/components/care/form-builder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default {
:is-active="true"
:form-data="formData"
:locked="!isActive"
:show-pinned="true"
:show-bulkchange-actions="true"
/>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions cataloging/src/components/inspector/entity-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default {
type: String,
default: '',
},
showPinned: {
showBulkchangeActions: {
type: Boolean,
default: false,
}
Expand Down Expand Up @@ -158,7 +158,7 @@ export default {
:field-key="k"
:field-value="v"
:parent-path="editingObject"
:showPinned="showPinned"
:showBulkchangeActions="showBulkchangeActions"
/>
<div id="result" v-if="user.settings.appTech && !isLocked">
<pre class="col-md-12">
Expand Down
46 changes: 43 additions & 3 deletions cataloging/src/components/inspector/field.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default {
type: Boolean,
default: false,
},
showPinned: {
showBulkchangeActions: {
type: Boolean,
default: false,
}
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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 });
Expand Down Expand Up @@ -845,7 +865,17 @@ export default {
:field-key="fieldKey"
:field-value="item"
:entity-type="entityType"
:parent-path="path" />
:parent-path="path"/>
<div class="Field-matchSubClasses" v-if="this.parentPath === 'mainEntity' && showBulkchangeActions">
<span class="Field-matchSubClassesLabel">
{{ translatePhrase('Match subclasses') }}
</span>
<input
:checked="matchSubClasses(item)"
type="checkbox"
:disabled="isLocked"
@change="toggleMatchSubClasses()"/>
</div>
</div>
</div>

Expand Down Expand Up @@ -937,7 +967,7 @@ export default {
:in-array="valueIsArray"
:diff="diff"
:should-expand="expandChildren || embellished"
:show-pinned="showPinned"
:show-pinned="showBulkchangeActions"
/>
</div>
<portal-target :name="`typeSelect-${path}`" />
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions cataloging/src/components/inspector/item-local.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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');
},
Expand Down Expand Up @@ -411,7 +411,7 @@ export default {
if (del) {
delete update['_match'];
} else {
update['_match'] = 'Exact';
update['_match'] = ['Exact'];
}
this.$store.dispatch('updateInspectorData', {
changeList: [
Expand Down
4 changes: 2 additions & 2 deletions cataloging/src/resources/json/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

0 comments on commit c5868ae

Please sign in to comment.