-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp-setting.ts
154 lines (137 loc) · 3.72 KB
/
app-setting.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import { $themeConfig } from "./theme.config";
import { useAppStore } from "@/stores/index";
export default {
init(setLocale: any) {
const store = useAppStore();
// set default styles
let val: any = localStorage.getItem("theme"); // light, dark, system
val = val || $themeConfig.theme;
store.toggleTheme(val);
val = localStorage.getItem("i18n_locale"); // en, da, de, el, es, fr, hu, it, ja, pl, pt, ru, sv, tr, zh
val = val || $themeConfig.locale;
const list = store.languageList;
const item = list.find((item: any) => item.code === val);
if (item) {
this.toggleLanguage(item, setLocale);
}
val = localStorage.getItem("rtlClass"); // rtl, ltr
val = val || $themeConfig.rtlClass;
store.toggleRTL(val);
val = localStorage.getItem("animation"); // animate__fadeIn, animate__fadeInDown, animate__fadeInUp, animate__fadeInLeft, animate__fadeInRight, animate__slideInDown, animate__slideInLeft, animate__slideInRight, animate__zoomIn
val = val || $themeConfig.animation;
store.toggleAnimation(val);
val = localStorage.getItem("semidark");
val = val === "true" ? true : $themeConfig.semidark;
store.toggleSemidark(val);
val = localStorage.getItem("graphlib") || "cytoscape";
store.changeGraphlib(val);
val = localStorage.getItem("commitClientChanges");
if (val && val === "true") {
store.commitClientChanges(true);
} else {
store.commitClientChanges(false);
}
},
toggleLanguage(item: any, setLocale: any) {
const store = useAppStore();
let lang: any = null;
if (item) {
lang = item;
} else {
let code = store.locale || null;
if (!code) {
code = localStorage.getItem("i18n_locale");
}
item = store.languageList.find((d: any) => d.code === code);
if (item) {
lang = item;
}
}
if (!lang) {
lang = store.languageList.find((d: any) => d.code === "en");
}
store.toggleLocale(lang.code, setLocale);
return lang;
},
changeAnimation(type = "add") {
const store = useAppStore();
if (store.animation) {
const eleanimation: any = document.querySelector(".animation");
if (type === "add") {
eleanimation?.classList.add("animate__animated");
eleanimation?.classList.add(store.animation);
} else {
eleanimation?.classList.remove("animate__animated");
eleanimation?.classList.remove(store.animation);
}
}
},
/**
* This is the content of the sidebar.
*/
sidebarTree: [
{
text: "Explorations",
description: "Explorations are a datasets you can edit. They are the starting point for creating recipes, perspectives, notebooks, and dashboards.",
children: [
{
text: "Recipes",
link: "/apps/generic/editor",
},
{
text: "Schema",
link: "/apps/generic/schema",
},
],
},
{
text: "Perspectives",
description: "Perspectives are a visualization of a dataset. These are read-only views of datasets.",
children: [
{
text: "Thai Food",
link: "/apps/generic/viewer",
},
{
text: "Italian Food",
},
],
},
{
text: "Notebooks",
description: "Notebooks are collections of recipes that can be used to analyze data.",
children: [
{
text: "Notebook 1",
},
{
text: "Notebook 2",
},
],
},
{
text: "Dashboards",
description: "Dashboards are collections of visualizations that can be used to monitor and analyze data.",
children: [
{
text: "Dashboard 1",
},
{
text: "Dashboard 2",
},
],
},
{
text: "Datasets",
description: "Datasets are collections of data (a sub-graph) that can be used in diverse places. They can be used to create recipes, perspectives, notebooks, and dashboards.",
children: [
{
text: "Dataset 1",
},
{
text: "Dataset 2",
},
],
},
],
};