mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
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 !
32 lines
1.7 KiB
JavaScript
32 lines
1.7 KiB
JavaScript
'use strict';
|
|
|
|
// The one-line summary of what an import could not bring over, for Admin
|
|
// Panel -> Problems -> Recovery (docs/Features/Board-Sidebar/Board-Settings/Import-Export/Format-Coverage.md:
|
|
// "a success with unsupported fields is completed-with-warnings, not silently
|
|
// completed"). Parsers and planners return { path, reason } entries; this
|
|
// bounds them so a huge source cannot grow one recovery row without limit.
|
|
// Paths and reasons never carry source VALUES, only locations and counts.
|
|
|
|
export const IMPORT_WARNINGS_EVENT = 'import-completed-with-warnings';
|
|
const MAX_LISTED = 20;
|
|
const MAX_TEXT = 200;
|
|
|
|
function clip(value) {
|
|
const text = String(value == null ? '' : value).replace(/\s+/g, ' ').trim();
|
|
return text.length > MAX_TEXT ? `${text.slice(0, MAX_TEXT - 1)}…` : text;
|
|
}
|
|
|
|
export function importLossReport({ source, warnings = [], unsupported = [] } = {}) {
|
|
const entries = []
|
|
.concat((Array.isArray(unsupported) ? unsupported : []).map(e => ({ kind: 'not imported', ...e })))
|
|
.concat((Array.isArray(warnings) ? warnings : []).map(e => ({ kind: 'warning', ...e })))
|
|
.filter(e => e && (e.path || e.reason));
|
|
if (!entries.length) return null;
|
|
const notImported = entries.filter(e => e.kind === 'not imported').length;
|
|
const listed = entries.slice(0, MAX_LISTED).map(e => `${clip(e.path)} ${clip(e.reason)}`.trim());
|
|
const more = entries.length - listed.length;
|
|
const detail = `${clip(source || 'import')}: ${notImported} not imported, ${entries.length - notImported} warning(s). `
|
|
+ listed.join('; ') + (more > 0 ? `; and ${more} more` : '');
|
|
return { type: IMPORT_WARNINGS_EVENT, severity: 'warning', detail, count: entries.length };
|
|
}
|