From 004a9286ee50c74dd973cc03b4e97cad82dd060a Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Mon, 16 Dec 2019 11:22:26 -0700 Subject: [PATCH] Pass logging config down to logging targets for json parsing rancher/rancher#24367 --- .../logging/form-log-format/template.hbs | 2 +- .../logging/target-elasticsearch/template.hbs | 90 ++++++------- .../logging/target-flentd/template.hbs | 1 + .../logging/target-kafka/template.hbs | 119 +++++++++--------- .../logging/target-splunk/template.hbs | 53 ++++---- .../logging/target-syslog/template.hbs | 92 +++++++------- 6 files changed, 184 insertions(+), 173 deletions(-) diff --git a/lib/logging/addon/components/logging/form-log-format/template.hbs b/lib/logging/addon/components/logging/form-log-format/template.hbs index 049f0a675..79d3f997b 100644 --- a/lib/logging/addon/components/logging/form-log-format/template.hbs +++ b/lib/logging/addon/components/logging/form-log-format/template.hbs @@ -61,7 +61,7 @@ @type="checkbox" class="form-control" id="enable-json-parsing" - @checked={{model.enableJSONParsing}} + @checked={{loggingModel.enableJSONParsing}} /> {{t "loggingPage.additional.jsonParsing.label"}} diff --git a/lib/logging/addon/components/logging/target-elasticsearch/template.hbs b/lib/logging/addon/components/logging/target-elasticsearch/template.hbs index 2bc66f265..9cbeae504 100644 --- a/lib/logging/addon/components/logging/target-elasticsearch/template.hbs +++ b/lib/logging/addon/components/logging/target-elasticsearch/template.hbs @@ -1,66 +1,66 @@ -

{{t 'loggingPage.elasticsearch.header'}}

+

{{t "loggingPage.elasticsearch.header"}}


- + {{input - type="text" - value=config.endpoint - classNames="form-control" - placeholder=(t 'loggingPage.endpointPlaceholder') - id="elasticsearch-endpoint" - focus-out=(action "alertMessage") + type="text" + value=config.endpoint + classNames="form-control" + placeholder=(t "loggingPage.endpointPlaceholder") + id="elasticsearch-endpoint" + focus-out=(action "alertMessage") }}
{{#if endpointError}}

{{t endpointErrorText}}

{{else}} -

{{t 'loggingPage.elasticsearch.endpointHelpText'}}

+

{{t "loggingPage.elasticsearch.endpointHelpText"}}

{{/if}}
-

{{t 'loggingPage.elasticsearch.xpack.header'}} {{t 'loggingPage.elasticsearch.xpack.headerOptional'}}

+

{{t "loggingPage.elasticsearch.xpack.header"}} {{t "loggingPage.elasticsearch.xpack.headerOptional"}}

-

{{t 'loggingPage.elasticsearch.xpack.helpText'}}

+

{{t "loggingPage.elasticsearch.xpack.helpText"}}

- + {{input - type="text" - utocomplete="off" - value=config.authUsername - classNames="form-control" - placeholder=(t 'loggingPage.elasticsearch.xpack.usernamePlaceholder') + type="text" + utocomplete="off" + value=config.authUsername + classNames="form-control" + placeholder=(t "loggingPage.elasticsearch.xpack.usernamePlaceholder") }}
- + {{input - utocomplete="off" - type="password" - value=config.authPassword - classNames="form-control" - placeholder=(t 'loggingPage.elasticsearch.xpack.passwordPlaceholder') + utocomplete="off" + type="password" + value=config.authPassword + classNames="form-control" + placeholder=(t "loggingPage.elasticsearch.xpack.passwordPlaceholder") }}
-

{{t 'loggingPage.elasticsearch.indexPatterns.header'}}

-

{{t 'loggingPage.elasticsearch.indexPatterns.helpText'}}

+

{{t "loggingPage.elasticsearch.indexPatterns.header"}}

+

{{t "loggingPage.elasticsearch.indexPatterns.helpText"}}

- + {{input - type="text" - value=config.indexPrefix - className="form-control" - placeholder=(t 'loggingPage.elasticsearch.indexPatterns.prefixPlaceholder') - }} + type="text" + value=config.indexPrefix + className="form-control" + placeholder=(t "loggingPage.elasticsearch.indexPatterns.prefixPlaceholder") + }}
- + @@ -68,10 +68,10 @@
- {{t 'loggingPage.elasticsearch.generatedIndex' - esIndex=esIndex - indexFormat=indexFormat - htmlSafe=true + {{t "loggingPage.elasticsearch.generatedIndex" + esIndex=esIndex + indexFormat=indexFormat + htmlSafe=true }}
@@ -79,13 +79,17 @@ {{logging/form-log-ssl - config=config - targetType=targetType - disabled=(not enableSSLConfig) + config=config + targetType=targetType + disabled=(not enableSSLConfig) }} -{{logging/form-log-format logPreview=logPreview model=model}} +{{logging/form-log-format + logPreview=logPreview + model=model + loggingModel=parentModel +}} {{!-- - {{#advanced-section advanced=showAdvanced}} - {{logging/form-log-docker model=model parentModel=parentModel}} - {{/advanced-section}} --}} +{{#advanced-section advanced=showAdvanced}} +{{logging/form-log-docker model=model parentModel=parentModel}} +{{/advanced-section}} --}} diff --git a/lib/logging/addon/components/logging/target-flentd/template.hbs b/lib/logging/addon/components/logging/target-flentd/template.hbs index 5b275fe81..d1d28032a 100644 --- a/lib/logging/addon/components/logging/target-flentd/template.hbs +++ b/lib/logging/addon/components/logging/target-flentd/template.hbs @@ -148,4 +148,5 @@ {{logging/form-log-format logPreview=logPreview model=model + loggingModel=parentModel }} diff --git a/lib/logging/addon/components/logging/target-kafka/template.hbs b/lib/logging/addon/components/logging/target-kafka/template.hbs index b9044a56c..124c17c99 100644 --- a/lib/logging/addon/components/logging/target-kafka/template.hbs +++ b/lib/logging/addon/components/logging/target-kafka/template.hbs @@ -34,63 +34,63 @@

- {{#if (eq brokerType "zookeeper")}} -
- - {{input - type="text" - value=config.zookeeperEndpoint - classNames="form-control" - placeholder=(t "loggingPage.kafka.endpoint.zookeeper.placeholder") - id="kafka-endpoint" - }} -
-

- {{t "loggingPage.kafka.zookeeperHelpText"}} -

- {{else}} - {{#each brokerEndpoints as |item idx|}} -
-
- - {{input - type="text" - value=item.endpoint - classNames="form-control" - placeholder=(t "loggingPage.kafka.endpoint.broker.placeholder") - }} -
-
- -
+ {{#if (eq brokerType "zookeeper")}} +
+ + {{input + type="text" + value=config.zookeeperEndpoint + classNames="form-control" + placeholder=(t "loggingPage.kafka.endpoint.zookeeper.placeholder") + id="kafka-endpoint" + }}
- {{/each}} -

- {{t "loggingPage.kafka.brokerHelpText"}} -

-
- -
- {{/if}} +

+ {{t "loggingPage.kafka.zookeeperHelpText"}} +

+ {{else}} + {{#each brokerEndpoints as |item idx|}} +
+
+ + {{input + type="text" + value=item.endpoint + classNames="form-control" + placeholder=(t "loggingPage.kafka.endpoint.broker.placeholder") + }} +
+
+ +
+
+ {{/each}} +

+ {{t "loggingPage.kafka.brokerHelpText"}} +

+
+ +
+ {{/if}}

@@ -126,8 +126,9 @@ {{logging/form-log-format logPreview=logPreview model=model + loggingModel=parentModel }} {{!-- - {{#advanced-section advanced=showAdvanced}} - {{logging/form-log-docker model=model parentModel=parentModel}} - {{/advanced-section}} --}} +{{#advanced-section advanced=showAdvanced}} +{{logging/form-log-docker model=model parentModel=parentModel}} +{{/advanced-section}} --}} diff --git a/lib/logging/addon/components/logging/target-splunk/template.hbs b/lib/logging/addon/components/logging/target-splunk/template.hbs index d4de9c3a9..d9ef004a0 100644 --- a/lib/logging/addon/components/logging/target-splunk/template.hbs +++ b/lib/logging/addon/components/logging/target-splunk/template.hbs @@ -1,7 +1,7 @@

{{t "loggingPage.splunk.header"}} - {{t "loggingPage.splunk.helpText" htmlSafe=true}} + {{t "loggingPage.splunk.helpText" htmlSafe=true}}


@@ -9,11 +9,11 @@
{{input - type="text" - value=config.endpoint - classNames="form-control" - placeholder=(t "loggingPage.splunk.endpoint.placeholder") - id="splunk-endpoint" + type="text" + value=config.endpoint + classNames="form-control" + placeholder=(t "loggingPage.splunk.endpoint.placeholder") + id="splunk-endpoint" }}
@@ -21,10 +21,10 @@
{{input - type="text" - value=config.token - classNames="form-control" - placeholder=(t "loggingPage.splunk.tokenPlaceholder") + type="text" + value=config.token + classNames="form-control" + placeholder=(t "loggingPage.splunk.tokenPlaceholder") }}

{{t "loggingPage.splunk.tokenHelpText" htmlSafe=true}} @@ -35,10 +35,10 @@

{{input - type="text" - value=config.source - classNames="form-control" - placeholder=(t "loggingPage.splunk.sourcePlaceholder") + type="text" + value=config.source + classNames="form-control" + placeholder=(t "loggingPage.splunk.sourcePlaceholder") }}

{{t "loggingPage.splunk.sourceHelpText" htmlSafe=true}} @@ -47,10 +47,10 @@

{{input - type="text" - value=config.index - classNames="form-control" - placeholder=(t "loggingPage.splunk.indexPlaceholder") + type="text" + value=config.index + classNames="form-control" + placeholder=(t "loggingPage.splunk.indexPlaceholder") }}

{{t "loggingPage.splunk.indexHelpText" htmlSafe=true}} @@ -60,16 +60,17 @@ {{logging/form-log-ssl - config=config - targetType=targetType - disabled=(not enableSSLConfig) + config=config + targetType=targetType + disabled=(not enableSSLConfig) }} {{logging/form-log-format - logPreview=logPreview - model=model + logPreview=logPreview + model=model + loggingModel=parentModel }} {{!-- - {{#advanced-section advanced=showAdvanced}} - {{logging/form-log-docker model=model parentModel=parentModel}} - {{/advanced-section}} --}} +{{#advanced-section advanced=showAdvanced}} +{{logging/form-log-docker model=model parentModel=parentModel}} +{{/advanced-section}} --}} diff --git a/lib/logging/addon/components/logging/target-syslog/template.hbs b/lib/logging/addon/components/logging/target-syslog/template.hbs index 447f154d7..37f6b5c21 100644 --- a/lib/logging/addon/components/logging/target-syslog/template.hbs +++ b/lib/logging/addon/components/logging/target-syslog/template.hbs @@ -1,57 +1,57 @@ -

{{t 'loggingPage.syslog.header'}}

+

{{t "loggingPage.syslog.header"}}


- -
- {{input - type="text" - value=config.endpoint - classNames="form-control" - placeholder=(t 'loggingPage.syslog.endpointPlaceholder') - id="syslog-endpoint" - }} -
- {{#basic-dropdown - horizontalPosition="right" - as |dd|}} - {{#dd.trigger class="btn bg-default text-uppercase"}} - {{config.protocol}} - {{/dd.trigger}} + +
+ {{input + type="text" + value=config.endpoint + classNames="form-control" + placeholder=(t "loggingPage.syslog.endpointPlaceholder") + id="syslog-endpoint" + }} +
+ {{#basic-dropdown + horizontalPosition="right" + as |dd|}} + {{#dd.trigger class="btn bg-default text-uppercase"}} + {{config.protocol}} + {{/dd.trigger}} - {{#dd.content}} -
  • TCP
  • -
  • UDP
  • - {{/dd.content}} + {{#dd.content}} +
  • TCP
  • +
  • UDP
  • + {{/dd.content}} - {{/basic-dropdown}} -
    + {{/basic-dropdown}}
    -

    {{t 'loggingPage.syslog.endpointHelpText'}}

    +
    +

    {{t "loggingPage.syslog.endpointHelpText"}}

    - + {{input - type="text" - value=config.program - classNames="form-control" - placeholder=(t 'loggingPage.syslog.programPlaceholder') + type="text" + value=config.program + classNames="form-control" + placeholder=(t "loggingPage.syslog.programPlaceholder") }} -

    {{t 'loggingPage.syslog.programHelpText'}}

    +

    {{t "loggingPage.syslog.programHelpText"}}

    - + {{input - type="text" - value=config.token - classNames="form-control" - placeholder=(t 'loggingPage.splunk.tokenPlaceholder') + type="text" + value=config.token + classNames="form-control" + placeholder=(t "loggingPage.splunk.tokenPlaceholder") }}

    - {{t 'loggingPage.syslog.tokenHelpText' htmlSafe=true}} + {{t "loggingPage.syslog.tokenHelpText" htmlSafe=true}}

    @@ -64,18 +64,22 @@ {{t item.label}} {{/each}} - {{t 'loggingPage.syslog.severityHelpText' htmlSafe=true}} + {{t "loggingPage.syslog.severityHelpText" htmlSafe=true}}
    {{logging/form-log-ssl - config=config - targetType=targetType - disabled=(or (not enableSSLConfig) (not config.enableTls)) + config=config + targetType=targetType + disabled=(or (not enableSSLConfig) (not config.enableTls)) }} -{{logging/form-log-format logPreview=logPreview model=model}} +{{logging/form-log-format + logPreview=logPreview + model=model + loggingModel=parentModel +}} {{!-- - {{#advanced-section advanced=showAdvanced}} - {{logging/form-log-docker model=model parentModel=parentModel}} - {{/advanced-section}} --}} +{{#advanced-section advanced=showAdvanced}} +{{logging/form-log-docker model=model parentModel=parentModel}} +{{/advanced-section}} --}}