Fixes local array management when adding or removing children metadata. #17.
This commit is contained in:
parent
adf5d57072
commit
4802ca95f9
|
@ -302,6 +302,8 @@
|
||||||
.then((metadatum) => {
|
.then((metadatum) => {
|
||||||
if (!this.isRepositoryLevel)
|
if (!this.isRepositoryLevel)
|
||||||
this.updateMetadataOrder();
|
this.updateMetadataOrder();
|
||||||
|
|
||||||
|
this.childrenMetadata.splice(newIndex, 1, metadatum);
|
||||||
|
|
||||||
this.toggleMetadatumEdition(metadatum.id)
|
this.toggleMetadatumEdition(metadatum.id)
|
||||||
this.hightlightedMetadatum = '';
|
this.hightlightedMetadatum = '';
|
||||||
|
@ -319,12 +321,20 @@
|
||||||
title: this.$i18n.get('label_warning'),
|
title: this.$i18n.get('label_warning'),
|
||||||
message: this.$i18n.get('info_warning_metadatum_delete'),
|
message: this.$i18n.get('info_warning_metadatum_delete'),
|
||||||
onConfirm: () => {
|
onConfirm: () => {
|
||||||
this.deleteMetadatum({ collectionId: this.collectionId, metadatumId: removedMetadatum.id, isRepositoryLevel: this.isRepositoryLevel})
|
this.deleteMetadatum({
|
||||||
.then(() => {
|
collectionId: this.collectionId,
|
||||||
|
metadatumId: removedMetadatum.id,
|
||||||
|
isRepositoryLevel: this.isRepositoryLevel
|
||||||
|
})
|
||||||
|
.then((removedMetadatum) => {
|
||||||
if (!this.isRepositoryLevel)
|
if (!this.isRepositoryLevel)
|
||||||
this.updateMetadataOrder();
|
this.updateMetadataOrder();
|
||||||
else
|
else
|
||||||
this.$root.$emit('metadatumUpdated', this.isRepositoryLevel);
|
this.$root.$emit('metadatumUpdated', this.isRepositoryLevel);
|
||||||
|
|
||||||
|
const removedMetadatumIndex = this.childrenMetadata.findIndex(metadatum => metadatum.id == removedMetadatum.id);
|
||||||
|
if (removedMetadatumIndex >= 0)
|
||||||
|
this.childrenMetadata.splice(removedMetadatumIndex, 1);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$console.log("Error deleting metadatum.")
|
this.$console.log("Error deleting metadatum.")
|
||||||
|
@ -424,7 +434,7 @@
|
||||||
border-left: 1px solid var(--tainacan-gray2);
|
border-left: 1px solid var(--tainacan-gray2);
|
||||||
|
|
||||||
section {
|
section {
|
||||||
padding: 1em 0.5em;
|
padding: 0.5em 0.5em 0 0.5em;
|
||||||
}
|
}
|
||||||
.children-icon {
|
.children-icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
Loading…
Reference in New Issue