-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
68 lines (60 loc) · 2.17 KB
/
index.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
import {Application, WaltzWidget} from "@waltz-controls/middleware";
import {kWidgetXenvHq, XenvHqWidget} from "index";
import {kUserContext, UserContext} from "@waltz-controls/waltz-user-context-plugin";
import {TangoRestController, TangoSubscriptionsController} from "@waltz-controls/waltz-tango-rest-plugin";
const kDummyUser = {
name: 'tango-cs',
headers: {
"Authorization": "Basic " + btoa("tango-cs:tango")
}
};
class DummyUserContext extends UserContext {
constructor() {
super({
user: 'tango-cs', tango_hosts: {}, device_filters: [], ext: {
[kWidgetXenvHq]: [
{
id: "localhost:10000/development/xenv/hq",
name: "HeadQuarter",
state: "UNKNOWN",
status: "Not initialized"
},
{
id: "localhost:10000/development/xenv/config",
name: "ConfigurationManager",
state: "UNKNOWN",
status: "Not initialized"
},
{
id: "localhost:10000/development/xenv/manager",
name: "XenvManager",
state: "UNKNOWN",
status: "Not initialized"
}
]
}
});
}
save(host = '', options = {}) {
return Promise.resolve(42);
}
}
class MainWidget extends WaltzWidget {
constructor(app) {
super("widget:main", app);
}
run() {
this.mainView = webix.ui({
view: 'tabview',
cells: [{}]
});
}
}
const waltz = new Application({name: APPNAME, version: VERSION})
.registerContext('user', kDummyUser)
.registerContext(kUserContext, new DummyUserContext())
.registerController(application => new TangoRestController(application))
.registerController(application => new TangoSubscriptionsController(application))
.registerWidget(application => new MainWidget(application))
.registerWidget(application => new XenvHqWidget(application))
.run()