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/05/24 22:34:35 UTC
[incubator-druid] branch master updated: Web console: add log
tailing to task log view (#7703)
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 2b34e1b Web console: add log tailing to task log view (#7703)
2b34e1b is described below
commit 2b34e1b710d987a7f47e05dc43fda2384bc4ac8a
Author: mcbrewster <37...@users.noreply.github.com>
AuthorDate: Fri May 24 15:34:29 2019 -0700
Web console: add log tailing to task log view (#7703)
* add tail dialog checkbox to tasks show-log-component for webconsole
* add check box button css
* add 2 second delay
* left align
* change tail formatting
* use async/await syntax
* add space
* add public prefix
* update jest to reflect changes in show-log
* use sentence case
* update snapshots
---
.../show-log/__snapshots__/show-log.spec.tsx.snap | 11 ++++++
web-console/src/components/show-log/show-log.scss | 5 +++
web-console/src/components/show-log/show-log.tsx | 40 +++++++++++++++++++---
3 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/web-console/src/components/show-log/__snapshots__/show-log.spec.tsx.snap b/web-console/src/components/show-log/__snapshots__/show-log.spec.tsx.snap
index 37f75bc..cafc804 100644
--- a/web-console/src/components/show-log/__snapshots__/show-log.spec.tsx.snap
+++ b/web-console/src/components/show-log/__snapshots__/show-log.spec.tsx.snap
@@ -7,6 +7,17 @@ exports[`describe show log describe show log 1`] = `
<div
class="top-actions"
>
+ <label
+ class="bp3-control bp3-checkbox"
+ >
+ <input
+ type="checkbox"
+ />
+ <span
+ class="bp3-control-indicator"
+ />
+ Tail log
+ </label>
<div
class="bp3-button-group right-buttons"
>
diff --git a/web-console/src/components/show-log/show-log.scss b/web-console/src/components/show-log/show-log.scss
index cd6fe97..6dfb87b 100644
--- a/web-console/src/components/show-log/show-log.scss
+++ b/web-console/src/components/show-log/show-log.scss
@@ -41,4 +41,9 @@
line-height: 13px;
}
}
+
+ .bp3-checkbox {
+ float: left;
+ margin-top: 5px;
+ }
}
diff --git a/web-console/src/components/show-log/show-log.tsx b/web-console/src/components/show-log/show-log.tsx
index e6b5e18..d24f25d 100644
--- a/web-console/src/components/show-log/show-log.tsx
+++ b/web-console/src/components/show-log/show-log.tsx
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-import { Button, ButtonGroup, InputGroup, Intent, TextArea } from '@blueprintjs/core';
+import {Button, ButtonGroup, Checkbox, InputGroup, Intent, TextArea} from '@blueprintjs/core';
import axios from 'axios';
import * as React from 'react';
import * as CopyToClipboard from 'react-copy-to-clipboard';
@@ -43,15 +43,18 @@ export interface ShowLogProps extends React.Props<any> {
export interface ShowLogState {
logValue: string;
+ tail: boolean;
}
export class ShowLog extends React.Component<ShowLogProps, ShowLogState> {
+ public log = React.createRef<HTMLTextAreaElement>();
+
constructor(props: ShowLogProps, context: any) {
super(props, context);
this.state = {
- logValue: ''
+ logValue: '',
+ tail: false
};
-
this.getLogInfo();
}
@@ -71,12 +74,39 @@ export class ShowLog extends React.Component<ShowLogProps, ShowLogState> {
}
}
+ async tail() {
+ await this.getLogInfo();
+ if (this.state.tail) {
+ if (this.log.current) {
+ this.log.current.scrollTo(0, this.log.current.scrollHeight);
+ }
+ setTimeout(() => {
+ this.tail();
+ }, 2000);
+ }
+ }
+
+ private handleCheckboxChange = () => {
+ this.setState({
+ tail: !this.state.tail
+ });
+ if (!this.state.tail) {
+ this.tail();
+ }
+ }
+
+
render() {
const { endpoint, downloadFilename } = this.props;
const { logValue } = this.state;
return <div className="show-log">
<div className="top-actions">
+ <Checkbox
+ label="Tail log"
+ checked={this.state.tail}
+ onChange={this.handleCheckboxChange}
+ />
<ButtonGroup className="right-buttons">
{
downloadFilename &&
@@ -106,9 +136,11 @@ export class ShowLog extends React.Component<ShowLogProps, ShowLogState> {
</ButtonGroup>
</div>
<div className="main-area">
- <TextArea
+ <textarea
+ className="bp3-input"
readOnly
value={logValue}
+ ref={this.log}
/>
</div>
</div>;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org