forked from 2600hz/monster-ui-csv-onboarding
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
93 lines (77 loc) · 1.7 KB
/
app.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
define(function (require) {
var $ = require('jquery'),
_ = require('lodash'),
monster = require('monster'),
UploadPage = require('./components/UploadPage');
var app = {
name: 'csv_app',
css: ['app'],
i18n: {
'de-DE': { customCss: false },
'en-US': { customCss: false }
},
requests: {
/* Provisioner */
'common.chooseModel.getProvisionerData': {
apiRoot: monster.config.api.provisioner,
url: 'phones',
verb: 'GET'
},
/* Device iteration for feature keys */
'data.template.feature_keys.iteration': {
apiRoot: 'https://z.stg.audian.com/',
url: '/ui/{brand}/{family}/{model}',
verb: 'GET',
generateError: false,
removeHeaders: [
'X-Kazoo-Cluster-ID',
'X-Auth-Token',
'Content-Type'
]
}
},
subscribe: {},
load: function (callback) {
var self = this;
self.initApp(function () {
callback && callback(self);
});
},
initApp: function (callback) {
var self = this;
monster.pub('auth.initApp', {
app: self,
callback: callback
});
},
// Entry Point of the app
render: function (container) {
var App = this,
parent = $('#monster_content'),
layout = $(App.getTemplate({
name: 'layout'
}));
App._templates = {
layout: layout
};
App._selectors = {
parent: parent,
content: layout.find('.content-wrapper')
};
monster.request({
resource: 'common.chooseModel.getProvisionerData',
data: {},
success: function (dataProvisioner) {
if (_.has(dataProvisioner, 'data')) {
App._provisionerData = dataProvisioner.data;
}
parent
.empty()
.append(layout);
UploadPage.render(App);
}
});
},
};
return app;
});