You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by cw...@apache.org on 2020/01/17 05:06:59 UTC
[druid] branch master updated: allow empty values to be set in the
auto form (#9198)
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/druid.git
The following commit(s) were added to refs/heads/master by this push:
new ab26725 allow empty values to be set in the auto form (#9198)
ab26725 is described below
commit ab2672514b306243b8b72d64e7419fd8e8a18fe4
Author: Vadim Ogievetsky <va...@ogievetsky.com>
AuthorDate: Thu Jan 16 21:06:51 2020 -0800
allow empty values to be set in the auto form (#9198)
---
web-console/src/components/auto-form/auto-form.tsx | 15 +++++++++++----
.../coordinator-dynamic-config-dialog.tsx | 3 +++
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/web-console/src/components/auto-form/auto-form.tsx b/web-console/src/components/auto-form/auto-form.tsx
index 110bf49..66dffde 100644
--- a/web-console/src/components/auto-form/auto-form.tsx
+++ b/web-console/src/components/auto-form/auto-form.tsx
@@ -45,6 +45,7 @@ export interface Field<M> {
| 'json'
| 'interval';
defaultValue?: any;
+ emptyValue?: any;
suggestions?: Functor<M, Suggestion[]>;
placeholder?: string;
min?: number;
@@ -99,10 +100,16 @@ export class AutoForm<T extends Record<string, any>> extends React.PureComponent
const { model } = this.props;
if (!model) return;
- const newModel =
- typeof newValue === 'undefined'
- ? deepDelete(model, field.name)
- : deepSet(model, field.name, newValue);
+ let newModel: T;
+ if (typeof newValue === 'undefined') {
+ if (typeof field.emptyValue === 'undefined') {
+ newModel = deepDelete(model, field.name);
+ } else {
+ newModel = deepSet(model, field.name, field.emptyValue);
+ }
+ } else {
+ newModel = deepSet(model, field.name, newValue);
+ }
this.modelChange(newModel);
};
diff --git a/web-console/src/dialogs/coordinator-dynamic-config-dialog/coordinator-dynamic-config-dialog.tsx b/web-console/src/dialogs/coordinator-dynamic-config-dialog/coordinator-dynamic-config-dialog.tsx
index 8d82c0c..044e7ea 100644
--- a/web-console/src/dialogs/coordinator-dynamic-config-dialog/coordinator-dynamic-config-dialog.tsx
+++ b/web-console/src/dialogs/coordinator-dynamic-config-dialog/coordinator-dynamic-config-dialog.tsx
@@ -180,6 +180,7 @@ export class CoordinatorDynamicConfigDialog extends React.PureComponent<
{
name: 'killDataSourceWhitelist',
type: 'string-array',
+ emptyValue: [],
info: (
<>
List of dataSources for which kill tasks are sent if property{' '}
@@ -191,6 +192,7 @@ export class CoordinatorDynamicConfigDialog extends React.PureComponent<
{
name: 'killPendingSegmentsSkipList',
type: 'string-array',
+ emptyValue: [],
info: (
<>
List of dataSources for which pendingSegments are NOT cleaned up if property{' '}
@@ -259,6 +261,7 @@ export class CoordinatorDynamicConfigDialog extends React.PureComponent<
{
name: 'decommissioningNodes',
type: 'string-array',
+ emptyValue: [],
info: (
<>
List of historical services to 'decommission'. Coordinator will not assign new
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org