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:
@@ -9,6 +9,7 @@ import {ApiError} from 'app/common/ApiError';
|
||||
import {mapSetOrClear} from 'app/common/AsyncCreate';
|
||||
import {BrowserSettings} from 'app/common/BrowserSettings';
|
||||
import {DocCreationInfo, DocEntry, DocListAPI, OpenDocMode, OpenLocalDocResult} from 'app/common/DocListAPI';
|
||||
import {DocUsage} from 'app/common/DocUsage';
|
||||
import {Invite} from 'app/common/sharing';
|
||||
import {tbind} from 'app/common/tbind';
|
||||
import {NEW_DOCUMENT_CODE} from 'app/common/UserAPI';
|
||||
@@ -313,24 +314,28 @@ export class DocManager extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
const [metaTables, recentActions, userOverride, rowCount, dataLimitStatus] = await Promise.all([
|
||||
const [metaTables, recentActions, userOverride] = await Promise.all([
|
||||
activeDoc.fetchMetaTables(docSession),
|
||||
activeDoc.getRecentMinimalActions(docSession),
|
||||
activeDoc.getUserOverride(docSession),
|
||||
activeDoc.getRowCount(docSession),
|
||||
activeDoc.getDataLimitStatus(docSession),
|
||||
]);
|
||||
|
||||
const result = {
|
||||
let docUsage: DocUsage | undefined;
|
||||
try {
|
||||
docUsage = await activeDoc.getFilteredDocUsage(docSession);
|
||||
} catch (e) {
|
||||
log.warn("DocManager.openDoc failed to get doc usage", e);
|
||||
}
|
||||
|
||||
const result: OpenLocalDocResult = {
|
||||
docFD: docSession.fd,
|
||||
clientId: docSession.client.clientId,
|
||||
doc: metaTables,
|
||||
log: recentActions,
|
||||
recoveryMode: activeDoc.recoveryMode,
|
||||
userOverride,
|
||||
rowCount,
|
||||
dataLimitStatus,
|
||||
} as OpenLocalDocResult;
|
||||
docUsage,
|
||||
};
|
||||
|
||||
if (!activeDoc.muted) {
|
||||
this.emit('open-doc', this.storageManager.getPath(activeDoc.docName));
|
||||
|
||||
Reference in New Issue
Block a user