Skip to content

Commit

Permalink
working
Browse files Browse the repository at this point in the history
  • Loading branch information
jakub-bao committed Sep 14, 2020
1 parent f31c71a commit a3f0926
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/config/serverConfig.dev.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"baseUrl": "https://nr.testing.datim.org/",
"baseUrl": "https://dev.datim.org/",
"sqlViewId": "rQZnEgCAhuI",
"apiVersion": "33"
}
8 changes: 4 additions & 4 deletions src/modules/list/components/list.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class List extends React.Component<

this.workflowPeriodService = new WorkflowPeriodService();
let workflowsPromise = this.workflowPeriodService.init().then((workflows)=>{
let selectedWorkflow = workflows[0].id;
let selectedWorkflow = workflows.length>0 && workflows[0].id;
let periods = this.workflowPeriodService.getPeriods(selectedWorkflow);
this.setState({loading: {filters: false, mechanisms: false}, workflows: workflows, periods: periods, filters:{workflow: selectedWorkflow, period: periods[0].id, ou: this.state.filters.ou}});
this.setState({loading: {filters: false, mechanisms: false}, workflows: workflows, periods: periods, filters:{workflow: selectedWorkflow, period: periods.length>0&&periods[0].id, ou: this.state.filters.ou}});
this.setFilterFromUrl('workflow');
this.setFilterFromUrl('period');
});
Expand Down Expand Up @@ -131,7 +131,7 @@ class List extends React.Component<

renderResults(){
if (this.state.loading.mechanisms) return <Loading message='Loading mechanisms...'/>;
if (!this.state.mechanisms) return null;
if (!this.state.mechanisms) return <Typography color="secondary">No currently active workflows, if you feel this is in error, please contact support</Typography>;
if (this.state.mechanisms.length===0) return <Typography color="secondary">No mechanisms found</Typography>
return <ResultsTabs mechanisms={this.state.mechanisms} onMechanismsSelected={this.onMechanismsSelected} onSwitchTab={this.onSwitchTab}/>;
}
Expand All @@ -140,7 +140,7 @@ class List extends React.Component<
return (
<React.Fragment>
{this.renderFilters()}
<Divider/>
{this.state.filters.workflow && <Divider/>}
<ListAction selectedAction={this.state.selectedAction} selectedMechanisms={this.state.selectedMechanisms} actionUrl={this.getActionUrl()} onMechanismsSelected={this.onMechanismsSelected}/>
{this.renderResults()}
</React.Fragment>
Expand Down
1 change: 1 addition & 0 deletions src/modules/shared/services/workflowsPeriods.service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export default class WorkflowPeriodService {
}

getPeriods(workflowId: string):idNameList{
if (!workflowId) return [];
return this.workflowPeriods.filter(wf =>wf.id===workflowId)[0].periods;
}
getPeriodNameById(workflowId: string, periodId: string):string{
Expand Down

0 comments on commit a3f0926

Please sign in to comment.