gristlabs_grist-core/app/common/ActionGroup.ts
Alex Hall 02e69fb685 (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
2022-03-14 21:49:32 +02:00

30 lines
978 B
TypeScript

import {ActionSummary} from 'app/common/ActionSummary';
/**
* This is the action representation the client works with, for the purposes of undos/redos.
*/
export interface MinimalActionGroup {
actionNum: number;
actionHash: string;
fromSelf: boolean;
linkId: number;
otherId: number;
rowIdHint: number; // If non-zero, this is a rowId that would be a good place to put
// the cursor after an undo.
isUndo: boolean; // True if the first user action is ApplyUndoActions.
}
/**
* This is the action representation the client works with, for the purposes of document
* history and undos/redos.
*/
export interface ActionGroup extends MinimalActionGroup {
desc?: string;
actionSummary: ActionSummary;
time: number;
user: string;
primaryAction: string; // The name of the first user action in the ActionGroup.
internal: boolean; // True if it is inappropriate to log/undo the action.
rowCount?: number;
}