diff --git a/shell/edit/configmap.vue b/shell/edit/configmap.vue index fd5d3babfd..b292402954 100644 --- a/shell/edit/configmap.vue +++ b/shell/edit/configmap.vue @@ -40,7 +40,8 @@ export default { return { data: Object.keys(this.data).reduce((acc, key) => ({ ...acc, - [key]: { chomping: '+' }, + lineWidth: -1, + [key]: { chomping: '+' }, }), {}), }; }, diff --git a/shell/utils/create-yaml.js b/shell/utils/create-yaml.js index bdc813c551..78125ee020 100644 --- a/shell/utils/create-yaml.js +++ b/shell/utils/create-yaml.js @@ -443,20 +443,21 @@ export function saferDump(obj) { * * this is required since jsyaml.dump doesn't support chomping and scalar style at the moment. * see: https://github.com/nodeca/js-yaml/issues/171 + + * @typedef {Object} DumpBlockOptions + * @property {('>' | '|')} [scalarStyle] - The scalar style. + * @property {('-' | '+' | '' | null)} [chomping] - The chomping style. * * @param {*} data the multiline block - * @param {*} options blocks indicators, see: https://yaml-multiline.info + * @param {Object} options - Serialization options for jsyaml.dump. + * @param {number} options.lineWidth - Set max line width. Set -1 for unlimited width. + * @param {DumpBlockOptions} [options.dynamicProperties] - Options for dynamic properties. + * Developers can provide their own property names under `options`. * - * - scalarStyle: - * one of '|', '>' - * default '|' - * - chomping: - * one of: null, '', '-', '+' - * default: null * @returns the result of jsyaml.dump with the addition of multiline indicators */ export function dumpBlock(data, options = {}) { - const parsed = jsyaml.dump(data); + const parsed = jsyaml.dump(data, options); let out = parsed;