-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ [#5012] Add metadata to JSON dump configuration options
Also add support for an extra static variables registry in generate_json_schema
- Loading branch information
1 parent
08a9b23
commit c308bf6
Showing
9 changed files
with
230 additions
and
44 deletions.
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
48 changes: 48 additions & 0 deletions
48
...forms/js/components/admin/form_design/registrations/json_dump/fields/MetadataVariables.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,48 @@ | ||
import {useField} from 'formik'; | ||
import React from 'react'; | ||
import {FormattedMessage} from 'react-intl'; | ||
|
||
import {VARIABLE_SOURCES} from 'components/admin/form_design/variables/constants'; | ||
import {getVariableSource} from 'components/admin/form_design/variables/utils'; | ||
import Field from 'components/admin/forms/Field'; | ||
import FormRow from 'components/admin/forms/FormRow'; | ||
import VariableSelection from 'components/admin/forms/VariableSelection'; | ||
|
||
const MetadataVariables = () => { | ||
const [fieldProps] = useField('additionalMetadataVariables'); | ||
const [, {value}] = useField('fixedMetadataVariables'); | ||
|
||
return ( | ||
<FormRow> | ||
<Field | ||
name="additionalMetadataVariables" | ||
label={ | ||
<FormattedMessage | ||
description="JSON registration options 'additionalMetadataVariables' label" | ||
defaultMessage="Additional metadata variables" | ||
/> | ||
} | ||
helpText={ | ||
<FormattedMessage | ||
description="JSON registration options 'additionalMetadataVariables' helpText" | ||
defaultMessage="Which additional variables to include in the metadata (the following are already included by default: {alreadyIncluded})" | ||
values={{alreadyIncluded: value.join(', ')}} | ||
/> | ||
} | ||
noManageChildProps | ||
> | ||
<VariableSelection | ||
{...fieldProps} | ||
isMulti | ||
closeMenuOnSelect={false} | ||
includeStaticVariables | ||
filter={variable => | ||
getVariableSource(variable) === VARIABLE_SOURCES.static && !value.includes(variable.key) | ||
} // Only show static variables and variables which are not already required | ||
/> | ||
</Field> | ||
</FormRow> | ||
); | ||
}; | ||
|
||
export default MetadataVariables; |
3 changes: 2 additions & 1 deletion
3
src/openforms/js/components/admin/form_design/registrations/json_dump/fields/index.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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import MetadataVariables from './MetadataVariables'; | ||
import Path from './Path'; | ||
import ServiceSelect from './ServiceSelect'; | ||
import Variables from './Variables'; | ||
|
||
export {Path, ServiceSelect, Variables}; | ||
export {MetadataVariables, Path, ServiceSelect, Variables}; |
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
Oops, something went wrong.