mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add API endpoint to get site usage summary
Summary: The summary includes a count of documents that are approaching limits, in grace period, or delete-only. The endpoint is only accessible to site owners, and is currently unused. A follow-up diff will add usage banners to the site home page, which will use the response from the endpoint to communicate usage information to owners. Test Plan: Browser and server tests. Reviewers: alexmojaki Reviewed By: alexmojaki Differential Revision: https://phab.getgrist.com/D3420
This commit is contained in:
@@ -5,6 +5,7 @@ import {BillingAPI, BillingAPIImpl} from 'app/common/BillingAPI';
|
||||
import {BrowserSettings} from 'app/common/BrowserSettings';
|
||||
import {BulkColValues, TableColValues, TableRecordValue, TableRecordValues, UserAction} from 'app/common/DocActions';
|
||||
import {DocCreationInfo, OpenDocMode} from 'app/common/DocListAPI';
|
||||
import {OrgUsageSummary} from 'app/common/DocUsage';
|
||||
import {Features} from 'app/common/Features';
|
||||
import {ICustomWidget} from 'app/common/CustomWidget';
|
||||
import {isClient} from 'app/common/gristUrls';
|
||||
@@ -288,6 +289,7 @@ export interface UserAPI {
|
||||
getWorkspace(workspaceId: number): Promise<Workspace>;
|
||||
getOrg(orgId: number|string): Promise<Organization>;
|
||||
getOrgWorkspaces(orgId: number|string): Promise<Workspace[]>;
|
||||
getOrgUsageSummary(orgId: number|string): Promise<OrgUsageSummary>;
|
||||
getTemplates(onlyFeatured?: boolean): Promise<Workspace[]>;
|
||||
getDoc(docId: string): Promise<Document>;
|
||||
newOrg(props: Partial<OrganizationProperties>): Promise<number>;
|
||||
@@ -448,6 +450,10 @@ export class UserAPIImpl extends BaseAPI implements UserAPI {
|
||||
{ method: 'GET' });
|
||||
}
|
||||
|
||||
public async getOrgUsageSummary(orgId: number|string): Promise<OrgUsageSummary> {
|
||||
return this.requestJson(`${this._url}/api/orgs/${orgId}/usage`, { method: 'GET' });
|
||||
}
|
||||
|
||||
public async getTemplates(onlyFeatured: boolean = false): Promise<Workspace[]> {
|
||||
return this.requestJson(`${this._url}/api/templates?onlyFeatured=${onlyFeatured ? 1 : 0}`, { method: 'GET' });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user