summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/components/settings/informationBody.jade51
-rw-r--r--client/components/settings/informationBody.js48
-rw-r--r--client/components/settings/settingHeader.jade7
-rw-r--r--config/router.js20
-rw-r--r--i18n/en.i18n.json16
-rw-r--r--package.json1
-rw-r--r--server/statistics.js26
7 files changed, 166 insertions, 3 deletions
diff --git a/client/components/settings/informationBody.jade b/client/components/settings/informationBody.jade
new file mode 100644
index 00000000..53907513
--- /dev/null
+++ b/client/components/settings/informationBody.jade
@@ -0,0 +1,51 @@
+template(name='information')
+ .setting-content
+ unless currentUser.isAdmin
+ | {{_ 'error-notAuthorized'}}
+ else
+ .content-title
+ span {{_ 'info'}}
+ .content-body
+ .side-menu
+ ul
+ li.active
+ a.js-setting-menu(data-id="information-display") {{_ 'info'}}
+ .main-body
+ +statistics
+
+template(name='statistics')
+ table
+ tbody
+ tr
+ th {{_ 'Wekan_version'}}
+ td {{statistics.version}}
+ tr
+ th {{_ 'Node_version'}}
+ td {{statistics.process.nodeVersion}}
+ tr
+ th {{_ 'OS_Type'}}
+ td {{statistics.os.type}}
+ tr
+ th {{_ 'OS_Platform'}}
+ td {{statistics.os.platform}}
+ tr
+ th {{_ 'OS_Arch'}}
+ td {{statistics.os.arch}}
+ tr
+ th {{_ 'OS_Release'}}
+ td {{statistics.os.release}}
+ tr
+ th {{_ 'OS_Uptime'}}
+ td {{humanReadableTime statistics.os.uptime}}
+ tr
+ th {{_ 'OS_Loadavg'}}
+ td {{numFormat statistics.os.loadavg.[0]}}, {{numFormat statistics.os.loadavg.[1]}}, {{numFormat statistics.os.loadavg.[2]}}
+ tr
+ th {{_ 'OS_Totalmem'}}
+ td {{bytesToSize statistics.os.totalmem}}
+ tr
+ th {{_ 'OS_Freemem'}}
+ td {{bytesToSize statistics.os.freemem}}
+ tr
+ th {{_ 'OS_Cpus'}}
+ td {{statistics.os.cpus.length}}
diff --git a/client/components/settings/informationBody.js b/client/components/settings/informationBody.js
new file mode 100644
index 00000000..4775bce6
--- /dev/null
+++ b/client/components/settings/informationBody.js
@@ -0,0 +1,48 @@
+BlazeComponent.extendComponent({
+ onCreated() {
+ this.info = new ReactiveVar({});
+ Meteor.call('getStatistics', (error, ret) => {
+ if (!error && ret) {
+ this.info.set(ret);
+ }
+ });
+ },
+
+ statistics() {
+ return this.info.get();
+ },
+
+ humanReadableTime(time) {
+ const days = Math.floor(time / 86400);
+ const hours = Math.floor((time % 86400) / 3600);
+ const minutes = Math.floor(((time % 86400) % 3600) / 60);
+ const seconds = Math.floor(((time % 86400) % 3600) % 60);
+ let out = '';
+ if (days > 0) {
+ out += `${days} ${TAPi18n.__('days')}, `;
+ }
+ if (hours > 0) {
+ out += `${hours} ${TAPi18n.__('hours')}, `;
+ }
+ if (minutes > 0) {
+ out += `${minutes} ${TAPi18n.__('minutes')}, `;
+ }
+ if (seconds > 0) {
+ out += `${seconds} ${TAPi18n.__('seconds')}`;
+ }
+ return out;
+ },
+
+ numFormat(number) {
+ return parseFloat(number).toFixed(2);
+ },
+
+ bytesToSize(bytes) {
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
+ if (bytes === 0) {
+ return '0 Byte';
+ }
+ const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)), 10);
+ return `${Math.round(bytes / Math.pow(1024, i), 2)} ${sizes[i]}`;
+ },
+}).register('statistics');
diff --git a/client/components/settings/settingHeader.jade b/client/components/settings/settingHeader.jade
index fb884056..c22cf5c6 100644
--- a/client/components/settings/settingHeader.jade
+++ b/client/components/settings/settingHeader.jade
@@ -6,10 +6,13 @@ template(name="settingHeaderBar")
unless isMiniScreen
unless isSandstorm
if currentUser
- a.setting-header-btn.settings.active
+ a.setting-header-btn.settings(href="{{pathFor 'setting'}}")
i.fa(class="fa-cog")
span {{_ 'settings'}}
-//TODO
+ a.setting-header-btn.informations(href="{{pathFor 'information'}}")
+ i.fa(class="fa-info-circle")
+ span {{_ 'info'}}
+//TODO
// a.setting-header-btn.people
// i.fa(class="fa-users")
// span {{_ 'people'}}
diff --git a/config/router.js b/config/router.js
index ea85c7e6..7f657820 100644
--- a/config/router.js
+++ b/config/router.js
@@ -120,6 +120,26 @@ FlowRouter.route('/setting', {
},
});
+FlowRouter.route('/information', {
+ name: 'information',
+ triggersEnter: [
+ AccountsTemplates.ensureSignedIn,
+ () => {
+ Session.set('currentBoard', null);
+ Session.set('currentCard', null);
+
+ Filter.reset();
+ EscapeActions.executeAll();
+ },
+ ],
+ action() {
+ BlazeLayout.render('defaultLayout', {
+ headerBar: 'settingHeaderBar',
+ content: 'information',
+ });
+ },
+});
+
FlowRouter.notFound = {
action() {
BlazeLayout.render('defaultLayout', { content: 'notFound' });
diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json
index e8062f71..e29e7999 100644
--- a/i18n/en.i18n.json
+++ b/i18n/en.i18n.json
@@ -365,5 +365,19 @@
"error-invitation-code-not-exist": "Invitation code doesn't exist",
"error-notAuthorized": "You are not authorized to view this page.",
"outgoing-webhooks": "Outgoing Webhooks",
- "outgoingWebhooksPopup-title": "Outgoing Webhooks"
+ "outgoingWebhooksPopup-title": "Outgoing Webhooks",
+ "Wekan_version": "Wekan version",
+ "Node_version": "Node version",
+ "OS_Arch": "OS Arch",
+ "OS_Cpus": "OS CPU Count",
+ "OS_Freemem": "OS Free Memory",
+ "OS_Loadavg": "OS Load Average",
+ "OS_Platform": "OS Platform",
+ "OS_Release": "OS Release",
+ "OS_Totalmem": "OS Total Memory",
+ "OS_Type": "OS Type",
+ "OS_Uptime": "OS Uptime",
+ "hours": "hours",
+ "minutes": "minutes",
+ "seconds": "seconds"
}
diff --git a/package.json b/package.json
index 410ffc14..ecf694a0 100644
--- a/package.json
+++ b/package.json
@@ -28,6 +28,7 @@
"bson": "^1.0.4",
"es6-promise": "^4.1.0",
"meteor-node-stubs": "^0.2.6",
+ "os": "^0.1.1",
"winston": "^2.3.1",
"winston-zulip": "0.0.6",
"xss": "^0.3.3"
diff --git a/server/statistics.js b/server/statistics.js
new file mode 100644
index 00000000..1fbaecc9
--- /dev/null
+++ b/server/statistics.js
@@ -0,0 +1,26 @@
+Meteor.methods({
+ getStatistics() {
+ const os = require('os');
+ const pjson = require('/package.json');
+ const statistics = {};
+ statistics.version = pjson.version;
+ statistics.os = {
+ type: os.type(),
+ platform: os.platform(),
+ arch: os.arch(),
+ release: os.release(),
+ uptime: os.uptime(),
+ loadavg: os.loadavg(),
+ totalmem: os.totalmem(),
+ freemem: os.freemem(),
+ cpus: os.cpus(),
+ };
+ statistics.process = {
+ nodeVersion: process.version,
+ pid: process.pid,
+ uptime: process.uptime(),
+ };
+
+ return statistics;
+ },
+});