diff --git a/vue-client/src/App.vue b/vue-client/src/App.vue index 68b579bbd2..3bd32d71b5 100644 --- a/vue-client/src/App.vue +++ b/vue-client/src/App.vue @@ -1138,4 +1138,34 @@ h1 { } } +// ------------ HISTORY -------------- + +.is-diff-added { + @base-color: @form-add; + background-color: @base-color !important; +} + +.is-diff-removed { + @base-color: @remove; + border: 1px dashed !important; + border-color: @base-color !important; + background-color: @form-remove !important; +} + +.is-diff-modified { + @base-color: @brand-primary-orange; + border: 1px dashed !important; + border-color: @base-color !important; + background-color: @form-modified !important; +} + +.icon-removed { + transform: translateY(-5%); + color: @remove; +} + +.icon-added { + position: relative; + color: #428BCAFF; // @brand-primary base. +} diff --git a/vue-client/src/components/inspector/copy-attributes.vue b/vue-client/src/components/inspector/copy-attributes.vue new file mode 100644 index 0000000000..a65a2b2397 --- /dev/null +++ b/vue-client/src/components/inspector/copy-attributes.vue @@ -0,0 +1,71 @@ + + + + diff --git a/vue-client/src/components/inspector/field.vue b/vue-client/src/components/inspector/field.vue index a84b28e0a1..aacf768243 100644 --- a/vue-client/src/components/inspector/field.vue +++ b/vue-client/src/components/inspector/field.vue @@ -1130,37 +1130,6 @@ export default { background-color: hsl(hue(@base-color), 50%, 95%); } - &.is-diff-added { - @base-color: @form-add; - border: 1px solid; - border-color: @brand-primary; - background-color: @base-color; - } - - &.is-diff-removed { - @base-color: @remove; - border: 1px dashed; - border-color: @base-color; - background-color: @form-remove; - } - - &.is-diff-modified { - @base-color: @brand-primary-orange; - border: 1px dashed; - border-color: @base-color; - background-color: @form-modified; - } - - .icon-removed { - transform: translateY(-5%); - color: @remove; - } - - .icon-added { - position: relative; - color: #428BCAFF; // @brand-primary base. - } - &.is-highlighted { // replace 'is-lastadded' & 'is-marked' with this class background-color: @form-highlight; } diff --git a/vue-client/src/components/inspector/item-entity.vue b/vue-client/src/components/inspector/item-entity.vue index 419cdc5d6d..60c4ae33f1 100644 --- a/vue-client/src/components/inspector/item-entity.vue +++ b/vue-client/src/components/inspector/item-entity.vue @@ -211,8 +211,8 @@ export default { 'is-cache': recordType === 'CacheRecord', 'is-placeholder': recordType === 'PlaceholderRecord', 'is-ext-link': !isLibrisResource, - 'is-removed': diffRemoved, - 'is-added': diffAdded, + 'is-diff-removed': diffRemoved, + 'is-diff-added': diffAdded, }"> @@ -346,18 +346,6 @@ export default { animation-name: pulse; } - &.is-removed { - @base-color: @remove; - border: 1px dashed; - border-color: @base-color; - background-color: @form-remove; - } - - &.is-added { - @base-color: @form-add; - background-color: @base-color; - } - &.expanded { margin: 0 0 2em 0; } diff --git a/vue-client/src/components/inspector/item-local.vue b/vue-client/src/components/inspector/item-local.vue index 687af16bea..61422e808d 100644 --- a/vue-client/src/components/inspector/item-local.vue +++ b/vue-client/src/components/inspector/item-local.vue @@ -9,6 +9,8 @@ import * as LayoutUtil from '@/utils/layout'; import { translatePhrase, labelByLang, capitalize } from '@/utils/filters'; import PropertyAdder from '@/components/inspector/property-adder.vue'; import EntityAction from '@/components/inspector/entity-action.vue'; +import IdLabel from '@/components/shared/id-label.vue'; +import CopyAttributes from '@/components/inspector/copy-attributes.vue'; import SearchWindow from './search-window.vue'; import ItemMixin from '../mixins/item-mixin.vue'; import LensMixin from '../mixins/lens-mixin.vue'; @@ -150,6 +152,15 @@ export default { } return false; }, + canAddId() { + if (this.fieldKey === 'hasComponent' && this.isHolding && !this.hasId) { + return true; + } + return false; + }, + hasId() { + return this.item.hasOwnProperty('@id'); + }, getPath() { if (this.inArray) { return `${this.parentPath}[${this.index}]`; @@ -181,6 +192,14 @@ export default { } return false; }, + diffIdAdded() { + if (this.diff == null) return false; + return this.diff.added.includes(`${this.getPath}.@id`); + }, + diffIdRemoved() { + if (this.diff == null) return false; + return this.diff.removed.includes(`${this.getPath}.@id`); + }, }, methods: { translatePhrase, @@ -352,6 +371,23 @@ export default { } }); }, + addId() { + if (this.canAddId) { + this.$store.dispatch('updateInspectorData', { + changeList: [ + { + path: `${this.path}.@id`, + value: 'https://libris.kb.se/TEMPID', + }, + ], + addToHistory: true, + }); + this.$store.dispatch('setInspectorStatusValue', { + property: 'lastAdded', + value: `${this.path}.@id`, + }); + } + }, }, watch: { 'inspector.status.editing'(val) { @@ -452,6 +488,7 @@ export default { }, components: { + 'copy-attributes': CopyAttributes, 'property-adder': PropertyAdder, 'search-window': SearchWindow, 'entity-action': EntityAction, @@ -520,7 +557,14 @@ export default { - +