analysispreservation.cern.ch icon indicating copy to clipboard operation
analysispreservation.cern.ch copied to clipboard

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

Open miguelgrc opened this issue 2 years ago • 0 comments

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));

miguelgrc avatar Oct 20 '23 08:10 miguelgrc