Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
886465e
[tx-robot] updated from transifex
nextcloud-bot Jan 18, 2020
0da376c
[tx-robot] updated from transifex
nextcloud-bot Jan 19, 2020
04b37ff
[tx-robot] updated from transifex
nextcloud-bot Jan 21, 2020
eb36a72
Update version on master
nickvergessen Jan 20, 2020
9fbe064
[tx-robot] updated from transifex
nextcloud-bot Jan 29, 2020
2a13cd5
[tx-robot] updated from transifex
nextcloud-bot Feb 1, 2020
c3f7769
[tx-robot] updated from transifex
nextcloud-bot Feb 4, 2020
ee1e59e
[tx-robot] updated from transifex
nextcloud-bot Feb 5, 2020
44f0308
[tx-robot] updated from transifex
nextcloud-bot Feb 6, 2020
68b41ad
[tx-robot] updated from transifex
nextcloud-bot Feb 20, 2020
a22c5da
[tx-robot] updated from transifex
nextcloud-bot Feb 26, 2020
218add9
Enqueue next update after the last update is done
kesselb Feb 25, 2020
6b3994d
Avoid line breaks after long device names
mikoMK Feb 26, 2020
6195980
Do not print errors if time server config is not available
juliusknorr Mar 3, 2020
799760a
[tx-robot] updated from transifex
nextcloud-bot Mar 6, 2020
3dd4373
reseted fork to upstream/master and applied patch gracefully provided…
LordSimal Dec 19, 2019
114a7e8
fix code indention + convert snake case variabs to camelCase
LordSimal Dec 19, 2019
ec50d60
Revert changes to .gitignore and settings-admin.php
kesselb Jan 1, 2020
a49d657
Revert more whitespace in settings-admin.php
kesselb Jan 1, 2020
9df4383
Put the info text below the input.
kesselb Jan 2, 2020
91ad213
renamed style.css to style.scss and added -mobile variable for media …
LordSimal Feb 8, 2020
7adb7ca
removed custom svg icons and added nextcloud core icons to section he…
LordSimal Feb 24, 2020
579ef6a
reseted fork to upstream/master and applied patch gracefully provided…
LordSimal Dec 19, 2019
00b1fd7
fix code indention + convert snake case variabs to camelCase
LordSimal Dec 19, 2019
b7bc32e
Revert changes to .gitignore and settings-admin.php
kesselb Jan 1, 2020
30fc66f
Revert more whitespace in settings-admin.php
kesselb Jan 1, 2020
88bb1a4
Put the info text below the input.
kesselb Jan 2, 2020
a7e9b0e
renamed style.css to style.scss and added -mobile variable for media …
LordSimal Feb 8, 2020
d105cc2
removed custom svg icons and added nextcloud core icons to section he…
LordSimal Feb 24, 2020
e391ed3
Merge branch 'master' into master
LordSimal Mar 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix code indention + convert snake case variabs to camelCase
Signed-off-by: Kevin Pfeifer <kevin.pfeifer@sunlime.at>
  • Loading branch information
LordSimal committed Mar 13, 2020
commit 00b1fd7df128abc5ef543cc3dfc2dd8d748d7c76
73 changes: 36 additions & 37 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,41 +72,40 @@
* Reset all canvas widths on window resize so canvas is responsive
*/
function resizeSystemCharts() {
var cpu_canvas = $("#cpuloadcanvas"),
cpu_canvas_width = cpu_canvas.parents('.infobox').width() - 30,
mem_canvas = $("#memorycanvas"),
mem_canvas_width = mem_canvas.parents('.infobox').width() - 30,
active_users_canvas = $("#activeuserscanvas"),
active_users_canvas_width = active_users_canvas.parents('.infobox').width() - 30,
share_canvas = $("#sharecanvas"),
share_canvas_width = share_canvas.parents('.infobox').width() - 30,
current_vw = $(window).width();
var cpuCanvas = $("#cpuloadcanvas"),
cpuCanvasWidth = cpuCanvas.parents('.infobox').width() - 30,
memCanvas = $("#memorycanvas"),
memCanvasWidth = memCanvas.parents('.infobox').width() - 30,
activeUsersCanvas = $("#activeuserscanvas"),
activeUsersCanvasWidth = activeUsersCanvas.parents('.infobox').width() - 30,
shareCanvas = $("#sharecanvas"),
shareCanvasWidth = shareCanvas.parents('.infobox').width() - 30;

// We have to set css width AND attribute width
cpu_canvas.width(cpu_canvas_width);
cpu_canvas.attr('width', cpu_canvas_width);
mem_canvas.width(mem_canvas_width);
mem_canvas.attr('width', mem_canvas_width);
active_users_canvas.width(active_users_canvas_width);
active_users_canvas.attr('width', active_users_canvas_width);
share_canvas.width(share_canvas_width);
share_canvas.attr('width', share_canvas_width);
cpuCanvas.width(cpuCanvasWidth);
cpuCanvas.attr('width', cpuCanvasWidth);
memCanvas.width(memCanvasWidth);
memCanvas.attr('width', memCanvasWidth);
activeUsersCanvas.width(activeUsersCanvasWidth);
activeUsersCanvas.attr('width', activeUsersCanvasWidth);
shareCanvas.width(shareCanvasWidth);
shareCanvas.attr('width', shareCanvasWidth);

updateShareStatistics();
updateActiveUsersStatistics();
}

