Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cb 5178 redesign administration menu #2775

Merged
merged 41 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
23aa166
CB-5357 resolves auth dialog on successful login (removes no license …
sergeyteleshev Jul 8, 2024
d589b0a
CB-5178 fix settings names
sergeyteleshev Jul 8, 2024
76002db
CB-5178 adds to the drawer items the new order
sergeyteleshev Jul 8, 2024
ce878d7
CB-5178 removes license build and build time info from new "About" me…
sergeyteleshev Jul 8, 2024
1b46d44
CB-5178 renames: plugin product -> plugin-product-information
sergeyteleshev Jul 8, 2024
89952c5
CB-5178 adds products info settings tab and page template
sergeyteleshev Jul 8, 2024
3a051b2
Merge branch 'devel' into CB-5178-redesign-administration-menu
sergeyteleshev Jul 10, 2024
5831f09
CB-5178 adds product-info tabs
sergeyteleshev Jul 10, 2024
596948d
CB-5178 revert changes from another branch
sergeyteleshev Jul 10, 2024
6b9e6df
Merge branch 'devel' into CB-5178-redesign-administration-menu
sergeyteleshev Jul 11, 2024
cf2db02
CB-5178 fixes disappearing for sub tabs
sergeyteleshev Jul 11, 2024
ac3b957
CB-5178 removes license redirect memory leaks + redirects correctly
sergeyteleshev Jul 11, 2024
ffe5bb1
CB-5178 updates tabs state if license has new available version
sergeyteleshev Jul 11, 2024
004d71b
CB-5178 updates locale for new tabs
sergeyteleshev Jul 11, 2024
1cd8f3f
Merge branch 'devel' into CB-5178-redesign-administration-menu
sergeyteleshev Jul 15, 2024
f3851e3
CB-5178 moves product and product-info-administration to separate pac…
sergeyteleshev Jul 15, 2024
365c9ad
CB-5178 cleanup
sergeyteleshev Jul 15, 2024
59da980
CB-5178 uses TabsContainer for Product Information Administration tabs
sergeyteleshev Jul 16, 2024
0dde6ec
CB-5178 cleanup
sergeyteleshev Jul 16, 2024
1f350c8
CB-5178 cleanup
sergeyteleshev Jul 16, 2024
6cc8933
CB-5178 cleanup
sergeyteleshev Jul 16, 2024
f10d859
CB-5178 replace icon
sergeyteleshev Jul 16, 2024
659b572
CB-5178 removes extra icons
sergeyteleshev Jul 16, 2024
197f1df
Merge remote-tracking branch 'origin/devel' into CB-5178-redesign-adm…
Wroud Jul 16, 2024
f8737d8
CB-5178 fix: navigation sync with URL
Wroud Jul 16, 2024
d79d52e
CB-5178 fix: plugin name
Wroud Jul 16, 2024
9c55a45
CB-5178 fix: new version detection
Wroud Jul 16, 2024
8580ac0
CB-5178 chore: add comment about style duplication
Wroud Jul 16, 2024
07761fe
Merge remote-tracking branch 'origin/devel' into CB-5178-redesign-adm…
Wroud Jul 16, 2024
c9ed76c
Revert "CB-5178 removes extra icons"
sergeyteleshev Jul 16, 2024
294e858
Merge branch 'devel' into CB-5178-redesign-administration-menu
dariamarutkina Jul 19, 2024
6f4845c
Merge branch 'devel' into CB-5178-redesign-administration-menu
dariamarutkina Jul 22, 2024
fe0ad34
Merge branch 'devel' into CB-5178-redesign-administration-menu
dariamarutkina Jul 22, 2024
98a45a4
CB-5178 adds about labels
sergeyteleshev Jul 22, 2024
2584a73
CB-5178 fixes disabled tabs for invalid license
sergeyteleshev Jul 22, 2024
557cdae
Revert "CB-5178 fixes disabled tabs for invalid license"
sergeyteleshev Jul 23, 2024
f6296a5
CB-5178 disables administration items if license is expired (fix)
sergeyteleshev Jul 23, 2024
ca1a549
Merge branch 'devel' into CB-5178-redesign-administration-menu
dariamarutkina Jul 23, 2024
e3d6c85
CB-5178 disable product info tabs if no license required
sergeyteleshev Jul 23, 2024
0152ab8
Revert "CB-5178 disable product info tabs if no license required"
sergeyteleshev Jul 23, 2024
e5a14da
Merge branch 'devel' into CB-5178-redesign-administration-menu
Wroud Jul 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class AdministrationItemService {
return sub;
}

create(options: IAdministrationItemOptions): void {
create(options: IAdministrationItemOptions): IAdministrationItem {
const type = options.type ?? AdministrationItemType.Administration;

const existedIndex = this.items.findIndex(
Expand All @@ -160,7 +160,9 @@ export class AdministrationItemService {
sub: options.sub ?? [],
order: options.order ?? Number.MAX_SAFE_INTEGER,
};
this.items.push(item);
const index = this.items.push(item);

return this.items[index - 1];
}

async activate(screen: IAdministrationItemRoute, configurationWizard: boolean, outside: boolean, outsideAdminPage: boolean): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ export const Administration = observer<React.PropsWithChildren<Props>>(function
const optionsPanelService = useService(OptionsPanelService);

const OptionsPanel = optionsPanelService.getPanelComponent();
const items = administrationItemService.getActiveItems(configurationWizard);
const onlyActiveItem = items.find(filterOnlyActive(configurationWizard));
const visibleItems = administrationItemService.getActiveItems(configurationWizard);
const onlyActiveItem = administrationItemService.items.find(filterOnlyActive(configurationWizard));

useLayoutEffect(() => {
contentRef.current?.scrollTo({ top: 0, left: 0 });
Expand All @@ -101,7 +101,7 @@ export const Administration = observer<React.PropsWithChildren<Props>>(function
<TabsState currentTabId={activeScreen?.item} localState={administrationScreenService.itemState} orientation="vertical">
<SContext registry={tabsRegistry}>
<TabList aria-label="Administration items" vertical>
{items.map(item => (
{visibleItems.map(item => (
<DrawerItem
key={item.name}
item={item}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class ConfigurationWizardPagesBootstrapService extends Bootstrap {
onFinish: this.serverConfigurationService.saveConfiguration.bind(this.serverConfigurationService, false),
onConfigurationFinish: this.serverConfigurationService.saveConfiguration.bind(this.serverConfigurationService, true),
},
order: 4,
order: 2,
onActivate: () => this.serverConfigurationService.activate(),
onDeActivate: this.serverConfigurationService.deactivate.bind(this.serverConfigurationService),
onLoad: this.serverConfigurationService.loadConfig.bind(this.serverConfigurationService, false),
Expand Down
9 changes: 8 additions & 1 deletion webapp/packages/plugin-administration/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 [
['administration_server_configuration_save_confirmation_title', 'Server settings update'],
['administration_server_configuration_save_confirmation_message', 'You are about to change critical settings. Are you sure?'],
Expand All @@ -14,7 +21,7 @@ export default [
'Note: you will be able to change these configuration parameters later on the administration panel.',
],

['administration_configuration_wizard_configuration', 'Server configuration'],
['administration_configuration_wizard_configuration', 'Server Configuration'],
['administration_configuration_wizard_configuration_step_description', 'Main server configuration'],
['administration_configuration_wizard_configuration_title', 'You can configure the main server parameters here.'],
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class UsersAdministrationService extends Bootstrap {
register() {
this.administrationItemService.create({
name: UsersAdministrationNavigationService.ItemName,
order: 3,
order: 4,
sub: [
{
name: EUsersAdministrationSub.MetaProperties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* you may not use this file except in compliance with the License.
*/

// TODO: same styles in cloudbeaver/webapp/packages/plugin-product-information-administration/src/shared/ProductInfoPage.module.css
.tabList {
position: relative;
flex-shrink: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* you may not use this file except in compliance with the License.
*/

// TODO: same styles cloudbeaver/webapp/packages/plugin-product-information-administration/src/shared/ProductInfoPage.module.css
.administrationTabs {
& .tab {
height: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* you may not use this file except in compliance with the License.
*/

// TODO: same styles cloudbeaver/webapp/packages/plugin-product-information-administration/src/shared/ProductInfoPageTabPanel.module.css
.tabPanel {
overflow: auto;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* you may not use this file except in compliance with the License.
*/

// TODO: same styles cloudbeaver/webapp/packages/plugin-product-information-administration/src/shared/ProductInfoPageTabTitle.module.css
.tabTitle {
font-weight: 700;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default [
['authentication_administration_user_auth_methods', 'Auth Methods'],
['authentication_administration_user_auth_methods_empty', 'No available auth methods'],
['authentication_administration_user_auth_method_no_details', 'No details available'],
['authentication_administration_item', 'Access Management'],
['authentication_administration_item', 'Users and Teams'],
['authentication_administration_item_users', 'Users'],
['authentication_administration_item_metaParameters', 'Meta Parameters'],
['authentication_administration_tools_add_tooltip', 'Create new user'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default [
['authentication_administration_user_auth_methods', "Méthodes d'authentification"],
['authentication_administration_user_auth_methods_empty', "Aucune méthode d'authentification disponible"],
['authentication_administration_user_auth_method_no_details', 'Aucun détail disponible'],
['authentication_administration_item', 'Gestion des accès'],
['authentication_administration_item', 'Users and Teams'],
['authentication_administration_item_users', 'Utilisateurs'],
['authentication_administration_item_metaParameters', 'Paramètres Méta'],
['authentication_administration_tools_add_tooltip', 'Créer un nouvel utilisateur'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default [
['authentication_administration_user_auth_methods', 'Auth Methods'],
['authentication_administration_user_auth_methods_empty', 'No available auth methods'],
['authentication_administration_user_auth_method_no_details', 'No details available'],
['authentication_administration_item', 'Utenti'],
['authentication_administration_item', 'Users and Teams'],
['authentication_administration_tools_add_tooltip', 'Create new user'],
['authentication_administration_tools_refresh_tooltip', 'Aggiorna la lista utenti'],
['authentication_administration_tools_delete_tooltip', 'Elimina gli utenti selezionati'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default [
['authentication_administration_user_auth_methods', 'Способы входа'],
['authentication_administration_user_auth_methods_empty', 'Нет доступных способов входа'],
['authentication_administration_user_auth_method_no_details', 'Дополнительная информация не доступна'],
['authentication_administration_item', 'Управление доступом'],
['authentication_administration_item', 'Пользователи и команды'],
['authentication_administration_item_users', 'Пользователи'],
['authentication_administration_item_metaParameters', 'Свойства Пользователей'],
['authentication_administration_tools_add_tooltip', 'Создать нового пользователя'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default [
['authentication_administration_user_auth_methods_empty', 'No available auth methods'],
['authentication_administration_user_auth_method_no_details', 'No details available'],
['authentication_administration_user_local', 'Local user'],
['authentication_administration_item', '访问管理'],
['authentication_administration_item', 'Users and Teams'],
['authentication_administration_item_users', '用户'],
['authentication_administration_item_metaParameters', '元参数'],
['authentication_administration_tools_add_tooltip', 'Create new user'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class ConnectionsAdministrationService extends Bootstrap {
this.administrationItemService.create({
name: 'connections',
type: AdministrationItemType.Administration,
order: 2.2,
order: 5,
configurationWizardOptions: {
defaultRoute: { sub: 'create' },
description: 'connections_administration_configuration_wizard_step_description',
Expand Down
Original file line number Diff line number Diff line change
@@ -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*
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "@cloudbeaver/plugin-product-information-administration",
"sideEffects": [
"src/**/*.css",
"src/**/*.scss",
"public/**/*"
],
"version": "0.1.0",
"description": "",
"license": "Apache-2.0",
"main": "dist/index.js",
"scripts": {
"build": "tsc -b",
"clean": "rimraf --glob dist",
"lint": "eslint ./src/ --ext .ts,.tsx",
"validate-dependencies": "core-cli-validate-dependencies",
"update-ts-references": "yarn run clean && typescript-resolve-references"
},
"dependencies": {
"@cloudbeaver/core-administration": "^0",
"@cloudbeaver/core-blocks": "^0",
"@cloudbeaver/core-di": "^0",
"@cloudbeaver/core-localization": "^0",
"@cloudbeaver/core-ui": "^0",
"@cloudbeaver/core-version": "^0",
"@cloudbeaver/core-version-update": "^0",
"mobx": "^6",
"mobx-react-lite": "^4",
"react": "^18"
},
"peerDependencies": {},
"devDependencies": {
"@types/react": "^18",
"typescript": "^5",
"typescript-plugin-css-modules": "^5"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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 { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { LocalizationService } from '@cloudbeaver/core-localization';

@injectable()
export class LocaleService extends Bootstrap {
constructor(private readonly localizationService: LocalizationService) {
super();
}

register(): void | Promise<void> {
this.localizationService.addProvider(this.provider.bind(this));
}

load(): void | Promise<void> {}

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;
case 'fr':
return (await import('./locales/fr')).default;
default:
return (await import('./locales/en')).default;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,11 @@
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
.tabTitle {
flex: 1;
}

.icon {
composes: theme-background-primary from global;
width: 8px;
height: 8px;
border-radius: 50%;
flex-shrink: 0;
margin-right: 12px;
}

.iconOrImage {
width: 16px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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 type { AdministrationItemDrawerProps } from '@cloudbeaver/core-administration';
import { s, Translate, useResource, useS, useTranslate } from '@cloudbeaver/core-blocks';
import { useService } from '@cloudbeaver/core-di';
import { CachedMapAllKey } from '@cloudbeaver/core-resource';
import { Tab, TabIcon, TabTitle } from '@cloudbeaver/core-ui';
import { VersionResource } from '@cloudbeaver/core-version';
import { VersionUpdateService } from '@cloudbeaver/core-version-update';

import style from './ProductInfoDrawerItem.module.css';

export const ProductInfoDrawerItem: React.FC<AdministrationItemDrawerProps> = function ProductInfoDrawerItem({ item, onSelect, disabled }) {
const styles = useS(style);
const versionUpdateService = useService(VersionUpdateService);
const newVersionAvailable = versionUpdateService.newVersionAvailable;
const translate = useTranslate();

useResource(ProductInfoDrawerItem, VersionResource, CachedMapAllKey);

return (
<Tab
title={translate(newVersionAvailable ? 'version_update_new_version_available' : undefined)}
tabId={item.name}
disabled={disabled}
onOpen={() => onSelect(item.name)}
>
<TabIcon icon="/icons/license.svg" viewBox="0 0 16 16" />
<TabTitle>
<Translate token="administration_settings_menu_title" />
</TabTitle>
{newVersionAvailable && <div className={s(styles, { icon: true })} />}
</Tab>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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 { AdministrationScreenService, IRouteParams } from '@cloudbeaver/core-administration';
import { injectable } from '@cloudbeaver/core-di';

@injectable()
export class ProductInfoNavigationService {
static ROOT_ITEM = 'product-info';

constructor(private readonly administrationScreenService: AdministrationScreenService) {
this.navToRoot = this.navToRoot.bind(this);
}

navToRoot(): void {
this.administrationScreenService.navigateToItem(ProductInfoNavigationService.ROOT_ITEM);
}

navigateToSub(params: IRouteParams): void {
this.administrationScreenService.navigateToItemSub(ProductInfoNavigationService.ROOT_ITEM, params.sub, params.param);
}
}
Loading
Loading