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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue