mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Adding latest version section to the admin panel.
Summary: Update for the admin page to show the latest available version information. - Latest version is read from docs.getgrist.com by default - It sends basic information (installationId, deployment type, and version) - Checks are done only on the page itself - The actual request is routed through the API (to avoid CORS) Test Plan: Added new test Reviewers: paulfitz Reviewed By: paulfitz Subscribers: paulfitz Differential Revision: https://phab.getgrist.com/D4238
This commit is contained in:
@@ -24,9 +24,38 @@ export interface PrefWithSource<T> {
|
||||
|
||||
export type PrefSource = 'environment-variable' | 'preferences';
|
||||
|
||||
|
||||
/**
|
||||
* JSON returned to the client (exported for tests).
|
||||
*/
|
||||
export interface LatestVersion {
|
||||
/**
|
||||
* Latest version of core component of the client.
|
||||
*/
|
||||
latestVersion: string;
|
||||
/**
|
||||
* If there were any critical updates after client's version. Undefined if
|
||||
* we don't know client version or couldn't figure this out for some other reason.
|
||||
*/
|
||||
isCritical?: boolean;
|
||||
/**
|
||||
* Url where the client can download the latest version (if applicable)
|
||||
*/
|
||||
updateURL?: string;
|
||||
|
||||
/**
|
||||
* When the latest version was updated (in ISO format).
|
||||
*/
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
export interface InstallAPI {
|
||||
getInstallPrefs(): Promise<InstallPrefsWithSources>;
|
||||
updateInstallPrefs(prefs: Partial<InstallPrefs>): Promise<void>;
|
||||
/**
|
||||
* Returns information about latest version of Grist
|
||||
*/
|
||||
checkUpdates(): Promise<LatestVersion>;
|
||||
}
|
||||
|
||||
export class InstallAPIImpl extends BaseAPI implements InstallAPI {
|
||||
@@ -45,6 +74,10 @@ export class InstallAPIImpl extends BaseAPI implements InstallAPI {
|
||||
});
|
||||
}
|
||||
|
||||
public checkUpdates(): Promise<LatestVersion> {
|
||||
return this.requestJson(`${this._url}/api/install/updates`, {method: 'GET'});
|
||||
}
|
||||
|
||||
private get _url(): string {
|
||||
return addCurrentOrgToPath(this._homeUrl);
|
||||
}
|
||||
|
||||
@@ -105,6 +105,8 @@ export const commonUrls = {
|
||||
gristLabsWidgetRepository: 'https://github.com/gristlabs/grist-widget/releases/download/latest/manifest.json',
|
||||
githubGristCore: 'https://github.com/gristlabs/grist-core',
|
||||
githubSponsorGristLabs: 'https://github.com/sponsors/gristlabs',
|
||||
|
||||
versionCheck: 'https://api.getgrist.com/api/version',
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user