Skip to content

Commit

Permalink
subcommunity: updated error mapping in the ui
Browse files Browse the repository at this point in the history
  • Loading branch information
0einstein0 committed Jun 28, 2024
1 parent 9a8786f commit 89f80d6
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const IdentifierField = ({ formConfig }) => {
"This is your community's unique identifier. You will be able to access your community through the URL:"
)}
<br />
{`${formConfig.SITE_UI_URL}/communities/${values["community"]["slug"]}`}
{`${formConfig.SITE_UI_URL}/communities/${values["metadata"]["slug"]}`}
</>
);

Expand Down Expand Up @@ -139,11 +139,18 @@ class CommunityCreateForm extends Component {
const { errors, message } = communityErrorSerializer(error);

if (message) {
this.setGlobalError(message);
this.setGlobalError("The form contains errors or missing fields. Please verify before submitting");

Check failure on line 142 in invenio_communities/assets/semantic-ui/js/invenio_communities/subcommunity/new.js

View workflow job for this annotation

GitHub Actions / Tests (3.9, postgresql14, opensearch2)

Replace `"The·form·contains·errors·or·missing·fields.·Please·verify·before·submitting"` with `⏎··········"The·form·contains·errors·or·missing·fields.·Please·verify·before·submitting"⏎········`

Check failure on line 142 in invenio_communities/assets/semantic-ui/js/invenio_communities/subcommunity/new.js

View workflow job for this annotation

GitHub Actions / Tests (3.10, postgresql14, opensearch2)

Replace `"The·form·contains·errors·or·missing·fields.·Please·verify·before·submitting"` with `⏎··········"The·form·contains·errors·or·missing·fields.·Please·verify·before·submitting"⏎········`

Check failure on line 142 in invenio_communities/assets/semantic-ui/js/invenio_communities/subcommunity/new.js

View workflow job for this annotation

GitHub Actions / Tests (3.11, postgresql14, opensearch2)

Replace `"The·form·contains·errors·or·missing·fields.·Please·verify·before·submitting"` with `⏎··········"The·form·contains·errors·or·missing·fields.·Please·verify·before·submitting"⏎········`

Check failure on line 142 in invenio_communities/assets/semantic-ui/js/invenio_communities/subcommunity/new.js

View workflow job for this annotation

GitHub Actions / Tests (3.12, postgresql14, opensearch2)

Replace `"The·form·contains·errors·or·missing·fields.·Please·verify·before·submitting"` with `⏎··········"The·form·contains·errors·or·missing·fields.·Please·verify·before·submitting"⏎········`
}

if (errors) {
errors.map(({ field, messages }) => setFieldError(field, messages[0]));
errors.map(({ field, messages }) => {

Check warning on line 146 in invenio_communities/assets/semantic-ui/js/invenio_communities/subcommunity/new.js

View workflow job for this annotation

GitHub Actions / Tests (3.9, postgresql14, opensearch2)

Array.prototype.map() expects a return value from arrow function

Check warning on line 146 in invenio_communities/assets/semantic-ui/js/invenio_communities/subcommunity/new.js

View workflow job for this annotation

GitHub Actions / Tests (3.10, postgresql14, opensearch2)

Array.prototype.map() expects a return value from arrow function

Check warning on line 146 in invenio_communities/assets/semantic-ui/js/invenio_communities/subcommunity/new.js

View workflow job for this annotation

GitHub Actions / Tests (3.11, postgresql14, opensearch2)

Array.prototype.map() expects a return value from arrow function

Check warning on line 146 in invenio_communities/assets/semantic-ui/js/invenio_communities/subcommunity/new.js

View workflow job for this annotation

GitHub Actions / Tests (3.12, postgresql14, opensearch2)

Array.prototype.map() expects a return value from arrow function
// Check if the field is already prefixed with "metadata"
if (!field.startsWith("metadata")) {
// Add "metadata" prefix if not already present
field = `metadata.${field.split('.').pop()}`;

Check failure on line 150 in invenio_communities/assets/semantic-ui/js/invenio_communities/subcommunity/new.js

View workflow job for this annotation

GitHub Actions / Tests (3.9, postgresql14, opensearch2)

Replace `'.'` with `"."`

Check failure on line 150 in invenio_communities/assets/semantic-ui/js/invenio_communities/subcommunity/new.js

View workflow job for this annotation

GitHub Actions / Tests (3.10, postgresql14, opensearch2)

Replace `'.'` with `"."`

Check failure on line 150 in invenio_communities/assets/semantic-ui/js/invenio_communities/subcommunity/new.js

View workflow job for this annotation

GitHub Actions / Tests (3.11, postgresql14, opensearch2)

Replace `'.'` with `"."`

Check failure on line 150 in invenio_communities/assets/semantic-ui/js/invenio_communities/subcommunity/new.js

View workflow job for this annotation

GitHub Actions / Tests (3.12, postgresql14, opensearch2)

Replace `'.'` with `"."`
}
setFieldError(field, messages[0]);
});
}
}
};
Expand Down

0 comments on commit 89f80d6

Please sign in to comment.