-
Notifications
You must be signed in to change notification settings - Fork 1
/
dashboard.js
114 lines (106 loc) · 2.42 KB
/
dashboard.js
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
import log from '~/js/generic/log';
const buildConf = () => {
log.funcStart('buildConf');
const tabs = [
{
path: 'countries',
title: 'Countries',
tabs: [
{ path: 'table', title: 'Table' },
{ path: 'plot', title: 'Plot' },
{ path: 'map', title: 'Map' }
]
},
{
path: 'realtime',
title: 'Real Time'
},
{
path: 'slider2d',
title: '2D Slider'
},
{
path: 'climate',
title: 'Climate',
tabs: [
{ path: 'weather', title: 'Weather' },
{ path: 'temperature', title: 'Temperature' }
]
},
{
path: 'wikitable',
title: 'Wiki Tables',
tabs: [
{ path: 'ancient', title: 'Ancient' },
{ path: 'modern', title: 'Modern' }
]
},
{
path: 'bitcoin',
title: 'Bitcoin TX'
},
{
path: 'portrait',
title: 'Portraits',
tabs: [
{ path: 'obama', title: 'Obama' },
{ path: 'gosling', title: 'Gosling' },
{ path: 'moss', title: 'Moss' },
{ path: 'fassbender', title: 'Fassbender' },
{ path: 'delevigne', title: 'Delevigne' }
]
},
{
path: 'fractals',
title: 'Fractals',
tabs: [
{ path: 'mandelbrot', title: 'Mandelbrot' },
{ path: 'julia', title: 'Julia' },
{ path: 'info', title: 'Info' }
]
},
{
path: 'disclaimer',
title: 'Disclaimer'
}
];
const obj = {
tabs,
// MANUALCONFIG
// SET DEFAULT TAB
// FOR ALL TAB WITH SUBTABS SET DEFAULT SUBTAB
activeTab: { tab: 0, sub: { 0: 0, 4: 0, 6: 0 } },
// MANUAL CONFIG
defaultStyle: {
level1: {
vertical: true,
width: '130px',
height: '70px'
},
level2: {
vertical: false,
width: '125px',
height: '70px'
}
},
// MANUALCONFIG
navBarLink: '/countries/plot'
};
// DEFAULT CONFIG
// NOT SET => ALL DEFAULT TO 0
if (!obj.activeTab) obj.activeTab = {};
if (!obj.activeTab.tab) obj.activeTab.tab = 0;
if (!obj.activeTab.sub) obj.activeTab.sub = {};
tabs.forEach((e, i) => {
if (e.tabs && !obj.activeTab.sub[i]) obj.activeTab.sub[i] = 0;
});
// REMOVE INVALID SUB KEYS
for (const k of Object.keys(tabs)) {
if (k < 0 || k >= tabs.length) {
delete obj.activeTab.sub[k];
}
}
log.funcEnd('buidConf', obj);
return obj;
};
export default buildConf;