|
| 1 | +import FormControl from '@material-ui/core/FormControl'; |
| 2 | +import FormControlLabel from '@material-ui/core/FormControlLabel'; |
| 3 | +import FormHelperText from '@material-ui/core/FormHelperText'; |
| 4 | +import InputLabel from '@material-ui/core/InputLabel'; |
| 5 | +import MenuItem from '@material-ui/core/MenuItem'; |
| 6 | +import Typography from '@material-ui/core/Typography'; |
| 7 | +import { reduxForm } from 'redux-form'; |
| 8 | + |
| 9 | +import JobPriority from '../../const/JobPriority'; |
| 10 | +import { required } from '../../utils/FieldValidation'; |
| 11 | +import { TextField, Select } from '../form'; |
| 12 | +import { loadShapeTagOptions } from '../shapetag/ShapeTagSelect'; |
| 13 | +import { loadStorageOptions } from '../storage/StorageSelect'; |
| 14 | +import BoolCheckbox from '../ui/BoolCheckbox'; |
| 15 | +import Field from '../ui/Field'; |
| 16 | +import FieldTypeArray from '../ui/FieldTypeArray'; |
| 17 | +import FormSection from '../ui/FormSection'; |
| 18 | +import { KeyValuePairType } from '../ui/FormType'; |
| 19 | +import { StatefulAsyncSelect } from '../ui/Select'; |
| 20 | + |
| 21 | +const queryParams = () => ( |
| 22 | + <> |
| 23 | + <Field |
| 24 | + name="sourceTag" |
| 25 | + label="sourceTag" |
| 26 | + helperText="Comma-separated list of shape tags. The first valid shape is selected as the source of the job. If non of the tags are valid, the original shape will be used" |
| 27 | + component={StatefulAsyncSelect} |
| 28 | + loadOptions={loadShapeTagOptions} |
| 29 | + cacheOptions |
| 30 | + isClearable |
| 31 | + fullWidth |
| 32 | + isMulti |
| 33 | + creatable |
| 34 | + /> |
| 35 | + <Field |
| 36 | + name="tag" |
| 37 | + label="tag" |
| 38 | + helperText="Comma-separated list of shape tags specifying the desired output formats. Currently, only a single tag can be specified for a sequence item" |
| 39 | + component={StatefulAsyncSelect} |
| 40 | + loadOptions={loadShapeTagOptions} |
| 41 | + cacheOptions |
| 42 | + isClearable |
| 43 | + fullWidth |
| 44 | + isMulti |
| 45 | + creatable |
| 46 | + /> |
| 47 | + <Field |
| 48 | + name="original" |
| 49 | + label="original" |
| 50 | + component={TextField} |
| 51 | + fullWidth |
| 52 | + helperText="If specified, should be one of the tags specified in the tag parameter. Specifies that the original shape tag will be reset to the shape created to this tag." |
| 53 | + /> |
| 54 | + <Field |
| 55 | + name="destinationItem" |
| 56 | + label="destinationItem" |
| 57 | + component={TextField} |
| 58 | + fullWidth |
| 59 | + helperText="An item id to which the new shape will be associated" |
| 60 | + validate={[required]} |
| 61 | + required |
| 62 | + /> |
| 63 | + <Field |
| 64 | + name="storageId" |
| 65 | + label="storageId" |
| 66 | + helperText="Where essence file is to be stored" |
| 67 | + component={StatefulAsyncSelect} |
| 68 | + loadOptions={loadStorageOptions} |
| 69 | + cacheOptions |
| 70 | + isClearable |
| 71 | + fullWidth |
| 72 | + creatable |
| 73 | + /> |
| 74 | + <FormControl required fullWidth> |
| 75 | + <InputLabel htmlFor="mode">mode</InputLabel> |
| 76 | + <Field name="mode" component={Select} validate={[required]}> |
| 77 | + <MenuItem value="Rendering">Rendering</MenuItem> |
| 78 | + </Field> |
| 79 | + <FormHelperText>Rendermode of the transcoder</FormHelperText> |
| 80 | + </FormControl> |
| 81 | + <Field |
| 82 | + name="start" |
| 83 | + label="start" |
| 84 | + component={TextField} |
| 85 | + fullWidth |
| 86 | + helperText="Start frame in the source of the subclip" |
| 87 | + /> |
| 88 | + <Field name="duration" component={TextField} fullWidth helperText="Duration of the subclip" /> |
| 89 | + <Field |
| 90 | + name="startTimeCode" |
| 91 | + label="startTimeCode" |
| 92 | + component={TextField} |
| 93 | + fullWidth |
| 94 | + helperText="Start timecode of the new clip" |
| 95 | + /> |
| 96 | + <Field |
| 97 | + name="resourceId" |
| 98 | + label="resourceId" |
| 99 | + component={TextField} |
| 100 | + fullWidth |
| 101 | + helperText="The transcoder resource to use to execute the job" |
| 102 | + /> |
| 103 | + <Field |
| 104 | + name="resourceTag" |
| 105 | + label="resourceTag" |
| 106 | + component={TextField} |
| 107 | + fullWidth |
| 108 | + helperText="The resource tag criteria used to select transcoders for the job" |
| 109 | + /> |
| 110 | + <Field |
| 111 | + name="notification" |
| 112 | + label="notification" |
| 113 | + component={TextField} |
| 114 | + fullWidth |
| 115 | + helperText="The placeholder job notification to use for this job" |
| 116 | + /> |
| 117 | + <FieldTypeArray |
| 118 | + name="notificationData" |
| 119 | + label="notificationData" |
| 120 | + component={KeyValuePairType} |
| 121 | + arrayHeader |
| 122 | + withHeader={false} |
| 123 | + dense |
| 124 | + /> |
| 125 | + <FormControl fullWidth> |
| 126 | + <InputLabel htmlFor="priority">priority</InputLabel> |
| 127 | + <Field name="priority" component={Select}> |
| 128 | + {JobPriority.map((priority) => ( |
| 129 | + <MenuItem key={priority} value={priority}> |
| 130 | + {priority} |
| 131 | + </MenuItem> |
| 132 | + ))} |
| 133 | + </Field> |
| 134 | + <FormHelperText>The priority to assign to the job. Default is MEDIUM</FormHelperText> |
| 135 | + </FormControl> |
| 136 | + <FieldTypeArray |
| 137 | + name="jobmetadata" |
| 138 | + label="jobmetadata" |
| 139 | + component={KeyValuePairType} |
| 140 | + withHeader={false} |
| 141 | + arrayHeader |
| 142 | + dense |
| 143 | + /> |
| 144 | + <FormControl> |
| 145 | + <FormControlLabel |
| 146 | + control={<Field name="holdJob" component={BoolCheckbox} />} |
| 147 | + label="holdJob" |
| 148 | + fullWidth |
| 149 | + /> |
| 150 | + <FormHelperText>Created job in a HOLD state</FormHelperText> |
| 151 | + </FormControl> |
| 152 | + </> |
| 153 | +); |
| 154 | + |
| 155 | +function ItemSubclipCreateForm({ itemId, error, handleSubmit }) { |
| 156 | + return ( |
| 157 | + <form onSubmit={handleSubmit}> |
| 158 | + {error && <Typography color="error">{error}</Typography>} |
| 159 | + {itemId === undefined ? ( |
| 160 | + <Field name="itemId" label="Item ID" component={TextField} fullWidth /> |
| 161 | + ) : null} |
| 162 | + <FormSection name="queryParams" component={queryParams} /> |
| 163 | + <button type="submit" hidden /> |
| 164 | + </form> |
| 165 | + ); |
| 166 | +} |
| 167 | + |
| 168 | +export default reduxForm()(ItemSubclipCreateForm); |
0 commit comments