|
74 | 74 | } |
75 | 75 |
|
76 | 76 | function getThemedPassiveColor() { |
77 | | - return OCA.Theming && OCA.Theming.inverted ? 'rgb(55, 55, 55)' : 'rgb(200, 200, 200)'; |
| 77 | + return 'rgb(148, 148, 148)'; |
78 | 78 | } |
79 | 79 |
|
80 | 80 | /** |
|
84 | 84 | var cpuCanvas = $("#cpuloadcanvas"), |
85 | 85 | cpuCanvasWidth = cpuCanvas.parents('.infobox').width() - 30, |
86 | 86 | memCanvas = $("#memorycanvas"), |
87 | | - memCanvasWidth = memCanvas.parents('.infobox').width() - 30, |
88 | | - activeUsersCanvas = $("#activeuserscanvas"), |
89 | | - activeUsersCanvasWidth = activeUsersCanvas.parents('.infobox').width() - 30, |
90 | | - shareCanvas = $("#sharecanvas"), |
91 | | - shareCanvasWidth = shareCanvas.parents('.infobox').width() - 30; |
| 87 | + memCanvasWidth = memCanvas.parents('.infobox').width() - 30; |
| 88 | + |
92 | 89 |
|
93 | 90 | // We have to set css width AND attribute width |
94 | 91 | cpuCanvas.width(cpuCanvasWidth); |
95 | 92 | cpuCanvas.attr('width', cpuCanvasWidth); |
96 | 93 | memCanvas.width(memCanvasWidth); |
97 | 94 | memCanvas.attr('width', memCanvasWidth); |
98 | | - activeUsersCanvas.width(activeUsersCanvasWidth); |
99 | | - activeUsersCanvas.attr('width', activeUsersCanvasWidth); |
100 | | - shareCanvas.width(shareCanvasWidth); |
101 | | - shareCanvas.attr('width', shareCanvasWidth); |
102 | | - |
103 | | - updateShareStatistics(); |
104 | | - updateActiveUsersStatistics(); |
105 | 95 | } |
106 | 96 |
|
107 | 97 | function updateCPUStatistics(cpuload) { |
|
142 | 132 | $cpuFooterInfo.text(t('serverinfo', 'Load average: {cpu} (last minute)', { cpu: cpu1 })); |
143 | 133 | cpuLoadLine.append(new Date().getTime(), cpu1); |
144 | 134 | } |
145 | | - |
| 135 | + |
146 | 136 | function isMemoryStat(memTotal, memFree) { |
147 | 137 | if (memTotal === 'N/A' || memFree === 'N/A') { |
148 | 138 | return false; |
149 | 139 | } else { |
150 | 140 | return true; |
151 | 141 | } |
152 | 142 | } |
153 | | - |
| 143 | + |
154 | 144 | function isSwapStat(swapTotal, swapFree) { |
155 | 145 | if (swapTotal === 'N/A' || swapFree === 'N/A') { |
156 | 146 | return false; |
|
207 | 197 | if (isMemoryStat(memTotal, memFree)) { |
208 | 198 | $memFooterInfo.text(t('serverinfo','RAM: Total: {memTotalBytes}/Current usage: {memUsageBytes}', { memTotalBytes: OC.Util.humanFileSize(memTotalBytes), memUsageBytes: OC.Util.humanFileSize(memUsageBytes) })); |
209 | 199 | memoryUsageLine.append(new Date().getTime(), memUsageGB); |
210 | | - |
| 200 | + |
211 | 201 | if ($memoryCanvas.hasClass('hidden')) { |
212 | 202 | $memoryCanvas.removeClass('hidden'); |
213 | 203 | } |
214 | 204 | } else { |
215 | 205 | $memFooterInfo.text(t('serverinfo', 'RAM info not available')); |
216 | 206 | $memoryCanvas.addClass('hidden'); |
217 | 207 | } |
218 | | - |
| 208 | + |
219 | 209 | if (isSwapStat(swapTotal, swapFree)) { |
220 | 210 | $swapFooterInfo.text(t('serverinfo','SWAP: Total: {swapTotalBytes}/Current usage: {swapUsageBytes}', { swapTotalBytes: OC.Util.humanFileSize(swapTotalBytes), swapUsageBytes: OC.Util.humanFileSize(swapUsageBytes) })); |
221 | 211 | swapUsageLine.append(new Date().getTime(), swapUsageGB); |
|
224 | 214 | } |
225 | 215 | } |
226 | 216 |
|
227 | | - function updateShareStatistics() { |
228 | | - |
229 | | - var shares = $('#sharecanvas').data('shares'), |
230 | | - sharesData = [shares.num_shares_user, |
231 | | - shares.num_shares_groups, |
232 | | - shares.num_shares_link, |
233 | | - shares.num_shares_mail, |
234 | | - shares.num_fed_shares_sent, |
235 | | - shares.num_fed_shares_received, |
236 | | - shares.num_shares_room |
237 | | - ], |
238 | | - stepSize = 0; |
239 | | - |
240 | | - if (Math.max.apply(null, sharesData) < 10) { |
241 | | - stepSize = 1; |
242 | | - } |
243 | | - |
244 | | - if (typeof sharesChart === 'undefined') { |
245 | | - var ctx = document.getElementById("sharecanvas"); |
246 | | - |
247 | | - sharesChart = new Chart(ctx, { |
248 | | - type: 'bar', |
249 | | - data: { |
250 | | - labels: [ |
251 | | - t('serverinfo', 'Users'), |
252 | | - t('serverinfo', 'Groups'), |
253 | | - t('serverinfo', 'Links'), |
254 | | - t('serverinfo', 'Emails'), |
255 | | - t('serverinfo', 'Federated sent'), |
256 | | - t('serverinfo', 'Federated received'), |
257 | | - t('serverinfo', 'Talk conversations'), |
258 | | - ], |
259 | | - datasets: [{ |
260 | | - label: " ", |
261 | | - data: sharesData, |
262 | | - backgroundColor: [ |
263 | | - 'rgba(0, 76, 153, 0.2)', |
264 | | - 'rgba(51, 153, 255, 0.2)', |
265 | | - 'rgba(207, 102, 0, 0.2)', |
266 | | - 'rgba(255, 178, 102, 0.2)', |
267 | | - 'rgba(0, 153, 0, 0.2)', |
268 | | - 'rgba(153, 255, 51, 0.2)', |
269 | | - 'rgba(178, 102, 255, 0.2)' |
270 | | - ], |
271 | | - borderColor: [ |
272 | | - 'rgba(0, 76, 153, 1)', |
273 | | - 'rgba(51, 153, 255, 1)', |
274 | | - 'rgba(207, 102, 0, 1)', |
275 | | - 'rgba(255, 178, 102, 1)', |
276 | | - 'rgba(0, 153, 0, 1)', |
277 | | - 'rgba(153, 255, 51, 1)', |
278 | | - 'rgba(178, 102, 255, 1)' |
279 | | - ], |
280 | | - borderWidth: 1 |
281 | | - }] |
282 | | - }, |
283 | | - options: { |
284 | | - plugins: { legend: { display: false } }, |
285 | | - scales: { |
286 | | - yAxes: { |
287 | | - ticks: { |
288 | | - min: 0, |
289 | | - stepSize: stepSize |
290 | | - } |
291 | | - } |
292 | | - } |
293 | | - } |
294 | | - }); |
295 | | - } |
296 | | - |
297 | | - sharesChart.update(); |
298 | | - } |
299 | | - |
300 | | - function updateActiveUsersStatistics() { |
301 | | - |
302 | | - var activeUsers = $('#activeuserscanvas').data('users'), |
303 | | - activeUsersData = [activeUsers.last24hours, activeUsers.last1hour, activeUsers.last5minutes], |
304 | | - stepSize = 0; |
305 | | - |
306 | | - if (Math.max.apply(null, activeUsersData) < 10) { |
307 | | - stepSize = 1; |
308 | | - } |
309 | | - |
310 | | - if (typeof activeUsersChart === 'undefined') { |
311 | | - var ctx = document.getElementById("activeuserscanvas"); |
312 | | - |
313 | | - activeUsersChart = new Chart(ctx, { |
314 | | - type: 'line', |
315 | | - data: { |
316 | | - labels: [ |
317 | | - t('serverinfo', '24 hours'), |
318 | | - t('serverinfo', '1 hour'), |
319 | | - t('serverinfo', '5 mins') |
320 | | - ], |
321 | | - datasets: [{ |
322 | | - label: " ", |
323 | | - data: activeUsersData, |
324 | | - fill: false, |
325 | | - borderColor: [getThemedPrimaryColor()], |
326 | | - borderWidth: 1, |
327 | | - borderDashOffset: 0.0, |
328 | | - borderJoinStyle: 'miter', |
329 | | - pointBorderColor: getThemedPrimaryColor(), |
330 | | - pointBackgroundColor: getThemedPassiveColor(), |
331 | | - pointBorderWidth: 1, |
332 | | - pointHoverRadius: 5, |
333 | | - pointHoverBackgroundColor: getThemedPrimaryColor(), |
334 | | - pointHoverBorderColor: getThemedPrimaryColor(), |
335 | | - pointHoverBorderWidth: 1, |
336 | | - pointRadius: 5, |
337 | | - pointHitRadius: 10, |
338 | | - lineTension: 0 |
339 | | - }] |
340 | | - }, |
341 | | - options: { |
342 | | - plugins: { legend: { display: false } }, |
343 | | - scales: { |
344 | | - yAxes: { |
345 | | - ticks: { |
346 | | - min: 0, |
347 | | - stepSize: stepSize |
348 | | - } |
349 | | - } |
350 | | - } |
351 | | - } |
352 | | - }); |
353 | | - } |
354 | | - } |
355 | | - |
356 | 217 | function setHumanReadableSizeToElement(elementId) { |
357 | 218 | var maxUploadSize = parseInt($('#' + elementId).text()); |
358 | 219 |
|
|
362 | 223 | } |
363 | 224 |
|
364 | 225 | function initMonitoringLinkToClipboard() { |
365 | | - var monAPIBox = $("#ocsEndPoint"); |
366 | | - /* reused from settings/js/authtoken_view.js */ |
367 | | - monAPIBox.find('.clipboardButton').tooltip({placement: 'bottom', title: t('core', 'Copy'), trigger: 'hover'}); |
368 | | - |
369 | | - // Clipboard! |
370 | 226 | var clipboard = new Clipboard('.clipboardButton'); |
371 | 227 | clipboard.on('success', function (e) { |
372 | | - var $input = $(e.trigger); |
373 | | - $input.tooltip('hide') |
374 | | - .attr('data-original-title', t('core', 'Copied!')) |
375 | | - .tooltip('fixTitle') |
376 | | - .tooltip({placement: 'bottom', trigger: 'manual'}) |
377 | | - .tooltip('show'); |
378 | | - _.delay(function () { |
379 | | - $input.tooltip('hide') |
380 | | - .attr('data-original-title', t('core', 'Copy')) |
381 | | - .tooltip('fixTitle'); |
382 | | - }, 3000); |
| 228 | + OC.Notification.show('Copied!', { type: 'success' }) |
383 | 229 | }); |
384 | | - clipboard.on('error', function (e) { |
385 | | - var $input = $(e.trigger); |
| 230 | + clipboard.on('error', function () { |
386 | 231 | var actionMsg = ''; |
387 | 232 | if (/iPhone|iPad/i.test(navigator.userAgent)) { |
388 | 233 | actionMsg = t('core', 'Not supported!'); |
|
391 | 236 | } else { |
392 | 237 | actionMsg = t('core', 'Press Ctrl-C to copy.'); |
393 | 238 | } |
394 | | - |
395 | | - $input.tooltip('hide') |
396 | | - .attr('data-original-title', actionMsg) |
397 | | - .tooltip('fixTitle') |
398 | | - .tooltip({placement: 'bottom', trigger: 'manual'}) |
399 | | - .tooltip('show'); |
400 | | - _.delay(function () { |
401 | | - $input.tooltip('hide') |
402 | | - .attr('data-original-title', t('core', 'Copy')) |
403 | | - .tooltip('fixTitle'); |
404 | | - }, 3000); |
| 239 | + OC.Notification.show(actionMsg, { type: 'error' }) |
405 | 240 | }); |
406 | 241 | } |
407 | 242 |
|
|
415 | 250 | var i; |
416 | 251 | for (i = 0; i < diskcharts.length; i++) { |
417 | 252 | var chartdata = { |
418 | | - labels: ["Used GB", "Available GB"], |
419 | 253 | datasets: [ |
420 | 254 | { |
421 | 255 | backgroundColor: [ |
422 | 256 | getThemedPrimaryColor(), |
423 | 257 | getThemedPassiveColor(), |
424 | 258 | ], |
425 | | - borderWidth: 0, |
426 | | - data: diskdata[i] |
| 259 | + data: diskdata[i], |
427 | 260 | } |
428 | 261 | ] |
429 | 262 | }; |
|
432 | 265 | type: 'doughnut', |
433 | 266 | data: chartdata, |
434 | 267 | options: { |
435 | | - plugins: { legend: { display: false } }, |
| 268 | + plugins: { |
| 269 | + legend: { display: false }, |
| 270 | + tooltip: { |
| 271 | + enabled: false |
| 272 | + } |
| 273 | + }, |
436 | 274 | tooltips: { |
437 | 275 | enabled: true, |
438 | 276 | }, |
|
0 commit comments