mirror of https://github.com/apache/druid.git
allow empty values to be set in the auto form (#9198)
This commit is contained in:
parent
68ed2a2c8f
commit
ab2672514b
|
@ -45,6 +45,7 @@ export interface Field<M> {
|
||||||
| 'json'
|
| 'json'
|
||||||
| 'interval';
|
| 'interval';
|
||||||
defaultValue?: any;
|
defaultValue?: any;
|
||||||
|
emptyValue?: any;
|
||||||
suggestions?: Functor<M, Suggestion[]>;
|
suggestions?: Functor<M, Suggestion[]>;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
min?: number;
|
min?: number;
|
||||||
|
@ -99,10 +100,16 @@ export class AutoForm<T extends Record<string, any>> extends React.PureComponent
|
||||||
const { model } = this.props;
|
const { model } = this.props;
|
||||||
if (!model) return;
|
if (!model) return;
|
||||||
|
|
||||||
const newModel =
|
let newModel: T;
|
||||||
typeof newValue === 'undefined'
|
if (typeof newValue === 'undefined') {
|
||||||
? deepDelete(model, field.name)
|
if (typeof field.emptyValue === 'undefined') {
|
||||||
: deepSet(model, field.name, newValue);
|
newModel = deepDelete(model, field.name);
|
||||||
|
} else {
|
||||||
|
newModel = deepSet(model, field.name, field.emptyValue);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newModel = deepSet(model, field.name, newValue);
|
||||||
|
}
|
||||||
|
|
||||||
this.modelChange(newModel);
|
this.modelChange(newModel);
|
||||||
};
|
};
|
||||||
|
|
|
@ -180,6 +180,7 @@ export class CoordinatorDynamicConfigDialog extends React.PureComponent<
|
||||||
{
|
{
|
||||||
name: 'killDataSourceWhitelist',
|
name: 'killDataSourceWhitelist',
|
||||||
type: 'string-array',
|
type: 'string-array',
|
||||||
|
emptyValue: [],
|
||||||
info: (
|
info: (
|
||||||
<>
|
<>
|
||||||
List of dataSources for which kill tasks are sent if property{' '}
|
List of dataSources for which kill tasks are sent if property{' '}
|
||||||
|
@ -191,6 +192,7 @@ export class CoordinatorDynamicConfigDialog extends React.PureComponent<
|
||||||
{
|
{
|
||||||
name: 'killPendingSegmentsSkipList',
|
name: 'killPendingSegmentsSkipList',
|
||||||
type: 'string-array',
|
type: 'string-array',
|
||||||
|
emptyValue: [],
|
||||||
info: (
|
info: (
|
||||||
<>
|
<>
|
||||||
List of dataSources for which pendingSegments are NOT cleaned up if property{' '}
|
List of dataSources for which pendingSegments are NOT cleaned up if property{' '}
|
||||||
|
@ -259,6 +261,7 @@ export class CoordinatorDynamicConfigDialog extends React.PureComponent<
|
||||||
{
|
{
|
||||||
name: 'decommissioningNodes',
|
name: 'decommissioningNodes',
|
||||||
type: 'string-array',
|
type: 'string-array',
|
||||||
|
emptyValue: [],
|
||||||
info: (
|
info: (
|
||||||
<>
|
<>
|
||||||
List of historical services to 'decommission'. Coordinator will not assign new
|
List of historical services to 'decommission'. Coordinator will not assign new
|
||||||
|
|
Loading…
Reference in New Issue