gristlabs_grist-core/app/common/CustomWidget.ts
Jarosław Sadziński 1425461cd8 (core) Exposing custom widgets on the UI
Summary:
Exposing custom widgets as a dropdown menu in custom section configuration panel.

Adding new environmental variable GRIST_WIDGET_LIST_URL that points to a
json file with an array of available widgets. When not present, custom widget menu is
hidden, exposing only Custom URL option.

Available widget list can be fetched from:
https://github.com/gristlabs/grist-widget/releases/download/latest/manifest.json

Test Plan: New tests, and updated old ones.

Reviewers: paulfitz, dsagal

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D3127
2021-12-01 18:21:06 +01:00

40 lines
703 B
TypeScript

/**
* Custom widget manifest definition.
*/
export interface ICustomWidget {
/**
* Widget friendly name, used on the UI.
*/
name: string;
/**
* Widget unique id, probably in npm package format @gristlabs/custom-widget-name.
*/
widgetId: string;
/**
* Custom widget main page URL.
*/
url: string;
/**
* Optional desired access level.
*/
accessLevel?: AccessLevel;
}
/**
* Widget access level.
*/
export enum AccessLevel {
/**
* Default, no access to Grist.
*/
none = "none",
/**
* Read only access to table the widget is based on.
*/
read_table = "read table",
/**
* Full access to document on user's behalf.
*/
full = "full",
}