dclim commented on a change in pull request #6923: Adding a Unified web console. URL: https://github.com/apache/incubator-druid/pull/6923#discussion_r251473887
########## File path: web-console/src/console-application.tsx ########## @@ -0,0 +1,189 @@ +/* + * 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 axios from 'axios'; +import * as React from 'react'; +import * as classNames from 'classnames'; +import { HashRouter, Route, Switch } from "react-router-dom"; +import { Intent } from "@blueprintjs/core"; +import { AppToaster } from './aux/toaster'; +import { HeaderBar, HeaderActiveTab } from './components/header-bar'; +import { localStorageGet, localStorageSet } from './utils'; +import { HomeView } from './views/home-view'; +import { ServersView } from './views/servers-view'; +import { DatasourcesView } from './views/datasource-view'; +import { TasksView } from './views/tasks-view'; +import { SegmentsView } from './views/segments-view'; +import { SqlView } from './views/sql-view'; +import "./console-application.scss"; + +export interface ConsoleApplicationProps extends React.Props<any> { + version: string; +} + +export interface ConsoleApplicationState { + aboutDialogOpen: boolean; +} + +export class ConsoleApplication extends React.Component<ConsoleApplicationProps, ConsoleApplicationState> { + static MESSAGE_KEY = 'druid-console-message'; + static MESSAGE_DISMISSED = 'dismissed'; + + static async ensureSql() { + try { + await axios.post("/druid/v2/sql", { query: 'SELECT 1337' }); + } catch (e) { + const { response } = e; + if (response.status !== 405 || response.statusText !== "Method Not Allowed") return true; // other failure + try { + await axios.get("/status"); + } catch (e) { + return true; // total failure + } + + // Status works but SQL 405s => the SQL endpoint is disabled + AppToaster.show({ + icon: 'error', + intent: Intent.DANGER, + timeout: 120000, + message: <> + It appears that the SQL endpoint is disabled. Either <a + href="http://druid.io/docs/latest/querying/sql.html">enable the SQL endpoint</a> or use the old <a + href="/legacy-coordinator-console.html">coordinator</a> and <a + href="/legacy-overlord-console.html">overlord</a> consoles that do not reply on the SQL endpoint. Review comment: typo: reply -> rely ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
