diff --git a/SAS/TMSS/frontend/tmss_webapp/package.json b/SAS/TMSS/frontend/tmss_webapp/package.json index b7d1efb39638f0935f7e61338e88b9ac08b34783..41a95ba47c18c1fed93dadfcf8949dfc9b4e39d9 100644 --- a/SAS/TMSS/frontend/tmss_webapp/package.json +++ b/SAS/TMSS/frontend/tmss_webapp/package.json @@ -45,7 +45,7 @@ "test": "react-scripts test", "eject": "react-scripts eject" }, - "proxy": "http://192.168.99.100:8008/", + "proxy": "http://127.0.0.1:8008/", "eslintConfig": { "extends": "react-app" }, 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 d7bf9118ce0ada33008f03730b02407d38518b88..3aca66a0102aa972d67ad91db6cd66aabee01ff5 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js @@ -37,27 +37,33 @@ class SchedulingUnitList extends Component{ } } - componentDidMount(){ + async getSchedulingUnitList () { + const bluePrint = await ScheduleService.getSchedulingUnitBlueprint(); ScheduleService.getSchedulingUnitDraft().then(scheduleunit =>{ var scheduleunits = scheduleunit.data.results; for( const scheduleunit of scheduleunits){ - scheduleunit['actionpath']='/schedulingunit/view' + const blueprintdata = bluePrint.data.results.find(i => i.draft_id === scheduleunit.id); + scheduleunit['actionpath']='/schedulingunit/view'; + scheduleunit['start_time'] = blueprintdata.start_time; + scheduleunit['stop_time'] = blueprintdata.stop_time; } this.setState({ - scheduleunit : scheduleunit.data ,isLoading: false + scheduleunit : scheduleunit.data ,isLoading:false }); }) } + componentDidMount(){ + this.getSchedulingUnitList(); + } + render(){ if (this.state.isLoading) { return <AppLoader/> } return( <> - - { - + { /* * Call View table to show table data, the parameters are, data - Pass API data @@ -68,7 +74,7 @@ class SchedulingUnitList extends Component{ paths - specify the path for navigation - Table will set "id" value for each row in action button */} - {this.state.scheduleunit.results && + {this.state.scheduleunit.results && <ViewTable data={this.state.scheduleunit.results} defaultcolumns={this.state.defaultcolumns} @@ -85,4 +91,4 @@ class SchedulingUnitList extends Component{ } } -export default SchedulingUnitList \ No newline at end of file +export default SchedulingUnitList 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 cda5342a5c616ea178c7a7ed0d8a7508236daeed..602c36a0245c964d3312ffe472c88894e183d033 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js @@ -14,6 +14,16 @@ const ScheduleService = { }); return res; }, + getSchedulingUnitBlueprint: async function (){ + let res = []; + await axios.get('/api/scheduling_unit_blueprint/?ordering=id') + .then(response => { + res= response; + }).catch(function(error) { + console.error('[schedule.services.getSchedulingUnitBlueprint]',error); + }); + return res; + }, getSchedulingUnitDraftById: async function (id){ let res = []; await axios.get('/api/scheduling_unit_draft/'+id)