Skip to content
Snippets Groups Projects
Commit fba183b9 authored by Reinder Kraaij's avatar Reinder Kraaij :eye:
Browse files

Resolve TMSS-2899 "Front end only save button tweak"

parent 2fd02e1a
Branches
Tags
1 merge request!1308Resolve TMSS-2899 "Front end only save button tweak"
...@@ -1386,7 +1386,7 @@ Jeditor.propTypes = { ...@@ -1386,7 +1386,7 @@ Jeditor.propTypes = {
schema: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.oneOf([null, undefined])]), schema: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.oneOf([null, undefined])]),
bandPassFilter: PropTypes.string, bandPassFilter: PropTypes.string,
id: PropTypes.string, id: PropTypes.string,
resolveExtRef: PropTypes.func, resolveExtRef: PropTypes.bool,
showInGrid: PropTypes.bool, showInGrid: PropTypes.bool,
title: PropTypes.string, title: PropTypes.string,
errorsOn: PropTypes.bool, errorsOn: PropTypes.bool,
......
...@@ -47,6 +47,10 @@ export class SchedulingUnitCreate extends Component { ...@@ -47,6 +47,10 @@ export class SchedulingUnitCreate extends Component {
states: ['active'], states: ['active'],
purpose: [] purpose: []
}, },
constraintValidEditor:false,
validForm:false,
validConstraints:false,
validSpecification:false,
userrole: {}, userrole: {},
selectedProject: {}, selectedProject: {},
showAddSet: false, showAddSet: false,
...@@ -552,9 +556,8 @@ export class SchedulingUnitCreate extends Component { ...@@ -552,9 +556,8 @@ export class SchedulingUnitCreate extends Component {
} }
} }
const updatedErrors = errors.length > 0 ? [...this.state.errors, errors] : this.state.errors const updatedErrors = errors.length > 0 ? [...this.state.errors, errors] : this.state.errors
const updatedValidFields = validFields ? {...this.state.validFields, validFields} : this.state.validFields const updatedValidFields = validFields ? {...this.state.validFields, ...validFields} : this.state.validFields;
this.setState({errors: updatedErrors, validFields: updatedValidFields}); this.setState({errors: updatedErrors, validFields: updatedValidFields});
if (Object.keys(validFields).length === Object.keys(this.formRules).length) { if (Object.keys(validFields).length === Object.keys(this.formRules).length) {
validForm = true; validForm = true;
} }
...@@ -929,6 +932,7 @@ export class SchedulingUnitCreate extends Component { ...@@ -929,6 +932,7 @@ export class SchedulingUnitCreate extends Component {
} }
render() { render() {
let isSaveEnabled = ( this.state.constraintValidEditor && this.state.validEditor && this.state.validForm && this.state.validConstraints && this.state.validSpecification)
if (this.state.redirect) { if (this.state.redirect) {
return <Redirect to={{pathname: this.state.redirect}}></Redirect> return <Redirect to={{pathname: this.state.redirect}}></Redirect>
} }
...@@ -1071,19 +1075,7 @@ export class SchedulingUnitCreate extends Component { ...@@ -1071,19 +1075,7 @@ export class SchedulingUnitCreate extends Component {
onChange={(e) => this.setSchedUnitParams('output_pinned', e.target.checked)} onChange={(e) => this.setSchedUnitParams('output_pinned', e.target.checked)}
></Checkbox> ></Checkbox>
</div> </div>
{/*
<label htmlFor="schedulingConstraintsTemp" className="col-lg-2 col-md-2 col-sm-12 hide">Scheduling Constraints Template</label>
<div className="col-lg-3 col-md-3 col-sm-12 hide" data-testid="schedulingConstraintsTemp">
<Dropdown inputId="schedulingConstraintsTemp" optionLabel="name" optionValue="id"
tooltip="Scheduling Constraints Template to add scheduling constraints to a scheduling unit" tooltipOptions={this.tooltipOptions}
value={this.state.schedulingUnit.scheduling_constraints_template_id}
disabled
options={this.constraintTemplates}
//onChange={(e) => { this.setStrategyConstraint(e);}}
placeholder="Select Constraints Template"/>
</div>
*/}
</div> </div>
{_.keys(this.state.stationGroups).length > 0 && {_.keys(this.state.stationGroups).length > 0 &&
<div className='grouping'> <div className='grouping'>
...@@ -1161,7 +1153,7 @@ export class SchedulingUnitCreate extends Component { ...@@ -1161,7 +1153,7 @@ export class SchedulingUnitCreate extends Component {
tooltip="Select checkbox to create another Scheduling Unit after saving this Scheduling Unit" tooltip="Select checkbox to create another Scheduling Unit after saving this Scheduling Unit"
submitTitle={(!this.state.constraintValidEditor || !this.state.validEditor || !this.state.validForm || !this.state.validConstraints || !this.state.validSpecification) ? "" : "Save Scheduling Unit"} submitTitle={(!this.state.constraintValidEditor || !this.state.validEditor || !this.state.validForm || !this.state.validConstraints || !this.state.validSpecification) ? "" : "Save Scheduling Unit"}
onSubmit={this.saveSchedulingUnit} onSubmit={this.saveSchedulingUnit}
disableSaveBtn={!this.state.constraintValidEditor || !this.state.validEditor || !this.state.validForm || !this.state.validConstraints || !this.state.validSpecification} disableSaveBtn={!isSaveEnabled}
onCancel={this.checkIsDirty}/> onCancel={this.checkIsDirty}/>
</div> </div>
<ReactTooltip id="reacttooltip" place={'left'} type={'dark'} effect={'solid'} multiline={true}/> <ReactTooltip id="reacttooltip" place={'left'} type={'dark'} effect={'solid'} multiline={true}/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment