refactor: added params to filters, and removed manual mutation (#480)

* refractor: added params to fetch key

* feat: create views directly from views list page

fix: selected filter not showing up in multi-level dropdown, refactor: arranged imports

* refactor: added params to filters, and removed manual mutation
This commit is contained in:
Dakshesh Jain 2023-03-21 12:47:47 +05:30 committed by GitHub
parent 505b14e3a6
commit 53df658b60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 40 deletions

View file

@ -1,16 +1,19 @@
const paramsToKey = (params: any) => {
const { state, priority, assignees } = params;
let stateKey = state ? state.split(",").join(" ") : "";
let priorityKey = priority ? priority.split(",").join(" ") : "";
let assigneesKey = assignees ? assignees.split(",").join(" ") : "";
let stateKey = state ? state.split(",") : [];
let priorityKey = priority ? priority.split(",") : [];
let assigneesKey = assignees ? assignees.split(",") : [];
const type = params.type ? params.type.toUpperCase() : "NULL";
const groupBy = params.group_by ? params.group_by.toUpperCase() : "NULL";
const orderBy = params.order_by ? params.order_by.toUpperCase() : "NULL";
// sorting each keys in ascending order
stateKey = stateKey.split(" ").sort().join("");
priorityKey = priorityKey.split(" ").sort().join("");
assigneesKey = assigneesKey.split(" ").sort().join("");
stateKey = stateKey.sort().join("_");
priorityKey = priorityKey.sort().join("_");
assigneesKey = assigneesKey.sort().join("_");
return `${stateKey}_${priorityKey}_${assigneesKey}`;
return `${stateKey}_${priorityKey}_${assigneesKey}_${type}_${groupBy}_${orderBy}`;
};
export const CURRENT_USER = "CURRENT_USER";