-
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -41,8 +41,13 @@ 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> | ||||||
{{ $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> | ||||||
<span v-if="warning.type === 'structureChanged'"> | ||||||
<br> | ||||||
<strong>{{ $t('fields') }}</strong> {{ warning.details.join(', ') }} | ||||||
|
@@ -147,6 +152,9 @@ export default { | |||||
documentLinks: { | ||||||
deletedFormExists: 'central-forms/#deleting-a-form', | ||||||
structureChanged: 'central-forms/#central-forms-updates' | ||||||
}, | ||||||
externalLinks: { | ||||||
oldEntityVersion: 'https://getodk.github.io/xforms-spec/entities' | ||||||
} | ||||||
}; | ||||||
}, | ||||||
|
@@ -241,6 +249,10 @@ export default { | |||||
}, | ||||||
getLearnMoreLink(value) { | ||||||
return value.match(/Learn more: (https?:\/\/xlsform\.org[^.]*)\.?/)[1]; | ||||||
}, | ||||||
getWarningValue(warning) { | ||||||
if (warning.type === 'oldEntityVersion') return warning.details.version; | ||||||
return warning.details.xmlFormId; | ||||||
} | ||||||
} | ||||||
}; | ||||||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. I think curly quotes are usually a nice touch:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should I change it for the There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||||||
}, | ||||||
"Please correct the problems and try again.", | ||||||
{ | ||||||
|
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: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
showsdetails.xmlFormId
,oldEntityVersion
showsdetails.version
, andstructureChanged
only shows static text. Itsdetails
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.