diff options
author | nztqa <nztqa@users.noreply.github.com> | 2017-08-03 09:24:40 +0900 |
---|---|---|
committer | nztqa <nztqa@users.noreply.github.com> | 2017-08-03 09:24:40 +0900 |
commit | e407eb9a8b91d1100315f2fcab2cf8d184957929 (patch) | |
tree | 197510f28ad8ef829abc0f085a07dad2086eb943 /client/components/settings/informationBody.js | |
parent | 3085230b13e55542a4d95e9357366688b3e2fd1a (diff) | |
download | wekan-e407eb9a8b91d1100315f2fcab2cf8d184957929.tar.gz wekan-e407eb9a8b91d1100315f2fcab2cf8d184957929.tar.bz2 wekan-e407eb9a8b91d1100315f2fcab2cf8d184957929.zip |
Add display wekan version number and runtime environment
Diffstat (limited to 'client/components/settings/informationBody.js')
-rw-r--r-- | client/components/settings/informationBody.js | 48 |
1 files changed, 48 insertions, 0 deletions
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'); |