mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Crudely show row count and limit in UI
Summary: Add rowCount returned from sandbox when applying user actions to ActionGroup which is broadcast to clients. Add rowCount to ActiveDoc and update it after applying user actions. Add rowCount to OpenLocalDocResult using ActiveDoc value, to show when a client opens a doc before any user actions happen. Add rowCount observable to DocPageModel which is set when the doc is opened and when action groups are received. Add crude UI (commented out) in Tool.ts showing the row count and the limit in AppModel.currentFeatures. The actual UI doesn't have a place to go yet. Followup tasks: - Real, pretty UI - Counts per table - Keep count(s) secret from users with limited access? - Data size indicator? - Banner when close to or above limit - Measure row counts outside of sandbox to avoid spoofing with formula - Handle changes to the limit when the plan is changed or extra rows are purchased Test Plan: Tested UI manually, including with free team site, opening a fresh doc, opening an initialised doc, adding rows, undoing, and changes from another tab. Automated tests seem like they should wait for a proper UI. Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D3318
This commit is contained in:
@@ -19,8 +19,9 @@ import {Computed, Disposable, dom, makeTestId, Observable, observable, styled} f
|
||||
const testId = makeTestId('test-tools-');
|
||||
|
||||
export function tools(owner: Disposable, gristDoc: GristDoc, leftPanelOpen: Observable<boolean>): Element {
|
||||
const isOwner = gristDoc.docPageModel.currentDoc.get()?.access === 'owners';
|
||||
const isOverridden = Boolean(gristDoc.docPageModel.userOverride.get());
|
||||
const docPageModel = gristDoc.docPageModel;
|
||||
const isOwner = docPageModel.currentDoc.get()?.access === 'owners';
|
||||
const isOverridden = Boolean(docPageModel.userOverride.get());
|
||||
const hasDocTour = Computed.create(owner, use =>
|
||||
use(gristDoc.docModel.allTableIds.getObservable()).includes('GristDocTour'));
|
||||
const canViewAccessRules = observable(false);
|
||||
@@ -34,6 +35,13 @@ export function tools(owner: Disposable, gristDoc: GristDoc, leftPanelOpen: Obse
|
||||
cssTools.cls('-collapsed', (use) => !use(leftPanelOpen)),
|
||||
cssSectionHeader("TOOLS"),
|
||||
|
||||
// TODO proper UI
|
||||
// cssPageEntry(
|
||||
// dom.domComputed(docPageModel.rowCount, rowCount =>
|
||||
// `${rowCount} of ${docPageModel.appModel.currentFeatures.baseMaxRowsPerDocument || "infinity"} rows used`
|
||||
// ),
|
||||
// ),
|
||||
|
||||
cssPageEntry(
|
||||
cssPageEntry.cls('-selected', (use) => use(gristDoc.activeViewId) === 'acl'),
|
||||
cssPageEntry.cls('-disabled', (use) => !use(canViewAccessRules)),
|
||||
@@ -78,7 +86,7 @@ export function tools(owner: Disposable, gristDoc: GristDoc, leftPanelOpen: Obse
|
||||
testId('code'),
|
||||
),
|
||||
cssSpacer(),
|
||||
dom.maybe(gristDoc.docPageModel.currentDoc, (doc) => {
|
||||
dom.maybe(docPageModel.currentDoc, (doc) => {
|
||||
const ex = examples.find(e => e.urlId === doc.urlId);
|
||||
if (!ex || !ex.tutorialUrl) { return null; }
|
||||
return cssPageEntry(
|
||||
@@ -125,7 +133,7 @@ export function tools(owner: Disposable, gristDoc: GristDoc, leftPanelOpen: Obse
|
||||
)
|
||||
),
|
||||
),
|
||||
createHelpTools(gristDoc.docPageModel.appModel, false)
|
||||
createHelpTools(docPageModel.appModel, false)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user