mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Use localstorage instead of Cookies to save tree state.
That way we dont need to include the cookie js lib and save some memory.
This commit is contained in:
parent
7f6c9b614f
commit
10ec2adc66
3 changed files with 7 additions and 21 deletions
|
@ -28,8 +28,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import * as Cookies from "js-cookie";
|
||||
|
||||
/**
|
||||
* Extract the title (The name between the <title> tags) of a HTML snippet.
|
||||
* @param {string} html The HTML code which should be searched.
|
||||
|
@ -114,19 +112,19 @@ class AjaxUI {
|
|||
*/
|
||||
public fillTrees()
|
||||
{
|
||||
let categories = Cookies.get("tree_datasource_tree-categories");
|
||||
let devices = Cookies.get("tree_datasource_tree-devices");
|
||||
let tools = Cookies.get("tree_datasource_tree-tools");
|
||||
let categories = localStorage.getItem("tree_datasource_tree-categories");
|
||||
let devices = localStorage.getItem("tree_datasource_tree-devices");
|
||||
let tools = localStorage.getItem("tree_datasource_tree-tools");
|
||||
|
||||
if(typeof categories == "undefined") {
|
||||
if(categories == null) {
|
||||
categories = "categories";
|
||||
}
|
||||
|
||||
if(typeof devices == "undefined") {
|
||||
if(devices == null) {
|
||||
devices = "devices";
|
||||
}
|
||||
|
||||
if(typeof tools == "undefined") {
|
||||
if(tools == null) {
|
||||
tools = "tools";
|
||||
}
|
||||
|
||||
|
@ -154,7 +152,7 @@ class AjaxUI {
|
|||
// @ts-ignore
|
||||
$('#' + target).treeview('expandAll', { silent: true });
|
||||
} else {
|
||||
Cookies.set("tree_datasource_" + target, mode);
|
||||
localStorage.setItem("tree_datasource_" + target, mode);
|
||||
ajaxUI.treeLoadDataSource(target, mode);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
"@types/bootstrap-treeview": "^1.20.0",
|
||||
"@types/jquery": "^3.3.29",
|
||||
"@types/jquery.form": "^3.26.30",
|
||||
"@types/js-cookie": "^2.2.1",
|
||||
"bootbox": "^5.1.0",
|
||||
"bootstrap-fileinput": "^5.0.1",
|
||||
"bootstrap-select": "^1.13.8",
|
||||
|
@ -32,7 +31,6 @@
|
|||
"datatables.net-fixedheader-bs4": "^3.1.5",
|
||||
"datatables.net-select-bs4": "^1.2.7",
|
||||
"jquery-form": "^4.2.2",
|
||||
"js-cookie": "^2.2.0",
|
||||
"jszip": "^3.2.0",
|
||||
"patternfly-bootstrap-treeview": "^2.1.8",
|
||||
"pdfmake": "^0.1.53",
|
||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -739,11 +739,6 @@
|
|||
dependencies:
|
||||
"@types/sizzle" "*"
|
||||
|
||||
"@types/js-cookie@^2.2.1":
|
||||
version "2.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/js-cookie/-/js-cookie-2.2.2.tgz#84e8848e14d44418726ceb52dd887c7bfe45d678"
|
||||
integrity sha512-vkuGzldF9mNsWS9cmmMFfW1rufa7IdPUorS150gKoU/2fzLJ/0LXiMMtRqIBWz0sZ/VF2VxwB25WXEOo6akU6w==
|
||||
|
||||
"@types/minimatch@*":
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
|
||||
|
@ -4005,11 +4000,6 @@ jquery-form@^4.2.2:
|
|||
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.4.1.tgz#714f1f8d9dde4bdfa55764ba37ef214630d80ef2"
|
||||
integrity sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==
|
||||
|
||||
js-cookie@^2.2.0:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8"
|
||||
integrity sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ==
|
||||
|
||||
js-levenshtein@^1.1.3:
|
||||
version "1.1.6"
|
||||
resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue