CB-5872 adds instruction with link for AWS product updation (#3098)

This commit is contained in:
sergeyteleshev
2024-11-26 22:33:27 +08:00
committed by GitHub
parent 979cecff04
commit ff2cc51c11
14 changed files with 26 additions and 17 deletions
@@ -9,12 +9,4 @@ export const GITHUB_LINKS = {
CLOUDBEAVER_REPO: 'https://github.com/dbeaver/cloudbeaver',
EE_DEPLOY_UPDATE: 'https://github.com/dbeaver/cloudbeaver-deploy?tab=readme-ov-file#updating-the-cluster',
TE_DEPLOY_UPDATE: 'https://github.com/dbeaver/team-edition-deploy?tab=readme-ov-file#server-version-update',
getDeployUpdateLink(distributed: boolean) {
if (distributed) {
return GITHUB_LINKS.TE_DEPLOY_UPDATE;
}
return GITHUB_LINKS.EE_DEPLOY_UPDATE;
},
};
@@ -11,6 +11,7 @@ export const WEBSITE_LINKS = {
SQL_EDITOR_DOCUMENTATION_PAGE: 'https://dbeaver.com/docs/cloudbeaver/SQL-Editor/',
SERVER_CONFIGURATION_RESOURCE_QUOTAS_PAGE: 'https://dbeaver.com/docs/cloudbeaver/Server-configuration/#resource-quotas',
DATABASE_NAVIGATOR_DOCUMENTATION_PAGE: 'https://dbeaver.com/docs/cloudbeaver/Database-Navigator/',
AWS_DEPLOY_UPDATE_PAGE: 'https://dbeaver.com/docs/cloudbeaver/Managing-CloudBeaver-server-on-AWS/#version-update-procedure',
ENTERPRISE_BUY_PRODUCT_PAGE: 'https://dbeaver.com/products/cloudbeaver-enterprise/',
TEAM_EDITION_BUY_PRODUCT_PAGE: 'https://dbeaver.com/products/team-edition/',
@@ -114,7 +114,7 @@ export default [
['ui_close_others', 'Close others'],
['ui_close_all_to_the_right', 'Close all to the Right'],
['ui_close_all_to_the_left', 'Close all to the Left'],
['ui_or', 'Or'],
['ui_or', 'or'],
['ui_download', 'Download'],
['ui_download_file', 'Download file'],
['ui_upload', 'Upload'],
@@ -108,7 +108,7 @@ export default [
['ui_close_others', 'Fermer les autres'],
['ui_close_all_to_the_right', 'Fermer tout à droite'],
['ui_close_all_to_the_left', 'Fermer tout à gauche'],
['ui_or', 'Ou'],
['ui_or', 'ou'],
['ui_download', 'Télécharger'],
['ui_download_file', 'Télécharger le fichier'],
['ui_upload', 'Importer'],
@@ -104,7 +104,7 @@ export default [
['ui_close_others', 'Close others'],
['ui_close_all_to_the_right', 'Close all to the Right'],
['ui_close_all_to_the_left', 'Close all to the Left'],
['ui_or', 'Or'],
['ui_or', 'or'],
['ui_download', 'Download'],
['ui_download_file', 'Download file'],
['ui_upload', 'Upload'],
@@ -110,7 +110,7 @@ export default [
['ui_close_others', 'Закрыть другие'],
['ui_close_all_to_the_right', 'Закрыть все справа'],
['ui_close_all_to_the_left', 'Закрыть все слева'],
['ui_or', 'Или'],
['ui_or', 'или'],
['ui_download', 'Cкачать'],
['ui_download_file', 'Скачать файл'],
['ui_upload', 'Загрузить'],
@@ -5,13 +5,17 @@
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { Link, useTranslate } from '@cloudbeaver/core-blocks';
import { Link, Text, useTranslate } from '@cloudbeaver/core-blocks';
import type { InstructionComponent } from './VersionUpdateService.js';
export const BaseUpdateInstruction: InstructionComponent = function UpdateInstruction({ version, containerId, link, className }) {
const translate = useTranslate();
if (!link) {
return <Text className={className}>{translate('version_update_instruction_link_not_provided')}</Text>;
}
return (
<div className={className}>
{translate('version_update_instruction')}{' '}
@@ -5,14 +5,14 @@
* 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 { computed, makeObservable, observable } from 'mobx';
import { injectable } from '@cloudbeaver/core-di';
import { type IVersion, VersionResource, VersionService } from '@cloudbeaver/core-version';
interface IInstructionProps {
version: IVersion;
link: string;
link: string | null;
containerId?: string;
className?: string;
}
@@ -23,6 +23,7 @@ export type InstructionComponent = React.FunctionComponent<IInstructionProps>;
export class VersionUpdateService {
generalInstructionsGetter: (() => React.FC) | null = null;
versionInstructionGetter: (() => InstructionComponent) | null;
instructionLink: string | null;
get newVersionAvailable() {
if (!this.versionService.current || !this.versionResource.latest) {
@@ -37,12 +38,18 @@ export class VersionUpdateService {
private readonly versionResource: VersionResource,
) {
this.versionInstructionGetter = null;
this.instructionLink = null;
makeObservable(this, {
newVersionAvailable: computed,
instructionLink: observable.ref,
});
}
registerInstructionLink(link: string): void {
this.instructionLink = link;
}
registerVersionInstruction(componentGetter: () => InstructionComponent): void {
this.versionInstructionGetter = componentGetter;
}
@@ -16,4 +16,5 @@ export default [
['version_update_info', 'Info'],
['version_update_instruction', 'To update version, please follow'],
['version_update_instruction_link', 'the instructions'],
['version_update_instruction_link_not_provided', 'Instructions link is not provided. Please contact support.'],
];
@@ -16,4 +16,5 @@ export default [
['version_update_info', 'Info'],
['version_update_instruction', 'To update version, please follow'],
['version_update_instruction_link', 'the instructions'],
['version_update_instruction_link_not_provided', 'Instructions link is not provided. Please contact support.'],
];
@@ -16,4 +16,5 @@ export default [
['version_update_info', 'Info'],
['version_update_instruction', 'To update version, please follow'],
['version_update_instruction_link', 'the instructions'],
['version_update_instruction_link_not_provided', 'Instructions link is not provided. Please contact support.'],
];
@@ -16,4 +16,5 @@ export default [
['version_update_info', 'Информация'],
['version_update_instruction', 'Чтобы обновить версию, следуйте'],
['version_update_instruction_link', 'инструкциям'],
['version_update_instruction_link_not_provided', 'Ссылка на инструкции не предоставлена. Обратитесь в службу поддержки.'],
];
@@ -16,4 +16,5 @@ export default [
['version_update_info', '信息'],
['version_update_instruction', 'To update version, please follow'],
['version_update_instruction_link', 'the instructions'],
['version_update_instruction_link_not_provided', 'Instructions link is not provided. Please contact support.'],
];
@@ -10,7 +10,6 @@ import { useEffect, useState } from 'react';
import { Combobox, Container, Group, GroupItem, GroupTitle, s, useS, useTranslate } from '@cloudbeaver/core-blocks';
import { useService } from '@cloudbeaver/core-di';
import { GITHUB_LINKS } from '@cloudbeaver/core-links';
import { ServerConfigResource } from '@cloudbeaver/core-root';
import { type IVersion, VersionResource } from '@cloudbeaver/core-version';
import { VersionUpdateService } from '@cloudbeaver/core-version-update';
@@ -39,6 +38,7 @@ export const VersionSelector = observer<Props>(function VersionSelector({ versio
const version = versions.find(v => v.number === selected);
const Instruction = versionUpdateService.versionInstructionGetter?.();
const instructionLink = versionUpdateService.instructionLink;
return (
<Container gap>
@@ -56,7 +56,7 @@ export const VersionSelector = observer<Props>(function VersionSelector({ versio
{version && Instruction && (
<GroupItem>
<Instruction
link={GITHUB_LINKS.getDeployUpdateLink(!!serverConfigResource.data?.distributed)}
link={instructionLink}
className={s(style, { instruction: true })}
version={version}
containerId={serverConfigResource.data?.containerId}