Skip to content
Snippets Groups Projects
Commit fb23135d authored by Nithya's avatar Nithya
Browse files
TMSS-268 changes reverted
parent 49650fe1
No related branches found
No related tags found
1 merge request!191Resolve TMSS-243
...@@ -37,33 +37,29 @@ class SchedulingUnitList extends Component{ ...@@ -37,33 +37,29 @@ class SchedulingUnitList extends Component{
} }
} }
async getSchedulingUnitList () { componentDidMount(){
const bluePrint = await ScheduleService.getSchedulingUnitBlueprint();
ScheduleService.getSchedulingUnitDraft().then(scheduleunit =>{ ScheduleService.getSchedulingUnitDraft().then(scheduleunit =>{
console.log(scheduleunit)
var scheduleunits = scheduleunit.data.results; var scheduleunits = scheduleunit.data.results;
for( const scheduleunit of scheduleunits){ for( const scheduleunit of scheduleunits){
const blueprintdata = bluePrint.data.results.find(i => i.draft_id === scheduleunit.id); scheduleunit['actionpath']='/schedulingunit/view'
scheduleunit['actionpath']='/schedulingunit/view';
scheduleunit['start_time'] = blueprintdata.start_time;
scheduleunit['stop_time'] = blueprintdata.stop_time;
} }
this.setState({ this.setState({
scheduleunit : scheduleunit.data ,isLoading:false scheduleunit : scheduleunit.data ,isLoading: false
}); });
}) })
} }
componentDidMount(){
this.getSchedulingUnitList();
}
render(){ render(){
if (this.state.isLoading) { if (this.state.isLoading) {
return <AppLoader/> return <AppLoader/>
} }
return( return(
<> <>
{
{
/* /*
* Call View table to show table data, the parameters are, * Call View table to show table data, the parameters are,
data - Pass API data data - Pass API data
...@@ -74,7 +70,7 @@ class SchedulingUnitList extends Component{ ...@@ -74,7 +70,7 @@ class SchedulingUnitList extends Component{
paths - specify the path for navigation - Table will set "id" value for each row in action button 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 <ViewTable
data={this.state.scheduleunit.results} data={this.state.scheduleunit.results}
defaultcolumns={this.state.defaultcolumns} defaultcolumns={this.state.defaultcolumns}
......
...@@ -14,16 +14,6 @@ const ScheduleService = { ...@@ -14,16 +14,6 @@ const ScheduleService = {
}); });
return res; 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){ getSchedulingUnitDraftById: async function (id){
let res = []; let res = [];
await axios.get('/api/scheduling_unit_draft/'+id) await axios.get('/api/scheduling_unit_draft/'+id)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment