From a3f0926bff056345a810ffb0aa1a20254a75355b Mon Sep 17 00:00:00 2001 From: Jakub Date: Mon, 14 Sep 2020 15:10:55 -0400 Subject: [PATCH] working --- src/config/serverConfig.dev.json | 2 +- src/modules/list/components/list.component.tsx | 8 ++++---- src/modules/shared/services/workflowsPeriods.service.tsx | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/config/serverConfig.dev.json b/src/config/serverConfig.dev.json index ab66a52..8efaf40 100644 --- a/src/config/serverConfig.dev.json +++ b/src/config/serverConfig.dev.json @@ -1,5 +1,5 @@ { - "baseUrl": "https://nr.testing.datim.org/", + "baseUrl": "https://dev.datim.org/", "sqlViewId": "rQZnEgCAhuI", "apiVersion": "33" } \ No newline at end of file diff --git a/src/modules/list/components/list.component.tsx b/src/modules/list/components/list.component.tsx index d2caf4d..5186ba9 100644 --- a/src/modules/list/components/list.component.tsx +++ b/src/modules/list/components/list.component.tsx @@ -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'); }); @@ -131,7 +131,7 @@ class List extends React.Component< renderResults(){ if (this.state.loading.mechanisms) return ; - if (!this.state.mechanisms) return null; + if (!this.state.mechanisms) return No currently active workflows, if you feel this is in error, please contact support; if (this.state.mechanisms.length===0) return No mechanisms found return ; } @@ -140,7 +140,7 @@ class List extends React.Component< return ( {this.renderFilters()} - + {this.state.filters.workflow && } {this.renderResults()} diff --git a/src/modules/shared/services/workflowsPeriods.service.tsx b/src/modules/shared/services/workflowsPeriods.service.tsx index c1fde0d..eea6ab5 100644 --- a/src/modules/shared/services/workflowsPeriods.service.tsx +++ b/src/modules/shared/services/workflowsPeriods.service.tsx @@ -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{