mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add attachment and data size usage
Summary: Adds attachment and data size to the usage section of the raw data page. Also makes in-document usage banners update as user actions are applied, causing them to be hidden/shown or updated based on the current state of the document. Test Plan: Browser tests. Reviewers: jarek Reviewed By: jarek Subscribers: alexmojaki Differential Revision: https://phab.getgrist.com/D3395
This commit is contained in:
29
app/common/DocUsage.ts
Normal file
29
app/common/DocUsage.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import {ApiError} from 'app/common/ApiError';
|
||||
|
||||
export interface DocUsage {
|
||||
dataLimitStatus: DataLimitStatus;
|
||||
rowCount: RowCount;
|
||||
dataSizeBytes: DataSize;
|
||||
attachmentsSizeBytes: AttachmentsSize;
|
||||
}
|
||||
|
||||
type NumberOrStatus = number | 'hidden' | 'pending';
|
||||
|
||||
export type RowCount = NumberOrStatus;
|
||||
|
||||
export type DataSize = NumberOrStatus;
|
||||
|
||||
export type AttachmentsSize = NumberOrStatus;
|
||||
|
||||
export type DataLimitStatus = 'approachingLimit' | 'gracePeriod' | 'deleteOnly' | null;
|
||||
|
||||
export type NonHidden<T> = Exclude<T, 'hidden'>;
|
||||
|
||||
// Ratio of usage at which we start telling users that they're approaching limits.
|
||||
export const APPROACHING_LIMIT_RATIO = 0.9;
|
||||
|
||||
export class LimitExceededError extends ApiError {
|
||||
constructor(message: string) {
|
||||
super(message, 413);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user