From 082f7b6c4fe1adc3ddf4c8cf35502356623dd5ef Mon Sep 17 00:00:00 2001 From: Jen Huang Date: Fri, 13 Jul 2018 12:32:28 -0700 Subject: [PATCH] Use EuiCodeBlock for JSON settings, and overflow if long value (#20744) (#20784) --- .../field/__snapshots__/field.test.js.snap | 98 ++++++++++++------- .../settings/components/field/field.js | 18 +++- 2 files changed, 79 insertions(+), 37 deletions(-) diff --git a/src/core_plugins/kibana/public/management/sections/settings/components/field/__snapshots__/field.test.js.snap b/src/core_plugins/kibana/public/management/sections/settings/components/field/__snapshots__/field.test.js.snap index ea478bac32a95..7f3a8dd7f8242 100644 --- a/src/core_plugins/kibana/public/management/sections/settings/components/field/__snapshots__/field.test.js.snap +++ b/src/core_plugins/kibana/public/management/sections/settings/components/field/__snapshots__/field.test.js.snap @@ -195,10 +195,12 @@ exports[`Field for array setting should render user value if there is user value grow={true} size="xs" > - Default: - - default_value - + + Default: + + default_value + + @@ -459,10 +461,12 @@ exports[`Field for boolean setting should render user value if there is user val grow={true} size="xs" > - Default: - - true - + + Default: + + true + + @@ -723,10 +727,12 @@ exports[`Field for image setting should render user value if there is user value grow={true} size="xs" > - Default: - - null - + + Default: + + null + + @@ -936,10 +942,16 @@ exports[`Field for json setting should render default value if there is no user grow={true} size="xs" > - Default: - - {} - + + Default: + + {} + + @@ -1058,10 +1070,16 @@ exports[`Field for json setting should render user value if there is user value grow={true} size="xs" > - Default: - - {} - + + Default: + + {} + + @@ -1371,10 +1389,12 @@ exports[`Field for markdown setting should render user value if there is user va grow={true} size="xs" > - Default: - - null - + + Default: + + null + + @@ -1654,10 +1674,12 @@ exports[`Field for number setting should render user value if there is user valu grow={true} size="xs" > - Default: - - 5 - + + Default: + + 5 + + @@ -1956,10 +1978,12 @@ exports[`Field for select setting should render user value if there is user valu grow={true} size="xs" > - Default: - - orange - + + Default: + + orange + + @@ -2241,10 +2265,12 @@ exports[`Field for string setting should render user value if there is user valu grow={true} size="xs" > - Default: - - null - + + Default: + + null + + diff --git a/src/core_plugins/kibana/public/management/sections/settings/components/field/field.js b/src/core_plugins/kibana/public/management/sections/settings/components/field/field.js index 7336a4fa0d509..44ed2ff9ef7ac 100644 --- a/src/core_plugins/kibana/public/management/sections/settings/components/field/field.js +++ b/src/core_plugins/kibana/public/management/sections/settings/components/field/field.js @@ -28,6 +28,7 @@ import { EuiButton, EuiButtonEmpty, EuiCode, + EuiCodeBlock, EuiCodeEditor, EuiDescribedFormGroup, EuiFieldNumber, @@ -475,7 +476,22 @@ export class Field extends PureComponent { - Default: {this.getDisplayedDefaultValue(type, defVal)} + { type === 'json' ? ( + + Default: + = 500 ? 300 : null} + > + {this.getDisplayedDefaultValue(type, defVal)} + + + ) : ( + + Default: {this.getDisplayedDefaultValue(type, defVal)} + + ) } );