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 ea5c0dd490e5c52a18fcb848856cf07bf44e1c0b..5f16e824e75e381af4446b9f14c0d56b21104079 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js @@ -71,13 +71,14 @@ class SchedulingUnitList extends Component{ if (props.hideProjectColumn) { delete this.defaultcolumns['project']; } + this.getUIAttr(); this.STATUS_BEFORE_SCHEDULED = ['defining', 'defined', 'schedulable']; // Statuses before scheduled to get station_group this.mainStationGroups = {}; this.suTypeList = [{name: 'Blueprint'}, {name: 'Draft'}] this.totalPage = 0; this.state = { showSpinner: false, - suType: "Draft", + suType: this.suUIAttr['listType'] || "Draft", columnOrders: [ "Status", "Workflow Status", @@ -598,6 +599,26 @@ class SchedulingUnitList extends Component{ this.setToggleBySorting(); } + /** + * Function to get the UI attributes from local storage that are stored in the previous view + */ + getUIAttr() { + this.suUIAttr = UtilService.localStore({ type: 'get', + key: this.props.project?'PROJECT_VIEW_UI_ATTR':'SCHEDULE_LIST_UI_ATTR' }) || {}; + } + + /** + * Function that stores the preferred values in local storage to restore the same in the next view + * @param {string} key + * @param {Object} value + */ + storeUIAttr(key, value) { + this.suUIAttr[key] = value; + UtilService.localStore({ type: 'set', + key: this.props.project?'PROJECT_VIEW_UI_ATTR':'SCHEDULE_LIST_UI_ATTR', + value: this.suUIAttr }); + } + setToggleBySorting() { let sortData = null; if (this.lsKeySortColumn) { @@ -1083,8 +1104,9 @@ class SchedulingUnitList extends Component{ } } this.getSchedulingUnitList(false, this.state.suType.toLowerCase(),this.filterQry, this.orderBy, this.limit, this.offset); + this.storeUIAttr("listType", type); } - + /** * Fetch data from server side - while doing pagination, filtering, sorting * @param {Table State} Table props state diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js index e96df454791789f150958828f4d145de3079be83..26540f36b3c0238b9c8e55563adceb02cf1d97d8 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js @@ -1388,7 +1388,7 @@ class ViewSchedulingUnit extends Component { keyaccessor="id" paths={this.state.paths} unittest={this.state.unittest} - tablename="scheduleunit_task_list" + tablename={`scheduleunit_${this.props.match.params.type}_task_list`} allowRowSelection={true} onRowSelection={this.onRowSelection} ignoreSorting={this.ignoreSorting} @@ -1396,6 +1396,7 @@ class ViewSchedulingUnit extends Component { toggleBySorting={(sortData) => this.toggleBySorting(sortData)} defaultSortColumn={this.defaultSortColumn} pageUpdated={this.pageUpdated} + storeFilter={true} /> : <div>No Tasks found</div> } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/list.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/list.js index 1ca2038c9390ad1674f5a23386681fc36af4d503..598c892fe255b4c5fb52f0a9469b0925cca93c5f 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/list.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/list.js @@ -27,8 +27,9 @@ export class TaskList extends Component { TASK_BLUEPRINT_EXPAND = 'subtasks,subtasks.output_dataproducts,draft,scheduling_unit_blueprint'; constructor(props) { super(props); + this.getUIAttr(); this.state = { - taskType: 'Draft', + taskType: this.taskUIAttr['listType'] || 'Draft', isLoading: true, tasks: [], paths: [{ @@ -304,6 +305,23 @@ export class TaskList extends Component { this.setState({ tasks: [], isLoading: false, actions: actions, loadingStatus: false }); } + /** + * Function to get the UI attributes from local storage that are stored in the previous view + */ + getUIAttr() { + this.taskUIAttr = UtilService.localStore({ type: 'get', key: 'TASK_LIST_UI_ATTR' }) || {}; + } + + /** + * Function that stores the preferred values in local storage to restore the same in the next view + * @param {string} key + * @param {Object} value + */ + storeUIAttr(key, value) { + this.taskUIAttr[key] = value; + UtilService.localStore({ type: 'set', key: 'TASK_LIST_UI_ATTR', value: this.taskUIAttr }); + } + toggleBySorting = (sortData) => { UtilService.localStore({ type: 'set', key: this.lsKeySortColumn, value: sortData }); } @@ -540,6 +558,7 @@ export class TaskList extends Component { } } this.getTaskLists(this.state.taskType, this.filterQry, this.orderBy, this.limit, this.offset); + this.storeUIAttr('listType', type) } /**