Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@
<VBtn v-if="addTopicsMode" color="greyBackground" @click="createTopic">
{{ $tr('addTopic') }}
</VBtn>
<VBtn v-else-if="uploadMode" color="greyBackground" @click="openFileDialog">
<VBtn
v-else-if="uploadMode"
:disabled="creatingNodes"
color="greyBackground"
@click="openFileDialog"
>
{{ $tr('uploadButton') }}
</VBtn>
</ToolBar>
Expand Down Expand Up @@ -256,6 +261,7 @@
openTime: null,
isInheritModalOpen: false,
newNodeIds: [],
creatingNodes: false,
};
},
computed: {
Expand Down Expand Up @@ -532,6 +538,7 @@
});
},
async createNodesFromUploads(fileUploads) {
this.creatingNodes = true;
this.newNodeIds = await Promise.all(
fileUploads.map(async (file, index) => {
let title;
Expand All @@ -557,6 +564,7 @@
return newNodeId;
})
);
this.creatingNodes = false;
this.$refs.inheritModal?.resetClosed();
},
updateTitleForPage() {
Expand All @@ -568,8 +576,21 @@
});
},
inheritMetadata(metadata) {
for (const nodeId of this.currentSelectedNodes) {
this.updateContentNode({ id: nodeId, ...metadata, mergeMapFields: true });
const setMetadata = () => {
for (const nodeId of this.newNodeIds) {
this.updateContentNode({ id: nodeId, ...metadata, mergeMapFields: true });
}
this.newNodeIds = [];
};
if (!this.creatingNodes) {
setMetadata();
} else {
const unwatch = this.$watch('creatingNodes', creatingNodes => {
if (!creatingNodes) {
unwatch();
setMetadata();
}
});
}
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:submitText="$tr('continueAction')"
:cancelText="$tr('cancelAction')"
@submit="handleContinue"
@cancel="closed = true"
@cancel="handleCancel"
>
<div>
<div>
Expand Down Expand Up @@ -201,10 +201,14 @@
}
this.checks = checks;
ContentNode.getAncestors(this.parent.id).then(ancestors => {
if (!this.parent) {
// If the parent has been removed before the data is fetched, return
return;
}
for (const field of inheritableFields) {
if (
this.parent.extra_fields.inherited_metadata &&
this.parent.extra_fields.inherited_metadata[field]
this.parent.extra_fields?.inherited_metadata &&
!isUndefined(this.parent.extra_fields.inherited_metadata[field])
) {
this.checks[field] = this.parent.extra_fields.inherited_metadata[field];
}
Expand Down Expand Up @@ -291,6 +295,10 @@
}
this.closed = true;
},
handleCancel() {
this.closed = true;
this.$emit('inherit', {});
},
/**
* @public
*/
Expand Down