mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
Client side of CARDS_LOADING=lazy. In lazy mode each list's cardsWithLimit subscribes to boardCardsWindow for just the cards it renders (growing with the infinite-scroll limit) and to boardListCardCount for the total; showSpinner uses that server count to decide whether more cards remain, since minimongo now holds only the loaded window. Default 'all' mode is unchanged (helpers short-circuit on isLazyCards()). Adds Admin Panel / Features — a new admin section (route /admin-features, nav entry, adminFeatures template) intended as the home for optional / performance / future tier-gated capabilities. First control: "Card loading" (all | lazy), which writes the cardsLoading Setting; it mirrors, and is overridden on startup by, the CARDS_LOADING env var. Includes an experimental-note (counters/WIP limits and the Calendar/Table/Gantt views reflect only loaded cards; reload boards after change) and the i18n keys.
39 lines
1.4 KiB
JavaScript
39 lines
1.4 KiB
JavaScript
import { ReactiveCache } from '/imports/reactiveCache';
|
|
import { ReactiveVar } from 'meteor/reactive-var';
|
|
import Settings from '/models/settings';
|
|
|
|
// Admin Panel / Features — a home for optional / performance / tier-gated
|
|
// capabilities. First entry: "Card loading" (all | lazy), which also mirrors the
|
|
// CARDS_LOADING env var. Grouped by category in the side menu so more feature
|
|
// toggles (and, later, pricing-tier gating) can be added here.
|
|
Template.adminFeatures.onCreated(function () {
|
|
this.activePane = new ReactiveVar('performance');
|
|
Meteor.subscribe('setting');
|
|
});
|
|
|
|
Template.adminFeatures.helpers({
|
|
isPerformanceActive() {
|
|
return Template.instance().activePane.get() === 'performance';
|
|
},
|
|
cardsLoadingOptions() {
|
|
const current = (ReactiveCache.getCurrentSetting() || {}).cardsLoading || 'all';
|
|
return [
|
|
{ value: 'all', label: 'cards-loading-all', selected: current === 'all' },
|
|
{ value: 'lazy', label: 'cards-loading-lazy', selected: current === 'lazy' },
|
|
];
|
|
},
|
|
});
|
|
|
|
Template.adminFeatures.events({
|
|
'click .js-features-menu'(event, tpl) {
|
|
tpl.activePane.set(event.currentTarget.dataset.id);
|
|
},
|
|
'change .js-cards-loading'(event) {
|
|
const value = event.currentTarget.value === 'lazy' ? 'lazy' : 'all';
|
|
const setting = ReactiveCache.getCurrentSetting();
|
|
if (setting) {
|
|
Settings.update(setting._id, { $set: { cardsLoading: value } });
|
|
}
|
|
},
|
|
});
|