From f6028de7a84b4da8464a5e3e82995517e1b28f19 Mon Sep 17 00:00:00 2001 From: Vadim Ogievetsky Date: Thu, 31 Oct 2019 20:59:36 -0700 Subject: [PATCH] Web console: use SQL for the supervisor view (#8796) * use SQL for supervisor view * home view sql also * no proxy mode * fix alert * improve message --- .../__snapshots__/header-bar.spec.tsx.snap | 3 + .../components/header-bar/header-bar.spec.tsx | 4 +- .../src/components/header-bar/header-bar.tsx | 26 ++- web-console/src/console-application.tsx | 116 ++++++---- web-console/src/utils/capabilities.ts | 19 ++ .../datasource-view/datasource-view.spec.tsx | 2 +- .../views/datasource-view/datasource-view.tsx | 137 +++++++----- .../__snapshots__/home-view.spec.tsx.snap | 12 +- .../datasources-card.spec.tsx | 2 +- .../datasources-card/datasources-card.tsx | 13 +- .../src/views/home-view/home-view.spec.tsx | 2 +- web-console/src/views/home-view/home-view.tsx | 16 +- .../segments-card/segments-card.spec.tsx | 2 +- .../home-view/segments-card/segments-card.tsx | 13 +- .../servers-card/servers-card.spec.tsx | 2 +- .../home-view/servers-card/servers-card.tsx | 13 +- .../supervisors-card.spec.tsx | 2 +- .../supervisors-card/supervisors-card.tsx | 41 ++-- .../home-view/tasks-card/tasks-card.spec.tsx | 2 +- .../views/home-view/tasks-card/tasks-card.tsx | 13 +- .../segments-view/segments-view.spec.tsx | 2 +- .../src/views/segments-view/segments-view.tsx | 106 +++++---- .../views/servers-view/servers-view.spec.tsx | 2 +- .../src/views/servers-view/servers-view.tsx | 38 ++-- .../__snapshots__/tasks-view.spec.tsx.snap | 81 +------ .../src/views/task-view/tasks-view.spec.tsx | 2 +- .../src/views/task-view/tasks-view.tsx | 201 +++++++++--------- 27 files changed, 488 insertions(+), 384 deletions(-) create mode 100644 web-console/src/utils/capabilities.ts diff --git a/web-console/src/components/header-bar/__snapshots__/header-bar.spec.tsx.snap b/web-console/src/components/header-bar/__snapshots__/header-bar.spec.tsx.snap index 6b899838449..61ae684d18a 100644 --- a/web-console/src/components/header-bar/__snapshots__/header-bar.spec.tsx.snap +++ b/web-console/src/components/header-bar/__snapshots__/header-bar.spec.tsx.snap @@ -15,6 +15,7 @@ exports[`header bar matches snapshot 1`] = ` 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 0e596c32e3a..8e79ddfd1df 100644 --- a/web-console/src/components/header-bar/header-bar.spec.tsx +++ b/web-console/src/components/header-bar/header-bar.spec.tsx @@ -23,7 +23,9 @@ import { HeaderBar } from './header-bar'; describe('header bar', () => { 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 12b4a756c03..3a87b40812b 100644 --- a/web-console/src/components/header-bar/header-bar.tsx +++ b/web-console/src/components/header-bar/header-bar.tsx @@ -36,6 +36,7 @@ import { AboutDialog } from '../../dialogs/about-dialog/about-dialog'; import { CoordinatorDynamicConfigDialog } from '../../dialogs/coordinator-dynamic-config-dialog/coordinator-dynamic-config-dialog'; import { DoctorDialog } from '../../dialogs/doctor-dialog/doctor-dialog'; import { OverlordDynamicConfigDialog } from '../../dialogs/overlord-dynamic-config-dialog/overlord-dynamic-config-dialog'; +import { Capabilities } from '../../utils/capabilities'; import { DRUID_ASF_SLACK, DRUID_DOCS, @@ -130,10 +131,11 @@ function LegacyMenu() { export interface HeaderBarProps { active: HeaderActiveTab; hideLegacy: boolean; + capabilities: Capabilities; } export const HeaderBar = React.memo(function HeaderBar(props: HeaderBarProps) { - const { active, hideLegacy } = props; + const { active, hideLegacy, capabilities } = props; const [aboutDialogOpen, setAboutDialogOpen] = useState(false); const [doctorDialogOpen, setDoctorDialogOpen] = useState(false); const [coordinatorDynamicConfigDialogOpen, setCoordinatorDynamicConfigDialogOpen] = useState( @@ -198,6 +200,7 @@ export const HeaderBar = React.memo(function HeaderBar(props: HeaderBarProps) { href="#load-data" minimal={!loadDataPrimary} intent={loadDataPrimary ? Intent.PRIMARY : Intent.NONE} + disabled={capabilities === 'no-proxy'} /> @@ -241,12 +244,25 @@ export const HeaderBar = React.memo(function HeaderBar(props: HeaderBarProps) { {!hideLegacy && ( - } position={Position.BOTTOM_RIGHT}> -