(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:
Jarosław Sadziński
2024-04-29 16:54:03 +02:00
parent a3442aee77
commit ecf242c6c6
10 changed files with 609 additions and 69 deletions

View File

@@ -4,10 +4,11 @@ import * as sinon from 'sinon';
import { configForUser } from "test/gen-server/testUtils";
import * as testUtils from "test/server/testUtils";
import { serveSomething, Serving } from "test/server/customUtil";
import { Deps, LatestVersion } from "app/server/lib/UpdateManager";
import { Defer, serveSomething, Serving } from "test/server/customUtil";
import { Deps } from "app/server/lib/UpdateManager";
import { TestServer } from "test/gen-server/apiUtils";
import { delay } from "app/common/delay";
import { LatestVersion } from 'app/common/InstallAPI';
const assert = chai.assert;
@@ -249,7 +250,7 @@ async function dummyDockerHub() {
return Object.assign(tempServer, {
signal() {
const p = defer();
const p = new Defer();
signals.push(p);
return p;
},
@@ -326,22 +327,3 @@ const FIRST_PAGE = (tempServer: Serving) => ({
next: tempServer.url + "/next",
});
interface Defer {
then: Promise<void>["then"];
resolve: () => void;
reject: () => void;
}
const defer = () => {
let resolve: () => void;
let reject: () => void;
const promise = new Promise<void>((res, rej) => {
resolve = res;
reject = rej;
}).catch(() => {});
return {
then: promise.then.bind(promise),
resolve: resolve!,
reject: reject!,
};
};