Skip to content

Commit

Permalink
Merge branch 'main' into bfp-273-retain-order-of-components-on-ingest
Browse files Browse the repository at this point in the history
  • Loading branch information
thisismattmiller authored Nov 18, 2024
2 parents 7c261ce + b4b0e54 commit 460495e
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 76 deletions.
1 change: 0 additions & 1 deletion src/components/general/PreferenceModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@
<h3>Preferences - <select @change="loadPrefGroup($event)"><option v-for="group in possilbleGroups" :selected="showPrefModalGroup==group">{{group}}</option></select></h3>
<button class="close-button" @pointerup="preferenceStore.togglePrefModal()">X</button>


<div v-for="option in renderProperties" :key="showPrefModalGroup+ '_' +option.id">

<div class="option">
Expand Down
68 changes: 53 additions & 15 deletions src/components/panels/edit/EditPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@
:key="profileName"
:class="{'edit-panel-work': (profileName.split(':').slice(-1)[0] == 'Work'), 'edit-panel-instance': (profileName.split(':').slice(-1)[0] == 'Instance'), 'edit-panel-instance-secondary': (profileName.split(':').slice(-1)[0].indexOf('_') > -1), 'edit-panel-scroll-x-parent': preferenceStore.returnValue('--b-edit-main-splitpane-edit-scroll-x')}">


<template v-if="instanceMode == true && profileName.indexOf(':Instance') > -1">

<template v-if="profileName.includes(':Instance')">
<div>
<span class="instanceIdentifer">{{ instanceLabel(profileName) }}: {{ activeProfile.rt[profileName].URI.split("/").at(-1) }}</span>
<button class="instanceDeleteButton" v-if="showDeleteInstanceButton(profileName)" @click="showDeleteInstanceModal(profileName)">Delete Instance</button>
</div>
</template>
<template v-if="((preferenceStore.returnValue('--b-edit-main-splitpane-edit-switch-between-resource-button') === false) || (preferenceStore.returnValue('--b-edit-main-splitpane-edit-switch-between-resource-button') === true && profileName == activeResourceName ))">

<div v-for="(profileCompoent,idx) in activeProfile.rt[profileName].ptOrder"
Expand Down Expand Up @@ -52,7 +56,12 @@

</template>
<template v-if="instanceMode == false">

<template v-if="profileName.includes(':Instance')">
<div class="instanceInfoWrapper">
<span class="instanceIdentifer">{{ instanceLabel(profileName) }}: {{ activeProfile.rt[profileName].URI.split("/").at(-1) }}</span>
<button class="instanceDeleteButton" v-if="showDeleteInstanceButton(profileName)" @click="showDeleteInstanceModal(profileName)">Delete Instance</button>
</div>
</template>
<template v-for="(profileCompoent,idx) in activeProfile.rt[profileName].ptOrder" :key="profileCompoent">
<template v-if="layoutActive == false || (layoutActive == true && layoutActiveFilter.properties.indexOf(activeProfile.rt[profileName].pt[profileCompoent].propertyURI) > -1) ">

Expand Down Expand Up @@ -110,8 +119,6 @@
:parentId="activeProfile.rt[profileName].pt[profileCompoent].parentId"
:readOnly="isReadOnly(activeProfile.rt[profileName].pt[profileCompoent])" />



<template v-if="preferenceStore.returnValue('--b-edit-main-splitpane-edit-inline-mode')">
<InlineModeAddField :guid="activeProfile.rt[profileName].pt[profileCompoent]['@guid']" />
</template>
Expand All @@ -120,12 +127,9 @@
</template>
</template>
</template>

</template>
</template>

</template>

</template>


