mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Keep track of row counts per table
Summary: Displays a live row count of each table on the Raw Data page. Test Plan: Browser tests. Reviewers: alexmojaki Reviewed By: alexmojaki Differential Revision: https://phab.getgrist.com/D3540
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
import {DocAction, UserAction} from 'app/common/DocActions';
|
||||
import {RowCounts} from 'app/common/DocUsage';
|
||||
|
||||
// Metadata about the action.
|
||||
export interface ActionInfo {
|
||||
@@ -61,7 +62,7 @@ export interface SandboxActionBundle {
|
||||
calc: Array<EnvContent<DocAction>>;
|
||||
undo: Array<EnvContent<DocAction>>; // Inverse actions for all 'stored' actions.
|
||||
retValues: any[]; // Contains retValue for each of userActions.
|
||||
rowCount: number;
|
||||
rowCount: RowCounts;
|
||||
// Mapping of keys (hashes of request args) to all unique requests made in a round of calculation
|
||||
requests?: Record<string, SandboxRequest>;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ export function getDataLimitRatio(
|
||||
const {rowCount, dataSizeBytes} = docUsage;
|
||||
const maxRows = productFeatures?.baseMaxRowsPerDocument;
|
||||
const maxDataSize = productFeatures?.baseMaxDataSizePerDocument;
|
||||
const rowRatio = getUsageRatio(rowCount, maxRows);
|
||||
const rowRatio = getUsageRatio(rowCount?.total, maxRows);
|
||||
const dataSizeRatio = getUsageRatio(dataSizeBytes, maxDataSize);
|
||||
return Math.max(rowRatio, dataSizeRatio);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
export interface DocumentUsage {
|
||||
rowCount?: number;
|
||||
rowCount?: RowCounts;
|
||||
dataSizeBytes?: number;
|
||||
attachmentsSizeBytes?: number;
|
||||
}
|
||||
|
||||
export interface RowCounts {
|
||||
total: number;
|
||||
[tableRef: number]: number;
|
||||
}
|
||||
|
||||
export type DataLimitStatus = 'approachingLimit' | 'gracePeriod' | 'deleteOnly' | null;
|
||||
|
||||
type DocUsageOrPending = {
|
||||
|
||||
Reference in New Issue
Block a user