This is an automated email from the ASF dual-hosted git repository.
cwylie 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 d97c0d1 add url baser (#7585)
d97c0d1 is described below
commit d97c0d19a0e53cf651eab5331094fe70654db6ee
Author: Vadim Ogievetsky <[email protected]>
AuthorDate: Wed May 1 01:53:03 2019 -0700
add url baser (#7585)
---
web-console/src/console-application.tsx | 2 ++
web-console/src/singletons/url-baser.ts | 26 ++++++++++++++++++++++++++
web-console/src/views/home-view.tsx | 3 ++-
web-console/src/views/tasks-view.tsx | 19 ++++++++++---------
4 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/web-console/src/console-application.tsx
b/web-console/src/console-application.tsx
index 4f5ea47..dad1b56 100644
--- a/web-console/src/console-application.tsx
+++ b/web-console/src/console-application.tsx
@@ -26,6 +26,7 @@ import { HashRouter, Route, Switch } from 'react-router-dom';
import { HeaderActiveTab, HeaderBar } from './components/header-bar';
import {Loader} from './components/loader';
import { AppToaster } from './singletons/toaster';
+import { UrlBaser } from './singletons/url-baser';
import {QueryManager} from './utils';
import {DRUID_DOCS_API, DRUID_DOCS_SQL, LEGACY_COORDINATOR_CONSOLE,
LEGACY_OVERLORD_CONSOLE} from './variables';
import { DatasourcesView } from './views/datasource-view';
@@ -113,6 +114,7 @@ export class ConsoleApplication extends
React.Component<ConsoleApplicationProps,
if (props.baseURL) {
axios.defaults.baseURL = props.baseURL;
+ UrlBaser.baseURL = props.baseURL;
}
if (props.customHeaderName && props.customHeaderValue) {
axios.defaults.headers.common[props.customHeaderName] =
props.customHeaderValue;
diff --git a/web-console/src/singletons/url-baser.ts
b/web-console/src/singletons/url-baser.ts
new file mode 100644
index 0000000..df0cc6b
--- /dev/null
+++ b/web-console/src/singletons/url-baser.ts
@@ -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;
+ }
+}
diff --git a/web-console/src/views/home-view.tsx
b/web-console/src/views/home-view.tsx
index 5e2f369..ae5d13d 100644
--- a/web-console/src/views/home-view.tsx
+++ b/web-console/src/views/home-view.tsx
@@ -21,6 +21,7 @@ import { IconName, IconNames } from '@blueprintjs/icons';
import axios from 'axios';
import * as React from 'react';
+import { UrlBaser } from '../singletons/url-baser';
import { getHeadProp, pluralIfNeeded, queryDruidSql, QueryManager } from
'../utils';
import './home-view.scss';
@@ -341,7 +342,7 @@ GROUP BY 1`);
return <div className="home-view app-view">
{this.renderCard({
- href: '/status',
+ href: UrlBaser.base('/status'),
icon: IconNames.GRAPH,
title: 'Status',
loading: state.statusLoading,
diff --git a/web-console/src/views/tasks-view.tsx
b/web-console/src/views/tasks-view.tsx
index 6f11c87..c179d49 100644
--- a/web-console/src/views/tasks-view.tsx
+++ b/web-console/src/views/tasks-view.tsx
@@ -28,6 +28,7 @@ import { ViewControlBar } from
'../components/view-control-bar';
import { AsyncActionDialog } from '../dialogs/async-action-dialog';
import { SpecDialog } from '../dialogs/spec-dialog';
import { AppToaster } from '../singletons/toaster';
+import { UrlBaser } from '../singletons/url-baser';
import {
addFilter,
booleanCustomTableFilter,
@@ -434,10 +435,10 @@ ORDER BY "rank" DESC, "created_time" DESC`);
<a onClick={() => this.setState({ suspendSupervisorId: id
})}>Suspend</a>;
return <div>
- <a href={`/druid/indexer/v1/supervisor/${id}`}
target="_blank">Payload</a>
- <a href={`/druid/indexer/v1/supervisor/${id}/status`}
target="_blank">Status</a>
- <a href={`/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}`)}
target="_blank">Payload</a>
+ <a
href={UrlBaser.base(`/druid/indexer/v1/supervisor/${id}/status`)}
target="_blank">Status</a>
+ <a
href={UrlBaser.base(`/druid/indexer/v1/supervisor/${id}/stats`)}
target="_blank">Stats</a>
+ <a
href={UrlBaser.base(`/druid/indexer/v1/supervisor/${id}/history`)}
target="_blank">History</a>
{suspendResume}
<a onClick={() => this.setState({ resetSupervisorId: id
})}>Reset</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 { status } = row.original;
return <div>
- <a href={`/druid/indexer/v1/task/${id}`}
target="_blank">Payload</a>
- <a href={`/druid/indexer/v1/task/${id}/status`}
target="_blank">Status</a>
- <a href={`/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={`/druid/indexer/v1/task/${id}/log?offset=-8192`}
target="_blank">Log (last 8kb)</a>
+ <a href={UrlBaser.base(`/druid/indexer/v1/task/${id}`)}
target="_blank">Payload</a>
+ <a href={UrlBaser.base(`/druid/indexer/v1/task/${id}/status`)}
target="_blank">Status</a>
+ <a
href={UrlBaser.base(`/druid/indexer/v1/task/${id}/reports`)}
target="_blank">Reports</a>
+ <a href={UrlBaser.base(`/druid/indexer/v1/task/${id}/log`)}
target="_blank">Log (all)</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>}
</div>;
},
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]