NCEAS / metacatui

MetacatUI: A client-side web interface for DataONE data repositories
https://nceas.github.io/metacatui
Apache License 2.0
42 stars 26 forks source link

Portal validation issues should prevent Save #1079

Closed laurenwalker closed 4 years ago

laurenwalker commented 4 years ago

When there is at least one validation error, the portal editor should show an error message when the Save button is clicked, and inputs with errors should be marked in red with error messages. This should mirror the metadata editor functionality and styling.

laurenwalker commented 4 years ago

The portal editor now has required fields that can be configured in the AppModel:

https://github.com/NCEAS/metacatui/blob/feature-project-editor/src/js/models/AppModel.js#L185-L204

/**
      * The list of fields that should be required in the portal editor.
      * Set individual properties to `true` to require them in the portal editor.
      * @type {Object}
      */
      portalEditorRequiredFields: {
        label: true,
        name: true,
        description: false,
        sectionTitle: true,
        sectionIntroduction: false,
        //The following fields are not yet supported as required fields in the portal editor
        //TODO: Add support for requiring the below fields
        sectionImage: false,
        logo: false,
        acknowledgments: false,
        acknowledgmentsLogos: false,
        awards: false,
        associatedParties: false
      }

As we continue to add fields to the editor, we need to add validation checks for those fields. This involves both checking if the values are valid and if they are configured as required.

So as we are adding the new image fields for MVP-5, we should be adding validation checks for logo, sectionImage, etc. (@robyngit)