Skip to content
Snippets Groups Projects
Commit 06ce2eef authored by Reinder Kraaij's avatar Reinder Kraaij :eye:
Browse files

Merge branch 'TMSS-3063-Front-End-Only' into 'master'

FIx Blueprint without draft showing drafts

Closes TMSS-3063 and TMSS-3064

See merge request !1411
parents 732c5205 bbe9e302
No related branches found
No related tags found
1 merge request!1411FIx Blueprint without draft showing drafts
...@@ -24,6 +24,21 @@ import { useParsedDataWebSocket } from '../../utils/websocket'; ...@@ -24,6 +24,21 @@ import { useParsedDataWebSocket } from '../../utils/websocket';
const derviedscheduleconstraints = {}; const derviedscheduleconstraints = {};
const getUIAttr = (props) => {
let uistore = UtilService.localStore({
type: 'get',
key: props.project ? 'PROJECT_VIEW_UI_ATTR' : 'SCHEDULE_LIST_UI_ATTR'
}) || {};
return uistore
}
function getStoredSuType(props) {
let store = getUIAttr(props);
let sutype = store?.['listType']?.replaceAll("_", " ") || "Draft"
return sutype
}
export function SchedulingUnitList(props) { export function SchedulingUnitList(props) {
const viewtable = useRef(null); const viewtable = useRef(null);
let defaultSortColumn = [{ id: "Name", desc: false }]; let defaultSortColumn = [{ id: "Name", desc: false }];
...@@ -121,8 +136,8 @@ export function SchedulingUnitList(props) { ...@@ -121,8 +136,8 @@ export function SchedulingUnitList(props) {
let statusList = []; let statusList = [];
const [definitionCache, setDefinitionCache] = useState([]); const [definitionCache, setDefinitionCache] = useState([]);
const [suUIAttr, setSuUIAttr] = useState();
const [suType, setSuType] = useState("Draft"); const [suType, setSuType] = useState(getStoredSuType(props));
const [tmpDefaulColumns, setTmpDefaulColumns] = useState(); const [tmpDefaulColumns, setTmpDefaulColumns] = useState();
const [tmpOptionalColumns, setTmpOptionalColumns] = useState(); const [tmpOptionalColumns, setTmpOptionalColumns] = useState();
const [tmpColumnOrders, setTmpColumnOrders] = useState(); const [tmpColumnOrders, setTmpColumnOrders] = useState();
...@@ -131,7 +146,7 @@ export function SchedulingUnitList(props) { ...@@ -131,7 +146,7 @@ export function SchedulingUnitList(props) {
const [totalPage, setTotalPage] = useState([]); const [totalPage, setTotalPage] = useState([]);
const [userrole, setUserrole] = useState(); const [userrole, setUserrole] = useState();
const [timelineCommonUtils, setTimelineCommonUtils] = useState(); const timelineCommonUtils = new TimelineCommonUtils();
const [priorityQueueTypes, setPriorityQueueTypes] = useState(); const [priorityQueueTypes, setPriorityQueueTypes] = useState();
const [columnclassname, setColumnclassname] = useState([{ const [columnclassname, setColumnclassname] = useState([{
"Scheduling Unit ID": "filter-input-100", "Scheduling Unit ID": "filter-input-100",
...@@ -419,6 +434,7 @@ export function SchedulingUnitList(props) { ...@@ -419,6 +434,7 @@ export function SchedulingUnitList(props) {
*/ */
const getSchedulingUnitList = async (isInitial, suType, filterQry, orderBy, limit, offset) => { const getSchedulingUnitList = async (isInitial, suType, filterQry, orderBy, limit, offset) => {
//set query param for project if url has project param //set query param for project if url has project param
console.log("getSchedulingUnitList",suType)
if (props.project) { if (props.project) {
filterQry += (filterQry === '' ? 'project=' : '&project=') + props.project; filterQry += (filterQry === '' ? 'project=' : '&project=') + props.project;
} }
...@@ -453,7 +469,7 @@ export function SchedulingUnitList(props) { ...@@ -453,7 +469,7 @@ export function SchedulingUnitList(props) {
params = 'blueprint'; params = 'blueprint';
} }
if (suType == "drafts without blueprint") { if (suType.toLowerCase() == "drafts without blueprint") {
filterQry = filterQry + "&blueprinted=false" filterQry = filterQry + "&blueprinted=false"
} }
let response = await ScheduleService.getSchedulingUnitsExpandWithFilter(params.toLowerCase(), expand, filterQry, orderBy, limit, offset, fields.join(",")); let response = await ScheduleService.getSchedulingUnitsExpandWithFilter(params.toLowerCase(), expand, filterQry, orderBy, limit, offset, fields.join(","));
...@@ -548,31 +564,20 @@ export function SchedulingUnitList(props) { ...@@ -548,31 +564,20 @@ export function SchedulingUnitList(props) {
}, []); }, []);
const init = async () => { const init = async () => {
let store = getUIAttr(); lsKeySortColumn = "SchedulingUnit_" + changesutype(suType) + "_SortData"
let sutype = store?.['listType']?.replaceAll("_", " ") || "Draft"
setSuType(sutype)
lsKeySortColumn = "SchedulingUnit_" + changesutype(sutype) + "_SortData"
const permission = await AuthUtil.getUserRolePermission(); const permission = await AuthUtil.getUserRolePermission();
let priorityQueueTypes = await UtilService.getPriorityQueueType(); let priorityQueueTypes = await UtilService.getPriorityQueueType();
setPriorityQueueTypes(priorityQueueTypes) setPriorityQueueTypes(priorityQueueTypes)
setUserrole(permission); setUserrole(permission);
setPageUpdated(true); setPageUpdated(true);
getFilterColumns(changesutype()); getFilterColumns(changesutype());
setTimelineCommonUtils(new TimelineCommonUtils());
} }
/** /**
* Function to get the UI attributes from local storage that are stored in the previous view * Function to get the UI attributes from local storage that are stored in the previous view
*/ */
const getUIAttr = () => {
let uistore = UtilService.localStore({
type: 'get',
key: props.project ? 'PROJECT_VIEW_UI_ATTR' : 'SCHEDULE_LIST_UI_ATTR'
}) || {};
setSuUIAttr(uistore)
return uistore
}
/** /**
* Function that stores the preferred values in local storage to restore the same in the next view * Function that stores the preferred values in local storage to restore the same in the next view
...@@ -580,11 +585,13 @@ export function SchedulingUnitList(props) { ...@@ -580,11 +585,13 @@ export function SchedulingUnitList(props) {
* @param {Object} value * @param {Object} value
*/ */
const storeUIAttr = (key, value) => { const storeUIAttr = (key, value) => {
suUIAttr[key] = value; let uiAttri = getUIAttr(props)
uiAttri[key] = value;
UtilService.localStore({ UtilService.localStore({
type: 'set', type: 'set',
key: props.project ? 'PROJECT_VIEW_UI_ATTR' : 'SCHEDULE_LIST_UI_ATTR', key: props.project ? 'PROJECT_VIEW_UI_ATTR' : 'SCHEDULE_LIST_UI_ATTR',
value: suUIAttr value: uiAttri
}); });
} }
...@@ -720,7 +727,7 @@ export function SchedulingUnitList(props) { ...@@ -720,7 +727,7 @@ export function SchedulingUnitList(props) {
} }
setIsLoading(false) setIsLoading(false)
await getSchedulingUnitList(false, changesutype(), filterQry, newOrderBy, tablestate?.rows || 15, tablestate?.first || 0); await getSchedulingUnitList(false, suType, filterQry, newOrderBy, tablestate?.rows || 15, tablestate?.first || 0);
return [scheduleunit, totalPage]; return [scheduleunit, totalPage];
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment