-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
184 lines (172 loc) · 6.83 KB
/
index.html
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<!DOCTYPE html>
<html>
<head lang='en'>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Debugger</title>
<meta name='description' content='AppsGate Debugger example'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<!-- build:css(.tmp) themes/basic/theme.css -->
<link rel='stylesheet' href='themes/basic/theme.css'>
<!-- endbuild -->
<script type='text/javascript' src='components/requirejs/require.js'></script>
<script type='text/javascript'>
require.config({
baseUrl: '/',
map: {
'*': {
'underscore': 'lodash',
'i18n': 'i18next'
}
},
shim: {
'lodash': {
exports: '_'
},
'backbone': {
deps: ['jquery', 'underscore'],
exports: 'Backbone'
},
'jquery': {
exports: '$'
},
'tinysort': ['jquery'],
'appsgate.debugger': {
deps: ['jquery', 'jqueryui', 'backbone', 'lodash', 'd3', 'tinysort', "i18n"]
}
},
i18next: {
lng: 'fr',
fallbackLng: 'en',
lowerCaseLng : true,
useCookie : false,
resGetPath: 'locales/__lng__/__ns__.json'
},
paths: {
'appsgate.debugger': 'appsgate.debugger.dev',
'backbone': 'components/backbone/backbone',
'lodash': 'components/lodash/dist/lodash',
'jquery': 'components/jquery/dist/jquery',
'tinysort': 'components/tinysort/dist/jquery.tinysort',
'jqueryui': 'components/jqueryui/jquery-ui',
'd3': 'components/d3/d3',
'i18next': 'components/i18next/i18next.amd'
}
});
require(['appsgate.debugger', 'i18n'], function(Debugger, i18n) {
// setup i18n
i18n.init();
var connector = new Debugger.Connector({
address: 'localhost',
port: '3000'
});
// setup dashboard
var dashboard = window.dashboard = new Debugger.Dashboard('#canvas', {
d3: {
// Define custom locale (based on http://www.localeplanet.com/icu/fr/)
locale: {
'decimal': ',',
'thousands': ' ',
'grouping': [3],
'currency': ['€', ''],
'dateTime': '%a %b %e %X %Y',
'date': '%m/%d/%Y',
'time': '%H:%M:%S',
'periods': ['AM', 'PM'],
'days': ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
'shortDays': ['Dim.', 'Lun.', 'Mar.', 'Mer.', 'Jeu.', 'Ven.', 'Sam.'],
'months': ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Aout', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
'shortMonths': ['Janv.', 'Févr.', 'Mars', 'Avr.', 'Mai', 'Juin', 'Juil.', 'Aout', 'Sept.', 'Oct.', 'Nov.', 'Déc.']
},
// Define custom multi-time format
timeFormatMulti: [
['.%L', function (d) {
return d.getMilliseconds();
}],
[':%S', function (d) {
return d.getSeconds();
}],
['%H:%M', function (d) {
return d.getMinutes();
}],
['%Hh', function (d) {
return d.getHours();
}],
['%a %d', function (d) {
return d.getDay() && d.getDate() != 1;
}],
['%b %d', function (d) {
return d.getDate() != 1;
}],
['%B', function (d) {
return d.getMonth();
}],
['%Y', function () {
return true;
}]
]
},
i18n: {
ns: 'translation'
},
livetrace: {
delayBeforeFlush: 100000
}
});
dashboard.connect(connector);
// setup developer monitor
var monitor = window.monitor = new Debugger.Monitor();
monitor.connect(connector);
// listen to zoom request from dashboard
dashboard.on('zoom:request', function (context) {
dashboard.requestHistoryTrace(context);
});
// listen to marker click event from dashboard
dashboard.on('marker:click', function (decorations, textContent, htmlContent) {
alert(textContent);
});
// listen to widget focus request from dashboard
dashboard.on('eventline:focus:request', function(context, attributes) {
dashboard.requestHistoryTrace(context);
});
// listen to widget name click from dashboard
dashboard.on('eventline:name:click', function(context, attributes) {
if (attributes.kind == 'program') {
console.log("Program with id "+attributes.id+" was clicked");
} else {
console.log("Device of type "+attributes.type+" and with id "+attributes.id+" was clicked");
}
});
$('button').on('click', function(){
if( $(this).attr('id') == 'live' && !dashboard.isLiveMode()) {
dashboard.requestLiveTrace();
} else if ($(this).attr('id') == 'history' && !dashboard.isHistoryMode()) {
dashboard.requestInitialHistoryTrace();
}
});
// prompt server for initial history trace
dashboard.requestInitialHistoryTrace();
});
</script>
<style type="text/css">
body > .wrapper {
width: 960px;
height: 100%;
margin-left: auto;
margin-right: auto;
}
#toolbar {
text-align: center
}
</style>
</head>
<body>
<div class="wrapper">
<div id="toolbar">
<button id="live">Live</button>
<button id="history">History</button>
</div>
<div id='canvas'></div>
</div>
</body>
</html>