Skip to content

Commit

Permalink
CB-5645 adds BaseUpdate instruction to EE, TE, AWS
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyteleshev committed Oct 22, 2024
1 parent ffa267f commit 098e823
Show file tree
Hide file tree
Showing 14 changed files with 80 additions and 7 deletions.
11 changes: 6 additions & 5 deletions webapp/packages/core-links/src/GithubLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
*/
export class GithubLinks {
static CLOUDBEAVER_REPO = 'https://github.com/dbeaver/cloudbeaver';
static EE_DEPLOY_REPO = 'https://github.com/dbeaver/cloudbeaver-deploy';
static TE_DEPLOY_REPO = 'https://github.com/dbeaver/team-edition-deploy';

getDeployRepo(distributed: boolean) {
static EE_DEPLOY_UPDATE = 'https://github.com/dbeaver/cloudbeaver-deploy?tab=readme-ov-file#updating-the-cluster';
static TE_DEPLOY_UPDATE = 'https://github.com/dbeaver/team-edition-deploy?tab=readme-ov-file#server-version-update';

static getDeployUpdateLink(distributed: boolean) {
if (distributed) {
return GithubLinks.TE_DEPLOY_REPO;
return GithubLinks.TE_DEPLOY_UPDATE;
}

return GithubLinks.EE_DEPLOY_REPO;
return GithubLinks.EE_DEPLOY_UPDATE;
}
}
6 changes: 5 additions & 1 deletion webapp/packages/core-version-update/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@
"update-ts-references": "yarn run clean && typescript-resolve-references"
},
"dependencies": {
"@cloudbeaver/core-blocks": "^0",
"@cloudbeaver/core-di": "^0",
"@cloudbeaver/core-localization": "^0",
"@cloudbeaver/core-version": "^0",
"mobx": "^6"
"@cloudbeaver/core-version-update": "^0",
"mobx": "^6",
"react": "^18"
},
"peerDependencies": {},
"devDependencies": {
"@types/react": "^18",
"typescript": "^5"
}
}
27 changes: 27 additions & 0 deletions webapp/packages/core-version-update/src/BaseUpdateInstruction.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 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 { Link, useTranslate } from '@cloudbeaver/core-blocks';

import type { InstructionComponent } from './VersionUpdateService.js';

const SPLITTER = '*splitter*';

export const BaseUpdateInstruction: InstructionComponent = function UpdateInstruction({ version, containerId, link, className }) {
const translate = useTranslate();
const mainText = translate('version_update_instruction').split(SPLITTER)[0]?.trim();
const linkText = translate('version_update_instruction').split(SPLITTER)[1]?.trim();

return (
<div className={className}>
{mainText}{' '}
<Link href={link} target="_blank" rel="noopener noreferrer" inline indicator>
{linkText}
</Link>
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { type IVersion, VersionResource, VersionService } from '@cloudbeaver/cor

interface IInstructionProps {
version: IVersion;
link: string;
containerId?: string;
className?: string;
}
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-version-update/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
export { manifest as coreVersionUpdateManifest } from './manifest.js';

export * from './VersionUpdateService.js';
export * from './BaseUpdateInstruction.js';
8 changes: 8 additions & 0 deletions webapp/packages/core-version-update/src/locales/en.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 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 default [
['version_update', 'Version update'],
['version_update_version_is_up_to_date', 'Version is up to date'],
Expand All @@ -7,4 +14,5 @@ export default [
['version_update_versions_refresh_fail', 'Versions list refresh failed'],
['version_update_how_to_update', 'How to update'],
['version_update_info', 'Info'],
['version_update_instruction', 'To update version, please follow *splitter* the instructions'],
];
1 change: 1 addition & 0 deletions webapp/packages/core-version-update/src/locales/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export default [
['version_update_versions_refresh_fail', 'Échec du rafraîchissement de la liste des versions'],
['version_update_how_to_update', 'Comment mettre à jour'],
['version_update_info', 'Info'],
['version_update_instruction', 'To update version, please follow *splitter* the instructions'],
];
8 changes: 8 additions & 0 deletions webapp/packages/core-version-update/src/locales/it.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 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 default [
['version_update', 'Version update'],
['version_update_version_is_up_to_date', 'Version is up to date'],
Expand All @@ -7,4 +14,5 @@ export default [
['version_update_versions_refresh_fail', 'Versions list refresh failed'],
['version_update_how_to_update', 'How to update'],
['version_update_info', 'Info'],
['version_update_instruction', 'To update version, please follow *splitter* the instructions'],
];
8 changes: 8 additions & 0 deletions webapp/packages/core-version-update/src/locales/ru.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 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 default [
['version_update', 'Обновление версии'],
['version_update_version_is_up_to_date', 'Установлена актуальная версия'],
Expand All @@ -7,4 +14,5 @@ export default [
['version_update_versions_refresh_fail', 'Не удалось обновить список версий'],
['version_update_how_to_update', 'Как обновить версию'],
['version_update_info', 'Информация'],
['version_update_instruction', 'Чтобы обновить версию, следуйте *splitter* инструкциям'],
];
1 change: 1 addition & 0 deletions webapp/packages/core-version-update/src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export default [
['version_update_versions_refresh_fail', '版本列表刷新失败'],
['version_update_how_to_update', '如何升级'],
['version_update_info', '信息'],
['version_update_instruction', 'To update version, please follow *splitter* the instructions'],
];
3 changes: 3 additions & 0 deletions webapp/packages/core-version-update/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo"
},
"references": [
{
"path": "../core-blocks/tsconfig.json"
},
{
"path": "../core-di/tsconfig.json"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@cloudbeaver/core-administration": "^0",
"@cloudbeaver/core-blocks": "^0",
"@cloudbeaver/core-di": "^0",
"@cloudbeaver/core-links": "^0",
"@cloudbeaver/core-localization": "^0",
"@cloudbeaver/core-resource": "^0",
"@cloudbeaver/core-root": "^0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ 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 { GithubLinks } 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';
Expand Down Expand Up @@ -54,7 +55,12 @@ export const VersionSelector = observer<Props>(function VersionSelector({ versio
</Combobox>
{version && Instruction && (
<GroupItem>
<Instruction className={s(style, { instruction: true })} version={version} containerId={serverConfigResource.data?.containerId} />
<Instruction
link={GithubLinks.getDeployUpdateLink(!!serverConfigResource.data?.distributed)}
className={s(style, { instruction: true })}
version={version}
containerId={serverConfigResource.data?.containerId}
/>
</GroupItem>
)}
<GroupTitle>{translate('plugin_version_update_administration_recommendations_label')}</GroupTitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
{
"path": "../core-di/tsconfig.json"
},
{
"path": "../core-links/tsconfig.json"
},
{
"path": "../core-localization/tsconfig.json"
},
Expand Down

0 comments on commit 098e823

Please sign in to comment.