mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 04:49:41 -05:00
dcefd4b367cec460e6e8b7d23cbdbb758eef5c19
12
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c1add5bc5e |
Paginate the admin lists honestly: one page of ten, index-backed.
Admin Panel / People showed the admin on every one of its 578 pages, and Admin Panel / Problems / Broken cards was one endless page under a pager that said "1 / 1". Same bug in two shapes: the pane subscribes to a publication that sends exactly one page, then reads the page back out of minimongo - which holds far more than the page. The logged-in user's own record is always there (accounts publishes it), and so is every card of every board the admin has opened. A plain find(query) cannot tell those apart from the page. So the server names the page. getPeoplePageIds returns the ids of the People page with the publication's own selector, sort and window; the Broken cards, Cards and Boards report publications send the ids of the page they just sent alongside it. Both panes render that list, in that order, and nothing else. Every paginated page in WeKan now loads ten rows at a time, from one constant - TABLE_PAGE_ROWS_PER_PAGE - including the pages that draw a pager of their own: the reports and event streams, the four People panes, Translation, the search pages and the archive. docs/Design/Page/Table.md records the rule and its two deliberate exceptions. And the counting behind those pagers is index-backed. Every count already asks the database for a count rather than fetching the rows, but several counted and paged on unindexed fields: People sorts users newest-first, so on an instance with 14000 users each page of ten sorted all 14000 first. Broken cards asks an $or over boardId/swimlaneId/listId/type, which uses no index at all unless every branch has one. The missing indexes are created at startup by the idempotent ensureIndex, so an upgrade adds them by itself. Thanks to xet7 ! |
||
|
|
fc0fe31779 |
Admin Panel / Problems: Broken cards is a report, and the menu says which group is which.
Broken cards was the one entry in this menu with a different set of controls: no
search box, no total, no "page X / N", just a prev/next of its own - because it
ran on the global-search machinery (CardSearchPaged, a session document and the
nextPage/previousPage publications) instead of the shared table page. It is a
column spec in REPORT_TABLES now, like Files, Rules, Boards and Cards, driven by
the same loadReport(): a new admin-only `brokenCardsReport` publication takes a
search term plus limit/skip and publishes ONE page manually (a returned
sorted+limited cursor hangs on FerretDB's OpLog, as with the other reports), and
`getBrokenCardsReportCount` gives the total behind the counter.
What "broken" means - no board, swimlane or list, or a type that is not a card
type - is now one selector shared by the report and by the standalone
/broken-cards page, which still runs on the global search and keeps its own
publication unchanged.
The menu is two named groups. Summary, then a rule and a "Settings" title over the
two panes that came from Admin Panel / Features, then a rule and a "Reports" title
over the reports. A title is a new kind of menu item - `{ heading: true, labelKey }`
- with no id, no icon and no handler class, so there is nothing to click, nothing
for the page's click handler to read a data-id from, and it can never be the active
row (or a group name could end up as a pane title). Both use an i18n key the app
already has, so no language has to translate anything new.
Performance moves down to sit with the Speed, Tests and CPU usage streams it is
about, below Impersonation Report - it was three groups away from them, up with the
other two Features panes.
While there: the separator between groups is styled with the menu itself. The rule
for it lived in adminReports.css, twice, targeting a class the shared menu does not
render - so it had never applied to anything.
Thanks to xet7 !
|
||
|
|
d232194070 |
Admin Panel: the tables fit, every pane has a title, and Version opens first.
Reported one after another, all in the Admin Panel, and they turned out to share
two causes: a stylesheet deciding a table's width from outside the design that
owns it, and a pane having to write for itself what every pane needs.
The tables
* Admin Panel / People / People rendered NOTHING - no table, no search box, no
pager. `buildFilters` and `buildActions` were used in peopleTablePageData but
never imported. That is not a build error: it is a ReferenceError thrown inside
a helper while rendering, which Blaze answers by rendering nothing at all.
Organizations, Teams and Domains use neither function, so they drew normally,
which is what made it look like a People-only problem.
* The right-hand side of a table was off screen - reported on Domains, and just
as true of Admin Panel / Version, where the value column was cut off at the
window edge. Two admin stylesheets forced `min-width: 1200px !important;
width: max-content !important` with nowrap cells on a bare `table` selector.
peopleBody.css had no page in the selector at all, so it reached every table in
WeKan, and `!important` beat the shared table page's own width:100% +
table-layout:fixed. The same rules also made a SHORT table shrink to its
content, which is why Domains sat at a third of the panel on a narrow window.
No admin table is forced wide any more: it fits its panel and its cells wrap,
and the phone-width exception that used to undo the floor is simply the rule at
every width. The shared table page's width and wrapping are `!important` now -
a guarantee a stylesheet in another folder can silently override is not a
guarantee.
* An empty table page rendered no table at all, and the "New" link of
Organizations, Teams, People and Translation is a column HEADER - so an empty
pane had no way to create the first row. The table always renders now; the
"no items" message moved below it.
* The controls row: every control shares one height and no margin. forms.css is
`button { display: block; margin-bottom: 14px }`, written for stacked form
buttons, so a button that kept that margin was centred higher than one that did
not - "Unlock all users" sat lower and shorter than "Teams" beside it, since it
also carried a 20px margin and a 28px height from the old hand-written header.
Action buttons are themed with the pager, in the one stylesheet that owns those
colours, every state spelled out, or a bare <button> falls through to the
forms.css fallback, which is literally black.
Admin Panel / Settings / Translation now renders through the shared table page
(docs/Design/Page/Table.md) instead of a hand-written table: four columns, an
interactive row, the "New" link as a column header. It pages ONE page of 25
server-side with limit/skip and a count method, where it used to grow a window by
infinite scroll; the publication publishes the field it is sorted by, so the
client's sort matches the server's page.
The pane title
Every Admin Panel pane opens with the same heading, and the heading is the ACTIVE
LEFT MENU ENTRY's own label - `paneTitle()` in models/lib/leftMenu.js, one class
`.admin-pane-title`, which the shared table page's own title carries too. Before
this only the paginated table pages had a title at all: Domains said "Domains"
while Login, Announcement, Accessibility, PWA and Version opened with no heading.
Deriving it from the menu is what keeps them identical - a pane cannot end up with
a title of a different size or none at all - and it is why a table page inside the
Admin Panel now passes no titleKey: the section already rendered the heading.
The menus
* Version is the FIRST pane of Admin Panel / Settings and the one that opens with
the page, so what an admin sees first is the version, database and system
information they usually came for. Its page, its one-entry menu and its tab are
gone - a page whose menu had a single entry was a page in name only - and
/information redirects to Settings, the same move Translation made.
* Admin Panel / People: Domains moves up beside E-mail, the settings it is about.
* Admin Panel / Attachments: Backup moves to the top.
Tests: tests/tablePage.test.cjs gains the Translation conversion, the empty-table
header, the one-height controls row, the themed actions and a guard that no admin
stylesheet may force a table's width; tests/leftMenu.test.cjs gains the pane title
(helper, template, every page renders it, one shared size) and Version as the
first Settings pane; tests/translationPane.test.cjs is rewritten for the pane that
is left once the shared design owns the table.
Thanks to xet7 !
|
||
|
|
ccc95bffba |
Admin Panel / People: search, filter and actions move to the shared controls row.
The last loose end of the People conversion. Its search box, its show-filter
dropdown, its "Unlock all users" and "Add / Remove Teams" buttons and its user
count lived in the PAGE HEADER, a different template from the table they act on.
They are the shared controls row now - the same slots this design gained FROM
People a few commits ago, finally used by it.
Its separate Search BUTTON is gone. Every table page searches on Enter, and a
second way to search is exactly the divergence this design removes.
Three things had to change with them, not just move:
- The search term is STATE (peopleSearchTerm) instead of being read back out of
$('#searchInput') - that id lived in the other template and no longer exists, so
filterPeople() would have searched for undefined.
- "Unlock all users" was a handler BODY. It is an instance method now, called by
the shared action handler via data-action, because the button is no longer
identified by its own id.
- The filter reset on render poked $('#userFilterSelect').val('all'). The shared
row renders the select from userFilterType, so it sets the state instead; the
old code would have silently done nothing.
All three handlers are scoped to the open pane, like the pager: every People pane
renders inside one template and they all carry the same shared classes.
Tests: none of the five removed ids survives in the header, the filter and actions
are declared to the shared row, the search term is state, the reset sets state,
and each of the three handlers is scoped to people-setting.
Thanks to xet7 !
|
||
|
|
3f44e622ba |
Table.md: People's three remaining panes are not tables, and are recorded as such.
Locked users is a form of numeric lockout settings with a Save button, Roles is a checkbox list, and Shared templates is a checkbox list of scopes. None has a paginated set of rows, so this design does not apply to them - forcing it would only wrap a form in a table. They are listed with that reason so the next person does not read the code to find out, or convert them by mistake. That completes People: all FOUR of its table panes - Domains, Organizations, Teams and People - render through the shared table page, and its three non-table panes are documented as out of scope. The old entry asking "what converting it would take" is answered and replaced. One loose end stays recorded, as wiring rather than design: People's search box, filter dropdown and two action buttons still live in the page header rather than the shared controls row. The slots for all three exist - they were added to this design FROM People - and its separate Search button should go when they move, since every table page searches on Enter. Tests: the three panes are listed with "not tables" as the reason, and none of them renders a table page in the code - so the doc cannot drift from what is there, in either direction. Thanks to xet7 ! |
||
|
|
6ff98891c8 |
Admin Panel / People / People: render through the shared table page.
Fourth and last of People's table panes. Interactive rows again (rowTemplate) and two template headers - the new-user row and the select-all checkbox. Its .people-pagination rules are gone from both stylesheets, so NO People pane keeps a pager of its own any more; all four use the shared, themed one. The page of users is now one query. peopleDocs() is shared by the table context and the old peopleList helper, instead of the same find() being written twice, and it still must not re-slice: the 'people' publication already applies limit/skip sorted createdAt:-1, and re-slicing it is what once left page 2 showing a single stray doc - the admin's own user record, always in minimongo - with later pages empty. A test pins both. The Add/Remove Teams panel stays outside the table page: it is a panel this pane opens, not part of the table. All four table panes now share ONE scoped pager pair, switching on the open pane - the only shape that works here, since every pane renders inside the same template and duplicate keys in one event map would overwrite each other. Remaining: Locked users, Roles and Shared templates. The last two still do not look like tables at all - Roles is a checkbox list with a Save button - so they may belong in the "does not use this design" list rather than converted. Not yet moved: People's search box, its filter dropdown and its two action buttons still live in the page header rather than the shared controls row. The slots for them exist; wiring them across is the remaining step for this pane. Thanks to xet7 ! |
||
|
|
6908821d17 |
Admin Panel / People / Teams: render through the shared table page.
Same shape as Organizations, so the same two slots: a rowTemplate for its interactive rows and three headerTemplate columns for the select-all pairs. 1857 characters of its own table markup gone, plus its .team-pagination rules from both stylesheets. Its three feature headers share ONE template parameterised by feature, as Organizations' do. Teams gains a working PREV button. It had one in its markup and no handler behind it - paging backwards was silently dead - and folding both panes into a single scoped handler pair fixed that on the way past. That folding was forced, not chosen: every People pane renders inside the same template and the shared page gives them all the same control classes, so a second handler for the same selector would be a duplicate key in one event map and simply overwrite the first. One pair now switches on the open pane. Tests: Teams renders the shared page and keeps no table markup, uses both slots, pages backwards, and there is exactly ONE prev handler. The uiDensity guard that pins these headers as compact icon links was updated for the team half the same way as the org half - it matches the parameterised markup and separately checks all three features still have a header. I ran the full suite BEFORE committing this time. The previous commit went in red because I chained the run and the commit in one command; that guard's team half was the failure it hid. Four panes remain: People, Locked users, Roles and Shared templates. Thanks to xet7 ! |
||
|
|
13f40bf3ab |
Table page: row and header slots (option A), and Organizations converted.
Organizations could not be expressed as a column spec: its rows carry inline checkboxes and edit links, and three of its headers carry a select-all pair. The design gains two slots rather than those panes staying outside it: - rowTemplate + docs - the page supplies a template and one data context per row, and owns its <tr>. It is then responsible for matching the column count: the guarantee that a row can never be shorter than the header holds for the CELLS form only, and the doc says so. - headerTemplate + headerData on a column - the <th> still belongs to the shared template; only its contents come from the page. Everything else stays shared either way: layout, paging, search, the themed pager, the total. The doc says to prefer the column spec and reach for these only when a pane is genuinely interactive. Organizations now renders through the shared page - 1826 characters of its own table markup gone, plus its .org-pagination rules from both stylesheets, since it uses the shared pager. Its three feature headers share ONE new template parameterised by feature, instead of three copies of the select-all pair. One thing the conversion forced: all of People's panes render inside the SAME template, so a handler bound to a shared control class fires for every converted pane at once. The org pager is scoped to the open pane via activeMenuId - Domains was unaffected because its handlers live on its own child template. Tests: the two slots exist and the plain column path is unchanged; Organizations renders the shared page, keeps no table markup, uses both slots, and scopes its pager. Two doc/test pairs updated to say "Domains and Organizations". Five panes remain: Teams, People, Locked users, Roles, Shared templates. Thanks to xet7 ! |
||
|
|
4eab5ffe9f |
Admin Panel / People / Domains: render through the shared table page.
First of People's seven panes converted to docs/Design/Page/Table.md. Its own controls row, pagination markup and table - 891 characters of jade - became one +tablePage(tablePageData) plus a two-column spec, and 56 lines of pane-specific CSS are gone: the layout comes from tablePage.css and the pager colours from paginationControls.css, like every other pager. Its separate Search BUTTON is dropped, as the design says: every table page searches on Enter, and a second way to search is exactly the divergence this design removes. The handlers keep their behaviour but move to the shared control classes, so the pane needs no markup, no CSS and no pager rules of its own - .domain-pagination and .domain-page-info had no users left and are removed from the shared pager stylesheet. The pane also gains the result total for free: it is one of the controls-row features adopted from People itself a few commits ago. Docs: the "Pages that do not use this design" entry now reads "People - six of its seven panes" and records that Domains is converted; Domains is listed among the pages that DO use the design. Tests: the entry must say Domains is converted, and that pane must render the shared template and keep no markup of its own - so the doc cannot claim a conversion that did not happen, nor stay silent about one that did. A test that listed Domains among the panes with their own themed pager was updated; it caught the now-dead CSS, which is what it was for. Six panes remain: Organizations, Teams, People, Locked users, Roles and Shared templates. Thanks to xet7 ! |
||
|
|
7e2f33387e |
Table page: adopt People's filter, actions and total into the shared controls row.
The three features that kept Admin Panel / People off this design are now part of
it, and they are ON by default - there is no enabling flag. A page that supplies a
filter or an action gets it rendered, and the total is shown whenever the page
knows one:
filters: buildFilters([{ id, labelKey, options: [{ value, labelKey }] }], current)
actions: buildActions([{ id, labelKey, icon, cls }])
total: <number> (+ optional totalLabelKey)
They are general - a Boards or Cards report wants a filter and a total as much as
People does - so they belong in the one template rather than in a per-page copy.
The controls row now reads: search, filters, actions, total, pagination.
A page identifies which control was used by its data attribute (data-filter,
data-action), so this adds no new handler pattern: the same one-handler-per-page
rule as the search and the pager.
The option matching `current` is selected as STRINGS, so a numeric filter value
still selects. The total sits with the controls, not in the table, because it
counts the whole result set rather than the page, and inherits its colour so it
stays readable on a dark theme.
Tests: the two new helpers (including junk input - a filter with no options
renders an empty select rather than crashing), that the four parts appear in
reading order between the search field and the pagination, that there is NO
opt-in flag, and that the doc says so.
One earlier guard needed fixing rather than the code: "the table page stylesheet
does not restate button colours" sliced the CSS by POSITION, so the new rules
landed inside the slice and tripped it. It now matches by selector, which is what
it always meant.
NOT done: People itself still renders its own markup. Its seven panes
(Organizations, Teams, People, Domains, Locked users, Roles, Shared templates)
are seven tables with their own columns and handlers, and converting them is a
larger piece of work than adding these features was. The blocker recorded in
Table.md is now gone, so that conversion is unblocked - the "Pages that do not
use this design" entry stays until it is actually done.
Thanks to xet7 !
|
||
|
|
18a286a740 |
Table.md: record which pages do NOT use this design, and why.
A page with a paginated table that is not built from this design is a gap. Left
unwritten, the next person re-derives the answer by reading the code - or worse,
copies a few of this design's classes into it and leaves it half-converted, which
is exactly how the ten report pages drifted apart before.
People (Admin Panel / People) is the one such page. It predates this design and
has its own controls and table markup, one set per pane - Organizations, Teams,
People, Domains, Locked users, Roles, Shared templates - so it is several tables
on one page rather than one. It also carries four things this template has no
slot for: a filter dropdown (all / locked / active / inactive / admin), action
buttons ("Unlock all users", "Add / Remove Teams"), a result count beside the
controls, and a separate Search button where a table page searches on Enter.
The entry also records what People ALREADY shares, so the remaining work is not
overstated: it pages server-side with limit/skip exactly as this design requires,
and its prev/next buttons are themed by the shared pager stylesheet through the
.people-pagination class, so it already follows the per-user theme and the WeKan
default. What is missing is on this side - optional slots in the controls row for
a filter, extra actions and a total, rendered only when a page supplies them.
Those are general enough for a Boards or Cards report to use, so they belong in
the shared template rather than in a per-page copy.
Tests: the section must exist, must come before the pages that DO use the design,
must list People with a reason that actually explains, and - so the entry cannot
quietly go stale - People must still have none of this design's markup. If it
ever gains it, the test fails and the page moves to the other section.
Thanks to xet7 !
|
||
|
|
33a0cf6160 |
Design docs: move Table-Page.md under Design/Page/, and add Left-Menu.md.
docs/Design/Table-Page.md -> docs/Design/Page/Table.md, with every reference updated: the three design docs that link to it (History, CPU-usage, Recovery), the code comments in the shared template, stylesheet and helpers, and the four test suites that read it. Its own link to History.md is re-based, since the file is one level deeper now. docs/Design/Page/Left-Menu.md is the second page design: the menu beside the content on every Admin Panel page. It records what those seven menus share, which pages use it, the entry shape, and how a page adds one. Which side it is on is part of the design, not an accident of the markup: for a left-to-right language the menu is on the LEFT with the content to its right; for a right-to-left language the whole panel MIRRORS - the menu is on the right, the content to its left, and inside each entry the icon and label mirror too. That works only through the document direction plus logical CSS, so the doc says to never write left/right/margin-left/padding-left for this menu. Checking that turned up two places where the current CSS did exactly that: - .side-menu had `box-shadow: inset -0.2vh ...`. An inset shadow offset on the X axis is a PHYSICAL direction and does not mirror, so it shaded the wrong inner edge once the menu moved to the right. The X offset is dropped. - the entries used `padding: 1.3vh 0 1.3vh 1.3vw`, i.e. padding-LEFT, so under an RTL language the indent stayed on the left - the outer edge of a right-hand menu. Now padding-block + padding-inline-start. Theme: the menu was entirely hard-coded greys. Most of it stays neutral on purpose - it is chrome, and tinting the whole card would fight the content beside it - but the entry you are ON now takes the per-user theme accent (Member Settings -> Change color sets --theme-accent on :root), with `inherit` as the fallback so the WeKan default look is byte-for-byte unchanged when no colour is chosen. No brand colour is hard-coded in the menu. The shared pieces are in place: client/components/settings/leftMenu.jade renders the menu from an item list, and models/lib/leftMenu.js turns (items, activeId) into it - marking exactly ONE entry active, dropping conditional holes, and supporting group separators. Tests: tests/leftMenu.test.cjs is the one suite for this design - the pure helpers, the template, the mirroring, the theming, the shared narrow-window stacking, and that every path in the doc's related-files table exists. NOT done yet: the seven Admin Panel templates still render their own copy of the menu markup. Converting them to +leftMenu is the next step; the design, the template, the helpers and the tests it will be checked against are ready. Thanks to xet7 ! |