From aac4f00c08a58ac7c76e43b16341a81af489b478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olov=20Ylinenp=C3=A4=C3=A4?= Date: Thu, 14 Oct 2021 15:40:32 +0200 Subject: [PATCH] Fixes for external data. * Make it possible to show data from Record / meta in top of card (categorization) * Show inDataset in top of card * Fix color for link-count border * Make PlaceholderRecord and CacheRecord non-editable (should be data/vocab driven...?). But deletable for now --- .../src/components/inspector/entity-header.vue | 5 +++++ .../src/components/inspector/toolbar.vue | 13 ++++++++++++- .../src/components/mixins/lens-mixin.vue | 18 ++++++++++++++++-- .../components/search/panel-search-item.vue | 2 +- .../src/components/shared/entity-summary.vue | 4 ++++ .../src/resources/json/displayGroups.json | 3 ++- vue-client/src/views/Inspector.vue | 3 ++- 7 files changed, 42 insertions(+), 6 deletions(-) diff --git a/vue-client/src/components/inspector/entity-header.vue b/vue-client/src/components/inspector/entity-header.vue index 0e0175e512..e6af9052f3 100644 --- a/vue-client/src/components/inspector/entity-header.vue +++ b/vue-client/src/components/inspector/entity-header.vue @@ -24,6 +24,10 @@ export default { type: Object, default: null, }, + recordData: { + type: Object, + default: null, + }, }, data() { return { @@ -108,6 +112,7 @@ export default { @hiddenDetailsNumber="setHiddenDetailsNumber" :show-all-keys="showAllKeys || hiddenDetailsNumber === 1" :focus-data="focusData" + :record-data="recordData" :should-link="false" :exclude-components="inspector.status.isNew ? ['id'] : []" :valueDisplayLimit=3> diff --git a/vue-client/src/components/inspector/toolbar.vue b/vue-client/src/components/inspector/toolbar.vue index 96e5ed6321..d67ffa0deb 100644 --- a/vue-client/src/components/inspector/toolbar.vue +++ b/vue-client/src/components/inspector/toolbar.vue @@ -373,9 +373,13 @@ export default { }, userIsPermittedToEdit() { const mainEntity = this.inspector.data.mainEntity; + const record = this.inspector.data.record; if (this.user.isLoggedIn === false) { return false; } + if (record['@type'] !== 'Record') { + return false; + } if (mainEntity['@type'] === 'Item') { if (this.isMyHolding || this.user.isGlobalRegistrant()) { return true; @@ -395,6 +399,13 @@ export default { } return true; }, + userIsPermittedToRemove() { + const record = this.inspector.data.record; + if (record['@type'] === 'CacheRecord' || record['@type'] === 'PlaceholderRecord') { + return true; + } + return this.userIsPermittedToEdit; + }, showRecord() { return this.status.showRecord; }, @@ -599,7 +610,7 @@ export default { {{ "Preview MARC21" | translatePhrase }} {{ getKeybindText('preview-marc') ? ` (${getKeybindText('preview-marc')})` : ''}} -
  • +
  • {{"Remove" | translatePhrase}} {{ recordType | labelByLang | lowercase }} diff --git a/vue-client/src/components/mixins/lens-mixin.vue b/vue-client/src/components/mixins/lens-mixin.vue index b502da25b1..0e9ad4bbf9 100644 --- a/vue-client/src/components/mixins/lens-mixin.vue +++ b/vue-client/src/components/mixins/lens-mixin.vue @@ -76,7 +76,7 @@ export default { return card; }, getSummary() { - const summary = DisplayUtil.getItemSummary( + const mainSummary = DisplayUtil.getItemSummary( this.focusData, this.resources.display, this.inspector.data.quoted, @@ -85,7 +85,21 @@ export default { this.resources.context, this.excludeProperties, ); - return summary; + const record = this.focusData.meta || this.recordData || {}; + const recordSummary = DisplayUtil.getItemSummary( + record, + this.resources.display, + this.inspector.data.quoted, + this.resources.vocab, + this.settings, + this.resources.context, + this.excludeProperties, + ); + return { + categorization: mainSummary.categorization.concat(recordSummary.categorization), + header: mainSummary.header, + info: mainSummary.info, + }; }, }, }; diff --git a/vue-client/src/components/search/panel-search-item.vue b/vue-client/src/components/search/panel-search-item.vue index c8c0445f58..16fa87839f 100644 --- a/vue-client/src/components/search/panel-search-item.vue +++ b/vue-client/src/components/search/panel-search-item.vue @@ -211,7 +211,7 @@ export default { } &-linkCount { - border: 2px solid #29A1A2; + border: 2px solid @brand-primary; width: 100%; text-align: center; margin-top: -4px; diff --git a/vue-client/src/components/shared/entity-summary.vue b/vue-client/src/components/shared/entity-summary.vue index e945e8066c..167bf186e0 100644 --- a/vue-client/src/components/shared/entity-summary.vue +++ b/vue-client/src/components/shared/entity-summary.vue @@ -22,6 +22,10 @@ export default { type: Object, default: null, }, + recordData: { + type: Object, + default: null, + }, animate: { type: Boolean, default: false, diff --git a/vue-client/src/resources/json/displayGroups.json b/vue-client/src/resources/json/displayGroups.json index e751e347e9..e1132b95b0 100644 --- a/vue-client/src/resources/json/displayGroups.json +++ b/vue-client/src/resources/json/displayGroups.json @@ -5,7 +5,8 @@ "inCollection", "inScheme", "mediaType", - "carrierType" + "carrierType", + "inDataset" ], "header": [ "hasTitle", diff --git a/vue-client/src/views/Inspector.vue b/vue-client/src/views/Inspector.vue index c2532c2b4c..e49982a07e 100644 --- a/vue-client/src/views/Inspector.vue +++ b/vue-client/src/views/Inspector.vue @@ -939,7 +939,8 @@ export default {