From 72aa570c4dc659922763daffc054aa248b686c5f Mon Sep 17 00:00:00 2001 From: Kathleen Tuite Date: Mon, 20 Jun 2022 14:38:26 -0700 Subject: [PATCH 1/4] Showing form IDs next to duplicated form names --- src/components/form/row.vue | 13 ++++++- src/components/form/trash-row.vue | 13 ++++++- src/components/project/form-row.vue | 10 ++++++ test/components/project/home-block.spec.js | 15 ++++++++ test/components/project/overview.spec.js | 42 ++++++++++++++++++++++ 5 files changed, 91 insertions(+), 2 deletions(-) diff --git a/src/components/form/row.vue b/src/components/form/row.vue index 17d3dac30..18acead0c 100644 --- a/src/components/form/row.vue +++ b/src/components/form/row.vue @@ -15,6 +15,7 @@ except according to the terms contained in the LICENSE file. {{ form.nameOrId() }} + ({{ form.xmlFormId }}) @@ -112,7 +113,7 @@ export default { computed: { // The component assumes that this data will exist when the component is // created. - ...requestData(['project']), + ...requestData(['project', 'forms', 'deletedForms']), visibleReviewStates: () => ['received', 'hasIssues', 'edited'], urlFilterEncode() { return new Map() @@ -126,6 +127,11 @@ export default { this.form.xmlFormId, 'draft/testing' ); + }, + showIdForDuplicateName() { + const allForms = [...this.forms || [], ...this.deletedForms || []]; + const formNames = allForms.flatMap((form) => ((form.xmlFormId !== this.form.xmlFormId) ? form.nameOrId() : [])); + return formNames.includes(this.form.nameOrId()); } } }; @@ -147,6 +153,11 @@ export default { font-size: 18px; } + .duplicate-form-id { + font-family: $font-family-monospace; + padding-left: 6px; + } + .review-state, .total-submissions, .not-published { a { @include text-link; } text-align: right; diff --git a/src/components/form/trash-row.vue b/src/components/form/trash-row.vue index 004e389e7..11b637b86 100644 --- a/src/components/form/trash-row.vue +++ b/src/components/form/trash-row.vue @@ -13,6 +13,7 @@ except according to the terms contained in the LICENSE file. {{ form.nameOrId() }} + ({{ form.xmlFormId }}) @@ -67,7 +68,7 @@ export default { computed: { // The component assumes that this data will exist when the component is // created. - ...requestData(['forms']), + ...requestData(['forms', 'deletedForms']), activeFormIds() { // returns ids of existing forms to disable restoring deleted // forms with conflicting ids (also prevented on backend) @@ -82,6 +83,11 @@ export default { if (this.disabled) return this.$t('disabled.conflict'); return null; + }, + showIdForDuplicateName() { + const allForms = [...this.forms || [], ...this.deletedForms || []]; + const formNames = allForms.flatMap((form) => ((form.xmlFormId !== this.form.xmlFormId) ? form.nameOrId() : [])); + return formNames.includes(this.form.nameOrId()); } }, methods: { @@ -108,6 +114,11 @@ export default { font-size: 18px; } + .duplicate-form-id { + font-family: $font-family-monospace; + padding-left: 6px; + } + .deleted { width: 300px; text-align: right; diff --git a/src/components/project/form-row.vue b/src/components/project/form-row.vue index e1df4ae5a..7b87284ed 100644 --- a/src/components/project/form-row.vue +++ b/src/components/project/form-row.vue @@ -26,6 +26,7 @@ except according to the terms contained in the LICENSE file. {{ form.nameOrId() }} + ({{ form.xmlFormId }})