This is an automated email from the ASF dual-hosted git repository.
vogievetsky pushed a commit to branch 28.0.1
in repository https://gitbox.apache.org/repos/asf/druid.git
The following commit(s) were added to refs/heads/28.0.1 by this push:
new 889f03b7552 Web console: fix tab duplication (#15457) (#15508)
889f03b7552 is described below
commit 889f03b755231a9e764f89cf042e5e0148a4526d
Author: Laksh Singla <[email protected]>
AuthorDate: Thu Dec 7 21:12:02 2023 +0530
Web console: fix tab duplication (#15457) (#15508)
* fix duplication
* includeFuture defaults to true
Co-authored-by: Vadim Ogievetsky <[email protected]>
---
web-console/src/components/rule-editor/rule-editor.tsx | 6 ++++--
web-console/src/druid-models/execution/execution.ts | 3 ++-
web-console/src/utils/load-rule.ts | 16 +++++++++++-----
web-console/src/views/workbench-view/workbench-view.tsx | 2 +-
4 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/web-console/src/components/rule-editor/rule-editor.tsx
b/web-console/src/components/rule-editor/rule-editor.tsx
index 3f72a8ca411..8c40ede1ac5 100644
--- a/web-console/src/components/rule-editor/rule-editor.tsx
+++ b/web-console/src/components/rule-editor/rule-editor.tsx
@@ -200,11 +200,13 @@ export const RuleEditor = React.memo(function
RuleEditor(props: RuleEditorProps)
{RuleUtil.hasIncludeFuture(rule) && (
<Switch
className="include-future"
- checked={rule.includeFuture || false}
+ checked={RuleUtil.getIncludeFuture(rule)}
label="Include future"
disabled={disabled}
onChange={() => {
- onChange?.(RuleUtil.changeIncludeFuture(rule,
!rule.includeFuture));
+ onChange?.(
+ RuleUtil.changeIncludeFuture(rule,
!RuleUtil.getIncludeFuture(rule)),
+ );
}}
/>
)}
diff --git a/web-console/src/druid-models/execution/execution.ts
b/web-console/src/druid-models/execution/execution.ts
index 1899f126072..3e8b3af6d6b 100644
--- a/web-console/src/druid-models/execution/execution.ts
+++ b/web-console/src/druid-models/execution/execution.ts
@@ -21,6 +21,7 @@ import { Column, QueryResult, SqlExpression, SqlQuery,
SqlWithQuery } from '@dru
import {
deepGet,
deleteKeys,
+ formatDuration,
formatInteger,
nonEmptyArray,
oneOf,
@@ -563,7 +564,7 @@ export class Execution {
break;
case 'SUCCESS':
- label = 'Segments loaded successfully in ' + segmentStatus.duration +
'ms.';
+ label = `Segments loaded successfully in
${formatDuration(segmentStatus.duration)}`;
break;
default:
diff --git a/web-console/src/utils/load-rule.ts
b/web-console/src/utils/load-rule.ts
index 29e62084849..a32422bbb6a 100644
--- a/web-console/src/utils/load-rule.ts
+++ b/web-console/src/utils/load-rule.ts
@@ -57,8 +57,9 @@ export class RuleUtil {
static ruleToString(rule: Rule): string {
const params: string[] = [];
- if (RuleUtil.hasPeriod(rule))
- params.push(`${rule.period}${rule.includeFuture ? '+future' : ''}`);
+ if (RuleUtil.hasPeriod(rule)) {
+ params.push(`${rule.period}${RuleUtil.getIncludeFuture(rule) ? '+future'
: ''}`);
+ }
if (RuleUtil.hasInterval(rule)) params.push(rule.interval || '?');
if (RuleUtil.canHaveTieredReplicants(rule))
params.push(`${RuleUtil.totalReplicas(rule)}x`);
@@ -69,20 +70,21 @@ export class RuleUtil {
const newRule = deepSet(rule, 'type', type);
if (RuleUtil.hasPeriod(newRule)) {
- if (!newRule.period) newRule.period = 'P1M';
+ newRule.period ??= 'P1M';
+ newRule.includeFuture ??= true;
} else {
delete newRule.period;
delete newRule.includeFuture;
}
if (RuleUtil.hasInterval(newRule)) {
- if (!newRule.interval) newRule.interval = '2010-01-01/2020-01-01';
+ newRule.interval ??= '2010-01-01/2020-01-01';
} else {
delete newRule.interval;
}
if (RuleUtil.canHaveTieredReplicants(newRule)) {
- if (!newRule.tieredReplicants) newRule.tieredReplicants = {
_default_tier: 2 };
+ newRule.tieredReplicants ??= { _default_tier: 2 };
} else {
delete newRule.tieredReplicants;
}
@@ -102,6 +104,10 @@ export class RuleUtil {
return RuleUtil.hasPeriod(rule) && rule.type !== 'dropBeforeByPeriod';
}
+ static getIncludeFuture(rule: Rule): boolean {
+ return rule.includeFuture ?? true;
+ }
+
static changeIncludeFuture(rule: Rule, includeFuture: boolean): Rule {
return deepSet(rule, 'includeFuture', includeFuture);
}
diff --git a/web-console/src/views/workbench-view/workbench-view.tsx
b/web-console/src/views/workbench-view/workbench-view.tsx
index 097dfd2e4af..9c859f9b462 100644
--- a/web-console/src/views/workbench-view/workbench-view.tsx
+++ b/web-console/src/views/workbench-view/workbench-view.tsx
@@ -496,7 +496,7 @@ export class WorkbenchView extends
React.PureComponent<WorkbenchViewProps, Workb
const newTabEntry: TabEntry = {
id,
tabName: tabEntry.tabName + ' (copy)',
- query: tabEntry.query,
+ query:
tabEntry.query.changeLastExecution(undefined),
};
this.handleQueriesChange(
tabEntries.slice(0, i + 1).concat(newTabEntry,
tabEntries.slice(i + 1)),
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]