diff --git a/changelog/11708.txt b/changelog/11708.txt new file mode 100644 index 000000000..212119156 --- /dev/null +++ b/changelog/11708.txt @@ -0,0 +1,3 @@ +```release-note:improvement +ui: JSON fields on database can be cleared on edit +``` diff --git a/ui/app/models/database/connection.js b/ui/app/models/database/connection.js index aeda7b28d..e82dc5904 100644 --- a/ui/app/models/database/connection.js +++ b/ui/app/models/database/connection.js @@ -198,10 +198,10 @@ export default Model.extend({ port: attr('string', {}), write_concern: attr('string', { subText: 'Optional. Must be in JSON. See our documentation for help.', + allowReset: true, editType: 'json', theme: 'hashi short', defaultShown: 'Default', - // defaultValue: '# For example: { "wmode": "majority", "wtimeout": 5000 }', }), username_template: attr('string', { editType: 'optionalText', diff --git a/ui/app/models/database/role.js b/ui/app/models/database/role.js index 06416ba98..18f2b9572 100644 --- a/ui/app/models/database/role.js +++ b/ui/app/models/database/role.js @@ -69,11 +69,13 @@ export default Model.extend({ }), creation_statement: attr('string', { editType: 'json', + allowReset: true, theme: 'hashi short', defaultShown: 'Default', }), revocation_statement: attr('string', { editType: 'json', + allowReset: true, theme: 'hashi short', defaultShown: 'Default', }), diff --git a/ui/lib/core/addon/templates/components/form-field.hbs b/ui/lib/core/addon/templates/components/form-field.hbs index ac2118aa4..9910aaf0d 100644 --- a/ui/lib/core/addon/templates/components/form-field.hbs +++ b/ui/lib/core/addon/templates/components/form-field.hbs @@ -213,9 +213,6 @@ @spellcheck="false" /> {{else if (eq attr.options.editType "json")}} {{!-- JSON Editor --}} - {{#if attr.options.subText}} -

{{attr.options.subText}} {{#if attr.options.docLink}}See our documentation for help.{{/if}}

- {{/if}} + > + {{#if attr.options.allowReset}} + + {{/if}} + + {{#if attr.options.subText}} +

{{attr.options.subText}} {{#if attr.options.docLink}}See our documentation for help.{{/if}}

+ {{/if}} {{else}} {{!-- Regular Text Input --}}