Commit 203216c8 authored by Matija Obreza's avatar Matija Obreza
Browse files

Allow ADMIN role to specify descriptor list UUID on creation

parent daebc019
......@@ -43,7 +43,7 @@ class Authorize extends React.Component<IAuthorizeProps, any> {
public render() {
const {children, ...rest} = this.props;
return this.state.show ? React.cloneElement(children, rest) : null;
return this.state.show && children ? React.cloneElement(children, rest) : null;
}
}
......
......@@ -5,6 +5,7 @@ import { DESCRIPTORLIST_FORM } from 'constants/descriptors';
import { TextField } from 'ui/common/text-field';
import { MarkdownField } from 'ui/common/markdown';
import Authorize from 'ui/common/authorized/Authorize';
import SelectPartner from 'ui/catalog/partner/SelectPartner';
import Validators from 'utilities/Validators';
......@@ -20,6 +21,26 @@ const DescriptorListForm = ({invalid, submitting, error, handleSubmit, initialVa
editable={ ! (initialValues.uuid && initialValues.version) }
component={ SelectPartner } partners={ partners }
validate={ [ Validators.required ] } />
<Authorize role="ROLE_ADMINISTRATOR">
{ (! initialValues.uuid && initialValues.version) &&
<div>
<div className="p-20 even-row">
<p>
You're <b>ADMINISTRATOR</b> and you get to pick the <code>UUID</code> if you want to.
Leave field blank to have it automatically assigned.
Standard codes used by the Catalog:
</p>
<ul>
<li><code>dc1d4e81-a6dd-4f03-b682-53a3a1383988</code> Genesys PGR descriptors</li>
</ul>
</div>
<Field name="uuid"
label="UUID" placeholder="ihope-youk-noww-hatyouredoing"
component={ TextField }
/>
</div>
}
</Authorize>
<Field name="crop" label="Crop code" placeholder="maize" component={ TextField } />
<Field required name="title" label="Descriptor list title" placeholder="Descriptors for" basicMarkdown component={ MarkdownField } validate={ [ Validators.required ] } />
<Field required disabled={ initialValues.uuid } name="versionTag" label="Version tag" placeholder="1.0" component={ TextField } validate={ [ Validators.required ] }/>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment