diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue b/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue index 2dba69cc0f..ad498da058 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue @@ -70,7 +70,7 @@
@@ -96,7 +96,7 @@ @@ -123,8 +123,10 @@ @@ -252,6 +254,8 @@ listElevated: false, storagePoll: null, openTime: null, + isInheritModalOpen: false, + newNodeIds: [], }; }, computed: { @@ -315,6 +319,17 @@ invalidNodes() { return this.nodeIds.filter(id => !this.getContentNodeIsValid(id)); }, + currentSelectedNodes: { + get() { + if (this.isInheritModalOpen && this.newNodeIds.length) { + return this.newNodeIds; + } + return this.selected; + }, + set(value) { + this.selected = value; + }, + }, }, beforeRouteEnter(to, from, next) { if ( @@ -513,21 +528,22 @@ this.selected = [newNodeId]; }); }, - createNodesFromUploads(fileUploads) { - fileUploads.forEach((file, index) => { - let title; - if (file.metadata.title) { - title = file.metadata.title; - } else { - title = file.original_filename - .split('.') - .slice(0, -1) - .join('.'); - } - this.createNode( - FormatPresets.has(file.preset) && FormatPresets.get(file.preset).kind_id, - { title, ...file.metadata } - ).then(newNodeId => { + async createNodesFromUploads(fileUploads) { + this.newNodeIds = await Promise.all( + fileUploads.map(async (file, index) => { + let title; + if (file.metadata.title) { + title = file.metadata.title; + } else { + title = file.original_filename + .split('.') + .slice(0, -1) + .join('.'); + } + const newNodeId = await this.createNode( + FormatPresets.has(file.preset) && FormatPresets.get(file.preset).kind_id, + { title, ...file.metadata } + ); if (index === 0) { this.selected = [newNodeId]; } @@ -535,8 +551,10 @@ ...file, contentnode: newNodeId, }); - }); - }); + return newNodeId; + }) + ); + this.$refs.inheritModal?.resetClosed(); }, updateTitleForPage() { this.updateTabTitle(this.$store.getters.appendChannelName(this.modalTitle)); @@ -547,7 +565,7 @@ }); }, inheritMetadata(metadata) { - for (const nodeId of this.nodeIds) { + for (const nodeId of this.currentSelectedNodes) { this.updateContentNode({ id: nodeId, ...metadata, mergeMapFields: true }); } }, diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/edit/InheritAncestorMetadataModal.vue b/contentcuration/contentcuration/frontend/channelEdit/components/edit/InheritAncestorMetadataModal.vue index 6c0a42fda7..4147ab63e5 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/edit/InheritAncestorMetadataModal.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/edit/InheritAncestorMetadataModal.vue @@ -178,6 +178,9 @@ this.resetData(); } }, + active(newValue) { + this.$emit('updateActive', newValue); + }, }, created() { this.resetData(); @@ -283,6 +286,12 @@ } this.closed = true; }, + /** + * @public + */ + resetClosed() { + this.closed = false; + }, }, $trs: { applyResourceDetailsTitle: "Apply details from the folder '{folder}'",