From f3842d8652a86db74c4060d76d6dcd13acdcdd8c Mon Sep 17 00:00:00 2001 From: Vadim Ogievetsky Date: Tue, 11 Jun 2024 14:41:31 -0700 Subject: [PATCH 1/8] don't start completions on numbers... it makes numbers hard to enter --- web-console/src/ace-modes/dsql.ts | 5 ++++- .../flexible-query-input/flexible-query-input.tsx | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/web-console/src/ace-modes/dsql.ts b/web-console/src/ace-modes/dsql.ts index e57d17d51e7c..38cc40124e2f 100644 --- a/web-console/src/ace-modes/dsql.ts +++ b/web-console/src/ace-modes/dsql.ts @@ -186,7 +186,10 @@ ace.define( this.$id = 'ace/mode/dsql'; this.lineCommentStart = '--'; - this.getCompletions = () => completions; + this.getCompletions = (_state: any, _session: any, _pos: any, prefix: string) => { + if (/^\d+$/.test(prefix)) return; // Don't start completing if the user is typing a number + return completions; + }; }; oop.inherits(Mode, TextMode); diff --git a/web-console/src/views/workbench-view/flexible-query-input/flexible-query-input.tsx b/web-console/src/views/workbench-view/flexible-query-input/flexible-query-input.tsx index 7ba116e34b5d..fba74e521a44 100644 --- a/web-console/src/views/workbench-view/flexible-query-input/flexible-query-input.tsx +++ b/web-console/src/views/workbench-view/flexible-query-input/flexible-query-input.tsx @@ -82,6 +82,10 @@ export class FlexibleQueryInput extends React.PureComponent< // Local completions { getCompletions: (_state, session, pos, prefix, callback) => { + if (/^\d+$/.test(prefix)) { + callback(null, []); // Don't start completing if the user is typing a number + return; + } const charBeforePrefix = session.getLine(pos.row)[pos.column - prefix.length - 1]; callback( null, From 313916d84931e6054b5ff371cfda57c3273c3bfa Mon Sep 17 00:00:00 2001 From: Vadim Ogievetsky Date: Tue, 11 Jun 2024 15:35:13 -0700 Subject: [PATCH 2/8] add handoff dialog --- web-console/src/dialogs/index.ts | 1 + .../supervisor-handoff-dialog.tsx | 63 +++++++++++++++++++ .../supervisors-view/supervisors-view.tsx | 46 +++++++++++--- 3 files changed, 102 insertions(+), 8 deletions(-) create mode 100644 web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx diff --git a/web-console/src/dialogs/index.ts b/web-console/src/dialogs/index.ts index f7e239b53f41..4f684b5868c5 100644 --- a/web-console/src/dialogs/index.ts +++ b/web-console/src/dialogs/index.ts @@ -34,6 +34,7 @@ export * from './retention-dialog/retention-dialog'; export * from './snitch-dialog/snitch-dialog'; export * from './spec-dialog/spec-dialog'; export * from './string-input-dialog/string-input-dialog'; +export * from './supervisor-handoff-dialog/supervisor-handoff-dialog'; export * from './supervisor-reset-offsets-dialog/supervisor-reset-offsets-dialog'; export * from './supervisor-table-action-dialog/supervisor-table-action-dialog'; export * from './table-action-dialog/table-action-dialog'; diff --git a/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx b/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx new file mode 100644 index 000000000000..495f12f08af0 --- /dev/null +++ b/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx @@ -0,0 +1,63 @@ +/* + * 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. + */ + +import { FormGroup, Tag } from '@blueprintjs/core'; +import React, { useState } from 'react'; + +import { ArrayInput } from '../../components'; +import { Api } from '../../singletons'; +import { AsyncActionDialog } from '../async-action-dialog/async-action-dialog'; + +export interface SupervisorHandoffDialogProps { + supervisorId: string; + onSuccess(): void; + onClose(): void; +} + +export function SupervisorHandoffDialog(props: SupervisorHandoffDialogProps) { + const { supervisorId, onSuccess, onClose } = props; + const [groupIds, setGroupIds] = useState([]); + + return ( + { + const resp = await Api.instance.post( + `/druid/indexer/v1/supervisor/${Api.encodePath(supervisorId)}/taskGroups/handoff`, + { taskGroupIds: groupIds.map(x => parseInt(x, 10)) }, + ); + return resp.data; + }} + confirmButtonText="Handoff supervisor" + successText="Supervisor handoff has been inititated" + failText="Could not initiate handoff for supervisor" + onClose={onClose} + onSuccess={onSuccess} + > +

