From 6edfddb92a67d88afa0fdcb9060d09a3f3a810d4 Mon Sep 17 00:00:00 2001 From: Naumov Alexey Date: Fri, 11 Jun 2021 14:29:20 +0300 Subject: [PATCH 1/5] feat(plugin-authentication): CB-999 hide menu in aws product --- .../core-connections/src/locales/en.ts | 2 +- .../plugin-authentication/src/UserInfo.tsx | 32 +++++++++++++++++-- .../src/UserMenu/userMenuStyles.ts | 2 +- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/webapp/packages/core-connections/src/locales/en.ts b/webapp/packages/core-connections/src/locales/en.ts index 0055a1e907..f90d027f4b 100644 --- a/webapp/packages/core-connections/src/locales/en.ts +++ b/webapp/packages/core-connections/src/locales/en.ts @@ -39,7 +39,7 @@ export default [ ['connections_connection_access_grant', 'Grant'], ['connections_connection_access_edit', 'Edit'], ['connections_connection_access_cloud_placeholder', 'Cloud connections are visible to all users. Access management can be configured in "AWS Management Console".'], - ['connections_connection_access_empty_table_placeholder', 'There are no items yet. Press edit button to grant role or user.'], + ['connections_connection_access_empty_table_placeholder', 'There are no items yet. Press Edit button to grant role or user.'], ['connections_connection_access_filter_placeholder', 'Search for user or role name'], ['connections_connection_access_filter_no_result', 'No results have been found.'], ['connections_connection_access_admin_info', 'Administators see all connections.'], diff --git a/webapp/packages/plugin-authentication/src/UserInfo.tsx b/webapp/packages/plugin-authentication/src/UserInfo.tsx index 1cda1ef094..990ef573b8 100644 --- a/webapp/packages/plugin-authentication/src/UserInfo.tsx +++ b/webapp/packages/plugin-authentication/src/UserInfo.tsx @@ -6,7 +6,9 @@ * you may not use this file except in compliance with the License. */ +import { computed } from 'mobx'; import { observer } from 'mobx-react-lite'; +import { useMemo } from 'react'; import styled, { css } from 'reshadow'; import { topMenuStyles } from '@cloudbeaver/core-app'; @@ -42,17 +44,41 @@ export const UserInfo = observer(function UserInfo() { const authInfoService = useService(AuthInfoService); const style = useStyles(styles, userMenuStyles); + const { panel, hidden } = useMemo( + () => { + const panel = userMenuService.getMenu(); + const hidden = computed(() => !panel.menuItems.length + || panel.menuItems.every(item => item.isHidden)); + + return { panel, hidden }; + }, + [userMenuService] + ); + if (!authInfoService.userInfo) { return null; } - return styled(style)( - + const userName = authInfoService.userInfo.displayName || authInfoService.userInfo.userId; + + if (hidden.get()) { + return styled(style)( - {authInfoService.userInfo.displayName || authInfoService.userInfo.userId} + {userName} + + ); + } + + return styled(style)( + + + + + + {userName} ); diff --git a/webapp/packages/plugin-authentication/src/UserMenu/userMenuStyles.ts b/webapp/packages/plugin-authentication/src/UserMenu/userMenuStyles.ts index d320ffcada..b8758910c0 100644 --- a/webapp/packages/plugin-authentication/src/UserMenu/userMenuStyles.ts +++ b/webapp/packages/plugin-authentication/src/UserMenu/userMenuStyles.ts @@ -10,7 +10,7 @@ import { css } from 'reshadow'; export const userMenuStyles = css` MenuTrigger { - padding: 0 16px !important; + padding: 0 !important; height: 48px; cursor: pointer; background: none; From 1934845b89b7a909bd8058f97076b99874f2c560 Mon Sep 17 00:00:00 2001 From: Wroud Date: Fri, 11 Jun 2021 15:32:55 +0300 Subject: [PATCH 2/5] chore(plugin-data-viewer): CB-907 text value styles --- .../ValuePanelPresentation/TextValue/TextValuePresentation.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/packages/plugin-data-viewer/src/ValuePanelPresentation/TextValue/TextValuePresentation.tsx b/webapp/packages/plugin-data-viewer/src/ValuePanelPresentation/TextValue/TextValuePresentation.tsx index 6f897a3f3e..d0cb39c99d 100644 --- a/webapp/packages/plugin-data-viewer/src/ValuePanelPresentation/TextValue/TextValuePresentation.tsx +++ b/webapp/packages/plugin-data-viewer/src/ValuePanelPresentation/TextValue/TextValuePresentation.tsx @@ -41,7 +41,7 @@ const styles = composes( } content-type { display: flex; - justify-content: flex-end; + justify-content: center; flex: 0; padding: 0 8px; padding-bottom: 16px; From 6156cbe0467d0ea94a955c3f4c67607fde89fb7d Mon Sep 17 00:00:00 2001 From: Naumov Alexey Date: Fri, 11 Jun 2021 15:33:36 +0300 Subject: [PATCH 3/5] feat(plugin-authentication): CB-999 disable MenuTrigger in AWS product --- .../plugin-authentication/src/UserInfo.tsx | 18 ++---------------- .../src/UserMenu/userMenuStyles.ts | 3 ++- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/webapp/packages/plugin-authentication/src/UserInfo.tsx b/webapp/packages/plugin-authentication/src/UserInfo.tsx index 990ef573b8..bd0e02920b 100644 --- a/webapp/packages/plugin-authentication/src/UserInfo.tsx +++ b/webapp/packages/plugin-authentication/src/UserInfo.tsx @@ -24,7 +24,6 @@ import { userMenuStyles } from './UserMenu/userMenuStyles'; const styles = css` user { height: 100%; - padding: 0 16px; display: flex; align-items: center; } @@ -59,26 +58,13 @@ export const UserInfo = observer(function UserInfo() { return null; } - const userName = authInfoService.userInfo.displayName || authInfoService.userInfo.userId; - - if (hidden.get()) { - return styled(style)( - - - - - {userName} - - ); - } - return styled(style)( - + - {userName} + {authInfoService.userInfo.displayName || authInfoService.userInfo.userId} ); diff --git a/webapp/packages/plugin-authentication/src/UserMenu/userMenuStyles.ts b/webapp/packages/plugin-authentication/src/UserMenu/userMenuStyles.ts index b8758910c0..61c68813be 100644 --- a/webapp/packages/plugin-authentication/src/UserMenu/userMenuStyles.ts +++ b/webapp/packages/plugin-authentication/src/UserMenu/userMenuStyles.ts @@ -10,7 +10,8 @@ import { css } from 'reshadow'; export const userMenuStyles = css` MenuTrigger { - padding: 0 !important; + opacity: 1; + padding: 0 16px !important; height: 48px; cursor: pointer; background: none; From 2be11341bef90da1e6ad93eb88b3293ea5da0fb3 Mon Sep 17 00:00:00 2001 From: Wroud Date: Fri, 11 Jun 2021 15:44:11 +0300 Subject: [PATCH 4/5] fix(plugin-codemirror): CB-1042 styles --- .../plugin-codemirror/src/theme/_base-code-editor.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/webapp/packages/plugin-codemirror/src/theme/_base-code-editor.scss b/webapp/packages/plugin-codemirror/src/theme/_base-code-editor.scss index 6360ff8fd8..0ddaafceb5 100644 --- a/webapp/packages/plugin-codemirror/src/theme/_base-code-editor.scss +++ b/webapp/packages/plugin-codemirror/src/theme/_base-code-editor.scss @@ -75,6 +75,10 @@ border-left: 1px solid $cursor; } + .cm-s-material .CodeMirror-scrollbar-filler { + @include mdc-theme-prop(background, secondary, false); + } + .cm-s-material :global(div).CodeMirror-selected { background: rgba(128, 203, 196, 0.2); } From 2bf885709918ea65f100ca5adabb84fbb2dc61d7 Mon Sep 17 00:00:00 2001 From: Naumov Alexey Date: Fri, 11 Jun 2021 16:41:39 +0300 Subject: [PATCH 5/5] feat(plugin-authentication): CB-999 move panel outside of useMemo --- .../plugin-authentication/src/UserInfo.tsx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/webapp/packages/plugin-authentication/src/UserInfo.tsx b/webapp/packages/plugin-authentication/src/UserInfo.tsx index bd0e02920b..ad16535002 100644 --- a/webapp/packages/plugin-authentication/src/UserInfo.tsx +++ b/webapp/packages/plugin-authentication/src/UserInfo.tsx @@ -42,17 +42,11 @@ export const UserInfo = observer(function UserInfo() { const userMenuService = useService(UserMenuService); const authInfoService = useService(AuthInfoService); const style = useStyles(styles, userMenuStyles); + const panel = userMenuService.getMenu(); - const { panel, hidden } = useMemo( - () => { - const panel = userMenuService.getMenu(); - const hidden = computed(() => !panel.menuItems.length - || panel.menuItems.every(item => item.isHidden)); - - return { panel, hidden }; - }, - [userMenuService] - ); + const hidden = useMemo(() => computed( + () => !panel.menuItems.length || panel.menuItems.every(item => item.isHidden) + ), [panel]); if (!authInfoService.userInfo) { return null;