You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by fj...@apache.org on 2019/06/07 15:31:32 UTC

[incubator-druid] branch master updated: less aggressive default value (#7844)

This is an automated email from the ASF dual-hosted git repository.

fjy 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 0ca867e  less aggressive default value (#7844)
0ca867e is described below

commit 0ca867efbffe4903d0444950eadd5224e8858b0f
Author: Vadim Ogievetsky <va...@gmail.com>
AuthorDate: Fri Jun 7 08:31:21 2019 -0700

    less aggressive default value (#7844)
---
 web-console/src/components/auto-form/auto-form.tsx | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/web-console/src/components/auto-form/auto-form.tsx b/web-console/src/components/auto-form/auto-form.tsx
index 6a54af7..d79e4be 100644
--- a/web-console/src/components/auto-form/auto-form.tsx
+++ b/web-console/src/components/auto-form/auto-form.tsx
@@ -173,11 +173,16 @@ export class AutoForm<T extends Record<string, any>> extends React.Component<Aut
       </Menu> :
       undefined;
 
+    const modalValue = deepGet(model as any, field.name);
     return <InputGroup
-      value={deepGet(model as any, field.name) || field.defaultValue || ''}
+      value={modalValue != null ? modalValue : (field.defaultValue || '')}
       onChange={(e: any) => {
-        const v = e.target.value;
-        this.fieldChange(field, v === '' ? undefined : (sanitize ? sanitize(v) : v));
+        let v = e.target.value;
+        if (sanitize) v = sanitize(v);
+        this.fieldChange(field, v);
+      }}
+      onBlur={() => {
+        if (modalValue === '') this.fieldChange(field, undefined);
       }}
       placeholder={field.placeholder}
       rightElement={


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org