-
Notifications
You must be signed in to change notification settings - Fork 518
/
menu.js
62 lines (54 loc) · 1.67 KB
/
menu.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
'use strict';
class Menu extends AbstractMenu {
constructor(props) {
super(props);
this.showWorkflow = this.showWorkflow.bind(this);
this.showStatistics = this.showStatistics.bind(this);
}
render() {
return e(
"ul",
{},
this.getHeading(),
this.getMenuItem("Workflow", "share", this.showWorkflow),
this.getMenuItem("Statistics", "chart", this.showStatistics),
this.getMenuItem("About", "information-circle", this.props.app.showReportInfo),
this.getCategoryMenumitems()
)
}
showWorkflow() {
this.props.app.setView({ content: "rulegraph" });
}
showStatistics() {
this.props.app.setView({ content: "stats" });
}
getHeading() {
if (isSingleCategory()) {
return [];
} else {
return e(
ListHeading,
{ text: "General" }
)
}
}
getCategoryMenumitems() {
let _this = this;
let app = this.props.app;
if (isSingleCategory()) {
let category = Object.keys(categories)[0];
return this.getMenuItem("Results", "folder", () => app.showCategory(category));
} else if (isNoResults()) {
return [];
} else {
let items = [e(
ListHeading,
{ key: "Results", text: "Result" }
)];
items.push(...Object.keys(categories).sort().map(function (category) {
return _this.getMenuItem(category, "folder", () => app.showCategory(category));
}));
return items;
}
}
}