+ Are you sure you want initiate handoff for the supervisor {supervisorId}? +

+ + setGroupIds(v || [])} + placeholder="1, 2, 3, ..." + /> + +
+ ); +} diff --git a/web-console/src/views/supervisors-view/supervisors-view.tsx b/web-console/src/views/supervisors-view/supervisors-view.tsx index 68654cbce79d..9a230ed131e6 100644 --- a/web-console/src/views/supervisors-view/supervisors-view.tsx +++ b/web-console/src/views/supervisors-view/supervisors-view.tsx @@ -45,6 +45,7 @@ import { SpecDialog, SupervisorTableActionDialog, } from '../../dialogs'; +import { SupervisorHandoffDialog } from '../../dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog'; import { SupervisorResetOffsetsDialog } from '../../dialogs/supervisor-reset-offsets-dialog/supervisor-reset-offsets-dialog'; import type { IngestionSpec, @@ -145,6 +146,7 @@ export interface SupervisorsViewState { resumeSupervisorId?: string; suspendSupervisorId?: string; + handoffSupervisorId?: string; resetOffsetsSupervisorInfo?: { id: string; type: string }; resetSupervisorId?: string; terminateSupervisorId?: string; @@ -426,15 +428,25 @@ export class SupervisorsView extends React.PureComponent< }, ); } + + actions.push({ + icon: supervisorSuspended ? IconNames.PLAY : IconNames.PAUSE, + title: supervisorSuspended ? 'Resume' : 'Suspend', + onAction: () => + supervisorSuspended + ? this.setState({ resumeSupervisorId: id }) + : this.setState({ suspendSupervisorId: id }), + }); + + if (!supervisorSuspended) { + actions.push({ + icon: IconNames.AUTOMATIC_UPDATES, + title: 'Handoff early', + onAction: () => this.setState({ handoffSupervisorId: id }), + }); + } + actions.push( - { - icon: supervisorSuspended ? IconNames.PLAY : IconNames.PAUSE, - title: supervisorSuspended ? 'Resume' : 'Suspend', - onAction: () => - supervisorSuspended - ? this.setState({ resumeSupervisorId: id }) - : this.setState({ suspendSupervisorId: id }), - }, { icon: IconNames.STEP_BACKWARD, title: `Set ${type === 'kinesis' ? 'sequence numbers' : 'offsets'}`, @@ -520,6 +532,23 @@ export class SupervisorsView extends React.PureComponent< ); } + renderHandoffSupervisorAction() { + const { handoffSupervisorId } = this.state; + if (!handoffSupervisorId) return; + + return ( + { + this.setState({ handoffSupervisorId: undefined }); + }} + onSuccess={() => { + this.supervisorQueryManager.rerunLastQuery(); + }} + /> + ); + } + renderResetOffsetsSupervisorAction() { const { resetOffsetsSupervisorInfo } = this.state; if (!resetOffsetsSupervisorInfo) return; @@ -1061,6 +1090,7 @@ export class SupervisorsView extends React.PureComponent< {this.renderSupervisorTable()} {this.renderResumeSupervisorAction()} {this.renderSuspendSupervisorAction()} + {this.renderHandoffSupervisorAction()} {this.renderResetOffsetsSupervisorAction()} {this.renderResetSupervisorAction()} {this.renderTerminateSupervisorAction()} From 6e41d8de74695f9acb7209698141196ebddb8e98 Mon Sep 17 00:00:00 2001 From: Vadim Ogievetsky Date: Tue, 11 Jun 2024 20:30:22 -0700 Subject: [PATCH 3/8] fix placeholder --- .../supervisor-handoff-dialog/supervisor-handoff-dialog.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx b/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx index 495f12f08af0..87be9584df85 100644 --- a/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx +++ b/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx @@ -16,7 +16,7 @@ * limitations under the License. */ -import { FormGroup, Tag } from '@blueprintjs/core'; +import { FormGroup, Intent, Tag } from '@blueprintjs/core'; import React, { useState } from 'react'; import { ArrayInput } from '../../components'; @@ -45,6 +45,7 @@ export function SupervisorHandoffDialog(props: SupervisorHandoffDialogProps) { confirmButtonText="Handoff supervisor" successText="Supervisor handoff has been inititated" failText="Could not initiate handoff for supervisor" + intent={Intent.PRIMARY} onClose={onClose} onSuccess={onSuccess} > @@ -55,7 +56,7 @@ export function SupervisorHandoffDialog(props: SupervisorHandoffDialogProps) { setGroupIds(v || [])} - placeholder="1, 2, 3, ..." + placeholder="0, 1, 2, ..." /> From 3d156fb24b06717d8ac8ab175d4664978251c99b Mon Sep 17 00:00:00 2001 From: Vadim Ogievetsky Date: Wed, 12 Jun 2024 13:54:00 -0700 Subject: [PATCH 4/8] Update web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx Co-authored-by: Katya Macedo <38017980+ektravel@users.noreply.github.com> --- .../supervisor-handoff-dialog/supervisor-handoff-dialog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx b/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx index 87be9584df85..a8de124f4cfe 100644 --- a/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx +++ b/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx @@ -43,7 +43,7 @@ export function SupervisorHandoffDialog(props: SupervisorHandoffDialogProps) { return resp.data; }} confirmButtonText="Handoff supervisor" - successText="Supervisor handoff has been inititated" + successText="Supervisor handoff has been initiated" failText="Could not initiate handoff for supervisor" intent={Intent.PRIMARY} onClose={onClose} From fcd4ddeecc925b83172c4feb39354ddb1d0bc72d Mon Sep 17 00:00:00 2001 From: Vadim Ogievetsky Date: Wed, 12 Jun 2024 13:54:07 -0700 Subject: [PATCH 5/8] Update web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx Co-authored-by: Katya Macedo <38017980+ektravel@users.noreply.github.com> --- .../supervisor-handoff-dialog/supervisor-handoff-dialog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx b/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx index a8de124f4cfe..429ff3aa065a 100644 --- a/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx +++ b/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx @@ -44,7 +44,7 @@ export function SupervisorHandoffDialog(props: SupervisorHandoffDialogProps) { }} confirmButtonText="Handoff supervisor" successText="Supervisor handoff has been initiated" - failText="Could not initiate handoff for supervisor" + failText="Could not initiate handoff for the supervisor" intent={Intent.PRIMARY} onClose={onClose} onSuccess={onSuccess} From 7e03ff11e6035b8a97d48f4dd410a6532f79f907 Mon Sep 17 00:00:00 2001 From: Vadim Ogievetsky Date: Wed, 12 Jun 2024 13:54:17 -0700 Subject: [PATCH 6/8] Update web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx Co-authored-by: Katya Macedo <38017980+ektravel@users.noreply.github.com> --- .../supervisor-handoff-dialog/supervisor-handoff-dialog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx b/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx index 429ff3aa065a..a3a825089e03 100644 --- a/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx +++ b/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx @@ -50,7 +50,7 @@ export function SupervisorHandoffDialog(props: SupervisorHandoffDialogProps) { onSuccess={onSuccess} >

- Are you sure you want initiate handoff for the supervisor {supervisorId}? + Are you sure you want to initiate handoff for the supervisor {supervisorId}?

Date: Fri, 16 Aug 2024 11:17:07 -0700 Subject: [PATCH 7/8] feedback fixes --- web-console/src/dialogs/index.ts | 2 +- .../task-group-handoff-dialog.tsx} | 13 +++++++------ .../src/views/supervisors-view/supervisors-view.tsx | 10 +++++----- 3 files changed, 13 insertions(+), 12 deletions(-) rename web-console/src/dialogs/{supervisor-handoff-dialog/supervisor-handoff-dialog.tsx => task-group-handoff-dialog/task-group-handoff-dialog.tsx} (80%) diff --git a/web-console/src/dialogs/index.ts b/web-console/src/dialogs/index.ts index 4f684b5868c5..6a3c336831be 100644 --- a/web-console/src/dialogs/index.ts +++ b/web-console/src/dialogs/index.ts @@ -34,8 +34,8 @@ export * from './retention-dialog/retention-dialog'; export * from './snitch-dialog/snitch-dialog'; export * from './spec-dialog/spec-dialog'; export * from './string-input-dialog/string-input-dialog'; -export * from './supervisor-handoff-dialog/supervisor-handoff-dialog'; export * from './supervisor-reset-offsets-dialog/supervisor-reset-offsets-dialog'; export * from './supervisor-table-action-dialog/supervisor-table-action-dialog'; export * from './table-action-dialog/table-action-dialog'; +export * from './task-group-handoff-dialog/task-group-handoff-dialog'; export * from './task-table-action-dialog/task-table-action-dialog'; diff --git a/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx b/web-console/src/dialogs/task-group-handoff-dialog/task-group-handoff-dialog.tsx similarity index 80% rename from web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx rename to web-console/src/dialogs/task-group-handoff-dialog/task-group-handoff-dialog.tsx index a3a825089e03..02e4b066af98 100644 --- a/web-console/src/dialogs/supervisor-handoff-dialog/supervisor-handoff-dialog.tsx +++ b/web-console/src/dialogs/task-group-handoff-dialog/task-group-handoff-dialog.tsx @@ -23,13 +23,13 @@ import { ArrayInput } from '../../components'; import { Api } from '../../singletons'; import { AsyncActionDialog } from '../async-action-dialog/async-action-dialog'; -export interface SupervisorHandoffDialogProps { +export interface TaskGroupHandoffDialogProps { supervisorId: string; onSuccess(): void; onClose(): void; } -export function SupervisorHandoffDialog(props: SupervisorHandoffDialogProps) { +export function TaskGroupHandoffDialog(props: TaskGroupHandoffDialogProps) { const { supervisorId, onSuccess, onClose } = props; const [groupIds, setGroupIds] = useState([]); @@ -42,15 +42,16 @@ export function SupervisorHandoffDialog(props: SupervisorHandoffDialogProps) { ); return resp.data; }} - confirmButtonText="Handoff supervisor" - successText="Supervisor handoff has been initiated" - failText="Could not initiate handoff for the supervisor" + confirmButtonText="Handoff task groups" + successText="Task group handoff has been initiated" + failText="Could not initiate handoff for the selected task groups" intent={Intent.PRIMARY} onClose={onClose} onSuccess={onSuccess} >

- Are you sure you want to initiate handoff for the supervisor {supervisorId}? + Are you sure you want to initiate early handoff for the given task groups belonging to + supervisor {supervisorId}?

{ this.setState({ handoffSupervisorId: undefined }); @@ -689,7 +689,7 @@ export class SupervisorsView extends React.PureComponent< ofText="" defaultPageSize={SMALL_TABLE_PAGE_SIZE} pageSizeOptions={SMALL_TABLE_PAGE_SIZE_OPTIONS} - showPagination + showPagination={supervisors.length > SMALL_TABLE_PAGE_SIZE} columns={[ { Header: twoLines('Supervisor ID', (datasource)), @@ -1090,7 +1090,7 @@ export class SupervisorsView extends React.PureComponent< {this.renderSupervisorTable()} {this.renderResumeSupervisorAction()} {this.renderSuspendSupervisorAction()} - {this.renderHandoffSupervisorAction()} + {this.renderTaskGroupHandoffAction()} {this.renderResetOffsetsSupervisorAction()} {this.renderResetSupervisorAction()} {this.renderTerminateSupervisorAction()} From 67a751a3d74acb3c38bfe100d1fd1484fa8adc03 Mon Sep 17 00:00:00 2001 From: Vadim Ogievetsky Date: Fri, 16 Aug 2024 13:36:33 -0700 Subject: [PATCH 8/8] update snapshot --- .../__snapshots__/supervisors-view.spec.tsx.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-console/src/views/supervisors-view/__snapshots__/supervisors-view.spec.tsx.snap b/web-console/src/views/supervisors-view/__snapshots__/supervisors-view.spec.tsx.snap index b20802ca4b84..9671213e3350 100644 --- a/web-console/src/views/supervisors-view/__snapshots__/supervisors-view.spec.tsx.snap +++ b/web-console/src/views/supervisors-view/__snapshots__/supervisors-view.spec.tsx.snap @@ -403,7 +403,7 @@ exports[`SupervisorsView matches snapshot 1`] = ` rowsText="rows" showPageJump={false} showPageSizeOptions={true} - showPagination={true} + showPagination={false} showPaginationBottom={true} showPaginationTop={false} sortable={true}