You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by fj...@apache.org on 2019/02/04 17:05:09 UTC

[incubator-druid] branch master updated: Fixing little issues and CSS bugs in the new web console. (#6995)

This is an automated email from the ASF dual-hosted git repository.

fjy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 06d56c2  Fixing little issues and CSS bugs in the new web console. (#6995)
06d56c2 is described below

commit 06d56c2abd603be4e0549bd96fcc696c87509805
Author: Vadim Ogievetsky <va...@gmail.com>
AuthorDate: Mon Feb 4 09:04:58 2019 -0800

    Fixing little issues and CSS bugs in the new web console. (#6995)
---
 web-console/src/console-application.scss                | 5 ++++-
 web-console/src/console-application.tsx                 | 8 ++++----
 web-console/src/dialogs/coordinator-dynamic-config.scss | 1 -
 web-console/src/dialogs/retention-dialog.tsx            | 2 +-
 web-console/src/utils/general.tsx                       | 5 +++++
 web-console/src/views/home-view.tsx                     | 6 +++---
 web-console/src/views/tasks-view.tsx                    | 6 ++++--
 7 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/web-console/src/console-application.scss b/web-console/src/console-application.scss
index b1df645..536e59c 100644
--- a/web-console/src/console-application.scss
+++ b/web-console/src/console-application.scss
@@ -39,8 +39,11 @@
     left: 0;
     right: 0;
     bottom: 0;
-    overflow-y: scroll;
     padding: $standard-padding;
+
+    &.scrollable {
+      overflow-y: scroll;
+    }
   }
 
   .control-separator {
diff --git a/web-console/src/console-application.tsx b/web-console/src/console-application.tsx
index 7aa1975..38c4c9d 100644
--- a/web-console/src/console-application.tsx
+++ b/web-console/src/console-application.tsx
@@ -131,10 +131,10 @@ export class ConsoleApplication extends React.Component<ConsoleApplicationProps,
   }
 
   render() {
-    const wrapInViewContainer = (active: HeaderActiveTab, el: JSX.Element) => {
+    const wrapInViewContainer = (active: HeaderActiveTab, el: JSX.Element, scrollable = false) => {
       return <>
         <HeaderBar active={active}/>
-        <div className="view-container">{el}</div>
+        <div className={classNames('view-container', { scrollable })}>{el}</div>
       </>;
     };
 
@@ -148,10 +148,10 @@ export class ConsoleApplication extends React.Component<ConsoleApplicationProps,
             return wrapInViewContainer('segments', <SegmentsView datasource={this.datasource} onlyUnavailable={this.onlyUnavailable} goToSql={this.goToSql}/>);
           }} />
           <Route path="/tasks" component={() => {
-            return wrapInViewContainer('tasks', <TasksView taskId={this.taskId} goToSql={this.goToSql} goToMiddleManager={this.goToMiddleManager}/>);
+            return wrapInViewContainer('tasks', <TasksView taskId={this.taskId} goToSql={this.goToSql} goToMiddleManager={this.goToMiddleManager}/>, true);
           }} />
           <Route path="/servers" component={() => {
-            return wrapInViewContainer('servers', <ServersView middleManager={this.middleManager} goToSql={this.goToSql} goToTask={this.goToTask}/>);
+            return wrapInViewContainer('servers', <ServersView middleManager={this.middleManager} goToSql={this.goToSql} goToTask={this.goToTask}/>, true);
           }} />
           <Route path="/sql" component={() => {
             return wrapInViewContainer('sql', <SqlView initSql={this.initSql}/>);
diff --git a/web-console/src/dialogs/coordinator-dynamic-config.scss b/web-console/src/dialogs/coordinator-dynamic-config.scss
index 663c029..a95edc2 100644
--- a/web-console/src/dialogs/coordinator-dynamic-config.scss
+++ b/web-console/src/dialogs/coordinator-dynamic-config.scss
@@ -18,7 +18,6 @@
 
 .coordinator-dynamic-config {
   .bp3-dialog-body {
-    overflow: scroll;
     max-height: 70vh;
 
     .auto-form {
diff --git a/web-console/src/dialogs/retention-dialog.tsx b/web-console/src/dialogs/retention-dialog.tsx
index 668b688..36a244a 100644
--- a/web-console/src/dialogs/retention-dialog.tsx
+++ b/web-console/src/dialogs/retention-dialog.tsx
@@ -167,7 +167,7 @@ export class RetentionDialog extends React.Component<RetentionDialogProps, Reten
       {
         (!currentRules.length && datasource !== '_default') &&
         <p>
-          This datasource currently has no rule, it will use the cluster defaults (<a onClick={onEditDefaults}>edit cluster defaults</a>)
+          This datasource currently has no rules, it will use the cluster defaults (<a onClick={onEditDefaults}>edit cluster defaults</a>)
         </p>
       }
     </SnitchDialog>;
diff --git a/web-console/src/utils/general.tsx b/web-console/src/utils/general.tsx
index 32835f9..873e634 100644
--- a/web-console/src/utils/general.tsx
+++ b/web-console/src/utils/general.tsx
@@ -121,6 +121,11 @@ export function pluralIfNeeded(n: number, singular: string, plural?: string): st
   return `${formatNumber(n)} ${n === 1 ? singular : plural}`;
 }
 
+export function getHeadProp(results: Record<string, any>[], prop: string): any {
+  if (!results || !results.length) return null;
+  return results[0][prop] || null;
+}
+
 // ----------------------------
 
 export function localStorageSet(key: string, value: string): void {
diff --git a/web-console/src/views/home-view.tsx b/web-console/src/views/home-view.tsx
index 4f8ed85..7258fe8 100644
--- a/web-console/src/views/home-view.tsx
+++ b/web-console/src/views/home-view.tsx
@@ -21,7 +21,7 @@ import * as React from 'react';
 import * as classNames from 'classnames';
 import { H5, Card, Icon } from "@blueprintjs/core";
 import { IconName, IconNames } from "@blueprintjs/icons";
-import { QueryManager, pluralIfNeeded, queryDruidSql } from '../utils';
+import { QueryManager, pluralIfNeeded, queryDruidSql, getHeadProp } from '../utils';
 import './home-view.scss';
 
 export interface CardOptions {
@@ -147,7 +147,7 @@ export class HomeView extends React.Component<HomeViewProps, HomeViewState> {
     this.segmentQueryManager = new QueryManager({
       processQuery: async (query) => {
         const segments = await queryDruidSql({ query });
-        return segments[0].count;
+        return getHeadProp(segments, 'count') || 0;
       },
       onStateChange: ({ result, loading, error }) => {
         this.setState({
@@ -211,7 +211,7 @@ GROUP BY 1`);
     this.dataServerQueryManager = new QueryManager({
       processQuery: async (query) => {
         const dataServerCounts = await queryDruidSql({ query });
-        return dataServerCounts[0].count;
+        return getHeadProp(dataServerCounts, 'count') || 0;
       },
       onStateChange: ({ result, loading, error }) => {
         this.setState({
diff --git a/web-console/src/views/tasks-view.tsx b/web-console/src/views/tasks-view.tsx
index 78c69e5..8f39458 100644
--- a/web-console/src/views/tasks-view.tsx
+++ b/web-console/src/views/tasks-view.tsx
@@ -167,6 +167,7 @@ ORDER BY "rank" DESC, "created_time" DESC`);
       message: 'Supervisor submitted successfully',
       intent: Intent.SUCCESS
     });
+    this.supervisorQueryManager.rerunLastQuery();
   }
 
   private async submitTask(spec: JSON) {
@@ -184,6 +185,7 @@ ORDER BY "rank" DESC, "created_time" DESC`);
       message: 'Task submitted successfully',
       intent: Intent.SUCCESS
     });
+    this.taskQueryManager.rerunLastQuery();
   }
 
   renderResumeSupervisorAction() {
@@ -192,7 +194,7 @@ ORDER BY "rank" DESC, "created_time" DESC`);
     return <AsyncActionDialog
       action={
         resumeSupervisorId ? async () => {
-          const resp = await axios.post(`/druid/indexer/v1/supervisor/${resumeSupervisorId}/suspend`, {})
+          const resp = await axios.post(`/druid/indexer/v1/supervisor/${resumeSupervisorId}/suspend`, {});
           return resp.data;
         } : null
       }
@@ -489,7 +491,7 @@ ORDER BY "rank" DESC, "created_time" DESC`);
             Header: 'Actions',
             id: 'actions',
             accessor: 'task_id',
-            width: 320,
+            width: 360,
             filterable: false,
             Cell: row => {
               if (row.aggregated) return '';


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org