gianm commented on a change in pull request #8672: Druid Doctor
URL: https://github.com/apache/incubator-druid/pull/8672#discussion_r335252958
 
 

 ##########
 File path: web-console/src/dialogs/doctor-dialog/doctor-dialog.tsx
 ##########
 @@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Button, Callout, Classes, Dialog, Intent } from '@blueprintjs/core';
+import { IconNames } from '@blueprintjs/icons';
+import React from 'react';
+
+import { delay, pluralIfNeeded } from '../../utils';
+
+import { DOCTOR_CHECKS } from './doctor-checks';
+
+import './doctor-dialog.scss';
+
+interface Diagnosis {
+  type: 'suggestion' | 'issue';
+  check: string;
+  message: string;
+}
+
+export interface DoctorDialogProps {
+  onClose: () => void;
+}
+
+export interface DoctorDialogState {
+  currentCheckIndex?: number;
+  diagnoses?: Diagnosis[];
+  earlyTermination?: string;
+}
+
+export class DoctorDialog extends React.PureComponent<DoctorDialogProps, 
DoctorDialogState> {
+  private mounted = false;
+
+  constructor(props: DoctorDialogProps, context: any) {
+    super(props, context);
+    this.state = {};
+  }
+
+  componentDidMount(): void {
+    this.mounted = true;
+  }
+
+  componentWillUnmount(): void {
+    this.mounted = false;
+  }
+
+  async doChecks() {
+    this.setState({ currentCheckIndex: 0, diagnoses: [] });
+
+    const addToDiagnoses = (diagnosis: Diagnosis) => {
+      if (!this.mounted) return;
+      this.setState(oldState => ({
+        diagnoses: (oldState.diagnoses || []).concat(diagnosis),
+      }));
+    };
+
+    for (let i = 0; i < DOCTOR_CHECKS.length; i++) {
+      if (!this.mounted) return;
+      this.setState({ currentCheckIndex: i });
+      const check = DOCTOR_CHECKS[i];
+      let terminateChecks = false;
+
+      // Slow down a bit so that the user can read the test name
+      await delay(500);
 
 Review comment:
   Is this so they appear slowly and look like they are really working hard?
   
   If so, lol.
   
   Also, I dunno, maybe don't do it. Assuming it's milliseconds, 500ms is a 
long time.

----------------------------------------------------------------
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

Reply via email to