diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js index fd65009e41f485cade1501afbc89120ad08f6826..856a20144bc9740ccc577dcb7746bed5d51ece78 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js @@ -198,6 +198,10 @@ class SchedulingUnitList extends Component{ this.checkAndCreateSUB = this.checkAndCreateSUB.bind(this); this.setTableReloadFunction = this.setTableReloadFunction.bind(this); this.setTableState = this.setTableState.bind(this); + this.updateAutoDeletion = this.updateAutoDeletion.bind(this); + this.confirmAutoDeletion = this.confirmAutoDeletion.bind(this); + this.setAutoDeletion = this.setAutoDeletion.bind(this); + this.getAutoDeletionDialogContent = this.getAutoDeletionDialogContent.bind(this); } /** @@ -625,7 +629,7 @@ class SchedulingUnitList extends Component{ /** * Funtion to update the draft with newly created blueprint data. This function can be called from the implementing component. */ - reloadData() { + reloadData() { this.pageUpdated = true; this.setState({isLoading: true}); this.getSchedulingUnitList(true, this.state.suType, this.filterQry, this.orderBy, this.limit, this.offset); @@ -766,7 +770,7 @@ class SchedulingUnitList extends Component{ /** * Prepare Scheduling Unit(s) details to show status of deletion */ - getSUDeleteStatusContent() { + getSUDeleteStatusContent() { let schedulingUnits = this.deletableDraftWithBlueprint; return <> <DataTable value={schedulingUnits} resizableColumns columnResizeMode="expand" className="card" style={{ paddingLeft: '0em' }}> @@ -812,7 +816,7 @@ class SchedulingUnitList extends Component{ /** * Prepare Scheduling Unit(s) details to show on confirmation dialog before cancelling */ - getSUCancelConfirmContent() { + getSUCancelConfirmContent() { let selectedSUs = [], ignoredSUs = []; for (const obj of this.selectedRows) { if (obj.type === "Blueprint" && this.SU_END_STATUSES.indexOf(obj.status) < 0) { @@ -1203,7 +1207,7 @@ class SchedulingUnitList extends Component{ /** * Function to create clean-up task for each selected SU blueprint */ - async createSUCleanupTask() { + async createSUCleanupTask() { this.setState({dialogVisible: false}); this.successSchedulingUnits = []; this.failedSchedulingUnits = []; @@ -1273,6 +1277,104 @@ class SchedulingUnitList extends Component{ } } + /** + * @returns Prepare dialog content for confirmation Automatic Deletion + */ + getAutoDeletionDialogContent() { + const unPinnedSUList = _.filter(this.selectedRows, (schedulingUnit) => { return schedulingUnit.output_pinned === false}); + const pinnedSUList = _.filter(this.selectedRows, (schedulingUnit) => { return schedulingUnit.output_pinned === true}); + return <> + {unPinnedSUList.length > 0 && + <div style={{marginTop: '1em'}}> + <b>Scheduling Unit(s) that will prevent automatic deletion</b> + <DataTable value={unPinnedSUList} resizableColumns columnResizeMode="expand" className="card" style={{paddingLeft: '0em'}}> + <Column field="id" header="Id"></Column> + <Column field="name" header="Name"></Column> + </DataTable> + </div> + } + {pinnedSUList.length > 0 && + <div style={{marginTop: '1em'}}> + <b>Scheduling Unit(s) that will allow automatic deletion</b> + <DataTable value={pinnedSUList} resizableColumns columnResizeMode="expand" className="card" style={{paddingLeft: '0em'}}> + <Column field="id" header="Id"></Column> + <Column field="name" header="Name"></Column> + </DataTable> + </div> + } + </> + } + + /** + * Confirm to Prevent/Allow Automatic Deletion for selected SU draft(s)/blueprint(s) + */ + async confirmAutoDeletion() { + if (this.selectedRows.length > 0) { + let dialog = this.state.dialog; + dialog.type = "confirmation"; + dialog.header= "Confirm Automatic Deletion"; + dialog.detail = "Do you want to Prevent/Allow Automatic Deletion of dataproducts for selected Scheduling Units?"; + dialog.content = this.getAutoDeletionDialogContent; + dialog.actions = [{id: 'yes', title: 'Yes', callback: this.setAutoDeletion, className:(this.props.project)?"dialog-btn": ""}, + {id: 'no', title: 'No', callback: this.closeDialog, className:(this.props.project)?"dialog-btn": ""}]; + dialog.onSubmit = this.setAutoDeletion; + dialog.width = '55vw'; + dialog.showIcon = false; + this.setState({dialog: dialog, dialogVisible: true}); + } else { + appGrowl.show({severity: 'info', summary: 'Select Row', detail: 'Please select one or more Scheduling Unit(s)'}); + } + } + + /** + * Prevent/Allow automatic deletion for selected SU(s) + */ + async setAutoDeletion(){ + this.successSchedulingUnits = []; + this.failedSchedulingUnits = []; + const unPinnedSUList = _.filter(this.selectedRows, (schedulingUnit) => { return schedulingUnit.output_pinned === false}); + const pinnedSUList = _.filter(this.selectedRows, (schedulingUnit) => { return schedulingUnit.output_pinned === true}); + this.successSchedulingUnits = await this.updateAutoDeletion(unPinnedSUList); + this.failedSchedulingUnits = await this.updateAutoDeletion(pinnedSUList); + this.tableReloadFunction(this.tableState); + let dialog = this.state.dialog; + dialog.type = "success"; + dialog.header= "Prevent / Allow Automatic Deletion Status"; + dialog.detail = ""; + dialog.content = this.getStatusContent; + dialog.actions = [{id: 'no', title: 'Close', callback: this.closeDialog, className:(this.props.project)?"dialog-btn": ""}]; + dialog.onSubmit = this.closeDialog; + dialog.width = '55vw'; + dialog.showIcon = false; + this.setState({dialog: dialog, dialogVisible: true}); + } + + /** + * Call service to set automatic deletion + * @param {Array} suList : - selected scheduling unit list + * @returns + */ + async updateAutoDeletion(suList) { + let result = []; + for(const scheduleunit of suList) { + scheduleunit['output_pinned'] = !scheduleunit.output_pinned; + delete scheduleunit['priority_queue']; + delete scheduleunit['task_blueprints']; + delete scheduleunit['draft']; + let resSu = await ScheduleService.updateSchedulingUnit(this.state.suType.toLowerCase(), scheduleunit); + if (resSu) { + scheduleunit['status']= 'Success'; + } else { + scheduleunit['status']= 'Failed'; + appGrowl.show({ severity: 'error', summary: 'Failed', detail: '[SU Name : '+scheduleunit.name+'] - Unable to update the Automatic Deletion state.' }); + } + scheduleunit['suId'] = scheduleunit.id; + scheduleunit['suName'] = scheduleunit.name; + result.push(scheduleunit); + }; + return result; + } + render(){ if (this.state.isLoading) { return <AppLoader/> @@ -1309,8 +1411,9 @@ class SchedulingUnitList extends Component{ <div className="delete-option"> <div > <span className="p-float-label"> - {this.state.scheduleunit && this.state.scheduleunit.length > 0 && <> + {this.state.scheduleunit && this.state.scheduleunit.length > 0 && + <> {this.state.suType === 'Draft' && <> <a href="#" style={{marginLeft: "5px"}} onClick={this.checkAndCreateSUB} @@ -1331,6 +1434,10 @@ class SchedulingUnitList extends Component{ </a> </> } + <a href="#" style={{marginLeft: "5px"}} onClick={this.confirmAutoDeletion} + title="Prevent/Allow Automatic Deletion"> + <i class="fa fa-thumbtack" aria-hidden="true" ></i> + </a> <a href="#" style={{marginLeft: "5px"}} onClick={this.confirmCopyingSU} title="Copy Scheduling Unit(s) Draft/Blueprint" > <i class="fa fa-copy"></i> @@ -1339,7 +1446,9 @@ class SchedulingUnitList extends Component{ title="Delete selected Scheduling Unit(s)"> <i class="fa fa-trash" aria-hidden="true" ></i> </a> - {this.props.project && + </> + } + {this.props.project && <> <Link style={{marginLeft: "5px"}} to={`${this.props.project?"/project/"+this.props.project:""}/schedulingunit/create`} title="Add New Scheduling Unit to this Project" > @@ -1350,7 +1459,6 @@ class SchedulingUnitList extends Component{ </> } </> - } </span> </div> </div> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js index b4599c1ec921292a187eaf60b0f3a49e737772c4..6da2f11b50910b2f79a9b57ac7c67569dacc12cb 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js @@ -188,6 +188,7 @@ class ViewSchedulingUnit extends Component { this.showTaskRelationDialog = this.showTaskRelationDialog.bind(this); this.showDeleteSUConfirmation = this.showDeleteSUConfirmation.bind(this); this.showCancelSUConfirmation = this.showCancelSUConfirmation.bind(this); + this.setAutoDeletion = this.setAutoDeletion.bind(this); this.cancelSchedulingUnit = this.cancelSchedulingUnit.bind(this); this.cancelTasks = this.cancelTasks.bind(this); this.getStatusContent = this.getStatusContent.bind(this); @@ -195,6 +196,7 @@ class ViewSchedulingUnit extends Component { this.createSUCleanupTask = this.createSUCleanupTask.bind(this); this.getCleanUpDialogContent = this.getCleanUpDialogContent.bind(this); this.cleanUpSUTask = this.cleanUpSUTask.bind(this); + this.confirmAutoDeletion = this.confirmAutoDeletion.bind(this); } componentDidUpdate(prevProps, prevState) { @@ -334,7 +336,7 @@ class ViewSchedulingUnit extends Component { this.actions.unshift({ icon: 'fa-copy', title: 'Copy Draft/Blueprint', type: 'button', actOn: 'click', props: { callback: this.confirmCopyingSU }, - }); + }); let canDelete = (this.state.scheduleunit && (!this.state.scheduleunit.scheduling_unit_blueprints_ids || this.state.scheduleunit.scheduling_unit_blueprints_ids.length === 0)); this.actions.push({ @@ -342,8 +344,8 @@ class ViewSchedulingUnit extends Component { type: 'button', disabled: !canDelete, actOn: 'click', props: { callback: this.showDeleteSUConfirmation } }); this.actions.push({ icon: 'fa-window-close', title: 'Click to Close Scheduling Unit View', link: this.props.history.goBack }); - if (this.props.match.params.type ==='draft') { - let blueprintExist = this.state.scheduleunit.scheduling_unit_blueprints && this.state.scheduleunit.scheduling_unit_blueprints.length>0; + if (this.props.match.params.type ==='draft') { + let blueprintExist = this.state.scheduleunit && this.state.scheduleunit.scheduling_unit_blueprints && this.state.scheduleunit.scheduling_unit_blueprints.length>0; if(isIngestPresent) { this.actions.unshift({ icon: 'fa-file-import', title: 'Data Products To Ingest', type: 'button', @@ -358,6 +360,10 @@ class ViewSchedulingUnit extends Component { actOn: 'click', disabled: blueprintExist, props: { callback: this.checkAndCreateBlueprint }, }); } else { + this.actions.unshift({ + icon: 'fa-thumbtack', title: this.state.scheduleunit.output_pinned? 'Allow Automatic Deletion' : 'Prevent Automatic Deletion', + type: 'button', actOn: 'click', props: { callback: this.confirmAutoDeletion } + }); if(isIngestPresent) { this.actions.unshift({ icon: 'fa-file-import', title: 'Data Products To Ingest', type: 'button', @@ -376,7 +382,7 @@ class ViewSchedulingUnit extends Component { actOn: 'click', props: { callback: this.cleanUpSUTask } }); this.actions.unshift({ icon: 'fa-sitemap', title: 'View Workflow', props: { pathname: `/schedulingunit/${this.props.match.params.id}/workflow` } }); - this.actions.unshift({ icon: 'fa-lock', title: 'Cannot edit blueprint' }); + this.actions.unshift({ icon: 'fa-lock', title: 'Cannot edit blueprint' }); } this.setState({ actions: this.actions }); } @@ -703,6 +709,7 @@ class ViewSchedulingUnit extends Component { this.setState({ dialog: dialog, dialogVisible: true }); } + /** * Show confirmation dialog before cancelling the scheduling unit. */ @@ -1176,6 +1183,46 @@ class ViewSchedulingUnit extends Component { </> } + /** + * Confirm Autodeletion before update the value + */ + confirmAutoDeletion() { + let dialog = this.state.dialog; + dialog.type = "confirmation"; + dialog.header= "Confirm Automatic Deletion"; + dialog.detail = this.state.scheduleunit.output_pinned ? 'Do you want to allow automatic deletion of dataproducts?' : 'Do you want to prevent automatic deletion of dataproducts?'; + dialog.content = ''; + dialog.actions = [{id: 'yes', title: 'Yes', callback: this.setAutoDeletion}, + {id: 'no', title: 'No', callback: this.closeDialog}]; + dialog.onSubmit = this.setAutoDeletion; + dialog.width = '35vw'; + dialog.showIcon = false; + this.setState({dialog: dialog, dialogVisible: true}); + } + + /** + * Enable/Disable autodeletion in the scheduling unit + */ + async setAutoDeletion() { + let resSU = this.state.scheduleunit; + resSU['output_pinned'] = !this.state.scheduleunit.output_pinned; + delete resSU['task_blueprints']; + delete resSU['task_drafts']; + resSU = await ScheduleService.updateSchedulingUnit(this.props.match.params.type, resSU); + if (resSU) { + appGrowl.show({ severity: 'success', summary: 'Success', detail: 'Prevent Automatic Deletion updated successfully' }); + let tmpSu = this.state.scheduleunit; + tmpSu['output_pinned'] = resSU.output_pinned; + var index = _.indexOf(this.actions, _.find(this.actions, {'icon' :'fa-thumbtack'})); + this.actions.splice(index, 1, { icon: 'fa-thumbtack', title: this.state.scheduleunit.output_pinned? 'Allow Automatic Deletion' : 'Prevent Automatic Deletion', + type: 'button', actOn: 'click', props: { callback: this.confirmAutoDeletion } }); + this.setState({scheduleunit: tmpSu, actions: this.actions, dialogVisible: false}); + } else { + appGrowl.show({ severity: 'error', summary: 'Failed', detail: 'Unable to update Automatic Deletion' }); + this.setState({dialogVisible: false}); + } + } + render() { if (this.state.redirect) { return <Redirect to={{ pathname: this.state.redirect }}></Redirect> @@ -1253,6 +1300,8 @@ class ViewSchedulingUnit extends Component { <div className="p-grid"> <label className="col-lg-2 col-md-2 col-sm-12">Tags</label> <Chips className="p-col-4 chips-readonly" disabled value={this.state.scheduleunit.tags}></Chips> + <label className="col-lg-2 col-md-2 col-sm-12">Prevent Automatic Deletion</label> + <span className="col-lg-4 col-md-4 col-sm-12"> <i className={this.state.scheduleunit.output_pinned?'fa fa-check-circle':'fa fa-times-circle'}></i> </span> </div> </div> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js index 7c92a01d419a975fdb45983fa4e43b7309aa3d90..f71d9c67ae576a8a4670b29e8f39216f25818554 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js @@ -4,6 +4,8 @@ import _ from 'lodash'; import $RefParser from "@apidevtools/json-schema-ref-parser"; import moment from 'moment'; import { publish } from '../../App'; + +import { Checkbox } from 'primereact/checkbox'; import { InputText } from 'primereact/inputtext'; import { InputTextarea } from 'primereact/inputtextarea'; import { Dropdown } from 'primereact/dropdown'; @@ -118,7 +120,13 @@ export class SchedulingUnitCreate extends Component { if (this.state.schedulingUnit.project) { const selectedProject = _.filter(this.projects, {'name': this.state.schedulingUnit.project}); const projectSchedSets = _.filter(this.schedulingSets, {'project_id': this.state.schedulingUnit.project}); - this.setState({isLoading: false, schedulingSets: projectSchedSets,selectedProject:selectedProject}); + let tmpSU = this.state.schedulingUnit; + tmpSU['output_pinned'] = selectedProject[0].auto_pin; + this.setState({isLoading: false, + schedulingSets: projectSchedSets, + selectedProject:selectedProject, + schedulingUnit:tmpSU + }); } else { this.setState({isLoading: false}); } @@ -135,6 +143,7 @@ export class SchedulingUnitCreate extends Component { schedulingUnit.project = projectName; schedulingUnit.scheduling_set_id = null; const selectedProject = _.filter(this.projects, {'name': projectName}); + schedulingUnit['output_pinned'] = selectedProject[0].auto_pin; this.setState({selectedProject: selectedProject, schedulingUnit: schedulingUnit, schedulingSets: projectSchedSets, validForm: this.validateForm('project'), isDirty: true}); publish('edit-dirty', true); } @@ -399,7 +408,7 @@ export class SchedulingUnitCreate extends Component { } const const_strategy = {scheduling_constraints_doc: constStrategy, id: this.constraintTemplates[0].id, constraint: this.constraintTemplates[0]}; let schedulingUnit = this.state.schedulingUnit; - schedulingUnit.priority_rank = schedulingUnit.priority_rank === '' ? 0: schedulingUnit.priority_rank.toFixed(4); + schedulingUnit.priority_rank = schedulingUnit.priority_rank === undefined || schedulingUnit.priority_rank === '' ? 0: schedulingUnit.priority_rank.toFixed(4); schedulingUnit = await ScheduleService.saveSUDraftFromObservStrategy(observStrategy, schedulingUnit, const_strategy, station_groups); if (!schedulingUnit.error) { // this.growl.show({severity: 'success', summary: 'Success', detail: 'Scheduling Unit and tasks created successfully!'}); @@ -459,6 +468,7 @@ export class SchedulingUnitCreate extends Component { description: '', project: this.props.match.params.project || null, scheduling_constraints_template_id: this.constraintTemplates[0].id, + priority_rank: '', }, projectDisabled: (this.props.match.params.project? true:false), observStrategy: {}, @@ -667,7 +677,17 @@ export class SchedulingUnitCreate extends Component { { this.state.observStrategy ? this.state.observStrategy.description : ""} </label> </div> - <div className="col-lg-1 col-md-1 col-sm-12"></div> + <div className="col-lg-1 col-md-1 col-sm-12"></div> + <label htmlFor="autodeletion" className="col-lg-2 col-md-2 col-sm-12">Prevent Automatic Deletion</label> + <div className="col-lg-3 col-md-3 col-sm-12" data-testid="autodeletion" > + <Checkbox inputId="trigger" role="trigger" + tooltip="Select to Prevent or Unselect to Allow Automatic Deletion of Dataproducts" + tooltipOptions={this.tooltipOptions} + checked={this.state.schedulingUnit.output_pinned} + onChange={(e) => this.setSchedUnitParams('output_pinned', e.target.checked)} + ></Checkbox> + </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" @@ -679,6 +699,7 @@ export class SchedulingUnitCreate extends Component { placeholder="Select Constraints Template"/> </div> + */} </div> <Stations stationGroup={this.state.stationGroup} diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js index c22215f9550f3c4e33713e5e9ac00e5ddb089214..8aac693a65c3ee17558a2b36c761b9373c2a1e0b 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js @@ -4,8 +4,9 @@ import moment from 'moment'; import _ from 'lodash'; import $RefParser from "@apidevtools/json-schema-ref-parser"; +import { Checkbox } from 'primereact/checkbox'; import { InputText } from 'primereact/inputtext'; -import { InputNumber } from 'primereact/inputnumber'; +//import { InputNumber } from 'primereact/inputnumber'; import { InputTextarea } from 'primereact/inputtextarea'; import { Dropdown } from 'primereact/dropdown'; import { Button } from 'primereact/button'; @@ -586,6 +587,16 @@ export class EditSchedulingUnit extends Component { </> } <div className="col-lg-1 col-md-1 col-sm-12"></div> + <label htmlFor="project" className="col-lg-2 col-md-2 col-sm-12">Prevent Automatic Deletion</label> + <div className="col-lg-3 col-md-3 col-sm-12" data-testid="project" > + <Checkbox inputId="trigger" role="trigger" + tooltip="Select to Prevent or Unselect to Allow Automatic Deletion of Dataproducts" + tooltipOptions={this.tooltipOptions} + checked={this.state.schedulingUnit.output_pinned} + onChange={(e) => this.setSchedUnitParams('output_pinned', e.target.checked)} + ></Checkbox> + </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" @@ -596,7 +607,7 @@ export class EditSchedulingUnit extends Component { //onChange={(e) => { this.constraintStrategy(e);}} placeholder="Select Constraints Template"/> - </div> + </div> */} </div> </div> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js index 5d0087ad5b9653a96065abece23d64103b2dec9b..6fb9c245967251bc7d9126d77f5e1968a0dbbb73 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js @@ -1888,6 +1888,7 @@ export class SchedulingSetCreate extends Component { newSU = _.find(this.state.schedulingUnitList, {'id': suRow.id}); newSU['name'] = suRow.suname; newSU['description'] = suRow.sudesc; + newSU['output_pinned'] = this.state.selectedProject[0].auto_pin; newSU['priority_rank'] = suRow.priority_rank && suRow.priority_rank.length>0? _.round(parseFloat(suRow.priority_rank), 4):suRow.priority_rank; if (suRow.priority_queue ) { newSU['priority_queue'] = suRow.priority_queue; @@ -1917,7 +1918,8 @@ export class SchedulingSetCreate extends Component { priority_rank: suRow.priority_rank && suRow.priority_rank.length > 0 ? _.round(parseFloat(suRow.priority_rank), 4) : suRow.priority_rank, priority_queue: suRow.priority_queue, scheduling_constraints_template_id: newSU['scheduling_constraints_template_id'], - scheduling_set_id: newSU['scheduling_set_id'] + scheduling_set_id: newSU['scheduling_set_id'], + output_pinned: this.state.selectedProject[0].auto_pin } suUpdateStatus['suName'] = suRow.suname; suUpdateStatus['action'] = 'Create'; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js b/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js index 1c9aa310194676ec6c9656a4655379f770981a4a..8a8d9dffdb406617684b998c7e18a78e27241d20 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js @@ -652,6 +652,7 @@ const ScheduleService = { if (schedulingUnit.priority_queue !== '') { suObsResponse.data.priority_queue = schedulingUnit.priority_queue; } + suObsResponse.data['output_pinned'] = schedulingUnit.output_pinned; schedulingUnit = suObsResponse.data; if (schedulingUnit && schedulingUnit.id) { // Update the newly created SU draft requirement_doc with captured parameter values @@ -1015,7 +1016,18 @@ const ScheduleService = { console.error(error); } return response; - } + }, + updateSchedulingUnit: async function (type, schedulingUnit) { + try { + let url = `/api/scheduling_unit_${type}/${schedulingUnit.id}/`; + const response = await axios.patch(url, schedulingUnit); + return response.data; + } catch (error) { + console.error('[schedule.services.updateSchedulingUnit]',"Mistake", error); + return null + } + }, + } export default ScheduleService;