Skip to content
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

global: move config properties of schemas to inside of the config property #2858

Open
miguelgrc opened this issue Oct 20, 2023 · 0 comments
Open

Comments

@miguelgrc
Copy link
Contributor

For schemas (e.g. cms) we have some of the "config" properties in the root of the schema (e.g. fullname, version, experiment) instead of having them inside the config property, which only contains. Those properties are saved in the redux state in schemaWizard.config, so it would make more sense if all of them were grouped (also because most of them come from the schema config) and would be less error prone. Also, config already exists and notifications are already saved inside of it, so the ideal result would be:

{
  ...
  "config": {
    "name": "cms-analysis",
    "version": "0.0.1",
    "fullname": "CMS Analysis",
    "experiment": "CMS",
    "is_indexed": true,
    "use_deposit_as_record": true,
    "notifications": {
        "actions": {
          "review": [],
          "publish": []
        }
     }
  },
  ...
}

whereas now we have:

{
  "name": "cms-analysis",
  "version": "0.0.1",
  "fullname": "CMS Analysis",
  "experiment": "CMS",
  "is_indexed": true,
  "use_deposit_as_record": true,
  "deposit_schema": {...}
  "deposit_mapping": {...}
  "deposit_options": {...}
}

This would be easy to change in the UI, but it requires changing the backend (validation, etc) as well as updating the existing schemas.

With this change, instead of

const { deposit_schema, deposit_options, ...configs } = data;
// We don't necessarily need to store every prop in ...configs in the redux state
// but else we'd need to filter manually here (and not only here) which is not ideal
store.dispatch(updateSchemaConfig(configs));

we could do

store.dispatch(updateSchemaConfig(data.config));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant