You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by fj...@apache.org on 2019/04/12 04:58:14 UTC

[incubator-druid] branch master updated: customHeader (#7456)

This is an automated email from the ASF dual-hosted git repository.

fjy 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 07eb2ef  customHeader (#7456)
07eb2ef is described below

commit 07eb2effe95788287f95aed1e7e2c8960c97fc93
Author: Vadim Ogievetsky <va...@gmail.com>
AuthorDate: Thu Apr 11 21:58:09 2019 -0700

    customHeader (#7456)
---
 web-console/src/console-application.tsx |  5 +++++
 web-console/src/entry.ts                | 11 ++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/web-console/src/console-application.tsx b/web-console/src/console-application.tsx
index 0a9efe2..52aa9b1 100644
--- a/web-console/src/console-application.tsx
+++ b/web-console/src/console-application.tsx
@@ -39,6 +39,8 @@ import './console-application.scss';
 export interface ConsoleApplicationProps extends React.Props<any> {
   hideLegacy: boolean;
   baseURL?: string;
+  customHeaderName?: string;
+  customHeaderValue?: string;
 }
 
 export interface ConsoleApplicationState {
@@ -99,6 +101,9 @@ export class ConsoleApplication extends React.Component<ConsoleApplicationProps,
     if (props.baseURL) {
       axios.defaults.baseURL = props.baseURL;
     }
+    if (props.customHeaderName && props.customHeaderValue) {
+      axios.defaults.headers.common[props.customHeaderName] = props.customHeaderValue;
+    }
   }
 
   componentDidMount(): void {
diff --git a/web-console/src/entry.ts b/web-console/src/entry.ts
index 2f75c58..344ce12 100644
--- a/web-console/src/entry.ts
+++ b/web-console/src/entry.ts
@@ -30,17 +30,26 @@ const container = document.getElementsByClassName('app-container')[0];
 if (!container) throw new Error('container not found');
 
 interface ConsoleConfig {
+  title?: string;
   hideLegacy?: boolean;
   baseURL?: string;
+  customHeaderName?: string;
+  customHeaderValue?: string;
 }
 
 const consoleConfig: ConsoleConfig = (window as any).consoleConfig;
+if (typeof consoleConfig.title === 'string') {
+  window.document.title = consoleConfig.title;
+}
+
 ReactDOM.render(
   React.createElement(
     ConsoleApplication,
     {
       hideLegacy: Boolean(consoleConfig.hideLegacy),
-      baseURL: consoleConfig.baseURL
+      baseURL: consoleConfig.baseURL,
+      customHeaderName: consoleConfig.customHeaderName,
+      customHeaderValue: consoleConfig.customHeaderValue
     }
   ) as any,
   container


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