Expand Down Expand Up @@ -186,7 +190,7 @@
// gives read access to this.count and this.double
// ...mapState(usePreferenceStore, ['profilesLoaded']),
...mapState(useProfileStore, ['profilesLoaded','activeProfile','activeComponent']),
...mapState(useProfileStore, ['profilesLoaded','activeProfile','activeComponent', 'dataChanged']),
...mapWritableState(usePreferenceStore, ['debugModalData','showDebugModal']),
activeResourceName(){
Expand Down Expand Up @@ -264,15 +268,37 @@
if (bibId && eId != bibId){
document.title = `Marva | ${bibId}`;
}
}
},
//only able to delete the instances they create
showDeleteInstanceButton: function(profileName){
return this.activeProfile.rt[profileName].deletable
},
showDeleteInstanceModal: function(profileName){
if (window.confirm("Do you really want to delete this instance?")){
// remove from rtOrder
const targetIndex = this.activeProfile.rtOrder.indexOf(profileName)
this.activeProfile.rtOrder.splice(targetIndex, 1)
// remove the profile
delete this.activeProfile.rt[profileName]
this.profileStore.dataChanged()
}
},
instanceLabel: function(profileName){
try{
if (this.activeProfile.rt[profileName]["@type"].includes("Secondary")){
return "Secondary Instance"
}
return "Instance"
} catch(err){
return "Instance"
}
}
},
watch:{
activeComponent(newVal){
Expand Down Expand Up @@ -393,6 +419,18 @@
font-size: 0.85em;
}
div.instanceInfoWrapper {
padding: 5px;
}
.instanceIdentifer {
font-weight: bold;
}
.instanceDeleteButton {
float: right;
margin-right: 5px;
}
</style>
4 changes: 4 additions & 0 deletions src/components/panels/edit/fields/helpers/ActionButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,10 @@
// if it's part of a group with members that have defaults, and that group isn't the whole thing
let parentId = this.structure.parentId
if (parentId.includes("_")){
parentId = parentId.split("_")[0]
}
if (!parentId.endsWith("Work") && !parentId.endsWith("Instance") && !parentId.endsWith("Hub") && !parentId.endsWith("Item")){
for (let sibling of this.profileStore.rtLookup[parentId].propertyTemplates){
Expand Down
1 change: 0 additions & 1 deletion src/components/panels/edit/modals/ShelfListing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@
<tbody>

<template v-for="r in results">

<template v-if="r.selected == undefined">
<tr :class="[{nuba: r.notused == 'nuba'}]">
<td>{{ r.term }}</td>
Expand Down
39 changes: 26 additions & 13 deletions src/components/panels/edit/modals/SubjectEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1574,6 +1574,7 @@ methods: {
}
this.getContext()
if (this.contextData){
this.localContextCache[this.contextData.uri] = JSON.parse(JSON.stringify(this.contextData))
}
Expand Down Expand Up @@ -1765,8 +1766,25 @@ methods: {
if (this.activeTypes[this.activeComponent.type]){
this.activeTypes[this.activeComponent.type].selected=true
}
}
} else if (this.activeComponent.type == null && this.activeComponent.marcKey != null){ //fall back on the marcKey, this can be null if the selection is too fast?
let subfield = this.activeComponent.marcKey.slice(5, 7)
switch(subfield){
case("$v"):
subfield = "madsrdf:GenreForm"
break
case("$y"):
subfield = "madsrdf:Temporal"
break
case("$z"):
subfield = "madsrdf:Geographic"
break
default:
subfield = "madsrdf:Topic"
}
this.activeTypes[subfield].selected=true
this.activeComponent.type = subfield
}
},
Expand Down Expand Up @@ -1955,26 +1973,20 @@ methods: {
if (this.localContextCache[x.uri].type === 'GenreForm'){
x.type = 'madsrdf:GenreForm'
}
if (this.localContextCache[x.uri].type === 'Temporal'){
} else if (this.localContextCache[x.uri].type === 'Temporal'){
x.type = 'madsrdf:Temporal'
}
if (this.localContextCache[x.uri].type === 'Geographic'){
} else if (this.localContextCache[x.uri].type === 'Geographic'){
x.type = 'madsrdf:Geographic'
}
if (this.localContextCache[x.uri].type === 'Topic'){
} else if (this.localContextCache[x.uri].type === 'Topic'){
x.type = 'madsrdf:Topic'
} else {
x.type = 'madsrdf:Topic'
}
}
}
// always make the first one the topic
try {
this.components[0].type = 'madsrdf:Topic'
} catch {}
this.updateAvctiveTypeSelected()
this.validateOkayToAdd()
},400)
Expand Down Expand Up @@ -2103,7 +2115,7 @@ methods: {
// something like a name becomes a madsrdf:PersonalName instead of madsrdf:Topic
if (c.uri && c.uri.includes('id.loc.gov/authorities/names/') && this.localContextCache && this.localContextCache[c.uri]){
c.type = this.localContextCache[c.uri].typeFull.replace('http://www.loc.gov/mads/rdf/v1#','madsrdf:')
}
}
}
// If the individual components together, match a complex subject, switch'em so the user ends up with a controlled term
Expand Down Expand Up @@ -2160,6 +2172,7 @@ methods: {
for (let component in frozenComponents){
// if (this.components[component].complex && !['madsrdf:Geographic', 'madsrdf:HierarchicalGeographic'].includes(this.components[component].type)){
const target = frozenComponents[component]
if (!['madsrdf:Geographic', 'madsrdf:HierarchicalGeographic'].includes(target.type) && target.complex){
let uri = target.uri
let data = false //await this.parseComplexSubject(uri) //This can take a while, and is only need for the URI, but lots of things don't have URIs
Expand Down
9 changes: 7 additions & 2 deletions src/components/panels/nav/Nav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,16 @@
]
if (this.$route.path.startsWith('/edit/')){
if (this.$route.path.startsWith('/edit/')){
menuButtonSubMenu.push({ is: 'separator'})
menuButtonSubMenu.push(
{
text: 'Add Additional Instance',
click: () => { this.profileStore.createInstance(false) }
},
{
text: 'Add Secondary Instance',
click: () => { this.profileStore.createSecondaryInstance() }
click: () => { this.profileStore.createInstance(true) }
}
)
}
Expand Down Expand Up @@ -443,6 +447,7 @@
}
})
},
},
created() {
Expand Down
3 changes: 2 additions & 1 deletion src/lib/utils_export.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,8 @@ const utilsExport = {
bnodeLvl1.setAttributeNS(this.namespace.rdf, 'rdf:about', value1['@id'])
}
}
if (keys.length>0){

if (keys.length>0){
for (let key2 of keys){
if (typeof value1[key2] == 'string' || typeof value1[key2] == 'number'){
// its a label or some other literal
Expand Down
3 changes: 1 addition & 2 deletions src/stores/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ export const useConfigStore = defineStore('config', {

versionMajor: 0,
versionMinor: 16,
versionPatch: 9,

versionPatch: 11,


regionUrls: {
Expand Down
2 changes: 1 addition & 1 deletion src/stores/preference.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ export const usePreferenceStore = defineStore('preference', {
group: 'Edit Panel',
range: null
},
'--c-edit-main-splitpane-edit-background-color-instance-secondary' : {
'--c-edit-main-splitpane-edit-background-color-instance-secondary' : {
value:'#f671f696',
desc: 'The background color of the secondary instance on edit screen panel.',
descShort: 'Secondary Instance Background Color',
Expand Down
Loading

0 comments on commit 460495e

Please sign in to comment.