From 419cdb64dc41c6ae27a9d3ae36ea031d4e1de14f Mon Sep 17 00:00:00 2001 From: n313893254 Date: Thu, 28 Feb 2019 09:52:49 +0800 Subject: [PATCH] Delete 'client_cert_key' when caChange https://github.com/rancher/rancher/issues/18394 --- .../logging/input-logging-config/component.js | 31 ++----------------- .../logging/input-logging-config/template.hbs | 6 ++-- 2 files changed, 5 insertions(+), 32 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 64e699455..f7b52d615 100644 --- a/lib/logging/addon/components/logging/input-logging-config/component.js +++ b/lib/logging/addon/components/logging/input-logging-config/component.js @@ -5,9 +5,6 @@ import layout from './template'; import { next } from '@ember/runloop'; import { get, set, observer, computed } from '@ember/object'; import ThrottledResize from 'shared/mixins/throttled-resize'; -import { downloadFile } from 'shared/utils/download-files'; -import CodeMirror from 'codemirror'; -import jsyaml from 'js-yaml'; import { alias } from '@ember/object/computed' import C from 'ui/utils/constants'; @@ -40,14 +37,11 @@ export default Component.extend(ThrottledResize, { showDownload: true, deepStr: null, - shouldChangeName: true, - config: alias('model.config'), init() { this._super(...arguments); - - window.jsyaml || (window.jsyaml = jsyaml); + this.customTypeObserver() }, actions: { @@ -55,27 +49,6 @@ export default Component.extend(ThrottledResize, { this.$('INPUT[type=file]')[0].click(); }, - wantsChange() { - set(this, 'shouldChangeName', true); - }, - - download() { - let yaml = get(this, 'value'); - const lintError = []; - - jsyaml.safeLoadAll(yaml, (y) => { - lintError.pushObjects(CodeMirror.lint.yaml(y)); - }); - - if ( lintError.length ) { - set(this, 'errors', [get(this, 'intl').t('yamlPage.errors')]); - - return; - } - - downloadFile(get(this, 'filename'), yaml); - }, - updateValue(value) { next(() => { set(this, 'value', value) @@ -102,7 +75,7 @@ export default Component.extend(ThrottledResize, { }) }), - caChange: observer('config.clientKey', 'config.clientCert', 'config.certificate', function() { + caChange: observer('clientKeyPath', 'clientCertPath', 'certificatePath', function() { let { fileObj, deepStrs = [] } = this.parseValue(get(this, 'value')); const deletedField = [ diff --git a/lib/logging/addon/components/logging/input-logging-config/template.hbs b/lib/logging/addon/components/logging/input-logging-config/template.hbs index 678779e24..5df743e19 100644 --- a/lib/logging/addon/components/logging/input-logging-config/template.hbs +++ b/lib/logging/addon/components/logging/input-logging-config/template.hbs @@ -3,14 +3,14 @@ {{ivy-codemirror placeholder=placeholder value=value - valueUpdated=(action 'updateValue') + valueUpdated=(action "updateValue") options=(hash autofocus=true theme="monokai" tabSize=2 lineNumbers=true mode="yaml" - readOnly=(if (or (eq modalOpts.type 'review') readOnly) true false) + readOnly=(if (or (eq modalOpts.type "review") readOnly) true false) gutters=gutters lint=false lineWrapping=true @@ -20,7 +20,7 @@ }} -{{yield 'description'}} +{{yield "description"}} {{logging/form-log-ssl