[GitHub] [incubator-druid] vogievetsky commented on a change in pull request #8484: Web console: Druid status displayed in a table

2019-09-09 Thread GitBox
vogievetsky commented on a change in pull request #8484: Web console: Druid 
status displayed in a table
URL: https://github.com/apache/incubator-druid/pull/8484#discussion_r322361257
 
 

 ##
 File path: web-console/src/dialogs/status-dialog/status-dialog.tsx
 ##
 @@ -16,29 +16,97 @@
  * limitations under the License.
  */
 
-import { Button, Classes, Dialog, Intent } from '@blueprintjs/core';
+import { Button, Classes, Dialog, InputGroup, Intent } from 
'@blueprintjs/core';
+import axios from 'axios';
 import React from 'react';
+import ReactTable from 'react-table';
 
-import { ShowJson } from '../../components';
 import { UrlBaser } from '../../singletons/url-baser';
+import { QueryManager } from '../../utils';
 
 import './status-dialog.scss';
 
 interface StatusDialogProps {
   onClose: () => void;
 }
 
-export class StatusDialog extends React.PureComponent {
+interface StatusDialogState {
+  response: any;
+  loading: boolean;
+  version: string;
+}
+
+export class StatusDialog extends React.PureComponent {
+  private showStatusQueryManager: QueryManager;
 
 Review comment:
   the return type should be more complex than a `string` so you could return 
the version and the modules at the same time and now need to call setState 
where it is not needed


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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



[GitHub] [incubator-druid] vogievetsky commented on a change in pull request #8484: Web console: Druid status displayed in a table

2019-09-09 Thread GitBox
vogievetsky commented on a change in pull request #8484: Web console: Druid 
status displayed in a table
URL: https://github.com/apache/incubator-druid/pull/8484#discussion_r322360577
 
 

 ##
 File path: web-console/src/dialogs/status-dialog/status-dialog.tsx
 ##
 @@ -16,29 +16,97 @@
  * limitations under the License.
  */
 
-import { Button, Classes, Dialog, Intent } from '@blueprintjs/core';
+import { Button, Classes, Dialog, InputGroup, Intent } from 
'@blueprintjs/core';
+import axios from 'axios';
 import React from 'react';
+import ReactTable from 'react-table';
 
-import { ShowJson } from '../../components';
 import { UrlBaser } from '../../singletons/url-baser';
+import { QueryManager } from '../../utils';
 
 import './status-dialog.scss';
 
 interface StatusDialogProps {
   onClose: () => void;
 }
 
-export class StatusDialog extends React.PureComponent {
+interface StatusDialogState {
+  response: any;
+  loading: boolean;
+  version: string;
+}
+
+export class StatusDialog extends React.PureComponent {
+  private showStatusQueryManager: QueryManager;
+  constructor(props: StatusDialogProps, context: any) {
+super(props, context);
+this.state = {
+  response: [],
+  loading: false,
+  version: '',
+};
+this.showStatusQueryManager = new QueryManager({
+  processQuery: async () => {
+const endpoint = UrlBaser.base(`/status`);
+const resp = await axios.get(endpoint);
+this.setState({ version: 'Version ' + resp.data.version });
 
 Review comment:
   do not call `setState` in the `processQuery` function it is assumes to be a 
pure function


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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



[GitHub] [incubator-druid] vogievetsky commented on a change in pull request #8484: Web console: Druid status displayed in a table

2019-09-09 Thread GitBox
vogievetsky commented on a change in pull request #8484: Web console: Druid 
status displayed in a table
URL: https://github.com/apache/incubator-druid/pull/8484#discussion_r322359910
 
 

 ##
 File path: web-console/src/dialogs/status-dialog/status-dialog.tsx
 ##
 @@ -16,29 +16,97 @@
  * limitations under the License.
  */
 
-import { Button, Classes, Dialog, Intent } from '@blueprintjs/core';
+import { Button, Classes, Dialog, InputGroup, Intent } from 
'@blueprintjs/core';
+import axios from 'axios';
 import React from 'react';
+import ReactTable from 'react-table';
 
-import { ShowJson } from '../../components';
 import { UrlBaser } from '../../singletons/url-baser';
+import { QueryManager } from '../../utils';
 
 import './status-dialog.scss';
 
 interface StatusDialogProps {
   onClose: () => void;
 }
 
-export class StatusDialog extends React.PureComponent {
+interface StatusDialogState {
+  response: any;
+  loading: boolean;
+  version: string;
+}
+
+export class StatusDialog extends React.PureComponent {
+  private showStatusQueryManager: QueryManager;
+  constructor(props: StatusDialogProps, context: any) {
+super(props, context);
+this.state = {
+  response: [],
+  loading: false,
+  version: '',
+};
+this.showStatusQueryManager = new QueryManager({
+  processQuery: async () => {
+const endpoint = UrlBaser.base(`/status`);
+const resp = await axios.get(endpoint);
+this.setState({ version: 'Version ' + resp.data.version });
+return resp.data.modules;
+  },
+  onStateChange: ({ result, loading }) => {
+this.setState({
+  loading,
+  response: result,
+});
+  },
+});
+  }
+
+  componentDidMount(): void {
+this.showStatusQueryManager.runQuery(null);
+  }
+
   render(): JSX.Element {
 const { onClose } = this.props;
-
+const { response, loading, version } = this.state;
 return (
   
 
-  
+  
+