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
Required meta fields UI #3285
Merged
Merged
Required meta fields UI #3285
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e0ecab1
add checkRequiredMetaFieldsOnFile for checking single file's meta fie…
arturi 363ce4d
add MetaErrorMessage component, mobile and desktop styles
arturi a0143f9
use AggregateRestrictionError again
arturi a5ad997
metaFieldIdToName — use names of meta fields instead of id
arturi 2a152d8
Update MetaErrorMessage.js
arturi b64717f
desktop style tweaks
arturi 35c7cc7
update jest snapshot
arturi File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
packages/@uppy/dashboard/src/components/FileItem/MetaErrorMessage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const { h } = require('preact') | ||
|
||
const metaFieldIdToName = (metaFieldId, metaFields) => { | ||
const field = metaFields.filter(f => f.id === metaFieldId) | ||
return field[0].name | ||
} | ||
|
||
module.exports = function renderMissingMetaFieldsError (props) { | ||
const { file, toggleFileCard, i18n, metaFields } = props | ||
const { missingRequiredMetaFields } = file | ||
if (!missingRequiredMetaFields?.length) { | ||
return null | ||
} | ||
|
||
const metaFieldsString = missingRequiredMetaFields.map(missingMetaField => ( | ||
metaFieldIdToName(missingMetaField, metaFields) | ||
)).join(', ') | ||
|
||
return ( | ||
<div className="uppy-Dashboard-Item-errorMessage"> | ||
{i18n('missingRequiredMetaFields', { | ||
smart_count: missingRequiredMetaFields.length, | ||
fields: metaFieldsString, | ||
})} | ||
{' '} | ||
<button | ||
type="button" | ||
class="uppy-u-reset uppy-Dashboard-Item-errorMessageBtn" | ||
onClick={() => toggleFileCard(true, file.id)} | ||
> | ||
{i18n('editFile')} | ||
</button> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back 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.
are we still logging required fields in informer even with the new UI?
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.
No,
showInformer: false
.