function updateCPUStatistics(cpuload) {
var $cpu_footer_info = $('#cpuFooterInfo');
var $cpu_load_canvas = $('#cpuloadcanvas');
var $cpuFooterInfo = $('#cpuFooterInfo');
var $cpuLoadCanvas = $('#cpuloadcanvas');

if (cpuload === 'N/A') {
$cpu_footer_info.text(t('serverinfo', 'CPU info not available'));
$cpu_load_canvas.addClass('hidden');
$cpuFooterInfo.text(t('serverinfo', 'CPU info not available'));
$cpuLoadCanvas.addClass('hidden');
return;

} else if ($cpu_load_canvas.hasClass('hidden')) {
$cpu_load_canvas.removeClass('hidden');
} else if ($cpuLoadCanvas.hasClass('hidden')) {
$cpuLoadCanvas.removeClass('hidden');
}

var cpu1 = cpuload[0],
Expand All @@ -131,21 +130,21 @@
});
}

$cpu_footer_info.text(t('serverinfo', 'Load average') + ": " + cpu1 + " (" + t('serverinfo', 'Last minute') + ")");
$cpuFooterInfo.text(t('serverinfo', 'Load average') + ": " + cpu1 + " (" + t('serverinfo', 'Last minute') + ")");
cpuLoadLine.append(new Date().getTime(), cpu1);
}

function updateMemoryStatistics(memTotal, memFree, swapTotal, swapFree) {
var $mem_footer_info = $('#memFooterInfo');
var $memory_canvas = $('#memorycanvas');
var $memFooterInfo = $('#memFooterInfo');
var $memoryCanvas = $('#memorycanvas');

if (memTotal === 'N/A' || memFree === 'N/A') {
$mem_footer_info.text(t('serverinfo', 'Memory info not available'));
$memory_canvas.addClass('hidden');
$memFooterInfo.text(t('serverinfo', 'Memory info not available'));
$memoryCanvas.addClass('hidden');
return;

} else if ($memory_canvas.hasClass('hidden')) {
$memory_canvas.removeClass('hidden');
} else if ($memoryCanvas.hasClass('hidden')) {
$memoryCanvas.removeClass('hidden');
}

var memTotalBytes = memTotal * 1024,
Expand Down Expand Up @@ -188,7 +187,7 @@
});
}

$mem_footer_info
$memFooterInfo
.text("RAM: " + t('serverinfo', 'Total') + ": " + OC.Util.humanFileSize(memTotalBytes) + " - " + t('serverinfo', 'Current usage') + ": " + OC.Util.humanFileSize(memUsageBytes));
memoryUsageLine.append(new Date().getTime(), memUsageGB);
$('#swapFooterInfo')
Expand All @@ -199,7 +198,7 @@
function updateShareStatistics() {

var shares = $('#sharecanvas').data('shares'),
shares_data = [shares.num_shares_user,
sharesData = [shares.num_shares_user,
shares.num_shares_groups,
shares.num_shares_link,
shares.num_shares_mail,
Expand All @@ -209,7 +208,7 @@
],
stepSize = 0;

if (Math.max.apply(null, shares_data) < 10) {
if (Math.max.apply(null, sharesData) < 10) {
stepSize = 1;
}

Expand All @@ -230,7 +229,7 @@
],
datasets: [{
label: " ",
data: shares_data,
data: sharesData,
backgroundColor: [
'rgba(0, 76, 153, 0.2)',
'rgba(51, 153, 255, 0.2)',
Expand Down Expand Up @@ -272,10 +271,10 @@
function updateActiveUsersStatistics() {

var activeUsers = $('#activeuserscanvas').data('users'),
activeUsers_data = [activeUsers.last24hours, activeUsers.last1hour, activeUsers.last5minutes],
activeUsersData = [activeUsers.last24hours, activeUsers.last1hour, activeUsers.last5minutes],
stepSize = 0;

if (Math.max.apply(null, activeUsers_data) < 10) {
if (Math.max.apply(null, activeUsersData) < 10) {
stepSize = 1;
}

Expand All @@ -292,7 +291,7 @@
],
datasets: [{
label: " ",
data: activeUsers_data,
data: activeUsersData,
fill: false,
borderColor: ['rgba(0, 0, 255, 1)'],
borderWidth: 1,
Expand Down
64 changes: 32 additions & 32 deletions templates/settings-admin.php
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
<?php
/**
* @copyright Copyright (c) 2016 Bjoern Schiessle <bjoern@schiessle.org>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* @copyright Copyright (c) 2016 Bjoern Schiessle <bjoern@schiessle.org>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

script('serverinfo', 'script');
script('serverinfo', 'smoothie');
script('serverinfo', 'Chart.min');
script('serverinfo', 'script');
script('serverinfo', 'smoothie');
script('serverinfo', 'Chart.min');

style('serverinfo', 'style');
style('serverinfo', 'style');

function FormatBytes($byte) {
$unim = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
$count = 1;
while ($byte >= 1024) {
$count++;
$byte = $byte / 1024;
}
function FormatBytes($byte) {
$unim = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
$count = 1;
while ($byte >= 1024) {
$count++;
$byte = $byte / 1024;
}

return number_format($byte, 2, '.', '.') . ' ' . $unim[$count];
}
return number_format($byte, 2, '.', '.') . ' ' . $unim[$count];
}

?>

Expand Down