From 7e8ce807db6f957fcc4348a9cb51f336766d6172 Mon Sep 17 00:00:00 2001 From: Naumov Alexey Date: Tue, 14 Dec 2021 19:40:58 +0300 Subject: [PATCH 1/3] feat(core-sdk): CB-1432 version update --- .../packages/core-app/src/useAppVersion.tsx | 23 +- webapp/packages/core-blocks/src/Cell.tsx | 7 +- .../packages/core-bootstrap/src/manifest.ts | 4 + .../src/queries/session/serverConfig.gql | 1 + webapp/packages/core-sdk/src/sdk.ts | 4 +- .../packages/core-version-update/.gitignore | 21 + .../packages/core-version-update/package.json | 40 ++ .../core-version-update/src/LocaleService.ts | 36 ++ .../src/VersionUpdateService.ts | 46 ++ .../packages/core-version-update/src/index.ts | 3 + .../core-version-update/src/locales/en.ts | 10 + .../core-version-update/src/locales/it.ts | 10 + .../core-version-update/src/locales/ru.ts | 10 + .../core-version-update/src/locales/zh.ts | 10 + .../core-version-update/src/manifest.ts | 23 + .../core-version-update/tsconfig.json | 13 + webapp/packages/core-version/.gitignore | 21 + webapp/packages/core-version/package.json | 34 ++ .../core-version/src/VersionLocaleService.ts | 36 ++ .../core-version/src/VersionResource.ts | 72 +++ .../core-version/src/VersionService.ts | 58 ++ webapp/packages/core-version/src/index.ts | 4 + .../packages/core-version/src/locales/en.ts | 8 + .../packages/core-version/src/locales/it.ts | 8 + .../packages/core-version/src/locales/ru.ts | 8 + .../packages/core-version/src/locales/zh.ts | 8 + webapp/packages/core-version/src/manifest.ts | 25 + webapp/packages/core-version/tsconfig.json | 13 + .../.gitignore | 17 + .../package.json | 49 ++ .../src/EVersionUpdate.ts | 12 + .../src/Instructions.tsx | 45 ++ .../src/PluginBootstrap.ts | 34 ++ .../src/Version.tsx | 41 ++ .../src/VersionChecker.tsx | 46 ++ .../src/VersionInfo.tsx | 51 ++ .../src/VersionUpdate.tsx | 63 ++ .../src/VersionUpdateDrawerItem.tsx | 63 ++ .../src/VersionsTable.tsx | 122 ++++ .../src/index.ts | 3 + .../src/manifest.ts | 21 + .../tsconfig.json | 8 + .../product-default/src/ProductBootstrap.ts | 29 + .../product-default/src/UpdateInstruction.tsx | 30 + webapp/packages/product-default/src/index.ts | 2 + webapp/yarn.lock | 544 +++++++++++++++++- 46 files changed, 1711 insertions(+), 25 deletions(-) create mode 100644 webapp/packages/core-version-update/.gitignore create mode 100644 webapp/packages/core-version-update/package.json create mode 100644 webapp/packages/core-version-update/src/LocaleService.ts create mode 100644 webapp/packages/core-version-update/src/VersionUpdateService.ts create mode 100644 webapp/packages/core-version-update/src/index.ts create mode 100644 webapp/packages/core-version-update/src/locales/en.ts create mode 100644 webapp/packages/core-version-update/src/locales/it.ts create mode 100644 webapp/packages/core-version-update/src/locales/ru.ts create mode 100644 webapp/packages/core-version-update/src/locales/zh.ts create mode 100644 webapp/packages/core-version-update/src/manifest.ts create mode 100644 webapp/packages/core-version-update/tsconfig.json create mode 100644 webapp/packages/core-version/.gitignore create mode 100644 webapp/packages/core-version/package.json create mode 100644 webapp/packages/core-version/src/VersionLocaleService.ts create mode 100644 webapp/packages/core-version/src/VersionResource.ts create mode 100644 webapp/packages/core-version/src/VersionService.ts create mode 100644 webapp/packages/core-version/src/index.ts create mode 100644 webapp/packages/core-version/src/locales/en.ts create mode 100644 webapp/packages/core-version/src/locales/it.ts create mode 100644 webapp/packages/core-version/src/locales/ru.ts create mode 100644 webapp/packages/core-version/src/locales/zh.ts create mode 100644 webapp/packages/core-version/src/manifest.ts create mode 100644 webapp/packages/core-version/tsconfig.json create mode 100644 webapp/packages/plugin-version-update-administration/.gitignore create mode 100644 webapp/packages/plugin-version-update-administration/package.json create mode 100644 webapp/packages/plugin-version-update-administration/src/EVersionUpdate.ts create mode 100644 webapp/packages/plugin-version-update-administration/src/Instructions.tsx create mode 100644 webapp/packages/plugin-version-update-administration/src/PluginBootstrap.ts create mode 100644 webapp/packages/plugin-version-update-administration/src/Version.tsx create mode 100644 webapp/packages/plugin-version-update-administration/src/VersionChecker.tsx create mode 100644 webapp/packages/plugin-version-update-administration/src/VersionInfo.tsx create mode 100644 webapp/packages/plugin-version-update-administration/src/VersionUpdate.tsx create mode 100644 webapp/packages/plugin-version-update-administration/src/VersionUpdateDrawerItem.tsx create mode 100644 webapp/packages/plugin-version-update-administration/src/VersionsTable.tsx create mode 100644 webapp/packages/plugin-version-update-administration/src/index.ts create mode 100644 webapp/packages/plugin-version-update-administration/src/manifest.ts create mode 100644 webapp/packages/plugin-version-update-administration/tsconfig.json create mode 100644 webapp/packages/product-default/src/ProductBootstrap.ts create mode 100644 webapp/packages/product-default/src/UpdateInstruction.tsx diff --git a/webapp/packages/core-app/src/useAppVersion.tsx b/webapp/packages/core-app/src/useAppVersion.tsx index 9edec9a5d8..835a3a563e 100644 --- a/webapp/packages/core-app/src/useAppVersion.tsx +++ b/webapp/packages/core-app/src/useAppVersion.tsx @@ -7,24 +7,9 @@ */ import { useService } from '@cloudbeaver/core-di'; -import { ServerService } from '@cloudbeaver/core-root'; -import { GlobalConstants } from '@cloudbeaver/core-utils'; +import { VersionService } from '@cloudbeaver/core-version'; -interface IAppVersion { - backendVersion: string; - frontendVersion: string; -} - -const VERSION_REGEX = /(\d+\.\d+\.\d+)/; - -export function useAppVersion(short = false): IAppVersion { - const serverService = useService(ServerService); - let backendVersion = serverService.config.data?.version || ''; - let frontendVersion = GlobalConstants.version || ''; - - if (short) { - backendVersion = VERSION_REGEX.exec(backendVersion)?.[1] ?? backendVersion; - frontendVersion = VERSION_REGEX.exec(frontendVersion)?.[1] ?? frontendVersion; - } - return { backendVersion, frontendVersion }; +export function useAppVersion(short = false) { + const versionService = useService(VersionService); + return versionService.getProductVersion(short); } diff --git a/webapp/packages/core-blocks/src/Cell.tsx b/webapp/packages/core-blocks/src/Cell.tsx index e41c10f854..ae52859278 100644 --- a/webapp/packages/core-blocks/src/Cell.tsx +++ b/webapp/packages/core-blocks/src/Cell.tsx @@ -8,12 +8,13 @@ import styled, { css } from 'reshadow'; -import { composes, useStyles } from '@cloudbeaver/core-theming'; +import { ComponentStyle, composes, useStyles } from '@cloudbeaver/core-theming'; interface Props { description?: React.ReactElement | string; before?: React.ReactElement; after?: React.ReactElement; + style?: ComponentStyle; className?: string; } @@ -54,8 +55,8 @@ const styles = composes( } `); -export const Cell: React.FC = function Cell({ before, after, description, className, children }) { - return styled(useStyles(styles))( +export const Cell: React.FC = function Cell({ before, after, description, style, className, children }) { + return styled(useStyles(styles, style))(
{before} diff --git a/webapp/packages/core-bootstrap/src/manifest.ts b/webapp/packages/core-bootstrap/src/manifest.ts index c046d3516e..222c456ffe 100644 --- a/webapp/packages/core-bootstrap/src/manifest.ts +++ b/webapp/packages/core-bootstrap/src/manifest.ts @@ -80,6 +80,8 @@ import { coreSDKManifest } from '@cloudbeaver/core-sdk'; import { LocalStorageSaveService, SettingsService } from '@cloudbeaver/core-settings'; import { ThemeService, ThemeSettingsService } from '@cloudbeaver/core-theming'; import { coreUIManifest } from '@cloudbeaver/core-ui'; +import { coreVersionManifest } from '@cloudbeaver/core-version'; +import { coreVersionUpdateManifest } from '@cloudbeaver/core-version-update'; import { coreViewManifest } from '@cloudbeaver/core-view'; export const coreManifests: PluginManifest[] = [ @@ -165,4 +167,6 @@ export const coreManifests: PluginManifest[] = [ coreAuthenticationManifest, coreUIManifest, coreViewManifest, + coreVersionManifest, + coreVersionUpdateManifest, ]; diff --git a/webapp/packages/core-sdk/src/queries/session/serverConfig.gql b/webapp/packages/core-sdk/src/queries/session/serverConfig.gql index 147baef1d4..bd62ec7cb5 100644 --- a/webapp/packages/core-sdk/src/queries/session/serverConfig.gql +++ b/webapp/packages/core-sdk/src/queries/session/serverConfig.gql @@ -36,6 +36,7 @@ query serverConfig { productInfo { id version + latestVersionInfo name description buildTime diff --git a/webapp/packages/core-sdk/src/sdk.ts b/webapp/packages/core-sdk/src/sdk.ts index 47b6504265..90b5ec2a9f 100644 --- a/webapp/packages/core-sdk/src/sdk.ts +++ b/webapp/packages/core-sdk/src/sdk.ts @@ -617,6 +617,7 @@ export interface ProductInfo { buildTime: Scalars['String']; description?: Maybe; id: Scalars['ID']; + latestVersionInfo?: Maybe; licenseInfo?: Maybe; name: Scalars['String']; releaseTime: Scalars['String']; @@ -1898,7 +1899,7 @@ export interface ReadSessionLogQuery { log: Array<{ time?: Maybe; type: str export type ServerConfigQueryVariables = Exact<{ [key: string]: never }>; -export interface ServerConfigQuery { serverConfig: { name: string; version: string; workspaceId: string; serverURL: string; rootURI: string; productConfiguration: any; supportsCustomConnections?: Maybe; supportsConnectionBrowser?: Maybe; supportsWorkspaces?: Maybe; sessionExpireTime?: Maybe; anonymousAccessEnabled?: Maybe; adminCredentialsSaveEnabled?: Maybe; publicCredentialsSaveEnabled?: Maybe; licenseRequired: boolean; licenseValid: boolean; configurationMode?: Maybe; developmentMode?: Maybe; enabledFeatures: string[]; enabledAuthProviders: string[]; supportedLanguages: Array<{ isoCode: string; displayName?: Maybe; nativeName?: Maybe }>; defaultNavigatorSettings: { showSystemObjects: boolean; showUtilityObjects: boolean; showOnlyEntities: boolean; mergeEntities: boolean; hideFolders: boolean; hideSchemas: boolean; hideVirtualModel: boolean }; productInfo: { id: string; version: string; name: string; description?: Maybe; buildTime: string; releaseTime: string; licenseInfo?: Maybe } } } +export interface ServerConfigQuery { serverConfig: { name: string; version: string; workspaceId: string; serverURL: string; rootURI: string; productConfiguration: any; supportsCustomConnections?: Maybe; supportsConnectionBrowser?: Maybe; supportsWorkspaces?: Maybe; sessionExpireTime?: Maybe; anonymousAccessEnabled?: Maybe; adminCredentialsSaveEnabled?: Maybe; publicCredentialsSaveEnabled?: Maybe; licenseRequired: boolean; licenseValid: boolean; configurationMode?: Maybe; developmentMode?: Maybe; enabledFeatures: string[]; enabledAuthProviders: string[]; supportedLanguages: Array<{ isoCode: string; displayName?: Maybe; nativeName?: Maybe }>; defaultNavigatorSettings: { showSystemObjects: boolean; showUtilityObjects: boolean; showOnlyEntities: boolean; mergeEntities: boolean; hideFolders: boolean; hideSchemas: boolean; hideVirtualModel: boolean }; productInfo: { id: string; version: string; latestVersionInfo?: Maybe; name: string; description?: Maybe; buildTime: string; releaseTime: string; licenseInfo?: Maybe } } } export type SessionPermissionsQueryVariables = Exact<{ [key: string]: never }>; @@ -3130,6 +3131,7 @@ export const ServerConfigDocument = ` productInfo { id version + latestVersionInfo name description buildTime diff --git a/webapp/packages/core-version-update/.gitignore b/webapp/packages/core-version-update/.gitignore new file mode 100644 index 0000000000..99902db863 --- /dev/null +++ b/webapp/packages/core-version-update/.gitignore @@ -0,0 +1,21 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/lib + +# misc +.DS_Store +.env* + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/webapp/packages/core-version-update/package.json b/webapp/packages/core-version-update/package.json new file mode 100644 index 0000000000..2247a1c27e --- /dev/null +++ b/webapp/packages/core-version-update/package.json @@ -0,0 +1,40 @@ +{ + "name": "@cloudbeaver/core-version-update", + "sideEffects": false, + "version": "0.1.0", + "description": "", + "license": "Apache-2.0", + "main": "lib/index.js", + "module": "lib/index.js", + "types": "src/index.ts", + "scripts": { + "prebuild": "rimraf lib/*", + "build": "webpack --config ../../configs/webpack.plugin.config.js", + "postbuild": "tsc", + "lint": "eslint ./src/ --ext .ts,.tsx", + "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix" + }, + "peerDependencies": { + "@cloudbeaver/core-administration": "^0.1.0", + "@cloudbeaver/core-authentication": "^0.1.0", + "@cloudbeaver/core-blocks": "^0.1.0", + "@cloudbeaver/core-di": "^0.1.0", + "@cloudbeaver/core-dialogs": "^0.1.0", + "@cloudbeaver/core-extensions": "^0.1.0", + "@cloudbeaver/core-localization": "^0.1.0", + "@cloudbeaver/core-notifications": "^0.1.0", + "@cloudbeaver/core-plugin": "^0.1.0", + "@cloudbeaver/core-sdk": "^0.1.0", + "@cloudbeaver/core-settings": "^0.1.0", + "@cloudbeaver/core-theming": "^0.1.0", + "@cloudbeaver/core-utils": "^0.1.0", + "@cloudbeaver/core-view": "^0.1.0", + "mobx": "^6.x.x" + }, + "dependencies": { + "semver": "^7.3.5" + }, + "devDependencies": { + "@types/semver": "^7.3.9" + } +} diff --git a/webapp/packages/core-version-update/src/LocaleService.ts b/webapp/packages/core-version-update/src/LocaleService.ts new file mode 100644 index 0000000000..4354d55e09 --- /dev/null +++ b/webapp/packages/core-version-update/src/LocaleService.ts @@ -0,0 +1,36 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import { Bootstrap, injectable } from '@cloudbeaver/core-di'; +import { LocalizationService } from '@cloudbeaver/core-localization'; + +@injectable() +export class VersionUpdateLocaleService extends Bootstrap { + constructor(private localizationService: LocalizationService) { + super(); + } + + register(): void | Promise { + this.localizationService.addProvider(this.provider.bind(this)); + } + + load(): void | Promise { } + + private async provider(locale: string) { + switch (locale) { + case 'ru': + return (await import('./locales/ru')).default; + case 'it': + return (await import('./locales/it')).default; + case 'zh': + return (await import('./locales/zh')).default; + default: + return (await import('./locales/en')).default; + } + } +} diff --git a/webapp/packages/core-version-update/src/VersionUpdateService.ts b/webapp/packages/core-version-update/src/VersionUpdateService.ts new file mode 100644 index 0000000000..2820ec3fee --- /dev/null +++ b/webapp/packages/core-version-update/src/VersionUpdateService.ts @@ -0,0 +1,46 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import { computed, makeObservable } from 'mobx'; +import { compare } from 'semver'; + +import { injectable } from '@cloudbeaver/core-di'; +import { IVersion, VersionService } from '@cloudbeaver/core-version'; + +interface IInstructionProps { + versions: IVersion[]; +} + +export type InstructionComponent = React.FunctionComponent; + +@injectable() +export class VersionUpdateService { + instructionGetter: (() => InstructionComponent) | null; + + get newVersionAvailable() { + if (!this.versionService.current || !this.versionService.latest) { + return false; + } + + return compare(this.versionService.latest.number, this.versionService.current) === 1; + } + + constructor( + private readonly versionService: VersionService, + ) { + this.instructionGetter = null; + + makeObservable(this, { + newVersionAvailable: computed, + }); + } + + registerInstruction(componentGetter: () => InstructionComponent): void { + this.instructionGetter = componentGetter; + } +} diff --git a/webapp/packages/core-version-update/src/index.ts b/webapp/packages/core-version-update/src/index.ts new file mode 100644 index 0000000000..1f90a4c28c --- /dev/null +++ b/webapp/packages/core-version-update/src/index.ts @@ -0,0 +1,3 @@ +export { manifest as coreVersionUpdateManifest } from './manifest'; + +export * from './VersionUpdateService'; diff --git a/webapp/packages/core-version-update/src/locales/en.ts b/webapp/packages/core-version-update/src/locales/en.ts new file mode 100644 index 0000000000..e8fbdc8374 --- /dev/null +++ b/webapp/packages/core-version-update/src/locales/en.ts @@ -0,0 +1,10 @@ +export default [ + ['version_update', 'Version update'], + ['version_update_version_is_up_to_date', 'Version is up to date'], + ['version_update_new_version_available', 'New version is available'], + ['version_update_version_no_info', 'No version information available'], + ['version_update_versions_refresh_successful', 'Versions list refreshed successfully'], + ['version_update_versions_refresh_fail', 'Versions list refresh failed'], + ['version_update_how_to_update', 'How to update'], + ['version_update_info', 'Info'], +]; diff --git a/webapp/packages/core-version-update/src/locales/it.ts b/webapp/packages/core-version-update/src/locales/it.ts new file mode 100644 index 0000000000..e8fbdc8374 --- /dev/null +++ b/webapp/packages/core-version-update/src/locales/it.ts @@ -0,0 +1,10 @@ +export default [ + ['version_update', 'Version update'], + ['version_update_version_is_up_to_date', 'Version is up to date'], + ['version_update_new_version_available', 'New version is available'], + ['version_update_version_no_info', 'No version information available'], + ['version_update_versions_refresh_successful', 'Versions list refreshed successfully'], + ['version_update_versions_refresh_fail', 'Versions list refresh failed'], + ['version_update_how_to_update', 'How to update'], + ['version_update_info', 'Info'], +]; diff --git a/webapp/packages/core-version-update/src/locales/ru.ts b/webapp/packages/core-version-update/src/locales/ru.ts new file mode 100644 index 0000000000..3eef410776 --- /dev/null +++ b/webapp/packages/core-version-update/src/locales/ru.ts @@ -0,0 +1,10 @@ +export default [ + ['version_update', 'Обновление версии'], + ['version_update_version_is_up_to_date', 'Установлена актуальная версия'], + ['version_update_new_version_available', 'Доступна новая версия'], + ['version_update_version_no_info', 'Информация о версии не найдена'], + ['version_update_versions_refresh_successful', 'Список версий успешно обновлен'], + ['version_update_versions_refresh_fail', 'Не удалось обновить список версий'], + ['version_update_how_to_update', 'Как обновить версию'], + ['version_update_info', 'Информация'], +]; diff --git a/webapp/packages/core-version-update/src/locales/zh.ts b/webapp/packages/core-version-update/src/locales/zh.ts new file mode 100644 index 0000000000..e8fbdc8374 --- /dev/null +++ b/webapp/packages/core-version-update/src/locales/zh.ts @@ -0,0 +1,10 @@ +export default [ + ['version_update', 'Version update'], + ['version_update_version_is_up_to_date', 'Version is up to date'], + ['version_update_new_version_available', 'New version is available'], + ['version_update_version_no_info', 'No version information available'], + ['version_update_versions_refresh_successful', 'Versions list refreshed successfully'], + ['version_update_versions_refresh_fail', 'Versions list refresh failed'], + ['version_update_how_to_update', 'How to update'], + ['version_update_info', 'Info'], +]; diff --git a/webapp/packages/core-version-update/src/manifest.ts b/webapp/packages/core-version-update/src/manifest.ts new file mode 100644 index 0000000000..85c9b2fdc1 --- /dev/null +++ b/webapp/packages/core-version-update/src/manifest.ts @@ -0,0 +1,23 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import type { PluginManifest } from '@cloudbeaver/core-di'; + +import { VersionUpdateLocaleService } from './LocaleService'; +import { VersionUpdateService } from './VersionUpdateService'; + +export const manifest: PluginManifest = { + info: { + name: 'Version update', + }, + + providers: [ + VersionUpdateService, + VersionUpdateLocaleService, + ], +}; diff --git a/webapp/packages/core-version-update/tsconfig.json b/webapp/packages/core-version-update/tsconfig.json new file mode 100644 index 0000000000..cccdae0035 --- /dev/null +++ b/webapp/packages/core-version-update/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "lib", + }, + "include": [ + "src" + ], + "exclude": [ + "**/node_modules", + "**/.*/" + ], +} \ No newline at end of file diff --git a/webapp/packages/core-version/.gitignore b/webapp/packages/core-version/.gitignore new file mode 100644 index 0000000000..99902db863 --- /dev/null +++ b/webapp/packages/core-version/.gitignore @@ -0,0 +1,21 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/lib + +# misc +.DS_Store +.env* + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/webapp/packages/core-version/package.json b/webapp/packages/core-version/package.json new file mode 100644 index 0000000000..1c0caf2147 --- /dev/null +++ b/webapp/packages/core-version/package.json @@ -0,0 +1,34 @@ +{ + "name": "@cloudbeaver/core-version", + "sideEffects": false, + "version": "0.1.0", + "description": "", + "license": "Apache-2.0", + "main": "lib/index.js", + "module": "lib/index.js", + "types": "src/index.ts", + "scripts": { + "prebuild": "rimraf lib/*", + "build": "webpack --config ../../configs/webpack.plugin.config.js", + "postbuild": "tsc", + "lint": "eslint ./src/ --ext .ts,.tsx", + "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix" + }, + "peerDependencies": { + "@cloudbeaver/core-administration": "^0.1.0", + "@cloudbeaver/core-authentication": "^0.1.0", + "@cloudbeaver/core-blocks": "^0.1.0", + "@cloudbeaver/core-di": "^0.1.0", + "@cloudbeaver/core-dialogs": "^0.1.0", + "@cloudbeaver/core-extensions": "^0.1.0", + "@cloudbeaver/core-localization": "^0.1.0", + "@cloudbeaver/core-notifications": "^0.1.0", + "@cloudbeaver/core-plugin": "^0.1.0", + "@cloudbeaver/core-sdk": "^0.1.0", + "@cloudbeaver/core-settings": "^0.1.0", + "@cloudbeaver/core-theming": "^0.1.0", + "@cloudbeaver/core-utils": "^0.1.0", + "@cloudbeaver/core-view": "^0.1.0", + "mobx": "^6.x.x" + } +} diff --git a/webapp/packages/core-version/src/VersionLocaleService.ts b/webapp/packages/core-version/src/VersionLocaleService.ts new file mode 100644 index 0000000000..2119ee0609 --- /dev/null +++ b/webapp/packages/core-version/src/VersionLocaleService.ts @@ -0,0 +1,36 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import { Bootstrap, injectable } from '@cloudbeaver/core-di'; +import { LocalizationService } from '@cloudbeaver/core-localization'; + +@injectable() +export class VersionLocaleService extends Bootstrap { + constructor(private localizationService: LocalizationService) { + super(); + } + + register(): void | Promise { + this.localizationService.addProvider(this.provider.bind(this)); + } + + load(): void | Promise { } + + private async provider(locale: string) { + switch (locale) { + case 'ru': + return (await import('./locales/ru')).default; + case 'it': + return (await import('./locales/it')).default; + case 'zh': + return (await import('./locales/zh')).default; + default: + return (await import('./locales/en')).default; + } + } +} diff --git a/webapp/packages/core-version/src/VersionResource.ts b/webapp/packages/core-version/src/VersionResource.ts new file mode 100644 index 0000000000..b695da2067 --- /dev/null +++ b/webapp/packages/core-version/src/VersionResource.ts @@ -0,0 +1,72 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import { makeObservable, observable, runInAction } from 'mobx'; + +import { injectable } from '@cloudbeaver/core-di'; +import { ServerConfigResource } from '@cloudbeaver/core-root'; +import { CachedMapResource } from '@cloudbeaver/core-sdk'; + +export interface IVersion { + number: string; + date: string; + releaseNotes: string; +} + +interface IVersions { + latestVersion?: string; + versions?: IVersion[]; +} + +@injectable() +export class VersionResource extends CachedMapResource { + latest: string | null; + constructor( + private readonly serverConfigResource: ServerConfigResource + ) { + super(); + + this.latest = null; + this.preloadResource(this.serverConfigResource); + + makeObservable(this, { + latest: observable.ref, + }); + } + + protected async loader(): Promise> { + const versionLink = this.serverConfigResource.data?.productInfo.latestVersionInfo; + if (!versionLink) { + return this.data; + } + + // https://www.npoint.io/docs/20ec48e3408c7e3543dc + const response = await fetch('https://api.npoint.io/20ec48e3408c7e3543dc', { + cache: 'no-cache', + }); + + const json = await response.json() as IVersions; + + if (json.latestVersion) { + this.latest = json.latestVersion; + } + + if (!json.versions) { + return this.data; + } + + runInAction(() => { + this.data.clear(); + for (const version of json.versions!) { + this.data.set(version.number, version); + } + }); + + return this.data; + } +} diff --git a/webapp/packages/core-version/src/VersionService.ts b/webapp/packages/core-version/src/VersionService.ts new file mode 100644 index 0000000000..a6db6fd7ae --- /dev/null +++ b/webapp/packages/core-version/src/VersionService.ts @@ -0,0 +1,58 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import { computed, makeObservable } from 'mobx'; + +import { injectable } from '@cloudbeaver/core-di'; +import { ServerService } from '@cloudbeaver/core-root'; +import { GlobalConstants } from '@cloudbeaver/core-utils'; + +import { IVersion, VersionResource } from './VersionResource'; + +const VERSION_REGEX = /(\d+\.\d+\.\d+)/; + +export interface IProductVersion { + frontendVersion: string; + backendVersion: string; +} + +@injectable() +export class VersionService { + get current(): string { + return this.getProductVersion(true).frontendVersion; + } + + get latest(): IVersion | undefined { + return this.versionResource.values.find(v => v.number === this.versionResource.latest); + } + + constructor( + private readonly serverService: ServerService, + private readonly versionResource: VersionResource, + ) { + makeObservable(this, { + current: computed, + latest: computed, + }); + } + + getProductVersion(short = false): IProductVersion { + let frontendVersion = GlobalConstants.version || ''; + let backendVersion = this.serverService.config.data?.version || ''; + + if (short) { + frontendVersion = VERSION_REGEX.exec(frontendVersion)?.[1] ?? frontendVersion; + backendVersion = VERSION_REGEX.exec(backendVersion)?.[1] ?? backendVersion; + } + + return { + frontendVersion, + backendVersion, + }; + } +} diff --git a/webapp/packages/core-version/src/index.ts b/webapp/packages/core-version/src/index.ts new file mode 100644 index 0000000000..8633dc16d8 --- /dev/null +++ b/webapp/packages/core-version/src/index.ts @@ -0,0 +1,4 @@ +export { manifest as coreVersionManifest } from './manifest'; + +export * from './VersionResource'; +export * from './VersionService'; diff --git a/webapp/packages/core-version/src/locales/en.ts b/webapp/packages/core-version/src/locales/en.ts new file mode 100644 index 0000000000..1139397f37 --- /dev/null +++ b/webapp/packages/core-version/src/locales/en.ts @@ -0,0 +1,8 @@ +export default [ + ['version', 'Version'], + ['versions', 'Versions'], + ['version_date', 'Release date'], + ['version_tag', 'Tag'], + ['version_latest', 'Latest'], + ['version_current', 'Current'], +]; diff --git a/webapp/packages/core-version/src/locales/it.ts b/webapp/packages/core-version/src/locales/it.ts new file mode 100644 index 0000000000..1139397f37 --- /dev/null +++ b/webapp/packages/core-version/src/locales/it.ts @@ -0,0 +1,8 @@ +export default [ + ['version', 'Version'], + ['versions', 'Versions'], + ['version_date', 'Release date'], + ['version_tag', 'Tag'], + ['version_latest', 'Latest'], + ['version_current', 'Current'], +]; diff --git a/webapp/packages/core-version/src/locales/ru.ts b/webapp/packages/core-version/src/locales/ru.ts new file mode 100644 index 0000000000..13904143a1 --- /dev/null +++ b/webapp/packages/core-version/src/locales/ru.ts @@ -0,0 +1,8 @@ +export default [ + ['version', 'Версия'], + ['versions', 'Версии'], + ['version_date', 'Дата релиза'], + ['version_tag', 'Тег'], + ['version_latest', 'Последняя'], + ['version_current', 'Текущая'], +]; diff --git a/webapp/packages/core-version/src/locales/zh.ts b/webapp/packages/core-version/src/locales/zh.ts new file mode 100644 index 0000000000..1139397f37 --- /dev/null +++ b/webapp/packages/core-version/src/locales/zh.ts @@ -0,0 +1,8 @@ +export default [ + ['version', 'Version'], + ['versions', 'Versions'], + ['version_date', 'Release date'], + ['version_tag', 'Tag'], + ['version_latest', 'Latest'], + ['version_current', 'Current'], +]; diff --git a/webapp/packages/core-version/src/manifest.ts b/webapp/packages/core-version/src/manifest.ts new file mode 100644 index 0000000000..6846893aa9 --- /dev/null +++ b/webapp/packages/core-version/src/manifest.ts @@ -0,0 +1,25 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import type { PluginManifest } from '@cloudbeaver/core-di'; + +import { VersionLocaleService } from './VersionLocaleService'; +import { VersionResource } from './VersionResource'; +import { VersionService } from './VersionService'; + +export const manifest: PluginManifest = { + info: { + name: 'App version', + }, + + providers: [ + VersionService, + VersionResource, + VersionLocaleService, + ], +}; diff --git a/webapp/packages/core-version/tsconfig.json b/webapp/packages/core-version/tsconfig.json new file mode 100644 index 0000000000..cccdae0035 --- /dev/null +++ b/webapp/packages/core-version/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "lib", + }, + "include": [ + "src" + ], + "exclude": [ + "**/node_modules", + "**/.*/" + ], +} \ No newline at end of file diff --git a/webapp/packages/plugin-version-update-administration/.gitignore b/webapp/packages/plugin-version-update-administration/.gitignore new file mode 100644 index 0000000000..15bc16c7c3 --- /dev/null +++ b/webapp/packages/plugin-version-update-administration/.gitignore @@ -0,0 +1,17 @@ +# dependencies +/node_modules + +# testing +/coverage + +# production +/lib + +# misc +.DS_Store +.env* + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/webapp/packages/plugin-version-update-administration/package.json b/webapp/packages/plugin-version-update-administration/package.json new file mode 100644 index 0000000000..bee88ebc8c --- /dev/null +++ b/webapp/packages/plugin-version-update-administration/package.json @@ -0,0 +1,49 @@ +{ + "name": "@cloudbeaver/plugin-version-update-administration", + "sideEffects": false, + "version": "0.1.0", + "description": "", + "license": "Apache-2.0", + "main": "lib/index.js", + "module": "lib/index.js", + "types": "src/index.ts", + "scripts": { + "prebuild": "rimraf lib/*", + "build": "webpack --config ../../configs/webpack.plugin.config.js", + "postbuild": "tsc", + "lint": "eslint ./src/ --ext .ts,.tsx", + "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix" + }, + "peerDependencies": { + "@cloudbeaver/core-administration": "^0.1.0", + "@cloudbeaver/core-app": "^0.1.0", + "@cloudbeaver/core-authentication": "^0.1.0", + "@cloudbeaver/core-blocks": "^0.1.0", + "@cloudbeaver/core-connections": "^0.1.0", + "@cloudbeaver/core-di": "^0.1.0", + "@cloudbeaver/core-dialogs": "^0.1.0", + "@cloudbeaver/core-events": "^0.1.0", + "@cloudbeaver/core-executor": "^0.1.0", + "@cloudbeaver/core-extensions": "^0.1.0", + "@cloudbeaver/core-localization": "^0.1.0", + "@cloudbeaver/core-notifications": "^0.1.0", + "@cloudbeaver/core-plugin": "^0.1.0", + "@cloudbeaver/core-product": "^0.1.0", + "@cloudbeaver/core-root": "^0.1.0", + "@cloudbeaver/core-routing": "^0.1.0", + "@cloudbeaver/core-sdk": "^0.1.0", + "@cloudbeaver/core-settings": "^0.1.0", + "@cloudbeaver/core-theming": "^0.1.0", + "@cloudbeaver/core-ui": "^0.1.0", + "@cloudbeaver/core-utils": "^0.1.0", + "@cloudbeaver/core-version-update": "^0.1.0", + "@cloudbeaver/core-view": "^0.1.0", + "mobx": "^6.x.x", + "mobx-react-lite": "^3.x.x", + "react": "^16.x.x", + "reshadow": "^0.x.x" + }, + "dependencies": { + "react-markdown": "^7.1.1" + } +} diff --git a/webapp/packages/plugin-version-update-administration/src/EVersionUpdate.ts b/webapp/packages/plugin-version-update-administration/src/EVersionUpdate.ts new file mode 100644 index 0000000000..6897cb7c76 --- /dev/null +++ b/webapp/packages/plugin-version-update-administration/src/EVersionUpdate.ts @@ -0,0 +1,12 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +export enum EVersionUpdate { + INFO = 'info', + VERSIONS = 'versions', +} diff --git a/webapp/packages/plugin-version-update-administration/src/Instructions.tsx b/webapp/packages/plugin-version-update-administration/src/Instructions.tsx new file mode 100644 index 0000000000..58a039babe --- /dev/null +++ b/webapp/packages/plugin-version-update-administration/src/Instructions.tsx @@ -0,0 +1,45 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import { observer } from 'mobx-react-lite'; +import styled, { css } from 'reshadow'; + +import { BASE_CONTAINERS_STYLES, Group, GroupItem, GroupTitle, useMapResource } from '@cloudbeaver/core-blocks'; +import { useService } from '@cloudbeaver/core-di'; +import { useTranslate } from '@cloudbeaver/core-localization'; +import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { useStyles } from '@cloudbeaver/core-theming'; +import { VersionResource } from '@cloudbeaver/core-version'; +import { VersionUpdateService } from '@cloudbeaver/core-version-update'; + +const style = css` + GroupItem { + white-space: pre-line; + } +`; + +export const Instructions = observer(function Instructions() { + const translate = useTranslate(); + const styles = useStyles(BASE_CONTAINERS_STYLES, style); + const versionUpdateService = useService(VersionUpdateService); + const versionResource = useMapResource(Instructions, VersionResource, CachedMapAllKey); + + if (!versionUpdateService.instructionGetter) { + return null; + } + + const Instruction = versionUpdateService.instructionGetter(); + return styled(styles)( + + {translate('version_update_how_to_update')} + + + + + ); +}); diff --git a/webapp/packages/plugin-version-update-administration/src/PluginBootstrap.ts b/webapp/packages/plugin-version-update-administration/src/PluginBootstrap.ts new file mode 100644 index 0000000000..670c9de0f9 --- /dev/null +++ b/webapp/packages/plugin-version-update-administration/src/PluginBootstrap.ts @@ -0,0 +1,34 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import { AdministrationItemService, AdministrationItemType } from '@cloudbeaver/core-administration'; +import { Bootstrap, injectable } from '@cloudbeaver/core-di'; + +import { VersionUpdate } from './VersionUpdate'; +import { VersionUpdateDrawerItem } from './VersionUpdateDrawerItem'; + +@injectable() +export class PluginBootstrap extends Bootstrap { + constructor( + private readonly administrationItemService: AdministrationItemService + ) { + super(); + } + + async load(): Promise { } + + register(): void { + this.administrationItemService.create({ + name: 'version-update', + type: AdministrationItemType.Administration, + order: 5, + getContentComponent: () => VersionUpdate, + getDrawerComponent: () => VersionUpdateDrawerItem, + }); + } +} diff --git a/webapp/packages/plugin-version-update-administration/src/Version.tsx b/webapp/packages/plugin-version-update-administration/src/Version.tsx new file mode 100644 index 0000000000..cc2a689df9 --- /dev/null +++ b/webapp/packages/plugin-version-update-administration/src/Version.tsx @@ -0,0 +1,41 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import { observer } from 'mobx-react-lite'; +import styled, { css } from 'reshadow'; + +import { TableItem, TableColumnValue, TableItemExpand } from '@cloudbeaver/core-blocks'; +import { useStyles } from '@cloudbeaver/core-theming'; +import type { IVersion } from '@cloudbeaver/core-version'; + +import { VersionInfo } from './VersionInfo'; + +const styles = css` + TableColumnValue[expand] { + cursor: pointer; + } + TableColumnValue[|gap] { + gap: 16px; + } +`; + +interface Props { + version: IVersion; +} + +export const Version = observer(function Version({ version }) { + return styled(useStyles(styles))( + + + + + {version.number} + {version.date} + + ); +}); diff --git a/webapp/packages/plugin-version-update-administration/src/VersionChecker.tsx b/webapp/packages/plugin-version-update-administration/src/VersionChecker.tsx new file mode 100644 index 0000000000..eee19471fc --- /dev/null +++ b/webapp/packages/plugin-version-update-administration/src/VersionChecker.tsx @@ -0,0 +1,46 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import { observer } from 'mobx-react-lite'; +import styled, { css } from 'reshadow'; + +import { BASE_CONTAINERS_STYLES, Cell, IconOrImage } from '@cloudbeaver/core-blocks'; +import { useService } from '@cloudbeaver/core-di'; +import { useTranslate } from '@cloudbeaver/core-localization'; +import { useStyles } from '@cloudbeaver/core-theming'; +import { VersionService } from '@cloudbeaver/core-version'; +import { VersionUpdateService } from '@cloudbeaver/core-version-update'; + +const style = css` + before { + width: 40px; + height: 40px; + } +`; + +export const VersionChecker = observer(function VersionChecker() { + const styles = useStyles(BASE_CONTAINERS_STYLES); + const translate = useTranslate(); + const versionUpdateService = useService(VersionUpdateService); + const versionService = useService(VersionService); + + const icon = versionUpdateService.newVersionAvailable ? '/icons/info_icon.svg' : '/icons/success_icon.svg'; + const text = versionUpdateService.newVersionAvailable ? 'version_update_new_version_available' : 'version_update_version_is_up_to_date'; + const description = versionService.current && versionService.latest + ? `${translate('version_current')}: ${versionService.current}, ${translate('version_latest')}: ${versionService.latest.number}` : ''; + + return styled(styles)( + } + description={versionUpdateService.newVersionAvailable ? description : undefined} + style={style} + > + {translate(text)} + + ); +}); diff --git a/webapp/packages/plugin-version-update-administration/src/VersionInfo.tsx b/webapp/packages/plugin-version-update-administration/src/VersionInfo.tsx new file mode 100644 index 0000000000..462447c22f --- /dev/null +++ b/webapp/packages/plugin-version-update-administration/src/VersionInfo.tsx @@ -0,0 +1,51 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import { observer } from 'mobx-react-lite'; +import ReactMarkdown from 'react-markdown'; +import styled, { css } from 'reshadow'; + +import { BASE_CONTAINERS_STYLES, ColoredContainer, Group, GroupItem, GroupTitle, useMapResource } from '@cloudbeaver/core-blocks'; +import { useTranslate } from '@cloudbeaver/core-localization'; +import { useStyles } from '@cloudbeaver/core-theming'; +import { VersionResource } from '@cloudbeaver/core-version'; + +interface Props { + item: string; +} + +const style = css` + Group { + composes: theme-typography--body2 from global; + } + ReactMarkdown > * { + margin: 0; + padding: 0; + } +`; + +export const VersionInfo = observer(function VersionInfo({ item }) { + const translate = useTranslate(); + const styles = useStyles(BASE_CONTAINERS_STYLES, style); + const versionResource = useMapResource(VersionInfo, VersionResource, item); + + const version = versionResource.data; + + return styled(styles)( + + + {version ? `CloudBeaver ${version.number} - ${version.date}` : translate('version_update_version_no_info')} + {version && ( + + {version.releaseNotes} + + )} + + + ); +}); diff --git a/webapp/packages/plugin-version-update-administration/src/VersionUpdate.tsx b/webapp/packages/plugin-version-update-administration/src/VersionUpdate.tsx new file mode 100644 index 0000000000..c7eaba5841 --- /dev/null +++ b/webapp/packages/plugin-version-update-administration/src/VersionUpdate.tsx @@ -0,0 +1,63 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import { observer } from 'mobx-react-lite'; +import styled, { css } from 'reshadow'; + +import { AdministrationItemContentComponent, ADMINISTRATION_TOOLS_PANEL_STYLES } from '@cloudbeaver/core-administration'; +import { TabsState, TabList, Tab, TabPanel, ToolsPanel, UNDERLINE_TAB_STYLES, BASE_CONTAINERS_STYLES, ColoredContainer } from '@cloudbeaver/core-blocks'; +import { useTranslate } from '@cloudbeaver/core-localization'; +import { useStyles } from '@cloudbeaver/core-theming'; + +import { EVersionUpdate } from './EVersionUpdate'; +import { Instructions } from './Instructions'; +import { VersionChecker } from './VersionChecker'; +import { VersionsTable } from './VersionsTable'; + +const tabsStyles = css` + TabList { + position: relative; + flex-shrink: 0; + align-items: center; + height: 51px; + } + Tab { + height: 46px!important; + text-transform: uppercase; + font-weight: 500 !important; + } + TabPanel { + flex-direction: column; + } +`; + +export const VersionUpdate: AdministrationItemContentComponent = observer(function VersionUpdate() { + const tabStyle = [tabsStyles, UNDERLINE_TAB_STYLES]; + const translate = useTranslate(); + const style = useStyles(ADMINISTRATION_TOOLS_PANEL_STYLES, BASE_CONTAINERS_STYLES, tabStyle); + + return styled(style)( + + + + {translate('version_update_info')} + {translate('versions')} + + + + + + + + + + + + + ); +}); diff --git a/webapp/packages/plugin-version-update-administration/src/VersionUpdateDrawerItem.tsx b/webapp/packages/plugin-version-update-administration/src/VersionUpdateDrawerItem.tsx new file mode 100644 index 0000000000..38a991d197 --- /dev/null +++ b/webapp/packages/plugin-version-update-administration/src/VersionUpdateDrawerItem.tsx @@ -0,0 +1,63 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import { observer } from 'mobx-react-lite'; +import styled, { css } from 'reshadow'; + +import type { AdministrationItemDrawerProps } from '@cloudbeaver/core-administration'; +import { Tab, TabTitle, TabIcon, IconOrImage, useMapResource } from '@cloudbeaver/core-blocks'; +import { useService } from '@cloudbeaver/core-di'; +import { Translate, useTranslate } from '@cloudbeaver/core-localization'; +import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { useStyles } from '@cloudbeaver/core-theming'; +import { VersionResource } from '@cloudbeaver/core-version'; +import { VersionUpdateService } from '@cloudbeaver/core-version-update'; + +const styles = css` + tab-container { + justify-content: space-between; + } + content { + display: flex; + align-items: center; + } + icon-container { + display: flex; + } + IconOrImage { + width: 16px; + } +`; + +export const VersionUpdateDrawerItem = observer(function VersionUpdateDrawerItem({ + item, onSelect, style, disabled, +}) { + const translate = useTranslate(); + const versionUpdateService = useService(VersionUpdateService); + useMapResource(VersionUpdateDrawerItem, VersionResource, CachedMapAllKey); + + return styled(useStyles(style, styles))( + onSelect(item.name)} + > + + + + + {versionUpdateService.newVersionAvailable && ( + + + + )} + + ); +}); diff --git a/webapp/packages/plugin-version-update-administration/src/VersionsTable.tsx b/webapp/packages/plugin-version-update-administration/src/VersionsTable.tsx new file mode 100644 index 0000000000..867de14a0b --- /dev/null +++ b/webapp/packages/plugin-version-update-administration/src/VersionsTable.tsx @@ -0,0 +1,122 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import { observer } from 'mobx-react-lite'; +import { useCallback } from 'react'; +import styled, { css, use } from 'reshadow'; + +import { ADMINISTRATION_TOOLS_PANEL_STYLES } from '@cloudbeaver/core-administration'; +import { Table, TableHeader, TableColumnHeader, TableBody, ToolsAction, ToolsPanel, Loader, useTable, useMapResource } from '@cloudbeaver/core-blocks'; +import { useService } from '@cloudbeaver/core-di'; +import { NotificationService } from '@cloudbeaver/core-events'; +import { useTranslate } from '@cloudbeaver/core-localization'; +import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { composes, useStyles } from '@cloudbeaver/core-theming'; +import { VersionResource } from '@cloudbeaver/core-version'; + +import { Version } from './Version'; + +const layoutStyles = composes( + css` + layout-grid-cell { + composes: theme-background-surface theme-text-on-surface from global; + } + + layout-grid-cell { + composes: theme-border-color-background from global; + } + `, + css` + layout-grid { + width: 100%; + overflow: auto; + } + + layout-grid-inner { + min-height: 100%; + } + + layout-grid-cell { + position: relative; + border: solid 1px; + } + ` +); + +const loaderStyle = css` + ExceptionMessage { + padding: 24px; + } +`; + +const styles = css` + Table { + width: 100%; + } + + ToolsPanel { + border-bottom: none; + } +`; + +export const VersionsTable = observer(function VersionsTable() { + const translate = useTranslate(); + const style = useStyles(styles, ADMINISTRATION_TOOLS_PANEL_STYLES, layoutStyles); + const notificationService = useService(NotificationService); + const versionResource = useMapResource(VersionsTable, VersionResource, CachedMapAllKey); + const table = useTable(); + + const refresh = useCallback(async () => { + try { + versionResource.resource.markOutdated(); + await versionResource.resource.load(CachedMapAllKey); + notificationService.logSuccess({ title: 'version_update_versions_refresh_successful' }); + } catch (exception) { + notificationService.logException(exception, 'version_update_versions_refresh_fail'); + } + }, [versionResource, notificationService]); + + return styled(style)( + + + + + + {translate('ui_refresh')} + + + + + + + + + {translate('version')} + {translate('version_date')} + + + {versionResource.resource.values.map(version => ( + + ))} + +
+
+
+
+
+ ); +}); diff --git a/webapp/packages/plugin-version-update-administration/src/index.ts b/webapp/packages/plugin-version-update-administration/src/index.ts new file mode 100644 index 0000000000..0574352abc --- /dev/null +++ b/webapp/packages/plugin-version-update-administration/src/index.ts @@ -0,0 +1,3 @@ +import { versionUpdatePlugin } from './manifest'; + +export default versionUpdatePlugin; diff --git a/webapp/packages/plugin-version-update-administration/src/manifest.ts b/webapp/packages/plugin-version-update-administration/src/manifest.ts new file mode 100644 index 0000000000..e39c660529 --- /dev/null +++ b/webapp/packages/plugin-version-update-administration/src/manifest.ts @@ -0,0 +1,21 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import type { PluginManifest } from '@cloudbeaver/core-di'; + +import { PluginBootstrap } from './PluginBootstrap'; + +export const versionUpdatePlugin: PluginManifest = { + info: { + name: 'Version update plugin', + }, + + providers: [ + PluginBootstrap, + ], +}; diff --git a/webapp/packages/plugin-version-update-administration/tsconfig.json b/webapp/packages/plugin-version-update-administration/tsconfig.json new file mode 100644 index 0000000000..8cd6b539e3 --- /dev/null +++ b/webapp/packages/plugin-version-update-administration/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["src"], + "exclude": ["**/node_modules", "**/.*/"], +} diff --git a/webapp/packages/product-default/src/ProductBootstrap.ts b/webapp/packages/product-default/src/ProductBootstrap.ts new file mode 100644 index 0000000000..5719d655e7 --- /dev/null +++ b/webapp/packages/product-default/src/ProductBootstrap.ts @@ -0,0 +1,29 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import { Bootstrap, injectable } from '@cloudbeaver/core-di'; +import { VersionUpdateService } from '@cloudbeaver/core-version-update'; + +import { UpdateInstruction } from './UpdateInstruction'; + +@injectable() +export class ProductBootstrap extends Bootstrap { + constructor( + private readonly versionUpdateService: VersionUpdateService + ) { + super(); + } + + async load() { } + + register() { + this.versionUpdateService.registerInstruction( + () => UpdateInstruction + ); + } +} diff --git a/webapp/packages/product-default/src/UpdateInstruction.tsx b/webapp/packages/product-default/src/UpdateInstruction.tsx new file mode 100644 index 0000000000..2e030f03c2 --- /dev/null +++ b/webapp/packages/product-default/src/UpdateInstruction.tsx @@ -0,0 +1,30 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import type { InstructionComponent } from '@cloudbeaver/core-version-update'; + +export const UpdateInstruction: InstructionComponent = function UpdateInstruction({ versions }) { + return ( +
+ {`CE PRODUCT + + Molly Miller temperate perch yellowfin tuna. Kelpfish vimba candlefish deepwater cardinalfish crappie yellowbelly tail catfish sand tilefish angler catfish tommy ruff. + + Trevally tompot blenny coelacanth; earthworm eel thresher shark duckbill eel Pacific saury. Antenna codlet queen triggerfish regal whiptail catfish lightfish slender barracudina bigmouth buffalo. Gray reef shark, pufferfish sandperch lemon shark, swallower darter seamoth paperbone crappie minnow carpsucker mora rudd. Cherubfish northern sea robin, barbeled houndshark giant sea bass armorhead giant sea bass daggertooth pike conger. Beaked salmon grideye flatfish nurse shark Owens pupfish lizardfish tetra pejerrey slickhead bigeye--Japanese eel. + + Bala shark slipmouth piranha morid cod thorny catfish deep sea bonefish Bigscale pomfret yellowbanded perch bream. Armoured catfish; largenose fish temperate ocean-bass, gizzard shad! Sacramento blackfish; candlefish damselfish pollock, yellowfin cutthroat trout bluefish silverside eeltail catfish steelhead. Rockfish warbonnet archerfish ribbonfish platyfish, "sturgeon frigate mackerel cavefish requiem shark sardine smelt." + + Wrasse sábalo bullhead Blacksmelt tench sleeper sandburrower labyrinth fish yellowtail snapper armored searobin Black tetra prickleback flagtail mosshead warbonnet snubnose parasitic eel. Jellynose fish, squawfish pelican gulper wasp fish, warmouth stonefish Antarctic icefish requiem shark orbicular velvetfish, loach minnow. + + Cardinalfish, "slimy mackerel," Blacksmelt dory megamouth shark darter, toadfish leatherjacket lamprey ocean sunfish sole, mora duckbill eel swordtail delta smelt grenadier slender barracudina." Atlantic trout Atlantic cod, Colorado squawfish, Atlantic eel, razorfish unicorn fish, whitetip reef shark. Black angelfish angler catfish blue shark ghost flathead? Lamprey weatherfish swordfish galjoen fish banjo catfish moonfish Moses sole peamouth eel Black mackerel Celebes rainbowfish grayling inanga boarfish x-ray tetra. Flagblenny Black scabbardfish--hamlet Black triggerfish sea snail Modoc sucker whiting cardinalfish. + + + Does your lorem ipsum text long for something a little fishier? Give our generator a try… it’s fishy!`} +
+ ); +}; diff --git a/webapp/packages/product-default/src/index.ts b/webapp/packages/product-default/src/index.ts index 8d1d9408cd..5c2fe71ee2 100644 --- a/webapp/packages/product-default/src/index.ts +++ b/webapp/packages/product-default/src/index.ts @@ -21,6 +21,7 @@ import sqlEditorTab from '@cloudbeaver/plugin-sql-editor-navigation-tab'; import sqlEditorScreen from '@cloudbeaver/plugin-sql-editor-screen'; import userProfile from '@cloudbeaver/plugin-user-profile'; import userProfileAdministration from '@cloudbeaver/plugin-user-profile-administration'; +import versionUpdate from '@cloudbeaver/plugin-version-update-administration'; import { defaultProductManifest } from './manifest'; @@ -44,6 +45,7 @@ const PLUGINS: PluginManifest[] = [ defaultProductManifest, connectionPlugin, connectionAdministration, + versionUpdate, productPlugin, ]; diff --git a/webapp/yarn.lock b/webapp/yarn.lock index 22011f6148..c30e81eff6 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -3191,6 +3191,13 @@ dependencies: "@types/tern" "*" +"@types/debug@^4.0.0": + version "4.1.7" + resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.7.tgz#7cc0ea761509124709b8b2d1090d8f6c17aadb82" + integrity sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg== + dependencies: + "@types/ms" "*" + "@types/eslint-scope@^3.7.0": version "3.7.1" resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.1.tgz#8dc390a7b4f9dd9f1284629efce982e41612116e" @@ -3225,6 +3232,13 @@ resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.8.tgz#30744afdb385e2945e22f3b033f897f76b1f12ca" integrity sha512-1rkryxURpr6aWP7R786/UQOkJ3PcpQiWkAXBmdWc7ryFWqN6a4xfK7BtjXvFBKO9LjQ+MWQSWxYeZX1OApnArA== +"@types/hast@^2.0.0": + version "2.3.4" + resolved "https://registry.yarnpkg.com/@types/hast/-/hast-2.3.4.tgz#8aa5ef92c117d20d974a82bdfb6a648b08c0bafc" + integrity sha512-wLEm0QvaoawEDoTRwzTXp4b4jpwiJDvR5KMnFnVodm3scufTlBOWRD6N1OBf9TZMhjlNsSfcO5V+7AF4+Vy+9g== + dependencies: + "@types/unist" "*" + "@types/html-minifier-terser@^6.0.0": version "6.0.0" resolved "https://registry.yarnpkg.com/@types/html-minifier-terser/-/html-minifier-terser-6.0.0.tgz#563c1c6c132cd204e71512f9c0b394ff90d3fae7" @@ -3283,6 +3297,18 @@ dependencies: "@types/node" "*" +"@types/mdast@^3.0.0": + version "3.0.10" + resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-3.0.10.tgz#4724244a82a4598884cbbe9bcfd73dff927ee8af" + integrity sha512-W864tg/Osz1+9f4lrGTZpCSO5/z4608eUp19tbozkq2HJK6i3z1kT0H9tlADXuYIb1YYOBByU4Jsqkk75q48qA== + dependencies: + "@types/unist" "*" + +"@types/mdurl@^1.0.0": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@types/mdurl/-/mdurl-1.0.2.tgz#e2ce9d83a613bacf284c7be7d491945e39e1f8e9" + integrity sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA== + "@types/minimatch@^3.0.3": version "3.0.5" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40" @@ -3293,6 +3319,11 @@ resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== +"@types/ms@*": + version "0.7.31" + resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" + integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== + "@types/node@*": version "16.0.0" resolved "https://registry.yarnpkg.com/@types/node/-/node-16.0.0.tgz#067a6c49dc7a5c2412a505628e26902ae967bf6f" @@ -3361,6 +3392,11 @@ resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39" integrity sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew== +"@types/semver@^7.3.9": + version "7.3.9" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.9.tgz#152c6c20a7688c30b967ec1841d31ace569863fc" + integrity sha512-L/TMpyURfBkf+o/526Zb6kd/tchUP3iBDEPjqjb+U2MAJhVRxxrmr2fwpe08E7QsV7YLcpq0tUaQ9O9x97ZIxQ== + "@types/tern@*": version "0.23.4" resolved "https://registry.yarnpkg.com/@types/tern/-/tern-0.23.4.tgz#03926eb13dbeaf3ae0d390caf706b2643a0127fb" @@ -3368,6 +3404,11 @@ dependencies: "@types/estree" "*" +"@types/unist@*", "@types/unist@^2.0.0": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d" + integrity sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ== + "@types/uuid@^7.0.2": version "7.0.5" resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-7.0.5.tgz#b1d2f772142a301538fae9bdf9cf15b9f2573a29" @@ -4220,6 +4261,11 @@ backo2@^1.0.2: resolved "https://registry.yarnpkg.com/backo2/-/backo2-1.0.2.tgz#31ab1ac8b129363463e35b3ebb69f4dfcfba7947" integrity sha1-MasayLEpNjRj41s+u2n038+6eUc= +bail@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/bail/-/bail-2.0.2.tgz#d26f5cd8fe5d6f832a31517b9f7c356040ba6d5d" + integrity sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw== + balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" @@ -4628,6 +4674,11 @@ change-case@^4.1.2: snake-case "^3.0.4" tslib "^2.0.3" +character-entities@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/character-entities/-/character-entities-2.0.1.tgz#98724833e1e27990dee0bd0f2b8a859c3476aac7" + integrity sha512-OzmutCf2Kmc+6DrFrrPS8/tDh2+DpnrfzdICHWhcVC9eOd0N1PXmQEE1a8iM4IziIAG+8tmTq3K+oo0ubH6RRQ== + chardet@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" @@ -4874,6 +4925,11 @@ combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" +comma-separated-tokens@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/comma-separated-tokens/-/comma-separated-tokens-2.0.2.tgz#d4c25abb679b7751c880be623c1179780fe1dd98" + integrity sha512-G5yTt3KQN4Yn7Yk4ed73hlZ1evrFKXeUW3086p3PRFNp7m2vIjI6Pg+Kgb+oyzhd9F2qdcoj67+y3SdxL5XWsg== + commander@^2.20.0: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" @@ -5478,6 +5534,13 @@ debug@^3.0.0, debug@^3.1.1, debug@^3.2.7: dependencies: ms "^2.1.1" +debug@^4.0.0: + version "4.3.3" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664" + integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== + dependencies: + ms "2.1.2" + debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" @@ -5501,6 +5564,13 @@ declaration-bundler-webpack-plugin@^1.0.3: resolved "https://registry.yarnpkg.com/declaration-bundler-webpack-plugin/-/declaration-bundler-webpack-plugin-1.0.3.tgz#9fb5ae393c63ed4175e7b6de4b58bafde34f097a" integrity sha1-n7WuOTxj7UF157beS1i6/eNPCXo= +decode-named-character-reference@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/decode-named-character-reference/-/decode-named-character-reference-1.0.1.tgz#57b2bd9112659cacbc449d3577d7dadb8e1f3d1b" + integrity sha512-YV/0HQHreRwKb7uBopyIkLG17jG6Sv2qUchk9qSoVJ2f+flwRsPNBO0hAnjt6mTNYUT+vw9Gy2ihXg4sUWPi2w== + dependencies: + character-entities "^2.0.0" + decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" @@ -5637,6 +5707,11 @@ deprecation@^2.0.0, deprecation@^2.3.1: resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.3.1.tgz#6368cbdb40abf3373b525ac87e4a260c3a700919" integrity sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ== +dequal@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.2.tgz#85ca22025e3a87e65ef75a7a437b35284a7e319d" + integrity sha512-q9K8BlJVxK7hQYqa6XISGmBZbtQQWVXSrRrWreHC94rMt1QL/Impruc+7p2CYSYuVIUr+YCt6hjrs1kkdJRTug== + destroy@~1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" @@ -5670,6 +5745,11 @@ diff@^4.0.1: resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== +diff@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" + integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== + dir-glob@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.0.0.tgz#0b205d2b6aef98238ca286598a8204d29d0a0034" @@ -6435,7 +6515,7 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2: assign-symbols "^1.0.0" is-extendable "^1.0.1" -extend@~3.0.2: +extend@^3.0.0, extend@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== @@ -7299,6 +7379,11 @@ has@^1.0.0, has@^1.0.3: dependencies: function-bind "^1.1.1" +hast-util-whitespace@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-2.0.0.tgz#4fc1086467cc1ef5ba20673cb6b03cec3a970f1c" + integrity sha512-Pkw+xBHuV6xFeJprJe2BBEoDV+AvQySaz3pPDRUs5PNZEMQjpXJJueqrpcHIXxnWTcAGi/UOCgVShlkY6kLoqg== + he@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" @@ -7674,6 +7759,11 @@ init-package-json@^2.0.2: validate-npm-package-license "^3.0.4" validate-npm-package-name "^3.0.0" +inline-style-parser@0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/inline-style-parser/-/inline-style-parser-0.1.1.tgz#ec8a3b429274e9c0a1f1c4ffa9453a7fef72cea1" + integrity sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q== + inquirer@^7.3.3: version "7.3.3" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.3.3.tgz#04d176b2af04afc157a83fd7c100e98ee0aad003" @@ -7817,6 +7907,11 @@ is-buffer@^1.1.5, is-buffer@~1.1.6: resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== +is-buffer@^2.0.0: + version "2.0.5" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.5.tgz#ebc252e400d22ff8d77fa09888821a24a658c191" + integrity sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ== + is-callable@^1.1.4, is-callable@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.3.tgz#8b1e0500b73a1d76c70487636f368e519de8db8e" @@ -8040,6 +8135,11 @@ is-plain-obj@^3.0.0: resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-3.0.0.tgz#af6f2ea14ac5a646183a5bbdb5baabbc156ad9d7" integrity sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA== +is-plain-obj@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-4.0.0.tgz#06c0999fd7574edf5a906ba5644ad0feb3a84d22" + integrity sha512-NXRbBtUdBioI73y/HmOhogw/U5msYPC9DAtGkJXeFcFWSFZw0mCUsPxk/snTuJHzNKA8kLBK4rH97RMB1BfCXw== + is-plain-object@^2.0.3, is-plain-object@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" @@ -8471,6 +8571,11 @@ kind-of@^6.0.0, kind-of@^6.0.2, kind-of@^6.0.3: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== +kleur@^4.0.3: + version "4.1.4" + resolved "https://registry.yarnpkg.com/kleur/-/kleur-4.1.4.tgz#8c202987d7e577766d039a8cd461934c01cda04d" + integrity sha512-8QADVssbrFjivHWQU7KkMgptGTl6WAcSdlbBPY4uNF+mWr6DGcKrvY2w4FQJoXch7+fKMjj0dRrL75vk3k23OA== + klona@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/klona/-/klona-2.0.4.tgz#7bb1e3affb0cb8624547ef7e8f6708ea2e39dfc0" @@ -8919,6 +9024,53 @@ md5@^2.3.0: crypt "0.0.2" is-buffer "~1.1.6" +mdast-util-definitions@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/mdast-util-definitions/-/mdast-util-definitions-5.1.0.tgz#b6d10ef00a3c4cf191e8d9a5fa58d7f4a366f817" + integrity sha512-5hcR7FL2EuZ4q6lLMUK5w4lHT2H3vqL9quPvYZ/Ku5iifrirfMHiGdhxdXMUbUkDmz5I+TYMd7nbaxUhbQkfpQ== + dependencies: + "@types/mdast" "^3.0.0" + "@types/unist" "^2.0.0" + unist-util-visit "^3.0.0" + +mdast-util-from-markdown@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mdast-util-from-markdown/-/mdast-util-from-markdown-1.2.0.tgz#84df2924ccc6c995dec1e2368b2b208ad0a76268" + integrity sha512-iZJyyvKD1+K7QX1b5jXdE7Sc5dtoTry1vzV28UZZe8Z1xVnB/czKntJ7ZAkG0tANqRnBF6p3p7GpU1y19DTf2Q== + dependencies: + "@types/mdast" "^3.0.0" + "@types/unist" "^2.0.0" + decode-named-character-reference "^1.0.0" + mdast-util-to-string "^3.1.0" + micromark "^3.0.0" + micromark-util-decode-numeric-character-reference "^1.0.0" + micromark-util-decode-string "^1.0.0" + micromark-util-normalize-identifier "^1.0.0" + micromark-util-symbol "^1.0.0" + micromark-util-types "^1.0.0" + unist-util-stringify-position "^3.0.0" + uvu "^0.5.0" + +mdast-util-to-hast@^11.0.0: + version "11.3.0" + resolved "https://registry.yarnpkg.com/mdast-util-to-hast/-/mdast-util-to-hast-11.3.0.tgz#ea9220617a710e80aa5cc3ac7cc9d4bb0440ae7a" + integrity sha512-4o3Cli3hXPmm1LhB+6rqhfsIUBjnKFlIUZvudaermXB+4/KONdd/W4saWWkC+LBLbPMqhFSSTSRgafHsT5fVJw== + dependencies: + "@types/hast" "^2.0.0" + "@types/mdast" "^3.0.0" + "@types/mdurl" "^1.0.0" + mdast-util-definitions "^5.0.0" + mdurl "^1.0.0" + unist-builder "^3.0.0" + unist-util-generated "^2.0.0" + unist-util-position "^4.0.0" + unist-util-visit "^4.0.0" + +mdast-util-to-string@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/mdast-util-to-string/-/mdast-util-to-string-3.1.0.tgz#56c506d065fbf769515235e577b5a261552d56e9" + integrity sha512-n4Vypz/DZgwo0iMHLQL49dJzlp7YtAJP+N07MZHpjPf/5XJuHUWstviF4Mn2jEiR/GNmtnRRqnwsXExk3igfFA== + mdn-data@2.0.14: version "2.0.14" resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.14.tgz#7113fc4281917d63ce29b43446f701e68c25ba50" @@ -8929,6 +9081,11 @@ mdn-data@2.0.4: resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.4.tgz#699b3c38ac6f1d728091a64650b65d388502fd5b" integrity sha512-iV3XNKw06j5Q7mi6h+9vbx23Tv7JkjEVgKHW4pimwyDGWm0OIQntJJ+u1C6mg6mK1EaTv42XQ7w76yuzH7M2cA== +mdurl@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" + integrity sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4= + media-typer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" @@ -9008,6 +9165,201 @@ methods@~1.1.2: resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= +micromark-core-commonmark@^1.0.1: + version "1.0.6" + resolved "https://registry.yarnpkg.com/micromark-core-commonmark/-/micromark-core-commonmark-1.0.6.tgz#edff4c72e5993d93724a3c206970f5a15b0585ad" + integrity sha512-K+PkJTxqjFfSNkfAhp4GB+cZPfQd6dxtTXnf+RjZOV7T4EEXnvgzOcnp+eSTmpGk9d1S9sL6/lqrgSNn/s0HZA== + dependencies: + decode-named-character-reference "^1.0.0" + micromark-factory-destination "^1.0.0" + micromark-factory-label "^1.0.0" + micromark-factory-space "^1.0.0" + micromark-factory-title "^1.0.0" + micromark-factory-whitespace "^1.0.0" + micromark-util-character "^1.0.0" + micromark-util-chunked "^1.0.0" + micromark-util-classify-character "^1.0.0" + micromark-util-html-tag-name "^1.0.0" + micromark-util-normalize-identifier "^1.0.0" + micromark-util-resolve-all "^1.0.0" + micromark-util-subtokenize "^1.0.0" + micromark-util-symbol "^1.0.0" + micromark-util-types "^1.0.1" + uvu "^0.5.0" + +micromark-factory-destination@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/micromark-factory-destination/-/micromark-factory-destination-1.0.0.tgz#fef1cb59ad4997c496f887b6977aa3034a5a277e" + integrity sha512-eUBA7Rs1/xtTVun9TmV3gjfPz2wEwgK5R5xcbIM5ZYAtvGF6JkyaDsj0agx8urXnO31tEO6Ug83iVH3tdedLnw== + dependencies: + micromark-util-character "^1.0.0" + micromark-util-symbol "^1.0.0" + micromark-util-types "^1.0.0" + +micromark-factory-label@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/micromark-factory-label/-/micromark-factory-label-1.0.2.tgz#6be2551fa8d13542fcbbac478258fb7a20047137" + integrity sha512-CTIwxlOnU7dEshXDQ+dsr2n+yxpP0+fn271pu0bwDIS8uqfFcumXpj5mLn3hSC8iw2MUr6Gx8EcKng1dD7i6hg== + dependencies: + micromark-util-character "^1.0.0" + micromark-util-symbol "^1.0.0" + micromark-util-types "^1.0.0" + uvu "^0.5.0" + +micromark-factory-space@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/micromark-factory-space/-/micromark-factory-space-1.0.0.tgz#cebff49968f2b9616c0fcb239e96685cb9497633" + integrity sha512-qUmqs4kj9a5yBnk3JMLyjtWYN6Mzfcx8uJfi5XAveBniDevmZasdGBba5b4QsvRcAkmvGo5ACmSUmyGiKTLZew== + dependencies: + micromark-util-character "^1.0.0" + micromark-util-types "^1.0.0" + +micromark-factory-title@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/micromark-factory-title/-/micromark-factory-title-1.0.2.tgz#7e09287c3748ff1693930f176e1c4a328382494f" + integrity sha512-zily+Nr4yFqgMGRKLpTVsNl5L4PMu485fGFDOQJQBl2NFpjGte1e86zC0da93wf97jrc4+2G2GQudFMHn3IX+A== + dependencies: + micromark-factory-space "^1.0.0" + micromark-util-character "^1.0.0" + micromark-util-symbol "^1.0.0" + micromark-util-types "^1.0.0" + uvu "^0.5.0" + +micromark-factory-whitespace@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/micromark-factory-whitespace/-/micromark-factory-whitespace-1.0.0.tgz#e991e043ad376c1ba52f4e49858ce0794678621c" + integrity sha512-Qx7uEyahU1lt1RnsECBiuEbfr9INjQTGa6Err+gF3g0Tx4YEviPbqqGKNv/NrBaE7dVHdn1bVZKM/n5I/Bak7A== + dependencies: + micromark-factory-space "^1.0.0" + micromark-util-character "^1.0.0" + micromark-util-symbol "^1.0.0" + micromark-util-types "^1.0.0" + +micromark-util-character@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/micromark-util-character/-/micromark-util-character-1.1.0.tgz#d97c54d5742a0d9611a68ca0cd4124331f264d86" + integrity sha512-agJ5B3unGNJ9rJvADMJ5ZiYjBRyDpzKAOk01Kpi1TKhlT1APx3XZk6eN7RtSz1erbWHC2L8T3xLZ81wdtGRZzg== + dependencies: + micromark-util-symbol "^1.0.0" + micromark-util-types "^1.0.0" + +micromark-util-chunked@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/micromark-util-chunked/-/micromark-util-chunked-1.0.0.tgz#5b40d83f3d53b84c4c6bce30ed4257e9a4c79d06" + integrity sha512-5e8xTis5tEZKgesfbQMKRCyzvffRRUX+lK/y+DvsMFdabAicPkkZV6gO+FEWi9RfuKKoxxPwNL+dFF0SMImc1g== + dependencies: + micromark-util-symbol "^1.0.0" + +micromark-util-classify-character@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/micromark-util-classify-character/-/micromark-util-classify-character-1.0.0.tgz#cbd7b447cb79ee6997dd274a46fc4eb806460a20" + integrity sha512-F8oW2KKrQRb3vS5ud5HIqBVkCqQi224Nm55o5wYLzY/9PwHGXC01tr3d7+TqHHz6zrKQ72Okwtvm/xQm6OVNZA== + dependencies: + micromark-util-character "^1.0.0" + micromark-util-symbol "^1.0.0" + micromark-util-types "^1.0.0" + +micromark-util-combine-extensions@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/micromark-util-combine-extensions/-/micromark-util-combine-extensions-1.0.0.tgz#91418e1e74fb893e3628b8d496085639124ff3d5" + integrity sha512-J8H058vFBdo/6+AsjHp2NF7AJ02SZtWaVUjsayNFeAiydTxUwViQPxN0Hf8dp4FmCQi0UUFovFsEyRSUmFH3MA== + dependencies: + micromark-util-chunked "^1.0.0" + micromark-util-types "^1.0.0" + +micromark-util-decode-numeric-character-reference@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-1.0.0.tgz#dcc85f13b5bd93ff8d2868c3dba28039d490b946" + integrity sha512-OzO9AI5VUtrTD7KSdagf4MWgHMtET17Ua1fIpXTpuhclCqD8egFWo85GxSGvxgkGS74bEahvtM0WP0HjvV0e4w== + dependencies: + micromark-util-symbol "^1.0.0" + +micromark-util-decode-string@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/micromark-util-decode-string/-/micromark-util-decode-string-1.0.2.tgz#942252ab7a76dec2dbf089cc32505ee2bc3acf02" + integrity sha512-DLT5Ho02qr6QWVNYbRZ3RYOSSWWFuH3tJexd3dgN1odEuPNxCngTCXJum7+ViRAd9BbdxCvMToPOD/IvVhzG6Q== + dependencies: + decode-named-character-reference "^1.0.0" + micromark-util-character "^1.0.0" + micromark-util-decode-numeric-character-reference "^1.0.0" + micromark-util-symbol "^1.0.0" + +micromark-util-encode@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/micromark-util-encode/-/micromark-util-encode-1.0.0.tgz#c409ecf751a28aa9564b599db35640fccec4c068" + integrity sha512-cJpFVM768h6zkd8qJ1LNRrITfY4gwFt+tziPcIf71Ui8yFzY9wG3snZQqiWVq93PG4Sw6YOtcNiKJfVIs9qfGg== + +micromark-util-html-tag-name@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/micromark-util-html-tag-name/-/micromark-util-html-tag-name-1.0.0.tgz#75737e92fef50af0c6212bd309bc5cb8dbd489ed" + integrity sha512-NenEKIshW2ZI/ERv9HtFNsrn3llSPZtY337LID/24WeLqMzeZhBEE6BQ0vS2ZBjshm5n40chKtJ3qjAbVV8S0g== + +micromark-util-normalize-identifier@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-1.0.0.tgz#4a3539cb8db954bbec5203952bfe8cedadae7828" + integrity sha512-yg+zrL14bBTFrQ7n35CmByWUTFsgst5JhA4gJYoty4Dqzj4Z4Fr/DHekSS5aLfH9bdlfnSvKAWsAgJhIbogyBg== + dependencies: + micromark-util-symbol "^1.0.0" + +micromark-util-resolve-all@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/micromark-util-resolve-all/-/micromark-util-resolve-all-1.0.0.tgz#a7c363f49a0162e931960c44f3127ab58f031d88" + integrity sha512-CB/AGk98u50k42kvgaMM94wzBqozSzDDaonKU7P7jwQIuH2RU0TeBqGYJz2WY1UdihhjweivStrJ2JdkdEmcfw== + dependencies: + micromark-util-types "^1.0.0" + +micromark-util-sanitize-uri@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-1.0.0.tgz#27dc875397cd15102274c6c6da5585d34d4f12b2" + integrity sha512-cCxvBKlmac4rxCGx6ejlIviRaMKZc0fWm5HdCHEeDWRSkn44l6NdYVRyU+0nT1XC72EQJMZV8IPHF+jTr56lAg== + dependencies: + micromark-util-character "^1.0.0" + micromark-util-encode "^1.0.0" + micromark-util-symbol "^1.0.0" + +micromark-util-subtokenize@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/micromark-util-subtokenize/-/micromark-util-subtokenize-1.0.2.tgz#ff6f1af6ac836f8bfdbf9b02f40431760ad89105" + integrity sha512-d90uqCnXp/cy4G881Ub4psE57Sf8YD0pim9QdjCRNjfas2M1u6Lbt+XZK9gnHL2XFhnozZiEdCa9CNfXSfQ6xA== + dependencies: + micromark-util-chunked "^1.0.0" + micromark-util-symbol "^1.0.0" + micromark-util-types "^1.0.0" + uvu "^0.5.0" + +micromark-util-symbol@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/micromark-util-symbol/-/micromark-util-symbol-1.0.1.tgz#b90344db62042ce454f351cf0bebcc0a6da4920e" + integrity sha512-oKDEMK2u5qqAptasDAwWDXq0tG9AssVwAx3E9bBF3t/shRIGsWIRG+cGafs2p/SnDSOecnt6hZPCE2o6lHfFmQ== + +micromark-util-types@^1.0.0, micromark-util-types@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/micromark-util-types/-/micromark-util-types-1.0.2.tgz#f4220fdb319205812f99c40f8c87a9be83eded20" + integrity sha512-DCfg/T8fcrhrRKTPjRrw/5LLvdGV7BHySf/1LOZx7TzWZdYRjogNtyNq885z3nNallwr3QUKARjqvHqX1/7t+w== + +micromark@^3.0.0: + version "3.0.10" + resolved "https://registry.yarnpkg.com/micromark/-/micromark-3.0.10.tgz#1eac156f0399d42736458a14b0ca2d86190b457c" + integrity sha512-ryTDy6UUunOXy2HPjelppgJ2sNfcPz1pLlMdA6Rz9jPzhLikWXv/irpWV/I2jd68Uhmny7hHxAlAhk4+vWggpg== + dependencies: + "@types/debug" "^4.0.0" + debug "^4.0.0" + decode-named-character-reference "^1.0.0" + micromark-core-commonmark "^1.0.1" + micromark-factory-space "^1.0.0" + micromark-util-character "^1.0.0" + micromark-util-chunked "^1.0.0" + micromark-util-combine-extensions "^1.0.0" + micromark-util-decode-numeric-character-reference "^1.0.0" + micromark-util-encode "^1.0.0" + micromark-util-normalize-identifier "^1.0.0" + micromark-util-resolve-all "^1.0.0" + micromark-util-sanitize-uri "^1.0.0" + micromark-util-subtokenize "^1.0.0" + micromark-util-symbol "^1.0.0" + micromark-util-types "^1.0.1" + uvu "^0.5.0" + micromatch@^3.1.10: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" @@ -9248,6 +9600,11 @@ modify-values@^1.0.0: resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== +mri@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" + integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA== + ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -11112,7 +11469,7 @@ promzard@^0.3.0: dependencies: read "1" -prop-types@^15.6.2, prop-types@^15.7.2: +prop-types@^15.0.0, prop-types@^15.6.2, prop-types@^15.7.2: version "15.7.2" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== @@ -11121,6 +11478,11 @@ prop-types@^15.6.2, prop-types@^15.7.2: object-assign "^4.1.1" react-is "^16.8.1" +property-information@^6.0.0: + version "6.1.1" + resolved "https://registry.yarnpkg.com/property-information/-/property-information-6.1.1.tgz#5ca85510a3019726cb9afed4197b7b8ac5926a22" + integrity sha512-hrzC564QIl0r0vy4l6MvRLhafmUowhO/O3KgVSoXIbbA2Sz4j8HGpJc6T2cubRVwMwpdiG/vKGfhT4IixmKN9w== + proto-list@~1.2.1: version "1.2.4" resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" @@ -11289,6 +11651,11 @@ react-is@^16.8.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== +react-is@^17.0.0: + version "17.0.2" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" + integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== + react-leaflet@^3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/react-leaflet/-/react-leaflet-3.2.2.tgz#3d779662c32a1d8729e73d24e8ad96ee5b38beef" @@ -11296,6 +11663,26 @@ react-leaflet@^3.2.2: dependencies: "@react-leaflet/core" "^1.1.1" +react-markdown@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/react-markdown/-/react-markdown-7.1.1.tgz#cb4d2c2fa3bc1292c889b068a5bf064ae4be1c60" + integrity sha512-bXS7indkcPlCLB6wRFFzX8Xdghr62TBxUF2587o+CUkaZlNaoILb2qNt+5pYmTZuCOC+OeEcdJ+06mu5whtCVQ== + dependencies: + "@types/hast" "^2.0.0" + "@types/unist" "^2.0.0" + comma-separated-tokens "^2.0.0" + hast-util-whitespace "^2.0.0" + prop-types "^15.0.0" + property-information "^6.0.0" + react-is "^17.0.0" + remark-parse "^10.0.0" + remark-rehype "^9.0.0" + space-separated-tokens "^2.0.0" + style-to-object "^0.3.0" + unified "^10.0.0" + unist-util-visit "^4.0.0" + vfile "^5.0.0" + react-popper@^2.2.5: version "2.2.5" resolved "https://registry.yarnpkg.com/react-popper/-/react-popper-2.2.5.tgz#1214ef3cec86330a171671a4fbcbeeb65ee58e96" @@ -11674,6 +12061,25 @@ relay-runtime@11.0.2: fbjs "^3.0.0" invariant "^2.2.4" +remark-parse@^10.0.0: + version "10.0.1" + resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-10.0.1.tgz#6f60ae53edbf0cf38ea223fe643db64d112e0775" + integrity sha512-1fUyHr2jLsVOkhbvPRBJ5zTKZZyD6yZzYaWCS6BPBdQ8vEMBCH+9zNCDA6tET/zHCi/jLqjCWtlJZUPk+DbnFw== + dependencies: + "@types/mdast" "^3.0.0" + mdast-util-from-markdown "^1.0.0" + unified "^10.0.0" + +remark-rehype@^9.0.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/remark-rehype/-/remark-rehype-9.1.0.tgz#e4b5b6e19c125b3780343eb66c3e9b99b0f06a81" + integrity sha512-oLa6YmgAYg19zb0ZrBACh40hpBLteYROaPLhBXzLgjqyHQrN+gVP9N/FJvfzuNNuzCutktkroXEZBrxAxKhh7Q== + dependencies: + "@types/hast" "^2.0.0" + "@types/mdast" "^3.0.0" + mdast-util-to-hast "^11.0.0" + unified "^10.0.0" + remedial@^1.0.7: version "1.0.8" resolved "https://registry.yarnpkg.com/remedial/-/remedial-1.0.8.tgz#a5e4fd52a0e4956adbaf62da63a5a46a78c578a0" @@ -11939,6 +12345,13 @@ rxjs@^6.3.3, rxjs@^6.6.0: dependencies: tslib "^1.9.0" +sade@^1.7.3: + version "1.7.4" + resolved "https://registry.yarnpkg.com/sade/-/sade-1.7.4.tgz#ea681e0c65d248d2095c90578c03ca0bb1b54691" + integrity sha512-y5yauMD93rX840MwUJr7C1ysLFBgMspsdTo4UVrDg3fXDvtwOyIqykhVAAm6fk/3au77773itJStObgK+LKaiA== + dependencies: + mri "^1.1.0" + safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" @@ -12415,6 +12828,11 @@ source-map@~0.7.2: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== +space-separated-tokens@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/space-separated-tokens/-/space-separated-tokens-2.0.1.tgz#43193cec4fb858a2ce934b7f98b7f2c18107098b" + integrity sha512-ekwEbFp5aqSPKaqeY1PGrlGQxPNaq+Cnx4+bE2D8sciBQrHpbwoBbawqTN2+6jPs9IdWxxiUcN0K2pkczD3zmw== + spdx-correct@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9" @@ -12736,6 +13154,13 @@ style-loader@^3.3.1: resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-3.3.1.tgz#057dfa6b3d4d7c7064462830f9113ed417d38575" integrity sha512-GPcQ+LDJbrcxHORTRes6Jy2sfvK2kS6hpSfI/fXhPt+spVzxF6LJ1dHLN9zIGmVaaP044YKaIatFaufENRiDoQ== +style-to-object@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/style-to-object/-/style-to-object-0.3.0.tgz#b1b790d205991cc783801967214979ee19a76e46" + integrity sha512-CzFnRRXhzWIdItT3OmF8SQfWyahHhjq3HwcMNCNLn+N7klOOqPjMeG/4JSu77D7ypZdGvSzvkrbyeTMizz2VrA== + dependencies: + inline-style-parser "0.1.1" + stylehacks@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/stylehacks/-/stylehacks-4.0.3.tgz#6718fcaf4d1e07d8a1318690881e8d96726a71d5" @@ -13049,6 +13474,11 @@ totalist@^1.0.0: resolved "https://registry.yarnpkg.com/totalist/-/totalist-1.1.0.tgz#a4d65a3e546517701e3e5c37a47a70ac97fe56df" integrity sha512-gduQwd1rOdDMGxFG1gEvhV88Oirdo2p+KjoYFU7k2g+i7n6AFFbDQ5kMPUsW0pNbfQsB/cwXvT1i4Bue0s9g5g== +totalist@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/totalist/-/totalist-2.0.0.tgz#db6f1e19c0fa63e71339bbb8fba89653c18c7eec" + integrity sha512-+Y17F0YzxfACxTyjfhnJQEe7afPA0GSpYlFkl2VFMxYP7jshQf9gXV7cH47EfToBumFThfKBvfAcoUn6fdNeRQ== + tough-cookie@~2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" @@ -13069,6 +13499,11 @@ trim-newlines@^3.0.0: resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144" integrity sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw== +trough@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/trough/-/trough-2.0.2.tgz#94a3aa9d5ce379fc561f6244905b3f36b7458d96" + integrity sha512-FnHq5sTMxC0sk957wHDzRnemFnNBvt/gSY99HzK8F7UP5WAbvP70yX5bd7CjEQkN+TjdxwI7g7lJ6podqrG2/w== + "true-case-path@^1.0.2": version "1.0.3" resolved "https://registry.yarnpkg.com/true-case-path/-/true-case-path-1.0.3.tgz#f813b5a8c86b40da59606722b144e3225799f47d" @@ -13276,6 +13711,19 @@ unicode-property-aliases-ecmascript@^1.0.4: resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz#dd57a99f6207bedff4628abefb94c50db941c8f4" integrity sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg== +unified@^10.0.0: + version "10.1.1" + resolved "https://registry.yarnpkg.com/unified/-/unified-10.1.1.tgz#345e349e3ab353ab612878338eb9d57b4dea1d46" + integrity sha512-v4ky1+6BN9X3pQrOdkFIPWAaeDsHPE1svRDxq7YpTc2plkIqFMwukfqM+l0ewpP9EfwARlt9pPFAeWYhHm8X9w== + dependencies: + "@types/unist" "^2.0.0" + bail "^2.0.0" + extend "^3.0.0" + is-buffer "^2.0.0" + is-plain-obj "^4.0.0" + trough "^2.0.0" + vfile "^5.0.0" + union-value@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" @@ -13310,6 +13758,69 @@ unique-slug@^2.0.0: dependencies: imurmurhash "^0.1.4" +unist-builder@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/unist-builder/-/unist-builder-3.0.0.tgz#728baca4767c0e784e1e64bb44b5a5a753021a04" + integrity sha512-GFxmfEAa0vi9i5sd0R2kcrI9ks0r82NasRq5QHh2ysGngrc6GiqD5CDf1FjPenY4vApmFASBIIlk/jj5J5YbmQ== + dependencies: + "@types/unist" "^2.0.0" + +unist-util-generated@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/unist-util-generated/-/unist-util-generated-2.0.0.tgz#86fafb77eb6ce9bfa6b663c3f5ad4f8e56a60113" + integrity sha512-TiWE6DVtVe7Ye2QxOVW9kqybs6cZexNwTwSMVgkfjEReqy/xwGpAXb99OxktoWwmL+Z+Epb0Dn8/GNDYP1wnUw== + +unist-util-is@^5.0.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-5.1.1.tgz#e8aece0b102fa9bc097b0fef8f870c496d4a6236" + integrity sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ== + +unist-util-position@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/unist-util-position/-/unist-util-position-4.0.1.tgz#f8484b2da19a897a0180556d160c28633070dbb9" + integrity sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA== + +unist-util-stringify-position@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/unist-util-stringify-position/-/unist-util-stringify-position-3.0.0.tgz#d517d2883d74d0daa0b565adc3d10a02b4a8cde9" + integrity sha512-SdfAl8fsDclywZpfMDTVDxA2V7LjtRDTOFd44wUJamgl6OlVngsqWjxvermMYf60elWHbxhuRCZml7AnuXCaSA== + dependencies: + "@types/unist" "^2.0.0" + +unist-util-visit-parents@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-4.1.1.tgz#e83559a4ad7e6048a46b1bdb22614f2f3f4724f2" + integrity sha512-1xAFJXAKpnnJl8G7K5KgU7FY55y3GcLIXqkzUj5QF/QVP7biUm0K0O2oqVkYsdjzJKifYeWn9+o6piAK2hGSHw== + dependencies: + "@types/unist" "^2.0.0" + unist-util-is "^5.0.0" + +unist-util-visit-parents@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-5.1.0.tgz#44bbc5d25f2411e7dfc5cecff12de43296aa8521" + integrity sha512-y+QVLcY5eR/YVpqDsLf/xh9R3Q2Y4HxkZTp7ViLDU6WtJCEcPmRzW1gpdWDCDIqIlhuPDXOgttqPlykrHYDekg== + dependencies: + "@types/unist" "^2.0.0" + unist-util-is "^5.0.0" + +unist-util-visit@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-3.1.0.tgz#9420d285e1aee938c7d9acbafc8e160186dbaf7b" + integrity sha512-Szoh+R/Ll68QWAyQyZZpQzZQm2UPbxibDvaY8Xc9SUtYgPsDzx5AWSk++UUt2hJuow8mvwR+rG+LQLw+KsuAKA== + dependencies: + "@types/unist" "^2.0.0" + unist-util-is "^5.0.0" + unist-util-visit-parents "^4.0.0" + +unist-util-visit@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-4.1.0.tgz#f41e407a9e94da31594e6b1c9811c51ab0b3d8f5" + integrity sha512-n7lyhFKJfVZ9MnKtqbsqkQEk5P1KShj0+//V7mAcoI6bpbUjh3C/OG8HVD+pBihfh6Ovl01m8dkcv9HNqYajmQ== + dependencies: + "@types/unist" "^2.0.0" + unist-util-is "^5.0.0" + unist-util-visit-parents "^5.0.0" + universal-user-agent@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-6.0.0.tgz#3381f8503b251c0d9cd21bc1de939ec9df5480ee" @@ -13438,6 +13949,17 @@ uuid@^7.0.3: resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.3.tgz#c5c9f2c8cf25dc0a372c4df1441c41f5bd0c680b" integrity sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg== +uvu@^0.5.0: + version "0.5.2" + resolved "https://registry.yarnpkg.com/uvu/-/uvu-0.5.2.tgz#c145e7f4b5becf80099cf22fd8a4a05f0112b2c0" + integrity sha512-m2hLe7I2eROhh+tm3WE5cTo/Cv3WQA7Oc9f7JB6uWv+/zVKvfAm53bMyOoGOSZeQ7Ov2Fu9pLhFr7p07bnT20w== + dependencies: + dequal "^2.0.0" + diff "^5.0.0" + kleur "^4.0.3" + sade "^1.7.3" + totalist "^2.0.0" + v8-compile-cache@^2.0.3: version "2.3.0" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" @@ -13487,6 +14009,24 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" +vfile-message@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/vfile-message/-/vfile-message-3.0.2.tgz#db7eaebe7fecb853010f2ef1664427f52baf8f74" + integrity sha512-UUjZYIOg9lDRwwiBAuezLIsu9KlXntdxwG+nXnjuQAHvBpcX3x0eN8h+I7TkY5nkCXj+cWVp4ZqebtGBvok8ww== + dependencies: + "@types/unist" "^2.0.0" + unist-util-stringify-position "^3.0.0" + +vfile@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/vfile/-/vfile-5.2.0.tgz#a32a646ff9251c274dbe8675644a39031025b369" + integrity sha512-ftCpb6pU8Jrzcqku8zE6N3Gi4/RkDhRwEXSWudzZzA2eEOn/cBpsfk9aulCUR+j1raRSAykYQap9u6j6rhUaCA== + dependencies: + "@types/unist" "^2.0.0" + is-buffer "^2.0.0" + unist-util-stringify-position "^3.0.0" + vfile-message "^3.0.0" + warning@^4.0.2: version "4.0.3" resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3" From 4ef5e992d36cdecdafc430757d5127b9e4b6a9ae Mon Sep 17 00:00:00 2001 From: Naumov Alexey Date: Wed, 15 Dec 2021 13:54:21 +0300 Subject: [PATCH 2/3] feat(core-version): CB-1432 add refreshAll to version resource --- webapp/packages/core-version/src/VersionResource.ts | 7 ++++++- .../src/Instructions.tsx | 3 +++ .../src/VersionUpdateDrawerItem.tsx | 2 +- .../src/VersionsTable.tsx | 5 ++--- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/webapp/packages/core-version/src/VersionResource.ts b/webapp/packages/core-version/src/VersionResource.ts index b695da2067..ea56046305 100644 --- a/webapp/packages/core-version/src/VersionResource.ts +++ b/webapp/packages/core-version/src/VersionResource.ts @@ -10,7 +10,7 @@ import { makeObservable, observable, runInAction } from 'mobx'; import { injectable } from '@cloudbeaver/core-di'; import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { CachedMapResource } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey, CachedMapResource } from '@cloudbeaver/core-sdk'; export interface IVersion { number: string; @@ -39,6 +39,11 @@ export class VersionResource extends CachedMapResource { }); } + async refreshAll(): Promise> { + await this.refresh(CachedMapAllKey); + return this.data; + } + protected async loader(): Promise> { const versionLink = this.serverConfigResource.data?.productInfo.latestVersionInfo; if (!versionLink) { diff --git a/webapp/packages/plugin-version-update-administration/src/Instructions.tsx b/webapp/packages/plugin-version-update-administration/src/Instructions.tsx index 58a039babe..cd11d3f03e 100644 --- a/webapp/packages/plugin-version-update-administration/src/Instructions.tsx +++ b/webapp/packages/plugin-version-update-administration/src/Instructions.tsx @@ -18,6 +18,9 @@ import { VersionResource } from '@cloudbeaver/core-version'; import { VersionUpdateService } from '@cloudbeaver/core-version-update'; const style = css` + Group { + composes: theme-typography--body2 from global; + } GroupItem { white-space: pre-line; } diff --git a/webapp/packages/plugin-version-update-administration/src/VersionUpdateDrawerItem.tsx b/webapp/packages/plugin-version-update-administration/src/VersionUpdateDrawerItem.tsx index 38a991d197..0343876a04 100644 --- a/webapp/packages/plugin-version-update-administration/src/VersionUpdateDrawerItem.tsx +++ b/webapp/packages/plugin-version-update-administration/src/VersionUpdateDrawerItem.tsx @@ -55,7 +55,7 @@ export const VersionUpdateDrawerItem = observer(f {versionUpdateService.newVersionAvailable && ( - + )} diff --git a/webapp/packages/plugin-version-update-administration/src/VersionsTable.tsx b/webapp/packages/plugin-version-update-administration/src/VersionsTable.tsx index 867de14a0b..9011eee825 100644 --- a/webapp/packages/plugin-version-update-administration/src/VersionsTable.tsx +++ b/webapp/packages/plugin-version-update-administration/src/VersionsTable.tsx @@ -73,8 +73,7 @@ export const VersionsTable = observer(function VersionsTable() { const refresh = useCallback(async () => { try { - versionResource.resource.markOutdated(); - await versionResource.resource.load(CachedMapAllKey); + await versionResource.resource.refreshAll(); notificationService.logSuccess({ title: 'version_update_versions_refresh_successful' }); } catch (exception) { notificationService.logException(exception, 'version_update_versions_refresh_fail'); @@ -87,7 +86,7 @@ export const VersionsTable = observer(function VersionsTable() { Date: Wed, 15 Dec 2021 22:15:25 +0300 Subject: [PATCH 3/3] feat(core-version): CB-1432 new ui implementation --- .../src/VersionUpdateService.ts | 10 ++- .../core-version/src/VersionResource.ts | 21 +++-- .../core-version/src/VersionService.ts | 8 -- .../public/icons/version_update.svg | 3 + .../src/Instructions.tsx | 25 +++--- .../src/VersionChecker.tsx | 7 +- .../src/VersionInfo.tsx | 6 +- .../src/VersionSelector.tsx | 89 +++++++++++++++++++ .../src/VersionUpdate.tsx | 12 ++- .../src/VersionUpdateDrawerItem.tsx | 2 +- .../src/VersionsTable.tsx | 25 +++--- .../product-default/src/UpdateInstruction.tsx | 24 ++--- 12 files changed, 162 insertions(+), 70 deletions(-) create mode 100644 webapp/packages/plugin-version-update-administration/public/icons/version_update.svg create mode 100644 webapp/packages/plugin-version-update-administration/src/VersionSelector.tsx diff --git a/webapp/packages/core-version-update/src/VersionUpdateService.ts b/webapp/packages/core-version-update/src/VersionUpdateService.ts index 2820ec3fee..0cff026c4f 100644 --- a/webapp/packages/core-version-update/src/VersionUpdateService.ts +++ b/webapp/packages/core-version-update/src/VersionUpdateService.ts @@ -10,10 +10,11 @@ import { computed, makeObservable } from 'mobx'; import { compare } from 'semver'; import { injectable } from '@cloudbeaver/core-di'; -import { IVersion, VersionService } from '@cloudbeaver/core-version'; +import { IVersion, VersionResource, VersionService } from '@cloudbeaver/core-version'; interface IInstructionProps { - versions: IVersion[]; + version: IVersion; + className?: string; } export type InstructionComponent = React.FunctionComponent; @@ -23,15 +24,16 @@ export class VersionUpdateService { instructionGetter: (() => InstructionComponent) | null; get newVersionAvailable() { - if (!this.versionService.current || !this.versionService.latest) { + if (!this.versionService.current || !this.versionResource.latest) { return false; } - return compare(this.versionService.latest.number, this.versionService.current) === 1; + return compare(this.versionResource.latest.number, this.versionService.current) === 1; } constructor( private readonly versionService: VersionService, + private readonly versionResource: VersionResource, ) { this.instructionGetter = null; diff --git a/webapp/packages/core-version/src/VersionResource.ts b/webapp/packages/core-version/src/VersionResource.ts index ea56046305..c543a9c851 100644 --- a/webapp/packages/core-version/src/VersionResource.ts +++ b/webapp/packages/core-version/src/VersionResource.ts @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. */ -import { makeObservable, observable, runInAction } from 'mobx'; +import { computed, makeObservable, observable, runInAction } from 'mobx'; import { injectable } from '@cloudbeaver/core-di'; import { ServerConfigResource } from '@cloudbeaver/core-root'; @@ -25,17 +25,23 @@ interface IVersions { @injectable() export class VersionResource extends CachedMapResource { - latest: string | null; + private latestVersionNumber: string | null; + + get latest() { + return this.values.find(v => v.number === this.latestVersionNumber); + } + constructor( private readonly serverConfigResource: ServerConfigResource ) { super(); - this.latest = null; + this.latestVersionNumber = null; this.preloadResource(this.serverConfigResource); - makeObservable(this, { - latest: observable.ref, + makeObservable(this, { + latestVersionNumber: observable.ref, + latest: computed, }); } @@ -50,15 +56,14 @@ export class VersionResource extends CachedMapResource { return this.data; } - // https://www.npoint.io/docs/20ec48e3408c7e3543dc - const response = await fetch('https://api.npoint.io/20ec48e3408c7e3543dc', { + const response = await fetch(versionLink, { cache: 'no-cache', }); const json = await response.json() as IVersions; if (json.latestVersion) { - this.latest = json.latestVersion; + this.latestVersionNumber = json.latestVersion; } if (!json.versions) { diff --git a/webapp/packages/core-version/src/VersionService.ts b/webapp/packages/core-version/src/VersionService.ts index a6db6fd7ae..400b56ed20 100644 --- a/webapp/packages/core-version/src/VersionService.ts +++ b/webapp/packages/core-version/src/VersionService.ts @@ -12,8 +12,6 @@ import { injectable } from '@cloudbeaver/core-di'; import { ServerService } from '@cloudbeaver/core-root'; import { GlobalConstants } from '@cloudbeaver/core-utils'; -import { IVersion, VersionResource } from './VersionResource'; - const VERSION_REGEX = /(\d+\.\d+\.\d+)/; export interface IProductVersion { @@ -27,17 +25,11 @@ export class VersionService { return this.getProductVersion(true).frontendVersion; } - get latest(): IVersion | undefined { - return this.versionResource.values.find(v => v.number === this.versionResource.latest); - } - constructor( private readonly serverService: ServerService, - private readonly versionResource: VersionResource, ) { makeObservable(this, { current: computed, - latest: computed, }); } diff --git a/webapp/packages/plugin-version-update-administration/public/icons/version_update.svg b/webapp/packages/plugin-version-update-administration/public/icons/version_update.svg new file mode 100644 index 0000000000..1c01d12853 --- /dev/null +++ b/webapp/packages/plugin-version-update-administration/public/icons/version_update.svg @@ -0,0 +1,3 @@ + + + diff --git a/webapp/packages/plugin-version-update-administration/src/Instructions.tsx b/webapp/packages/plugin-version-update-administration/src/Instructions.tsx index cd11d3f03e..c726eb291c 100644 --- a/webapp/packages/plugin-version-update-administration/src/Instructions.tsx +++ b/webapp/packages/plugin-version-update-administration/src/Instructions.tsx @@ -9,13 +9,9 @@ import { observer } from 'mobx-react-lite'; import styled, { css } from 'reshadow'; -import { BASE_CONTAINERS_STYLES, Group, GroupItem, GroupTitle, useMapResource } from '@cloudbeaver/core-blocks'; -import { useService } from '@cloudbeaver/core-di'; +import { BASE_CONTAINERS_STYLES, Group, GroupItem, GroupTitle } from '@cloudbeaver/core-blocks'; import { useTranslate } from '@cloudbeaver/core-localization'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; import { useStyles } from '@cloudbeaver/core-theming'; -import { VersionResource } from '@cloudbeaver/core-version'; -import { VersionUpdateService } from '@cloudbeaver/core-version-update'; const style = css` Group { @@ -24,24 +20,27 @@ const style = css` GroupItem { white-space: pre-line; } + ol { + margin: 0; + padding: 0; + } `; export const Instructions = observer(function Instructions() { const translate = useTranslate(); const styles = useStyles(BASE_CONTAINERS_STYLES, style); - const versionUpdateService = useService(VersionUpdateService); - const versionResource = useMapResource(Instructions, VersionResource, CachedMapAllKey); - if (!versionUpdateService.instructionGetter) { - return null; - } - - const Instruction = versionUpdateService.instructionGetter(); return styled(styles)( {translate('version_update_how_to_update')} - +
    +
  1. First, you’ll need to use the docker ps command to see a list of all containers currently running on your system.
  2. +
  3. Then, stop the existing container by running the docker stop command.
  4. +
  5. After stopping the running container, you can now use the docker rm command to remove it.
  6. +
  7. Next, you can look for the version of the image you need to update to. To download the image from Docker Hub, you can use the docker pull command.
  8. +
  9. After downloading the new image, you can use it to recreate the container by executing the docker run command.
  10. +
); diff --git a/webapp/packages/plugin-version-update-administration/src/VersionChecker.tsx b/webapp/packages/plugin-version-update-administration/src/VersionChecker.tsx index eee19471fc..38ec25c878 100644 --- a/webapp/packages/plugin-version-update-administration/src/VersionChecker.tsx +++ b/webapp/packages/plugin-version-update-administration/src/VersionChecker.tsx @@ -13,7 +13,7 @@ import { BASE_CONTAINERS_STYLES, Cell, IconOrImage } from '@cloudbeaver/core-blo import { useService } from '@cloudbeaver/core-di'; import { useTranslate } from '@cloudbeaver/core-localization'; import { useStyles } from '@cloudbeaver/core-theming'; -import { VersionService } from '@cloudbeaver/core-version'; +import { VersionResource, VersionService } from '@cloudbeaver/core-version'; import { VersionUpdateService } from '@cloudbeaver/core-version-update'; const style = css` @@ -28,11 +28,12 @@ export const VersionChecker = observer(function VersionChecker() { const translate = useTranslate(); const versionUpdateService = useService(VersionUpdateService); const versionService = useService(VersionService); + const versionResource = useService(VersionResource); const icon = versionUpdateService.newVersionAvailable ? '/icons/info_icon.svg' : '/icons/success_icon.svg'; const text = versionUpdateService.newVersionAvailable ? 'version_update_new_version_available' : 'version_update_version_is_up_to_date'; - const description = versionService.current && versionService.latest - ? `${translate('version_current')}: ${versionService.current}, ${translate('version_latest')}: ${versionService.latest.number}` : ''; + const description = versionService.current && versionResource.latest + ? `${translate('version_current')}: ${versionService.current}, ${translate('version_latest')}: ${versionResource.latest.number}` : ''; return styled(styles)( * { margin: 0; @@ -37,9 +39,9 @@ export const VersionInfo = observer(function VersionInfo({ item }) { const version = versionResource.data; return styled(styles)( - + - {version ? `CloudBeaver ${version.number} - ${version.date}` : translate('version_update_version_no_info')} + {version ? `Changelog ${version.number} - ${version.date}` : translate('version_update_version_no_info')} {version && ( {version.releaseNotes} diff --git a/webapp/packages/plugin-version-update-administration/src/VersionSelector.tsx b/webapp/packages/plugin-version-update-administration/src/VersionSelector.tsx new file mode 100644 index 0000000000..3949c88066 --- /dev/null +++ b/webapp/packages/plugin-version-update-administration/src/VersionSelector.tsx @@ -0,0 +1,89 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2021 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import { observer } from 'mobx-react-lite'; +import { useEffect, useState } from 'react'; +import styled, { css } from 'reshadow'; + +import { BASE_CONTAINERS_STYLES, Combobox, Container, Group, GroupItem, GroupTitle } from '@cloudbeaver/core-blocks'; +import { useService } from '@cloudbeaver/core-di'; +import { composes, useStyles } from '@cloudbeaver/core-theming'; +import { IVersion, VersionResource } from '@cloudbeaver/core-version'; +import { VersionUpdateService } from '@cloudbeaver/core-version-update'; + +import { VersionInfo } from './VersionInfo'; + +interface Props { + versions: IVersion[]; +} + +const style = composes( + css` + GroupItem { + composes: theme-background-secondary theme-text-on-secondary from global; + } +`, + css` + Container { + composes: theme-typography--body2 from global; + } + GroupItem { + padding: 16px; + } + Group { + list-style-position: inside; + } + Instruction { + white-space: pre-line; + } +`); + +export const VersionSelector = observer(function VersionSelector({ versions }) { + const styles = useStyles(BASE_CONTAINERS_STYLES, style); + const versionUpdateService = useService(VersionUpdateService); + const versionResource = useService(VersionResource); + + const [selected, setSelected] = useState(''); + + useEffect(() => { + if (versionResource.latest?.number) { + setSelected(versionResource.latest.number); + } + }, [versionResource.latest?.number]); + + if (!versions.length) { + return null; + } + + const version = versions.find(v => v.number === selected); + const Instruction = versionUpdateService.instructionGetter?.(); + + return styled(styles)( + + + Commands + value.number} + valueSelector={value => value.number} + value={selected} + tiny + onSelect={value => setSelected(value)} + > + Version + + {version && Instruction && ( + + + + )} + + {version && } + + ); +}); diff --git a/webapp/packages/plugin-version-update-administration/src/VersionUpdate.tsx b/webapp/packages/plugin-version-update-administration/src/VersionUpdate.tsx index c7eaba5841..748ec99518 100644 --- a/webapp/packages/plugin-version-update-administration/src/VersionUpdate.tsx +++ b/webapp/packages/plugin-version-update-administration/src/VersionUpdate.tsx @@ -10,16 +10,22 @@ import { observer } from 'mobx-react-lite'; import styled, { css } from 'reshadow'; import { AdministrationItemContentComponent, ADMINISTRATION_TOOLS_PANEL_STYLES } from '@cloudbeaver/core-administration'; -import { TabsState, TabList, Tab, TabPanel, ToolsPanel, UNDERLINE_TAB_STYLES, BASE_CONTAINERS_STYLES, ColoredContainer } from '@cloudbeaver/core-blocks'; +import { TabsState, TabList, Tab, TabPanel, ToolsPanel, UNDERLINE_TAB_STYLES, BASE_CONTAINERS_STYLES, ColoredContainer, useMapResource } from '@cloudbeaver/core-blocks'; import { useTranslate } from '@cloudbeaver/core-localization'; +import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; import { useStyles } from '@cloudbeaver/core-theming'; +import { VersionResource } from '@cloudbeaver/core-version'; import { EVersionUpdate } from './EVersionUpdate'; import { Instructions } from './Instructions'; import { VersionChecker } from './VersionChecker'; +import { VersionSelector } from './VersionSelector'; import { VersionsTable } from './VersionsTable'; const tabsStyles = css` + ColoredContainer { + list-style-position: inside; + } TabList { position: relative; flex-shrink: 0; @@ -40,6 +46,7 @@ export const VersionUpdate: AdministrationItemContentComponent = observer(functi const tabStyle = [tabsStyles, UNDERLINE_TAB_STYLES]; const translate = useTranslate(); const style = useStyles(ADMINISTRATION_TOOLS_PANEL_STYLES, BASE_CONTAINERS_STYLES, tabStyle); + const versionResource = useMapResource(VersionUpdate, VersionResource, CachedMapAllKey); return styled(style)( @@ -53,10 +60,11 @@ export const VersionUpdate: AdministrationItemContentComponent = observer(functi + - + ); diff --git a/webapp/packages/plugin-version-update-administration/src/VersionUpdateDrawerItem.tsx b/webapp/packages/plugin-version-update-administration/src/VersionUpdateDrawerItem.tsx index 0343876a04..90b5b7623b 100644 --- a/webapp/packages/plugin-version-update-administration/src/VersionUpdateDrawerItem.tsx +++ b/webapp/packages/plugin-version-update-administration/src/VersionUpdateDrawerItem.tsx @@ -50,7 +50,7 @@ export const VersionUpdateDrawerItem = observer(f onOpen={() => onSelect(item.name)} > - + {versionUpdateService.newVersionAvailable && ( diff --git a/webapp/packages/plugin-version-update-administration/src/VersionsTable.tsx b/webapp/packages/plugin-version-update-administration/src/VersionsTable.tsx index 9011eee825..654445f2f5 100644 --- a/webapp/packages/plugin-version-update-administration/src/VersionsTable.tsx +++ b/webapp/packages/plugin-version-update-administration/src/VersionsTable.tsx @@ -11,24 +11,19 @@ import { useCallback } from 'react'; import styled, { css, use } from 'reshadow'; import { ADMINISTRATION_TOOLS_PANEL_STYLES } from '@cloudbeaver/core-administration'; -import { Table, TableHeader, TableColumnHeader, TableBody, ToolsAction, ToolsPanel, Loader, useTable, useMapResource } from '@cloudbeaver/core-blocks'; +import { Table, TableHeader, TableColumnHeader, TableBody, ToolsAction, ToolsPanel, Loader, useTable } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; import { NotificationService } from '@cloudbeaver/core-events'; import { useTranslate } from '@cloudbeaver/core-localization'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; import { composes, useStyles } from '@cloudbeaver/core-theming'; -import { VersionResource } from '@cloudbeaver/core-version'; +import { IVersion, VersionResource } from '@cloudbeaver/core-version'; import { Version } from './Version'; const layoutStyles = composes( css` layout-grid-cell { - composes: theme-background-surface theme-text-on-surface from global; - } - - layout-grid-cell { - composes: theme-border-color-background from global; + composes: theme-border-color-background theme-background-surface theme-text-on-surface from global; } `, css` @@ -64,16 +59,20 @@ const styles = css` } `; -export const VersionsTable = observer(function VersionsTable() { +interface Props { + versions: IVersion[]; +} + +export const VersionsTable = observer(function VersionsTable({ versions }) { const translate = useTranslate(); const style = useStyles(styles, ADMINISTRATION_TOOLS_PANEL_STYLES, layoutStyles); const notificationService = useService(NotificationService); - const versionResource = useMapResource(VersionsTable, VersionResource, CachedMapAllKey); + const versionResource = useService(VersionResource); const table = useTable(); const refresh = useCallback(async () => { try { - await versionResource.resource.refreshAll(); + await versionResource.refreshAll(); notificationService.logSuccess({ title: 'version_update_versions_refresh_successful' }); } catch (exception) { notificationService.logException(exception, 'version_update_versions_refresh_fail'); @@ -96,7 +95,7 @@ export const VersionsTable = observer(function VersionsTable() {
- + {translate('version_date')} - {versionResource.resource.values.map(version => ( + {versions.map(version => ( ))} diff --git a/webapp/packages/product-default/src/UpdateInstruction.tsx b/webapp/packages/product-default/src/UpdateInstruction.tsx index 2e030f03c2..8013e95ccb 100644 --- a/webapp/packages/product-default/src/UpdateInstruction.tsx +++ b/webapp/packages/product-default/src/UpdateInstruction.tsx @@ -8,23 +8,15 @@ import type { InstructionComponent } from '@cloudbeaver/core-version-update'; -export const UpdateInstruction: InstructionComponent = function UpdateInstruction({ versions }) { +export const UpdateInstruction: InstructionComponent = function UpdateInstruction({ version, className }) { return ( -
- {`CE PRODUCT - - Molly Miller temperate perch yellowfin tuna. Kelpfish vimba candlefish deepwater cardinalfish crappie yellowbelly tail catfish sand tilefish angler catfish tommy ruff. - - Trevally tompot blenny coelacanth; earthworm eel thresher shark duckbill eel Pacific saury. Antenna codlet queen triggerfish regal whiptail catfish lightfish slender barracudina bigmouth buffalo. Gray reef shark, pufferfish sandperch lemon shark, swallower darter seamoth paperbone crappie minnow carpsucker mora rudd. Cherubfish northern sea robin, barbeled houndshark giant sea bass armorhead giant sea bass daggertooth pike conger. Beaked salmon grideye flatfish nurse shark Owens pupfish lizardfish tetra pejerrey slickhead bigeye--Japanese eel. - - Bala shark slipmouth piranha morid cod thorny catfish deep sea bonefish Bigscale pomfret yellowbanded perch bream. Armoured catfish; largenose fish temperate ocean-bass, gizzard shad! Sacramento blackfish; candlefish damselfish pollock, yellowfin cutthroat trout bluefish silverside eeltail catfish steelhead. Rockfish warbonnet archerfish ribbonfish platyfish, "sturgeon frigate mackerel cavefish requiem shark sardine smelt." - - Wrasse sábalo bullhead Blacksmelt tench sleeper sandburrower labyrinth fish yellowtail snapper armored searobin Black tetra prickleback flagtail mosshead warbonnet snubnose parasitic eel. Jellynose fish, squawfish pelican gulper wasp fish, warmouth stonefish Antarctic icefish requiem shark orbicular velvetfish, loach minnow. - - Cardinalfish, "slimy mackerel," Blacksmelt dory megamouth shark darter, toadfish leatherjacket lamprey ocean sunfish sole, mora duckbill eel swordtail delta smelt grenadier slender barracudina." Atlantic trout Atlantic cod, Colorado squawfish, Atlantic eel, razorfish unicorn fish, whitetip reef shark. Black angelfish angler catfish blue shark ghost flathead? Lamprey weatherfish swordfish galjoen fish banjo catfish moonfish Moses sole peamouth eel Black mackerel Celebes rainbowfish grayling inanga boarfish x-ray tetra. Flagblenny Black scabbardfish--hamlet Black triggerfish sea snail Modoc sucker whiting cardinalfish. - - - Does your lorem ipsum text long for something a little fishier? Give our generator a try… it’s fishy!`} +
+ + {`docker stop cloudbeaver + docker rm cloudbeaver + docker pull dbeaver/cloudbeaver:${version.number} + docker run dbeaver/cloudbeaver:${version.number}`} +
); };