mirror of https://github.com/apache/druid.git
add url baser (#7585)
This commit is contained in:
parent
6d4181191f
commit
d97c0d19a0
|
@ -26,6 +26,7 @@ import { HashRouter, Route, Switch } from 'react-router-dom';
|
||||||
import { HeaderActiveTab, HeaderBar } from './components/header-bar';
|
import { HeaderActiveTab, HeaderBar } from './components/header-bar';
|
||||||
import {Loader} from './components/loader';
|
import {Loader} from './components/loader';
|
||||||
import { AppToaster } from './singletons/toaster';
|
import { AppToaster } from './singletons/toaster';
|
||||||
|
import { UrlBaser } from './singletons/url-baser';
|
||||||
import {QueryManager} from './utils';
|
import {QueryManager} from './utils';
|
||||||
import {DRUID_DOCS_API, DRUID_DOCS_SQL, LEGACY_COORDINATOR_CONSOLE, LEGACY_OVERLORD_CONSOLE} from './variables';
|
import {DRUID_DOCS_API, DRUID_DOCS_SQL, LEGACY_COORDINATOR_CONSOLE, LEGACY_OVERLORD_CONSOLE} from './variables';
|
||||||
import { DatasourcesView } from './views/datasource-view';
|
import { DatasourcesView } from './views/datasource-view';
|
||||||
|
@ -113,6 +114,7 @@ export class ConsoleApplication extends React.Component<ConsoleApplicationProps,
|
||||||
|
|
||||||
if (props.baseURL) {
|
if (props.baseURL) {
|
||||||
axios.defaults.baseURL = props.baseURL;
|
axios.defaults.baseURL = props.baseURL;
|
||||||
|
UrlBaser.baseURL = props.baseURL;
|
||||||
}
|
}
|
||||||
if (props.customHeaderName && props.customHeaderValue) {
|
if (props.customHeaderName && props.customHeaderValue) {
|
||||||
axios.defaults.headers.common[props.customHeaderName] = props.customHeaderValue;
|
axios.defaults.headers.common[props.customHeaderName] = props.customHeaderValue;
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export class UrlBaser {
|
||||||
|
static baseURL: string = '';
|
||||||
|
|
||||||
|
static base(url: string): string {
|
||||||
|
if (!url.startsWith('/')) return url;
|
||||||
|
return UrlBaser.baseURL + url;
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,6 +21,7 @@ import { IconName, IconNames } from '@blueprintjs/icons';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
|
import { UrlBaser } from '../singletons/url-baser';
|
||||||
import { getHeadProp, pluralIfNeeded, queryDruidSql, QueryManager } from '../utils';
|
import { getHeadProp, pluralIfNeeded, queryDruidSql, QueryManager } from '../utils';
|
||||||
|
|
||||||
import './home-view.scss';
|
import './home-view.scss';
|
||||||
|
@ -341,7 +342,7 @@ GROUP BY 1`);
|
||||||
|
|
||||||
return <div className="home-view app-view">
|
return <div className="home-view app-view">
|
||||||
{this.renderCard({
|
{this.renderCard({
|
||||||
href: '/status',
|
href: UrlBaser.base('/status'),
|
||||||
icon: IconNames.GRAPH,
|
icon: IconNames.GRAPH,
|
||||||
title: 'Status',
|
title: 'Status',
|
||||||
loading: state.statusLoading,
|
loading: state.statusLoading,
|
||||||
|
|
|
@ -28,6 +28,7 @@ import { ViewControlBar } from '../components/view-control-bar';
|
||||||
import { AsyncActionDialog } from '../dialogs/async-action-dialog';
|
import { AsyncActionDialog } from '../dialogs/async-action-dialog';
|
||||||
import { SpecDialog } from '../dialogs/spec-dialog';
|
import { SpecDialog } from '../dialogs/spec-dialog';
|
||||||
import { AppToaster } from '../singletons/toaster';
|
import { AppToaster } from '../singletons/toaster';
|
||||||
|
import { UrlBaser } from '../singletons/url-baser';
|
||||||
import {
|
import {
|
||||||
addFilter,
|
addFilter,
|
||||||
booleanCustomTableFilter,
|
booleanCustomTableFilter,
|
||||||
|
@ -434,10 +435,10 @@ ORDER BY "rank" DESC, "created_time" DESC`);
|
||||||
<a onClick={() => this.setState({ suspendSupervisorId: id })}>Suspend</a>;
|
<a onClick={() => this.setState({ suspendSupervisorId: id })}>Suspend</a>;
|
||||||
|
|
||||||
return <div>
|
return <div>
|
||||||
<a href={`/druid/indexer/v1/supervisor/${id}`} target="_blank">Payload</a>
|
<a href={UrlBaser.base(`/druid/indexer/v1/supervisor/${id}`)} target="_blank">Payload</a>
|
||||||
<a href={`/druid/indexer/v1/supervisor/${id}/status`} target="_blank">Status</a>
|
<a href={UrlBaser.base(`/druid/indexer/v1/supervisor/${id}/status`)} target="_blank">Status</a>
|
||||||
<a href={`/druid/indexer/v1/supervisor/${id}/stats`} target="_blank">Stats</a>
|
<a href={UrlBaser.base(`/druid/indexer/v1/supervisor/${id}/stats`)} target="_blank">Stats</a>
|
||||||
<a href={`/druid/indexer/v1/supervisor/${id}/history`} target="_blank">History</a>
|
<a href={UrlBaser.base(`/druid/indexer/v1/supervisor/${id}/history`)} target="_blank">History</a>
|
||||||
{suspendResume}
|
{suspendResume}
|
||||||
<a onClick={() => this.setState({ resetSupervisorId: id })}>Reset</a>
|
<a onClick={() => this.setState({ resetSupervisorId: id })}>Reset</a>
|
||||||
<a onClick={() => this.setState({ terminateSupervisorId: id })}>Terminate</a>
|
<a onClick={() => this.setState({ terminateSupervisorId: id })}>Terminate</a>
|
||||||
|
@ -593,11 +594,11 @@ ORDER BY "rank" DESC, "created_time" DESC`);
|
||||||
const id = row.value;
|
const id = row.value;
|
||||||
const { status } = row.original;
|
const { status } = row.original;
|
||||||
return <div>
|
return <div>
|
||||||
<a href={`/druid/indexer/v1/task/${id}`} target="_blank">Payload</a>
|
<a href={UrlBaser.base(`/druid/indexer/v1/task/${id}`)} target="_blank">Payload</a>
|
||||||
<a href={`/druid/indexer/v1/task/${id}/status`} target="_blank">Status</a>
|
<a href={UrlBaser.base(`/druid/indexer/v1/task/${id}/status`)} target="_blank">Status</a>
|
||||||
<a href={`/druid/indexer/v1/task/${id}/reports`} target="_blank">Reports</a>
|
<a href={UrlBaser.base(`/druid/indexer/v1/task/${id}/reports`)} target="_blank">Reports</a>
|
||||||
<a href={`/druid/indexer/v1/task/${id}/log`} target="_blank">Log (all)</a>
|
<a href={UrlBaser.base(`/druid/indexer/v1/task/${id}/log`)} target="_blank">Log (all)</a>
|
||||||
<a href={`/druid/indexer/v1/task/${id}/log?offset=-8192`} target="_blank">Log (last 8kb)</a>
|
<a href={UrlBaser.base(`/druid/indexer/v1/task/${id}/log?offset=-8192`)} target="_blank">Log (last 8kb)</a>
|
||||||
{(status === 'RUNNING' || status === 'WAITING' || status === 'PENDING') && <a onClick={() => this.setState({ killTaskId: id })}>Kill</a>}
|
{(status === 'RUNNING' || status === 'WAITING' || status === 'PENDING') && <a onClick={() => this.setState({ killTaskId: id })}>Kill</a>}
|
||||||
</div>;
|
</div>;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue