mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 17:45:18 -05:00
A new page in the user menu, Workload and capacity (/workload), shows week
by week how much work each person has against the hours they have, across
every board the viewer is an active member of
(docs/Features/Workload/Workload.md):
- Load: a card's new Estimated hours, set in the Time popup beside the time
spent, less that time; story points from the board's Scrum estimate. A
card's work is spread from its start to its due date over the days the
person works; overdue work counts today; undated and unestimated cards are
counted apart, and work nobody carries is shown once as unassigned.
- Capacity: each person's hours per week (default 37.5), work time percent
(part-time 60 % is 22.5 h) and working days. Absences (vacation, sick
leave, day off, training, other) and public holidays set by an
administrator take their days away, and the work moves to the days the
person is there.
- A week over 100 % - more work than hours, allocations over 100 %, or work
in a week with no hours - is red; under half full is grey-blue. Clicking a
week lists its cards.
- Allocations: a board's admins give a member a share of their time on the
board for a period ("A on board X 50 % in April"), or name a role with no
person yet ("Developer x 1, 100 %, next month"), drawn as a placeholder
row with the hours it needs.
The server computes the report (models/lib/workload.js, server/workload.js);
cards are not published for it. Public boards and boards where the viewer
sees only their assigned cards are not included, inactive members are not
reported, and somebody else's absence is dates only: its type and note are
shown to that person and to administrators. Capacity and absences are a
person's own to change (an administrator's for anyone), allocations a board
admin's, holidays an administrator's. The four collections take no client
writes and have no publication; a deleted user's workload data goes with
them. Admin Panel / Features / Workload turns the page and its methods off.
The board's own Workload chart, a count of open cards per person, links to
the page. estimatedHours is copied by WeKan export/import.
tests/workload.test.cjs runs the rules as arithmetic, including the cases of
the request (37.5 h, 60 %, an overloaded week, a vacation, a holiday, 50 %
of April, the placeholder roles); tests/workloadAccess.test.cjs runs the real
methods as each kind of user; tests/playwright/specs/workload-capacity.e2e.js
drives the page. The new strings are translated into every language; low
confidence for the smallest ones (e.g. Tigre, Klingon, Wolaytta, Venda,
Vepsian, Cherokee, Dzongkha, Inuktitut, Nahuatl). In several locales the
eleven still-English enrollment/registration/auth strings were translated
too. The hour symbol h is language-independent in fill-translations.mjs.
Thanks to xet7 !
82 lines
3.0 KiB
JavaScript
82 lines
3.0 KiB
JavaScript
'use strict';
|
|
|
|
// Which controls the shared page sidebar shows, per page.
|
|
//
|
|
// A page's controls used to live in its own second header bar, beside its `h1`.
|
|
// The title moved to the first bar (models/lib/pageTitles.js) and the controls
|
|
// moved into a right sidebar, so a page is its content plus one panel rather
|
|
// than its content plus a strip of buttons above it.
|
|
//
|
|
// A board has its own sidebar and All Boards has its own; this is for every
|
|
// OTHER page. Most have no controls at all - their second bar was only a title
|
|
// - and those get no sidebar and no hamburger, because an empty panel is worse
|
|
// than none.
|
|
//
|
|
// Pure: a route name in, a Blaze template name out. No Meteor, no router.
|
|
// docs/Features/Header-Bar/Header.md
|
|
|
|
// routeName -> the template that draws that page's controls.
|
|
const PAGE_SIDEBAR_TEMPLATES = {
|
|
'my-cards': 'myCardsControls',
|
|
'due-cards': 'dueCardsControls',
|
|
workload: 'workloadControls',
|
|
'global-search': 'globalSearchControls',
|
|
};
|
|
|
|
// The routes that have their own sidebar already, and so must NOT get this one.
|
|
const OWN_SIDEBAR_ROUTES = [
|
|
// Every board route: the board sidebar. The Rules page is a page of the
|
|
// board and uses it too; its own sidebar, which held only its views, is gone
|
|
// - they are in Board Settings under Rules, in the board sidebar.
|
|
'board', 'card', 'boardCard', 'board-rules',
|
|
// All Boards and its sections, and Public: the All Boards sidebar.
|
|
'home', 'allboards', 'allboards-templates', 'allboards-remaining', 'public',
|
|
];
|
|
|
|
// ...and of those, the routes that must NOT be offered the HAMBURGER.
|
|
//
|
|
// All Boards has a sidebar, but nothing opens it from the top of the panel any
|
|
// more: its four controls are in the first header bar, and Search and
|
|
// Multi-Selection open the sidebar straight into their own view. The
|
|
// hamburger's only destination was a home view listing those same four things,
|
|
// so it opened a menu to reach what is now one click away.
|
|
//
|
|
// A board keeps its hamburger: what its sidebar holds - members, labels,
|
|
// activities, settings - is not in the bar and has nowhere else to be opened
|
|
// from.
|
|
const NO_HAMBURGER_ROUTES = [
|
|
'home', 'allboards', 'allboards-templates', 'allboards-remaining', 'public',
|
|
];
|
|
|
|
function hasHamburger(routeName) {
|
|
return !NO_HAMBURGER_ROUTES.includes(routeName);
|
|
}
|
|
|
|
function hasOwnSidebar(routeName) {
|
|
return OWN_SIDEBAR_ROUTES.includes(routeName);
|
|
}
|
|
|
|
// The controls template for a route, or null when that page has none.
|
|
function pageSidebarTemplate(routeName) {
|
|
if (hasOwnSidebar(routeName)) return null;
|
|
return Object.prototype.hasOwnProperty.call(PAGE_SIDEBAR_TEMPLATES, routeName)
|
|
? PAGE_SIDEBAR_TEMPLATES[routeName]
|
|
: null;
|
|
}
|
|
|
|
// Whether the hamburger should be offered at all. A page with no sidebar and
|
|
// nothing to put in one must not show a control that opens an empty panel.
|
|
function hasPageSidebar(routeName) {
|
|
return pageSidebarTemplate(routeName) !== null;
|
|
}
|
|
|
|
module.exports = {
|
|
PAGE_SIDEBAR_TEMPLATES,
|
|
OWN_SIDEBAR_ROUTES,
|
|
NO_HAMBURGER_ROUTES,
|
|
hasOwnSidebar,
|
|
hasHamburger,
|
|
pageSidebarTemplate,
|
|
hasPageSidebar,
|
|
};
|