Skip to content
Snippets Groups Projects
Commit 7b64f4e4 authored by Farbod Zamani's avatar Farbod Zamani Committed by Jan-Hendrik Willms
Browse files

Resolve "the lack of feedback if the copying process fails", fixes #347

parent cbaa9893
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<div class="cw-manager-element"> <div class="cw-manager-element">
<div v-if="currentElement"> <div v-if="currentElement">
<courseware-companion-box v-if="insertingInProgress" :msgCompanion="text.inProgress" mood="pointing" /> <courseware-companion-box v-if="insertingInProgress" :msgCompanion="text.inProgress" mood="pointing" />
<courseware-companion-box v-if="copyingFailed && !insertingInProgress" :msgCompanion="copyProcessFailedMessage" mood="sad" />
<div class="cw-manager-element-title"> <div class="cw-manager-element-title">
<div class="cw-manager-element-breadcrumb"> <div class="cw-manager-element-breadcrumb">
<span <span
...@@ -153,8 +154,10 @@ export default { ...@@ -153,8 +154,10 @@ export default {
sortArrayContainers: [], sortArrayContainers: [],
discardStateArrayContainers: [], discardStateArrayContainers: [],
insertingInProgress: false, insertingInProgress: false,
copyingFailed: false,
text: { text: {
inProgress: this.$gettext('Vorgang läuft. Bitte warten Sie einen Moment.') inProgress: this.$gettext('Vorgang läuft. Bitte warten Sie einen Moment.'),
copyProcessFailed: [],
}, },
}; };
}, },
...@@ -277,6 +280,13 @@ export default { ...@@ -277,6 +280,13 @@ export default {
}, },
filingData() { filingData() {
return this.$store.getters.filingData; return this.$store.getters.filingData;
},
copyProcessFailedMessage() {
let message = this.$gettext('Der Kopiervorgang ist fehlgeschlagen.');
if (this.text.copyProcessFailed.length) {
message = this.text.copyProcessFailed.join('<br>');
}
return message;
} }
}, },
methods: { methods: {
...@@ -317,6 +327,11 @@ export default { ...@@ -317,6 +327,11 @@ export default {
}); });
}, },
showFailedCopyProcessCompanion() {
this.copyingFailed = true;
this.insertingInProgress = false;
},
async insertElement(data) { async insertElement(data) {
let source = data.source; let source = data.source;
let element = data.element; let element = data.element;
...@@ -346,6 +361,10 @@ export default { ...@@ -346,6 +361,10 @@ export default {
await this.copyStructuralElement({ await this.copyStructuralElement({
parentId: parentId, parentId: parentId,
element: element, element: element,
}).catch((error) => {
let message = `${element.attributes.title} ` + this.$gettext('konnte nicht kopiert werden.');
this.text.copyProcessFailed.push(message);
this.showFailedCopyProcessCompanion();
}); });
this.$emit('loadSelf', parentId); this.$emit('loadSelf', parentId);
} }
...@@ -379,6 +398,10 @@ export default { ...@@ -379,6 +398,10 @@ export default {
await this.copyContainer({ await this.copyContainer({
parentId: parentId, parentId: parentId,
container: container, container: container,
}).catch((error) => {
let message = this.$gettext('Abschnitt konnte nicht kopiert werden') + ` - ${container.attributes.title}`;
this.text.copyProcessFailed.push(message);
this.showFailedCopyProcessCompanion();
}); });
this.$emit('loadSelf', parentId); this.$emit('loadSelf', parentId);
} }
...@@ -437,6 +460,10 @@ export default { ...@@ -437,6 +460,10 @@ export default {
await this.copyBlock({ await this.copyBlock({
parentId: parentId, parentId: parentId,
block: block, block: block,
}).catch((error) => {
let message = this.$gettext('Block konnte nicht kopiert werden') + ` - ${block.attributes.title}`;
this.text.copyProcessFailed.push(message);
this.showFailedCopyProcessCompanion();
}); });
await this.loadContainer(parentId); await this.loadContainer(parentId);
this.$emit('loadSelf',this.filingData.parentItem.relationships['structural-element'].data.id); this.$emit('loadSelf',this.filingData.parentItem.relationships['structural-element'].data.id);
...@@ -528,6 +555,8 @@ export default { ...@@ -528,6 +555,8 @@ export default {
this.blockInserterActive = true; this.blockInserterActive = true;
break; break;
} }
this.copyingFailed = false;
this.text.copyProcessFailed = [];
} else { } else {
this.elementInserterActive = false; this.elementInserterActive = false;
this.containerInserterActive = false; this.containerInserterActive = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment