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 5e6d833 Web-Console: tail log based on task status (#7888)
5e6d833 is described below
commit 5e6d833fd9673e894b0a50c9542395c356fea0cc
Author: mcbrewster <[email protected]>
AuthorDate: Fri Jun 14 14:37:21 2019 -0700
Web-Console: tail log based on task status (#7888)
* clean up
* fix declarations
* spacing
---
.../show-log/__snapshots__/show-log.spec.tsx.snap | 1 +
web-console/src/components/show-log/show-log.spec.tsx | 1 +
web-console/src/components/show-log/show-log.tsx | 14 ++++++++++++--
.../task-table-action-dialog.spec.tsx | 1 +
.../task-table-action-dialog/task-table-action-dialog.tsx | 4 +++-
web-console/src/views/task-view/tasks-view.tsx | 6 +++++-
6 files changed, 23 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 c287d66..aba2116 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
@@ -11,6 +11,7 @@ exports[`show log describe show log 1`] = `
class="bp3-control bp3-checkbox"
>
<input
+ checked=""
type="checkbox"
/>
<span
diff --git a/web-console/src/components/show-log/show-log.spec.tsx
b/web-console/src/components/show-log/show-log.spec.tsx
index d4ed5aa..7fe4133 100644
--- a/web-console/src/components/show-log/show-log.spec.tsx
+++ b/web-console/src/components/show-log/show-log.spec.tsx
@@ -25,6 +25,7 @@ describe('show log', () => {
it('describe show log', () => {
const showLog =
<ShowLog
+ status={'RUNNING'}
endpoint={'test'}
downloadFilename={'test'}
/>;
diff --git a/web-console/src/components/show-log/show-log.tsx
b/web-console/src/components/show-log/show-log.tsx
index 1db9c8b..1b0f95a 100644
--- a/web-console/src/components/show-log/show-log.tsx
+++ b/web-console/src/components/show-log/show-log.tsx
@@ -39,6 +39,7 @@ export interface ShowLogProps extends React.Props<any> {
endpoint: string;
downloadFilename?: string;
tailOffset?: number;
+ status: string | null;
}
export interface ShowLogState {
@@ -53,11 +54,17 @@ export class ShowLog extends
React.PureComponent<ShowLogProps, ShowLogState> {
super(props, context);
this.state = {
logValue: '',
- tail: false
+ tail: true
};
this.getLogInfo();
}
+ componentDidMount(): void {
+ if (this.props.status === 'RUNNING') {
+ this.tail();
+ }
+ }
+
private getLogInfo = async (): Promise<void> => {
const { endpoint, tailOffset } = this.props;
try {
@@ -97,16 +104,19 @@ export class ShowLog extends
React.PureComponent<ShowLogProps, ShowLogState> {
render() {
- const { endpoint, downloadFilename } = this.props;
+ const { endpoint, downloadFilename, status } = this.props;
const { logValue } = this.state;
return <div className="show-log">
<div className="top-actions">
+ {
+ status === 'RUNNING' &&
<Checkbox
label="Tail log"
checked={this.state.tail}
onChange={this.handleCheckboxChange}
/>
+ }
<ButtonGroup className="right-buttons">
{
downloadFilename &&
diff --git
a/web-console/src/dialogs/task-table-action-dialog/task-table-action-dialog.spec.tsx
b/web-console/src/dialogs/task-table-action-dialog/task-table-action-dialog.spec.tsx
index 30a3654..771cacd 100644
---
a/web-console/src/dialogs/task-table-action-dialog/task-table-action-dialog.spec.tsx
+++
b/web-console/src/dialogs/task-table-action-dialog/task-table-action-dialog.spec.tsx
@@ -26,6 +26,7 @@ describe('task table action dialog', () => {
it('matches snapshot', () => {
const taskTableActionDialog =
<TaskTableActionDialog
+ status={'RUNNING'}
taskId={'test'}
actions={[basicAction]}
onClose={() => null}
diff --git
a/web-console/src/dialogs/task-table-action-dialog/task-table-action-dialog.tsx
b/web-console/src/dialogs/task-table-action-dialog/task-table-action-dialog.tsx
index c7f52df..1952564 100644
---
a/web-console/src/dialogs/task-table-action-dialog/task-table-action-dialog.tsx
+++
b/web-console/src/dialogs/task-table-action-dialog/task-table-action-dialog.tsx
@@ -28,6 +28,7 @@ interface TaskTableActionDialogProps extends IDialogProps {
taskId: string;
actions: BasicAction[];
onClose: () => void;
+ status: string | null ;
}
interface TaskTableActionDialogState {
@@ -43,7 +44,7 @@ export class TaskTableActionDialog extends
React.PureComponent<TaskTableActionDi
}
render(): React.ReactNode {
- const { taskId, actions, onClose } = this.props;
+ const { taskId, actions, onClose, status } = this.props;
const { activeTab } = this.state;
const taskTableSideButtonMetadata: SideButtonMetaData[] = [
@@ -107,6 +108,7 @@ export class TaskTableActionDialog extends
React.PureComponent<TaskTableActionDi
{
activeTab === 'log' &&
<ShowLog
+ status={status}
endpoint={`/druid/indexer/v1/task/${taskId}/log`}
downloadFilename={`task-log-${taskId}.json`}
tailOffset={16000}
diff --git a/web-console/src/views/task-view/tasks-view.tsx
b/web-console/src/views/task-view/tasks-view.tsx
index 768a686..b2441ca 100644
--- a/web-console/src/views/task-view/tasks-view.tsx
+++ b/web-console/src/views/task-view/tasks-view.tsx
@@ -76,6 +76,7 @@ export interface TasksViewState {
alertErrorMsg: string | null;
taskTableActionDialogId: string | null;
+ taskTableActionDialogStatus: string | null;
taskTableActionDialogActions: BasicAction[];
supervisorTableActionDialogId: string | null;
supervisorTableActionDialogActions: BasicAction[];
@@ -154,6 +155,7 @@ export class TasksView extends
React.PureComponent<TasksViewProps, TasksViewStat
alertErrorMsg: null,
taskTableActionDialogId: null,
+ taskTableActionDialogStatus: null,
taskTableActionDialogActions: [],
supervisorTableActionDialogId: null,
supervisorTableActionDialogActions: []
@@ -690,6 +692,7 @@ ORDER BY "rank" DESC, "created_time" DESC`);
return <ActionCell
onDetail={() => this.setState({
taskTableActionDialogId: id,
+ taskTableActionDialogStatus: status,
taskTableActionDialogActions: taskActions
})}
actions={taskActions}
@@ -707,7 +710,7 @@ ORDER BY "rank" DESC, "created_time" DESC`);
render() {
const { goToSql, goToLoadDataView, noSqlMode } = this.props;
- const { groupTasksBy, supervisorSpecDialogOpen, taskSpecDialogOpen,
alertErrorMsg, taskTableActionDialogId, taskTableActionDialogActions,
supervisorTableActionDialogId, supervisorTableActionDialogActions } =
this.state;
+ const { groupTasksBy, supervisorSpecDialogOpen, taskSpecDialogOpen,
alertErrorMsg, taskTableActionDialogId, taskTableActionDialogActions,
supervisorTableActionDialogId, supervisorTableActionDialogActions,
taskTableActionDialogStatus } = this.state;
const { supervisorTableColumnSelectionHandler,
taskTableColumnSelectionHandler } = this;
const submitTaskMenu = <Menu>
<MenuItem
@@ -822,6 +825,7 @@ ORDER BY "rank" DESC, "created_time" DESC`);
taskTableActionDialogId &&
<TaskTableActionDialog
isOpen
+ status={taskTableActionDialogStatus}
taskId={taskTableActionDialogId}
actions={taskTableActionDialogActions}
onClose={() => this.setState({taskTableActionDialogId: null})}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]