Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show warning for old entity spec version #1059

Merged
merged 3 commits into from
Nov 25, 2024
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
31 changes: 19 additions & 12 deletions src/components/form/new.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,22 @@ definition for an existing form -->
<ul>
<!-- eslint-disable-next-line vue/require-v-for-key -->
<li v-for="warning of warnings.workflowWarnings">
{{ $t('warningsText[3].' + warning.type, { value: warning.details.xmlFormId }) }}
<doc-link :to="documentLinks[warning.type]">{{ $t('moreInfo.learnMore') }}</doc-link>
<span v-if="warning.type === 'structureChanged'">
<br>
<strong>{{ $t('fields') }}</strong> {{ warning.details.join(', ') }}
</span>
<template v-if="warning.type === 'deletedFormExists'">
{{ $t('warningsText[3].deletedFormExists', { value: warning.details.xmlFormId }) }}
<doc-link to="central-forms/#deleting-a-form">{{ $t('moreInfo.learnMore') }}</doc-link>
</template>
<template v-else-if="warning.type === 'structureChanged'">
{{ $t('warningsText[3].structureChanged') }}
<doc-link to="central-forms/#central-forms-updates">{{ $t('moreInfo.learnMore') }}</doc-link>
<span>
<br>
<strong>{{ $t('fields') }}</strong> {{ warning.details.join(', ') }}
</span>
</template>
<template v-else-if="warning.type === 'oldEntityVersion'">
{{ $t('warningsText[3].oldEntityVersion', { version: warning.details.version }) }}
<a href="https://getodk.github.io/xforms-spec/entities" target="_blank">{{ $t('moreInfo.learnMore') }}</a>
</template>
</li>
</ul>
</p>
Expand Down Expand Up @@ -143,11 +153,7 @@ export default {
data() {
return {
file: null,
warnings: null,
documentLinks: {
deletedFormExists: 'central-forms/#deleting-a-form',
structureChanged: 'central-forms/#central-forms-updates'
}
warnings: null
};
},
computed: {
Expand Down Expand Up @@ -318,7 +324,8 @@ export default {
"Workflow warnings:",
{
"deletedFormExists": "There is a form with ID \"{value}\" in the Trash. If you upload this Form, you won’t be able to undelete the other one with the matching ID.",
"structureChanged": "The following fields have been deleted, renamed or are now in different groups or repeats. These fields will not be visible in the Submission table or included in exports by default."
"structureChanged": "The following fields have been deleted, renamed or are now in different groups or repeats. These fields will not be visible in the Submission table or included in exports by default.",
"oldEntityVersion": "Entities specification version “{version}” is not compatible with Offline Entities. We recommend using version 2024.1.0 or later."
},
"Please correct the problems and try again.",
{
Expand Down
9 changes: 8 additions & 1 deletion test/components/form/new.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,8 @@ describe('FormNew', () => {
xlsFormWarnings: ['warning 1', 'warning 2'],
workflowWarnings: [
{ type: 'structureChanged', details: ['Name', 'Age'] },
{ type: 'deletedFormExists', details: { xmlFormId: 'simple' } }
{ type: 'deletedFormExists', details: { xmlFormId: 'simple' } },
{ type: 'oldEntityVersion', details: { version: '2022.1.0' } }
]
}
}
Expand Down Expand Up @@ -545,6 +546,9 @@ describe('FormNew', () => {

items[1].text().should.startWith('There is a form with ID "simple" in the Trash');
items[1].find('span').exists().should.be.false;

items[2].text().should.startWith('Entities specification version “2022.1.0” is not compatible with Offline Entities');
items[2].find('span').exists().should.be.false;
});
});

Expand All @@ -567,6 +571,9 @@ describe('FormNew', () => {

items[3].text().should.startWith('There is a form with ID "simple" in the Trash');
items[3].find('span').exists().should.be.false;

items[4].text().should.startWith('Entities specification version “2022.1.0” is not compatible with Offline Entities');
items[4].find('span').exists().should.be.false;
});
});

Expand Down
3 changes: 3 additions & 0 deletions transifex/strings_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3142,6 +3142,9 @@
},
"structureChanged": {
"string": "The following fields have been deleted, renamed or are now in different groups or repeats. These fields will not be visible in the Submission table or included in exports by default."
},
"oldEntityVersion": {
"string": "Entities specification version “{version}” is not compatible with Offline Entities. We recommend using version 2024.1.0 or later."
}
},
"4": {
Expand Down