Files
wekan/client/components/settings/informationBody.js
T
Lauri Ojansivu b7589737f5 File docs/Features the way the WeKan menus are.
A feature's guide now sits under the menu it is used from, read from the
templates rather than from where somebody once put it: Header-Bar,
All-Boards, Pages, Board-Header (search and every Board View), Board-Sidebar
(Board Settings, Filter, Members, Labels, Archive), Rules, Swimlanes, Lists,
Cards, Member-Settings, Admin-Panel and Login-Page. Topics used from several
menus (editor, history, theme, translations, email, troubleshooting) are in
General.

- Each area has a README mapping its menu entries to their guides and to the
  template or server module that implements them. Board-Header/README.md
  lists all 40 Board View entries with the template boardBody.jade renders;
  five views (Table, Calendar Mode, Time, Timeline, Map) have no guide of
  their own yet and say so.
- Board-View.md listed 25 views while BOARD_VIEWS has 40; it now lists all
  of them with their English labels.
- Pages keep their file names. Where a released changelog links an old path,
  a "# Moved" page stays there and points to the new one; test-menu.sh skips
  folders holding only those.
- Undo was filed under Login; it is General/Undo now.
- Every link in docs, code comments, scripts and tests follows the move;
  docsLinksResolve checks them all.

Tests that read a doc follow it to its new place. boardViewSettings now fails
when Board-View.md or Board-Header/README.md differs from BOARD_VIEWS, or
names a template boardBody.jade does not render.

Thanks to xet7 !
2026-10-16 23:45:35 +03:00

95 lines
2.7 KiB
JavaScript

import { TAPi18n } from '/imports/i18n';
const { filesize } = require('filesize');
Template.statistics.onCreated(function () {
this.info = new ReactiveVar({});
this.versionManifest = new ReactiveVar('');
this.versionCheckError = new ReactiveVar('');
this.versionCheckRunning = new ReactiveVar(false);
Meteor.call('getStatistics', (error, ret) => {
if (!error && ret) {
this.info.set(ret);
}
});
});
// No page template and no menu of its own any more: Version is the first pane of
// Admin Panel / Settings, whose menu (docs/Features/All-Boards/Left-Menu.md) carries the
// entry that opens it. This file is just the statistics pane now.
Template.statistics.helpers({
statistics() {
return Template.instance().info.get();
},
versionCheckRunning() {
return Template.instance().versionCheckRunning.get();
},
versionCheckError() {
return Template.instance().versionCheckError.get();
},
versionManifestText() {
return Template.instance().versionManifest.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);
},
fileSize(size) {
let ret = "";
if (typeof size === 'number') {
ret = filesize(size);
}
return ret;
},
formatBoolean(value) {
return value ? TAPi18n.__('yes') : TAPi18n.__('no');
},
});
Template.statistics.events({
'click .js-check-newest-versions'(event, instance) {
event.preventDefault();
if (instance.versionCheckRunning.get()) return;
instance.versionCheckRunning.set(true);
instance.versionCheckError.set('');
instance.versionManifest.set('');
Meteor.call('checkNewestVersions', (error, result) => {
instance.versionCheckRunning.set(false);
if (error || !result) {
// Never show an upstream body or exception: GitHub's reply is untrusted,
// and offline, timeout, HTTP and invalid-version failures are equivalent
// to the administrator using this on-demand check.
instance.versionCheckError.set(TAPi18n.__('version-check-failed'));
return;
}
instance.versionManifest.set(result.text);
});
},
});