-
Notifications
You must be signed in to change notification settings - Fork 59
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
Conversation
src/components/form/new.vue
Outdated
{{ $t('warningsText[3].' + warning.type, { value: warning.details.xmlFormId }) }} | ||
<doc-link :to="documentLinks[warning.type]">{{ $t('moreInfo.learnMore') }}</doc-link> | ||
{{ $t('warningsText[3].' + warning.type, { value: getWarningValue(warning) }) }} | ||
<template v-if="warning.type === 'oldEntityVersion'"> | ||
<a :href="externalLinks.oldEntityVersion" target="_blank">{{ $t('moreInfo.learnMore') }}</a> | ||
</template> | ||
<template v-else> | ||
<doc-link :to="documentLinks[warning.type]">{{ $t('moreInfo.learnMore') }}</doc-link> | ||
</template> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this predated your changes, but I feel like we're trying to impose a structure on these warnings that doesn't necessarily exist. We have three warnings, and we render each differently. Instead of trying to use computed properties and methods, could we use v-if
/v-else
? I think that'd be clearer overall. I'm thinking of something like:
<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].structuredChanged') }}
<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, { value: warning.details.version }) }}
<a href="https://getodk.github.io/xforms-spec/entities" target="_blank">{{ $t('moreInfo.learnMore') }}</a>
</template>
For example, I think it's easier to see here that while each warning shows an i18n message, they all work a little differently. deletedFormExists
shows details.xmlFormId
, oldEntityVersion
shows details.version
, and structureChanged
only shows static text. Its details
is actually an array of fields, which are shown in a separate <span>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this a lot better, I was struggling with how to manage these different, yet in some ways similar, cases.
src/components/form/new.vue
Outdated
@@ -318,7 +330,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 \"{value}\" is not compatible with Offline Entities. Please use version 2024.1.0 or later." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think curly quotes are usually a nice touch:
"oldEntityVersion": "Entities specification version \"{value}\" is not compatible with Offline Entities. Please use version 2024.1.0 or later." | |
"oldEntityVersion": "Entities specification version “{value}” is not compatible with Offline Entities. Please use version 2024.1.0 or later." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I change it for the deletedFormExists
string above, too, or would that require it to get re-translated (so maybe I should just leave it as is)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it's not worth it getting re-translated. It'll be nice to have curly quotes in the new warning though.
dee99c6
to
aae3d68
Compare
src/components/form/new.vue
Outdated
</span> | ||
</template> | ||
<template v-else-if="warning.type === 'oldEntityVersion'"> | ||
{{ $t('warningsText[3].oldEntityVersion', { value: warning.details.version }) }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could call value
version
in the translation message
src/components/form/new.vue
Outdated
@@ -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 “{value}” is not compatible with Offline Entities. Please use version 2024.1.0 or later." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could possibly say "We recommend using version 2024.1.0 or later..." to leave it more open ended?
Frontend of getodk/central-backend#1272
Issue getodk/central#730
What has been done to verify that this works as intended?
Why is this the best possible solution? Were any other approaches considered?
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
Does this change require updates to user documentation? If so, please file an issue here and include the link below.
Before submitting this PR, please make sure you have:
npm run test
andnpm run lint
and confirmed all checks still pass OR confirm CircleCI build passes