mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
New order top to bottom: Swimlanes, Lists, Table, Calendar, Time,
Statistics, Dashboard, Burndown, Burnup, Cumulative Flow, Control, Cycle
Time, Flow Efficiency, Gantt, Lead Time, Throughput Histogram, WIP Run -
each with its own font-awesome icon. The ten views with no implementation
yet get a real grey page (client/components/boards/chartPlaceholderViews.jade)
titled like their menu entry, with a shared "not implemented yet" note,
instead of a menu item that opens nothing.
"Time spent summary" moves out of Statistics into its own new Time view
(timeView.jade/.js), which keeps the same boardStatus subscription
Statistics already used.
Two places had to learn every new view or switching to one silently failed:
models/users.js's profile.boardView schema only allowed the original six
values, so the server rejected Meteor.call('setBoardView', ...) for any new
one with a 400; and boardHeader.js's tooltip name map fell back to a
generic label for the same ones. tests/boardViewMenu.test.cjs pins the
menu order, that every entry has an icon/handler/isView* helper/placeholder
template, AND both of those - the schema and the tooltip map - against the
same view list, so this cannot drift out of sync silently again.
Thanks to xet7.
65 lines
2.5 KiB
JavaScript
65 lines
2.5 KiB
JavaScript
import { ReactiveCache } from '/imports/reactiveCache';
|
|
import { TAPi18n } from '/imports/i18n';
|
|
import { ReactiveVar } from 'meteor/reactive-var';
|
|
import { Utils } from '/client/lib/utils';
|
|
|
|
// Board view "Statistics" (Tilastot) — a full-width board view (like Swimlanes /
|
|
// Lists / Calendar / Gantt / Table) showing the board's status: its card-loading
|
|
// mode and counts (swimlanes, lists, cards, labels, members, custom fields). The
|
|
// time-spent summary that used to be a second section here now has its own
|
|
// "Time" board view (timeView.jade/.js). Counts come from the server
|
|
// `boardStatus` method so they are accurate even in lazy mode, where the
|
|
// browser only holds the visible card window.
|
|
Template.statsView.onCreated(function() {
|
|
this.status = new ReactiveVar(null);
|
|
this.autorun(() => {
|
|
const boardId = Session.get('currentBoard');
|
|
if (boardId) {
|
|
Meteor.call('boardStatus', boardId, (err, res) => {
|
|
if (!err && res) this.status.set(res);
|
|
});
|
|
}
|
|
});
|
|
});
|
|
|
|
// Read one numeric field from the resolved status, or a placeholder while loading.
|
|
function statsNum(key) {
|
|
const s = Template.instance().status.get();
|
|
return s ? (s[key] || 0) : '…';
|
|
}
|
|
|
|
Template.statsView.events({
|
|
// The board canvas uses drag-to-scroll (the `dragscroll` class), which otherwise
|
|
// swallows pointer/touch drags and prevents selecting text. Stop these events from
|
|
// reaching it so the browser's native selection works — with the mouse (drag) and
|
|
// on touch (long-press) — and any value can be copied to the clipboard.
|
|
'mousedown .stats-view'(event) {
|
|
event.stopPropagation();
|
|
},
|
|
'touchstart .stats-view'(event) {
|
|
event.stopPropagation();
|
|
},
|
|
});
|
|
|
|
Template.statsView.helpers({
|
|
boardTitle() {
|
|
const board = Utils.getCurrentBoard();
|
|
return board ? board.title : '';
|
|
},
|
|
loadingModeLabel() {
|
|
const s = Template.instance().status.get();
|
|
if (!s) return '…';
|
|
const inEffect = s.lazy
|
|
? TAPi18n.__('cards-loading-lazy')
|
|
: TAPi18n.__('cards-loading-all');
|
|
return s.mode === 'auto' ? `${inEffect} (${TAPi18n.__('cards-loading-auto')})` : inEffect;
|
|
},
|
|
swimlaneCount() { return statsNum('swimlanes'); },
|
|
listCount() { return statsNum('lists'); },
|
|
cardCount() { return statsNum('cards'); },
|
|
archivedCardCount() { return statsNum('archivedCards'); },
|
|
labelCount() { return statsNum('labels'); },
|
|
memberCount() { return statsNum('members'); },
|
|
customFieldCount() { return statsNum('customFields'); },
|
|
});
|