diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js b/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js index d3ac0821b5743d229549da4d40174cc1a96a4972..ed11da3abf7e60fdf327ff8cea9693e69c449231 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js @@ -312,25 +312,48 @@ function BooleanColumnFilter({ // This is a custom filter UI that uses a // calendar to set the value function CalendarColumnFilter({ - column: { setFilter, filterValue }, + column: { setFilter, filterValue, Header }, }) { // Calculate the min and max // using the preFilteredRows const [value, setValue] = useState(''); + const [filtered, setFiltered] = useState(false); React.useEffect(() => { if (!filterValue && value) { setValue(null); } }, [filterValue, value]); + // Function to call the server side filtering + const callServerFilter = (event, isCleared) => { + if (isCleared) { + if (filtered) { + _.remove(tableOptionsState.filters, function(filter) { return filter.id === Header }); + filterCallback(tableOptionsState); + } + } else { + filterCallback(tableOptionsState); + } +}; return ( <div className="table-filter" onClick={e => { e.stopPropagation() }}> - <Calendar value={filterValue} appendTo={document.body} dateFormat="yy-mm-dd" onChange={(e) => { + <Calendar value={filterValue} appendTo={document.body} dateFormat="yy-mm-dd" + onChange={(e) => { const value = moment(e.value).format('YYYY-MM-DD') setValue(value); setFilter(e.value); - }} showIcon></Calendar> - {value && <i onClick={() => { setFilter(undefined); setValue('') }} className="tb-cal-reset fa fa-times" />} + if (value !== 'Invalid date' && doServersideFilter) { + setFiltered(true); + callServerFilter(e); + } + }} + showIcon></Calendar> + {value && <i onClick={(e) => { setFilter(undefined); setValue(''); setFiltered(false); + if (doServersideFilter) { + setFilter(undefined); + setValue(''); + callServerFilter(e, true); + } }} className="tb-cal-reset fa fa-times" />} </div> ) } @@ -338,26 +361,58 @@ function CalendarColumnFilter({ // This is a custom filter UI that uses a // calendar to set the value function DateTimeColumnFilter({ - column: { setFilter, filterValue }, + column: { setFilter, filterValue, Header }, }) { const [value, setValue] = useState(''); + const [filtered, setFiltered] = useState(false); React.useEffect(() => { if (!filterValue && value) { setValue(null); } }, [filterValue, value]); + + // Function to call the server side filtering + const callServerFilter = (event, isCleared) => { + if (isCleared) { + if (filtered) { + _.remove(tableOptionsState.filters, function(filter) { return filter.id === Header }); + filterCallback(tableOptionsState); + } + } else { + filterCallback(tableOptionsState); + } + }; return ( <div className="table-filter" onClick={e => { e.stopPropagation() }}> - <Calendar value={value} appendTo={document.body} dateFormat="yy/mm/dd" onChange={(e) => { + <Calendar value={value} appendTo={document.body} dateFormat="yy/mm/dd" + onKeyUp={(e) => { + if (e.key === "Enter" && doServersideFilter) { + setFiltered(true); + callServerFilter(e); + } + }} + onChange={(e) => { const value = moment(e.value, moment.ISO_8601).format('YYYY-MM-DD HH:mm:ss') setValue(value); setFilter(value); - }} showIcon + if (value !== 'Invalid date' && doServersideFilter) { + setFiltered(true); + callServerFilter(e); + } + }} + showIcon // showTime= {true} //showSeconds= {true} // hourFormat= "24" ></Calendar> - {value && <i onClick={() => { setFilter(undefined); setValue('') }} className="tb-cal-reset fa fa-times" />} + {value && <i onClick={(e) => { + setFiltered(false); setFilter(undefined); setValue(''); + if (doServersideFilter) { + setFilter(undefined); + setValue(''); + callServerFilter(e, true); + } + }} className="tb-cal-reset fa fa-times" />} </div> ) } @@ -765,7 +820,7 @@ function Table(props) { }, manualPagination: true, manualSortBy: true, - manualFilters: true, + manualFilters: doServersideFilter, //autoResetPage: false, //autoResetSortBy: false, pageCount: controlledPageCount, @@ -848,7 +903,7 @@ function Table(props) { const onColumnToggleViewTable = (selectedColumn, sortedColumn) => { let visibleColumn = {}; let viewColumn = {}; - if (selectedColumn.Header === sortedColumn.Header && !selectedColumn.isVisible) { + if (selectedColumn && selectedColumn.Header === sortedColumn.Header && !selectedColumn.isVisible) { visibleColumn = getFirstVisibleColumn(selectedColumn, allColumns); viewColumn = { Header: visibleColumn.Header, desc: checkDescendingColumnExists(visibleColumn.Header.toLowerCase())}; let tempdefaultSortColumn = [{ id: viewColumn.Header, desc: viewColumn.desc }]; @@ -1253,8 +1308,6 @@ function ViewTable(props) { const fetchData = React.useCallback( ({ state }) => { loadServerData(state); - // We'll even set a delay to simulate a server here - }, []); const loadServerData = (state) => { @@ -1263,10 +1316,10 @@ function ViewTable(props) { if(props.callBackFunction) { const promises = [props.callBackFunction(state)]; Promise.all(promises).then(async responses => { - tbldata = responses[0]; + tbldata = responses[0][0]; if (tbldata) { setData(tbldata); - setPageCount(Math.ceil(props.totalPage)); + setPageCount(Math.ceil(responses[0][1])); setLoading(false); } }); 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 6880ad5a51ac3237dd2cc89c500c4d18426c997f..dce8d08f067f5e0ec430d2d600074e8d5be1e353 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js @@ -70,34 +70,31 @@ class SchedulingUnitList extends Component{ columnOrders: [ "Status", "Type", - // "Workflow Status", - "workflowStatus", - "suid", - "linked_bp_draft", + "Workflow Status", + "Scheduling Unit ID", + "Linked Blueprint/ Draft ID", "Template ID", - "template_description", - "priority", + "Template Description", + "Priority", "Project", - "suSet", + "Scheduling set", "Name", - "description", + "Description", "Start Time", "End time", "Duration (HH:mm:ss)", - "station_group", - "task_content", - "target_observation_sap", - "target0angle1", - "target0angle2", - // "Target 1 - Reference Frame", - "target0referenceframe", - "target1angle1", - "target1angle2", - // "Target 2 - Reference Frame", - "target1referenceframe", + "Stations (CS/RS/IS)", + "Tasks content (O/P/I)", + "Number of SAPs in the target observation", + "Target 1 - Angle 1", + "Target 1 - Angle 2", + "Target 1 - Reference Frame", + "Target 2 - Angle 1", + "Target 2 - Angle 2", + "Target 2 - Reference Frame", "Cancelled", - "created_at", - "updated_at", + "Created_At", + "Updated_At" ], scheduleunit: [], paths: [{ @@ -142,7 +139,9 @@ class SchedulingUnitList extends Component{ "workflowStatus":"filter-input-100", "Stations (CS/RS/IS)":"filter-input-50", "Tasks content (O/P/I)":"filter-input-50", - "Number of SAPs in the target observation":"filter-input-50" + "Number of SAPs in the target observation":"filter-input-50", + "Start Time":"filter-input-150", + "End time":"filter-input-150", }], defaultSortColumn: [{id: "Name", desc: false}], dialog: {header: 'Confirm', detail: 'Do you want to create a Scheduling Unit Blueprint?'}, @@ -159,7 +158,6 @@ class SchedulingUnitList extends Component{ this.limit = 10; this.offset = 0; - this.checkAndDeleteSchedulingUnit = this.checkAndDeleteSchedulingUnit.bind(this); this.deleteSchedulingUnit = this.deleteSchedulingUnit.bind(this); this.getSchedulingDialogContent = this.getSchedulingDialogContent.bind(this); @@ -168,7 +166,7 @@ class SchedulingUnitList extends Component{ this.reloadData = this.reloadData.bind(this); this.addTargetColumns = this.addTargetColumns.bind(this); this.fetchTableData = this.fetchTableData.bind(this); - this.changeScheduleUnitType = this.changeScheduleUnitType.bind(this); + this.changeSUType = this.changeSUType.bind(this); } /** @@ -261,7 +259,7 @@ class SchedulingUnitList extends Component{ } getAPIFilter(suFilters, columnDef) { - let filterMap = UIConstants.filterMap; + // let filterMap = UIConstants.FILTER_MAP; let defaultColumsProps = columnDef; const defaultColKeys = Object.keys(columnDef); defaultColKeys.forEach(key => { @@ -272,6 +270,7 @@ class SchedulingUnitList extends Component{ if(key === 'suid') { tempKey = 'id'; + tmpColMap['orgField'] = tempKey; tmpColMap['tmpField'] = 'suid'; } let defaulColumn = defaultColumsProps[key]; @@ -283,8 +282,8 @@ class SchedulingUnitList extends Component{ if(filter) { defaultColumsProps[key]['disableSortBy'] = false; defaultColumsProps[key]['disableFilters'] = false; - if(filterMap[filter.type]) { - defaultColumsProps[key]['filter'] = filterMap[filter.type]; + if(UIConstants.FILTER_MAP[filter.type]) { + defaultColumsProps[key]['filter'] = UIConstants.FILTER_MAP[filter.type]; } } }); @@ -302,123 +301,139 @@ class SchedulingUnitList extends Component{ } - async getSchedulingUnitList (suType, filterQry, orderBy, limit, offset) { - const schedulingSet = await ScheduleService.getSchedulingSets(); - const projects = await ScheduleService.getProjectList(); - const promises = [ - ScheduleService.getSchedulingUnitsExtendedWithFilter(suType.toLowerCase(), filterQry, orderBy, limit, offset), - ScheduleService.getMainGroupStations(), - WorkflowService.getWorkflowProcesses(), - ScheduleService.getObservationStrategies()]; - await Promise.all(promises).then(async responses => { - if(responses[0] && responses[0].data) { - let scheduleunits = responses[0].data.results; - this.mainStationGroups = responses[1]; - let workflowProcesses = responses[2]; - const suTemplates = responses[3]; - const output = []; - // const defaultColumns = this.defaultcolumns; - let optionalColumns = this.state.optionalcolumns[0]; - let columnclassname = this.state.columnclassname[0]; - if ( suType.toLowerCase() === 'Draft'.toLowerCase()) { - for( const scheduleunit of scheduleunits){ - const suSet = schedulingSet.find((suSet) => { return scheduleunit.scheduling_set_id === suSet.id }); - const project = projects.find((project) => { return suSet.project_id === project.name}); - if (!this.props.project || (this.props.project && project.name===this.props.project)) { - scheduleunit['status'] = null; - scheduleunit['workflowStatus'] = null; - const obsStrategyTemplate = _.find(suTemplates, ['id',scheduleunit.observation_strategy_template_id]); - scheduleunit['template_description'] = obsStrategyTemplate.description; - scheduleunit['linked_bp_draft'] = this.getLinksList(scheduleunit.scheduling_unit_blueprints_ids, 'blueprint'); - scheduleunit['task_content'] = this.getTaskTypeGroupCounts(scheduleunit['task_drafts']); - scheduleunit['station_group'] = this.getStationGroup(scheduleunit).counts; - scheduleunit['actionpath']='/schedulingunit/view/draft/'+scheduleunit.id; - scheduleunit['type'] = 'Draft'; - scheduleunit['duration'] = moment.utc((scheduleunit.duration || 0)*1000).format('HH:mm:ss'); - scheduleunit.project = project.name; - scheduleunit.canSelect = true; - scheduleunit.suSet = suSet.name; - scheduleunit.links = ['Project', 'id']; - scheduleunit.linksURL = { - 'Project': `/project/view/${project.name}`, - 'id': `/schedulingunit/view/draft/${scheduleunit.id}` - }; - scheduleunit['suid'] = scheduleunit.id; - output.push(scheduleunit); - } - } - output.map(su => { - su.taskDetails = su.type==="Draft"?su.task_drafts:su.task_blueprints; - const targetObserv = su && su.taskDetails ? su.taskDetails.find(task => task.specifications_template.type_value==='observation' && task.specifications_doc.SAPs) : null; - // Constructing targets in single string to make it clear display - if (targetObserv && targetObserv.specifications_doc) { - targetObserv.specifications_doc.SAPs.map((target, index) => { - su[`target${index}angle1`] = UnitConverter.getAngleInput(target.digital_pointing.angle1); - su[`target${index}angle2`] = UnitConverter.getAngleInput(target.digital_pointing.angle2,true); - su[`target${index}referenceframe`] = target.digital_pointing.direction_type; - optionalColumns[`target${index}angle1`] = `Target ${index + 1} - Angle 1`; - optionalColumns[`target${index}angle2`] = `Target ${index + 1} - Angle 2`; - optionalColumns[`target${index}referenceframe`] = { - name: `Target ${index + 1} - Reference Frame`, - filter: "select" - }; - columnclassname[`Target ${index + 1} - Angle 1`] = "filter-input-75"; - columnclassname[`Target ${index + 1} - Angle 2`] = "filter-input-75"; - return target; - }); - } - return su; - }); - } else { - for( const scheduleunit of scheduleunits){ - const suSet = schedulingSet.find((suSet) => { - return scheduleunit.scheduling_set_id === suSet.id - }); - let project = null; - scheduleunit['suSet'] = ''; - if (suSet) { - scheduleunit.suSet = suSet.name; - project = projects.find((project) => { return suSet.project_id === project.name}); - } - scheduleunit['project'] = ''; - scheduleunit['links'] = ''; - scheduleunit['linksURL'] = ''; - if (!this.props.project || (this.props.project && project && project.name===this.props.project)) { - scheduleunit.project = project?project.name :''; - scheduleunit.links = ['Project', 'id']; - scheduleunit.linksURL = { - 'Project': `/project/view/${project?project.name:''}`, - 'id': `/schedulingunit/view/blueprint/${scheduleunit.id}` - } - } - scheduleunit['status'] = null; - scheduleunit['workflowStatus'] = null; - const obsStrategyTemplate = _.find(suTemplates, ['id',scheduleunit.observation_strategy_template_id]); - const workflowProcess = _.find(workflowProcesses, ['su', scheduleunit.id]); - scheduleunit['workflowStatus'] = workflowProcess?workflowProcess.status: null; - scheduleunit.duration = moment.utc((scheduleunit.duration || 0)*1000).format('HH:mm:ss'); - scheduleunit.type= 'Blueprint'; - scheduleunit['actionpath'] ='/schedulingunit/view/blueprint/'+scheduleunit.id; - scheduleunit['task_content'] = this.getTaskTypeGroupCounts(scheduleunit['task_blueprints']); - scheduleunit['linked_bp_draft'] = this.getLinksList([scheduleunit.draft_id], 'draft'); - scheduleunit['template_description'] = obsStrategyTemplate ? obsStrategyTemplate.description : ''; - scheduleunit['observation_strategy_template_id'] = obsStrategyTemplate? obsStrategyTemplate.id : ''; - scheduleunit['station_group'] = this.getStationGroup(scheduleunit).counts; - scheduleunit['suid'] = scheduleunit.id; - scheduleunit.canSelect = true; - scheduleunit['suid'] = scheduleunit.id; - output.push(scheduleunit); - } + async getSchedulingUnitList (isInitial, suType, filterQry, orderBy, limit, offset) { + if (isInitial) { + const schedulingSet = await ScheduleService.getSchedulingSets(); + const projects = await ScheduleService.getProjectList(); + this.mainStationGroups = null; + let workflowProcesses = null; + let suTemplates = null; + let scheduleunitDrafts = null; + const promises = [ + ScheduleService.getSchedulingUnitsExtendedWithFilter(suType.toLowerCase(), filterQry, orderBy, limit, offset), + ScheduleService.getMainGroupStations(), + WorkflowService.getWorkflowProcesses(), + ScheduleService.getObservationStrategies()]; + await Promise.all(promises).then(async responses => { + if(responses[0] && responses[0].data) { + this.totalPage = responses[0].data.count; + scheduleunitDrafts = responses[0].data.results; + this.mainStationGroups = responses[1]; + workflowProcesses = responses[2]; + suTemplates = responses[3]; } - this.totalPage = responses[0].data.count; - await this.setState({ - scheduleunit: output, isLoading: false, optionalColumns: [optionalColumns], columnclassname: [columnclassname], - }); - this.addTargetColumns(output); - this.selectedRows = []; + }); + this.setState({projects: projects, schedulingSet: schedulingSet, scheduleunitDrafts: scheduleunitDrafts, workflowProcesses: workflowProcesses, suTemplates: suTemplates}); + } + let scheduleunits = null; + if (isInitial && suType.toLowerCase() === 'draft') { + scheduleunits = this.state.scheduleunitDrafts + } else{ + let response = await ScheduleService.getSchedulingUnitsExtendedWithFilter(suType.toLowerCase(), filterQry, orderBy, limit, offset); + if (response.data) { + this.totalPage = response.data.count; } - + scheduleunits = response.data.results; + } + const output = []; + // const defaultColumns = this.defaultcolumns; + let optionalColumns = this.state.optionalcolumns[0]; + let columnclassname = this.state.columnclassname[0]; + if ( suType.toLowerCase() === 'draft') { + for( const scheduleunit of scheduleunits){ + const suSet = this.state.schedulingSet.find((suSet) => { return scheduleunit.scheduling_set_id === suSet.id }); + const project = this.state.projects.find((project) => { return suSet.project_id === project.name}); + if (!this.props.project || (this.props.project && project.name===this.props.project)) { + scheduleunit['status'] = null; + scheduleunit['workflowStatus'] = null; + const obsStrategyTemplate = _.find( this.state.suTemplates, ['id',scheduleunit.observation_strategy_template_id]); + scheduleunit['template_description'] = obsStrategyTemplate.description; + scheduleunit['linked_bp_draft'] = this.getLinksList(scheduleunit.scheduling_unit_blueprints_ids, 'blueprint'); + scheduleunit['task_content'] = this.getTaskTypeGroupCounts(scheduleunit['task_drafts']); + scheduleunit['station_group'] = this.getStationGroup(scheduleunit).counts; + scheduleunit['actionpath']='/schedulingunit/view/draft/'+scheduleunit.id; + scheduleunit['type'] = 'Draft'; + scheduleunit['duration'] = moment.utc((scheduleunit.duration || 0)*1000).format('HH:mm:ss'); + scheduleunit.project = project.name; + scheduleunit.canSelect = true; + scheduleunit.suSet = suSet.name; + scheduleunit.links = ['Project', 'id']; + scheduleunit.linksURL = { + 'Project': `/project/view/${project.name}`, + 'id': `/schedulingunit/view/draft/${scheduleunit.id}` + }; + scheduleunit['suid'] = scheduleunit.id; + output.push(scheduleunit); + } + } + output.map(su => { + su.taskDetails = su.type==="Draft"?su.task_drafts:su.task_blueprints; + const targetObserv = su && su.taskDetails ? su.taskDetails.find(task => task.specifications_template.type_value==='observation' && task.specifications_doc.SAPs) : null; + // Constructing targets in single string to make it clear display + if (targetObserv && targetObserv.specifications_doc) { + targetObserv.specifications_doc.SAPs.map((target, index) => { + su[`target${index}angle1`] = UnitConverter.getAngleInput(target.digital_pointing.angle1); + su[`target${index}angle2`] = UnitConverter.getAngleInput(target.digital_pointing.angle2,true); + su[`target${index}referenceframe`] = target.digital_pointing.direction_type; + optionalColumns[`target${index}angle1`] = {name: `Target ${index + 1} - Angle 1`}; + optionalColumns[`target${index}angle2`] = {name: `Target ${index + 1} - Angle 2`}; + optionalColumns[`target${index}referenceframe`] = { + name: `Target ${index + 1} - Reference Frame`, + filter: "select" + }; + columnclassname[`Target ${index + 1} - Angle 1`] = "filter-input-75"; + columnclassname[`Target ${index + 1} - Angle 2`] = "filter-input-75"; + return target; + }); + } + return su; + }); + } else { + for( const scheduleunit of scheduleunits){ + const suDraft = this.state.scheduleunitDrafts.find((sudraft) => { return sudraft.id === scheduleunit.draft_id }); + const suSet = this.state.schedulingSet.find((suSet) => {return suDraft.scheduling_set_id === suSet.id }); + let project = null; + scheduleunit['suSet'] = ''; + if (suSet) { + scheduleunit.suSet = suSet.name; + project = this.state.projects.find((project) => { return suSet.project_id === project.name}); + } + scheduleunit['project'] = ''; + scheduleunit['links'] = ''; + scheduleunit['linksURL'] = ''; + if (!this.props.project || (this.props.project && project && project.name===this.props.project)) { + scheduleunit.project = project?project.name :''; + scheduleunit.links = ['Project', 'id']; + scheduleunit.linksURL = { + 'Project': `/project/view/${project?project.name:''}`, + 'id': `/schedulingunit/view/blueprint/${scheduleunit.id}` + } + } + scheduleunit['status'] = null; + scheduleunit['workflowStatus'] = null; + const obsStrategyTemplate = _.find( this.state.suTemplates, ['id',scheduleunit.observation_strategy_template_id]); + const workflowProcess = _.find(this.state.workflowProcesses, ['su', scheduleunit.id]); + scheduleunit['workflowStatus'] = workflowProcess?workflowProcess.status: null; + scheduleunit.duration = moment.utc((scheduleunit.duration || 0)*1000).format('HH:mm:ss'); + scheduleunit.type= 'Blueprint'; + scheduleunit['actionpath'] ='/schedulingunit/view/blueprint/'+scheduleunit.id; + scheduleunit['task_content'] = this.getTaskTypeGroupCounts(scheduleunit['task_blueprints']); + scheduleunit['linked_bp_draft'] = this.getLinksList([scheduleunit.draft_id], 'draft'); + scheduleunit['template_description'] = obsStrategyTemplate ? obsStrategyTemplate.description : ''; + scheduleunit['observation_strategy_template_id'] = obsStrategyTemplate? obsStrategyTemplate.id : ''; + scheduleunit['station_group'] = this.getStationGroup(scheduleunit).counts; + //scheduleunit['suid'] = scheduleunit.id; + scheduleunit.canSelect = true; + scheduleunit['suid'] = scheduleunit.id; + output.push(scheduleunit); + } + } + + await this.setState({ + scheduleunit: output, isLoading: false, optionalColumns: [optionalColumns], columnclassname: [columnclassname], showSpinner: false }); + this.addTargetColumns(output); + this.selectedRows = []; } async addTargetColumns(schedulingUnits) { @@ -441,13 +456,13 @@ class SchedulingUnitList extends Component{ su[`target${index}angle1`] = UnitConverter.getAngleInput(target.digital_pointing.angle1); su[`target${index}angle2`] = UnitConverter.getAngleInput(target.digital_pointing.angle2,true); su[`target${index}referenceframe`] = target.digital_pointing.direction_type; - optionalColumns[`target${index}angle1`] = `Target ${index + 1} - Angle 1`; - optionalColumns[`target${index}angle2`] = `Target ${index + 1} - Angle 2`; + optionalColumns[`target${index}angle1`] = {name: `Target ${index + 1} - Angle 1`}; + optionalColumns[`target${index}angle2`] = {name: `Target ${index + 1} - Angle 2`}; /*optionalColumns[`target${index}referenceframe`] = { name: `Target ${index + 1} - Reference Frame`, filter: "select" };*/ //TODO: Need to check why this code is not working - optionalColumns[`target${index}referenceframe`] = `Target ${index + 1} - Reference Frame`; + optionalColumns[`target${index}referenceframe`] = {name: `Target ${index + 1} - Reference Frame`}; columnclassname[`Target ${index + 1} - Angle 1`] = "filter-input-75"; columnclassname[`Target ${index + 1} - Angle 2`] = "filter-input-75"; columnclassname[`Target ${index + 1} - Reference Frame`] = "filter-input-75"; @@ -466,7 +481,7 @@ class SchedulingUnitList extends Component{ componentDidMount(){ this.getFilterColumns(); - this.getSchedulingUnitList(this.state.suType, this.filterQry, this.orderBy, this.limit, this.offset); + this.getSchedulingUnitList(true, this.state.suType, this.filterQry, this.orderBy, this.limit, this.offset); this. setToggleBySorting(); } @@ -504,7 +519,7 @@ class SchedulingUnitList extends Component{ */ reloadData() { this.setState({isLoading: true}); - this.getSchedulingUnitList(this.state.suType, this.filterQry, this.orderBy, this.limit, this.offset); + this.getSchedulingUnitList(true, this.state.suType, this.filterQry, this.orderBy, this.limit, this.offset); } /** @@ -651,12 +666,11 @@ class SchedulingUnitList extends Component{ this.setState({dialogVisible: false}); } - async changeScheduleUnitType(type) { + async changeSUType(type) { this.filterQry = ''; this.orderBy = ''; await this.setState({suType: type, showSpinner: true, scheduleunit: []}); - await this.getSchedulingUnitList(this.state.suType.toLowerCase(),this.filterQry, this.orderBy, this.limit, this.offset); - this.setState({showSpinner: false}); + await this.getSchedulingUnitList(true, this.state.suType.toLowerCase(), this.filterQry, this.orderBy, this.limit, this.offset); } async fetchTableData(state) { @@ -680,9 +694,9 @@ class SchedulingUnitList extends Component{ } this.filterQry = this.filterQry.substring(0,this.filterQry.length-1); - await this.getSchedulingUnitList(this.state.suType, this.filterQry, this.orderBy, state.pageSize, (state.pageIndex*state.pageSize)); + await this.getSchedulingUnitList(false, this.state.suType, this.filterQry, this.orderBy, state.pageSize, (state.pageIndex*state.pageSize)); this.setState({showSpinner: false}); - return this.state.scheduleunit + return [this.state.scheduleunit, this.totalPage]; } render(){ @@ -699,7 +713,7 @@ class SchedulingUnitList extends Component{ tooltip="Schedule Unit Type" tooltipOptions={this.tooltipOptions} value={this.state.suType} options={this.suTypeList} - onChange={(e) => {this.changeScheduleUnitType( e.value)}} + onChange={(e) => {this.changeSUType( e.value)}} style={{width: '10em', marginLeft: '0.5em'}} /> </span> 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 3199b3c046a8930d88c97840a87ee7855b463fb1..baeba0e9b3fe743f8dcd8de77db7b5d047107add 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js @@ -719,4 +719,4 @@ const ScheduleService = { } } -export default ScheduleService; \ No newline at end of file +export default ScheduleService; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/utils/ui.constants.js b/SAS/TMSS/frontend/tmss_webapp/src/utils/ui.constants.js index 16c35768007379b5620ca36fbfb9666c434d912b..d50e1a3c0a5de065d1f7b73dfc3693bbbdd34520 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/utils/ui.constants.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/utils/ui.constants.js @@ -18,7 +18,7 @@ const UIConstants = { CALENDAR_DEFAULTDATE_FORMAT: 'YYYY-MM-DD', UTC_DATE_TIME_FORMAT: "YYYY-MM-DDTHH:mm:ss", UTC_DATE_TIME_MS_FORMAT: "YYYY-MM-DDTHH:mm:ss.SSSSS", - filterMap: { + FILTER_MAP: { 'AutoField': '', 'CharFilter':'', 'DateTimeFilter':'fromdatetime',