Commit 1c013c8e authored by Tom Quirk's avatar Tom Quirk

Hide checkbox when design is uploading

parent 7148226e
...@@ -47,6 +47,7 @@ export default { ...@@ -47,6 +47,7 @@ export default {
createDesign: false, createDesign: false,
}, },
isSaving: false, isSaving: false,
savingDesignFiles: [],
selectedDesigns: [], selectedDesigns: [],
}; };
}, },
...@@ -100,7 +101,8 @@ export default { ...@@ -100,7 +101,8 @@ export default {
return null; return null;
} }
const optimisticResponse = Array.from(files).map(file => ({ const filesArray = Array.from(files);
const optimisticResponse = filesArray.map(file => ({
// False positive i18n lint: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/26 // False positive i18n lint: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/26
// eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings // eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings
__typename: 'Design', __typename: 'Design',
...@@ -134,6 +136,7 @@ export default { ...@@ -134,6 +136,7 @@ export default {
})); }));
this.isSaving = true; this.isSaving = true;
this.savingDesignFiles = filesArray;
return this.$apollo return this.$apollo
.mutate({ .mutate({
...@@ -187,6 +190,13 @@ export default { ...@@ -187,6 +190,13 @@ export default {
isDesignSelected(filename) { isDesignSelected(filename) {
return this.selectedDesigns.includes(filename); return this.selectedDesigns.includes(filename);
}, },
canSelectDesign(filename) {
return (
this.isLatestVersion &&
this.canCreateDesign &&
!this.savingDesignFiles.some(file => file.name === filename)
);
},
onDesignDelete() { onDesignDelete() {
this.selectedDesigns = []; this.selectedDesigns = [];
if (this.$route.query.version) this.$router.push({ name: 'designs' }); if (this.$route.query.version) this.$router.push({ name: 'designs' });
...@@ -243,7 +253,7 @@ export default { ...@@ -243,7 +253,7 @@ export default {
<li v-for="design in designs" :key="design.id" class="col-md-6 col-lg-4 mb-3"> <li v-for="design in designs" :key="design.id" class="col-md-6 col-lg-4 mb-3">
<design v-bind="design" /> <design v-bind="design" />
<input <input
v-if="isLatestVersion && canCreateDesign" v-if="canSelectDesign(design.filename)"
:checked="isDesignSelected(design.filename)" :checked="isDesignSelected(design.filename)"
type="checkbox" type="checkbox"
class="design-checkbox" class="design-checkbox"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment