From d7464d334f51007e5930c24ed48a11915afbb361 Mon Sep 17 00:00:00 2001 From: n313893254 Date: Fri, 1 Mar 2019 14:29:03 +0800 Subject: [PATCH] Fix logging adavance mode issue https://github.com/rancher/rancher/issues/18476 https://github.com/rancher/rancher/issues/18479 --- .../components/logging/input-logging-config/component.js | 4 ++-- lib/logging/addon/components/logging/new-edit/component.js | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/logging/addon/components/logging/input-logging-config/component.js b/lib/logging/addon/components/logging/input-logging-config/component.js index f7b52d615..d730b403a 100644 --- a/lib/logging/addon/components/logging/input-logging-config/component.js +++ b/lib/logging/addon/components/logging/input-logging-config/component.js @@ -121,7 +121,7 @@ export default Component.extend(ThrottledResize, { deepStrs.map((s) => { str += s }) - const out = `\n${ body }${ str }` + const out = `\n${ body } ${ str }\n` this.send('updateValue', out) }), @@ -290,7 +290,7 @@ ${ fieldsStr } parseValue(value = '') { let fileObj = {} - const removeMacth = value.replace(/.*(\r\n|\n|\r) {2}/ig, '').replace(/(\r\n|\n|\r).*<\/match.*>/ig, '') + const removeMacth = value.replace(/.*.*(\r\n|\n|\r) {2}/ig, '').replace(/(\r\n|\n|\r).*<\/match.*>/ig, '') const deepStrs = removeMacth.match(/<(.|\r\n|\n|\r)*<\/.*>/ig, '') || [] const removedDeep = removeMacth.replace(/<(.|\r\n|\n|\r)*<\/.*>/ig, '') diff --git a/lib/logging/addon/components/logging/new-edit/component.js b/lib/logging/addon/components/logging/new-edit/component.js index b80cd9a0b..cf5ebbdb2 100644 --- a/lib/logging/addon/components/logging/new-edit/component.js +++ b/lib/logging/addon/components/logging/new-edit/component.js @@ -194,8 +194,7 @@ export default Component.extend(NewOrEdit, { parseValue: computed('customContent', function() { let fileObj = {} - const removeMacth = get(this, 'customContent').replace(/.*(\r\n|\n|\r) {2}/ig, '').replace(/(\r\n|\n|\r).*<\/match.*>/ig, '') - + const removeMacth = get(this, 'customContent').replace(/.*.*(\r\n|\n|\r) {2}/ig, '').replace(/(\r\n|\n|\r).*<\/match.*>/ig, '') const deepStrs = removeMacth.match(/<(.|\r\n|\n|\r)*<\/.*>/ig, '') || [] const removedDeep = removeMacth.replace(/<(.|\r\n|\n|\r)*<\/.*>/ig, '') @@ -256,7 +255,7 @@ export default Component.extend(NewOrEdit, { clientKey: get(this, 'model.customTarget.config.clientKey'), clientCert: get(this, 'model.customTarget.config.clientCert'), certificate: get(this, 'model.customTarget.config.certificate'), - content: (get(this, 'customContent') || '').replace(/.*(\r\n|\n|\r) {2}/ig, '').replace(/(\r\n|\n|\r).*<\/match.*>/ig, ''), + content: (get(this, 'customContent') || '').replace(/.*.*(\r\n|\n|\r) {2}/ig, '').replace(/(\r\n|\n|\r).*<\/match.*>/ig, ''), } })