From 3299ec0e11ae72791cd55a7d89e1265c80a5bc35 Mon Sep 17 00:00:00 2001 From: Vadim Ogievetsky Date: Thu, 5 May 2022 10:10:30 -0700 Subject: [PATCH 1/2] allow unrestrict --- .../components/header-bar/header-bar.spec.tsx | 4 +- .../src/components/header-bar/header-bar.tsx | 39 ++++++++++++--- web-console/src/console-application.tsx | 14 ++++-- web-console/src/utils/capabilities.ts | 48 ++++++++++++++----- 4 files changed, 83 insertions(+), 22 deletions(-) diff --git a/web-console/src/components/header-bar/header-bar.spec.tsx b/web-console/src/components/header-bar/header-bar.spec.tsx index cac4febb262b..61650aa7aa9c 100644 --- a/web-console/src/components/header-bar/header-bar.spec.tsx +++ b/web-console/src/components/header-bar/header-bar.spec.tsx @@ -25,7 +25,9 @@ import { HeaderBar } from './header-bar'; describe('HeaderBar', () => { it('matches snapshot', () => { - const headerBar = shallow(); + const headerBar = shallow( + {}} />, + ); expect(headerBar).toMatchSnapshot(); }); }); diff --git a/web-console/src/components/header-bar/header-bar.tsx b/web-console/src/components/header-bar/header-bar.tsx index 217ff807571f..53042d91a22d 100644 --- a/web-console/src/components/header-bar/header-bar.tsx +++ b/web-console/src/components/header-bar/header-bar.tsx @@ -85,10 +85,11 @@ const DruidLogo = React.memo(function DruidLogo() { interface RestrictedModeProps { capabilities: Capabilities; + onUnrestrict(capabilities: Capabilities): void; } const RestrictedMode = React.memo(function RestrictedMode(props: RestrictedModeProps) { - const { capabilities } = props; + const { capabilities, onUnrestrict } = props; const mode = capabilities.getModeExtended(); let label: string; @@ -136,7 +137,8 @@ const RestrictedMode = React.memo(function RestrictedMode(props: RestrictedModeP

It appears that you are accessing the console on the Coordinator/Overlord shared service. Due to the lack of access to some APIs on this service the console will operate in a - limited mode. The full version of the console can be accessed on the Router service. + limited mode. The unrestricted version of the console can be accessed on the Router + service.

); break; @@ -157,8 +159,8 @@ const RestrictedMode = React.memo(function RestrictedMode(props: RestrictedModeP message = (

It appears that you are accessing the console on the Overlord service. Due to the lack of - access to some APIs on this service the console will operate in a limited mode. The full - version of the console can be accessed on the Router service. + access to some APIs on this service the console will operate in a limited mode. The + unrestricted version of the console can be accessed on the Router service.

); break; @@ -168,7 +170,8 @@ const RestrictedMode = React.memo(function RestrictedMode(props: RestrictedModeP message = (

Due to the lack of access to some APIs on this service the console will operate in a - limited mode. The full version of the console can be accessed on the Router service. + limited mode. The unrestricted version of the console can be accessed on the Router + service.

); break; @@ -187,6 +190,27 @@ const RestrictedMode = React.memo(function RestrictedMode(props: RestrictedModeP .

+

+ It is possible that there is an issue with the capability detection. You can enable the + unrestricted console but certain features might not work if the underlying APIs are not + available. +

+

+