After click save button in cluster logging, UI keep loading

https://github.com/rancher/rancher/issues/17023
This commit is contained in:
n313893254 2018-12-13 15:08:59 +08:00
parent b553b47cc5
commit cf73d744ea
11 changed files with 25 additions and 4 deletions

View File

@ -59,6 +59,7 @@
@import "app/styles/components/searchable-select"; @import "app/styles/components/searchable-select";
@import "app/styles/components/nav-boxes"; @import "app/styles/components/nav-boxes";
@import "app/styles/components/pipeline"; @import "app/styles/components/pipeline";
@import "app/styles/components/logging";
// Vendor // Vendor
// Pretty much what it says. Vendor specific changes/overrides or includes. // Pretty much what it says. Vendor specific changes/overrides or includes.

View File

@ -0,0 +1,3 @@
.logging-format {
font-size: 85%;
}

View File

@ -0,0 +1,4 @@
import layout from './template';
import CodeBlock from 'shared/components/code-block/component';
export default CodeBlock.extend({ layout, });

View File

@ -0,0 +1 @@
{{{highlighted}}}

View File

@ -33,6 +33,6 @@
</div> </div>
<div class="col span-7 logging-format"> <div class="col span-7 logging-format">
{{code-block code=logPreview}} {{logging/code-block code=logPreview language="json"}}
</div> </div>
</main> </main>

View File

@ -27,6 +27,7 @@ export default Component.extend(NewOrEdit, {
let targetType = get(this, 'targetType'); let targetType = get(this, 'targetType');
const pageScope = this.get('pageScope'); const pageScope = this.get('pageScope');
const model = get(this, 'model'); const model = get(this, 'model');
const intl = get(this, 'intl')
// set projectId or clusterId // set projectId or clusterId
if (pageScope === 'project') { if (pageScope === 'project') {
@ -84,6 +85,15 @@ export default Component.extend(NewOrEdit, {
} }
} }
if (targetType === 'splunk') {
if (!get(model, 'splunk.config.token')) {
set(this, 'errors', [intl.t('loggingPage.splunk.tokenRequired')]);
cb();
return;
}
}
// set kafka config // set kafka config
if (targetType === 'kafka') { if (targetType === 'kafka') {
let kt; let kt;

View File

@ -108,7 +108,7 @@ export default Component.extend({
logPreview: computed('fieldsStr', function() { logPreview: computed('fieldsStr', function() {
const fieldsStr = get(this, 'fieldsStr'); const fieldsStr = get(this, 'fieldsStr');
const template = `{ const template = `{
"log": "time=\"${ new Date().toString() }\" level=info msg=\"Cluster [local] condition status unknown\"\n", "log": "time=\"${ new Date().toString() }\" level=info msg=\"Cluster [local] condition status unknown\"",
"stream": "stderr", "stream": "stderr",
"tag": "default.var.log.containers.cattle-6b4ccb5b9d-v57vw_default_cattle-xxx.log" "tag": "default.var.log.containers.cattle-6b4ccb5b9d-v57vw_default_cattle-xxx.log"
"docker": { "docker": {

View File

@ -35,7 +35,7 @@ export default Component.extend({
logPreview: function() { logPreview: function() {
const fieldsStr = get(this, 'fieldsStr'); const fieldsStr = get(this, 'fieldsStr');
const template = `{ const template = `{
"log": "time=\"${ new Date().toString() }\" level=info msg=\"Cluster [local] condition status unknown\"\n", "log": "time=\"${ new Date().toString() }\" level=info msg=\"Cluster [local] condition status unknown\"",
"stream": "stderr", "stream": "stderr",
"tag": "default.var.log.containers.cattle-6b4ccb5b9d-v57vw_default_cattle-xxx.log" "tag": "default.var.log.containers.cattle-6b4ccb5b9d-v57vw_default_cattle-xxx.log"
"docker": { "docker": {

View File

@ -67,7 +67,7 @@ export default Component.extend({
{ {
type: 'fluentForwarder', type: 'fluentForwarder',
label: 'loggingPage.targetTypes.fluentd', label: 'loggingPage.targetTypes.fluentd',
css: `fluentd${ this.currentCss('fluentd') }`, css: `fluentd${ this.currentCss('fluentd output forward') }`,
available: true, available: true,
disabled: false, disabled: false,
}, },

View File

@ -79,6 +79,7 @@ loggingPage:
token: Token token: Token
tokenPlaceholder: Your Token tokenPlaceholder: Your Token
tokenHelpText: 'Tokens are entities that let logging agents and HTTP clients connect to the HEC input. <a href="http://docs.splunk.com/Documentation/Splunk/7.0.0/Data/UsetheHTTPEventCollector#Configure_HTTP_Event_Collector_on_Splunk_Enterprise" target="_blank">Detail</a>' tokenHelpText: 'Tokens are entities that let logging agents and HTTP clients connect to the HEC input. <a href="http://docs.splunk.com/Documentation/Splunk/7.0.0/Data/UsetheHTTPEventCollector#Configure_HTTP_Event_Collector_on_Splunk_Enterprise" target="_blank">Detail</a>'
tokenRequired: Token is Required
source: Source source: Source
sourcePlaceholder: e.g. fluentd sourcePlaceholder: e.g. fluentd
sourceHelpText: 'A default field that identifies the source of an event, that is, where the event originated. <a href="https://docs.splunk.com/Splexicon:Source" target="_blank">Detail</a>' sourceHelpText: 'A default field that identifies the source of an event, that is, where the event originated. <a href="https://docs.splunk.com/Splexicon:Source" target="_blank">Detail</a>'

View File

@ -79,6 +79,7 @@ loggingPage:
token: Token token: Token
tokenPlaceholder: Your Token tokenPlaceholder: Your Token
tokenHelpText: 'Token是允许日志收集程序和HTTP客户端连接到HEC的验证信息<a href="http://docs.splunk.com/Documentation/Splunk/7.0.0/Data/UsetheHTTPEventCollector#Configure_HTTP_Event_Collector_on_Splunk_Enterprise" target="_blank">了解详情</a>。' tokenHelpText: 'Token是允许日志收集程序和HTTP客户端连接到HEC的验证信息<a href="http://docs.splunk.com/Documentation/Splunk/7.0.0/Data/UsetheHTTPEventCollector#Configure_HTTP_Event_Collector_on_Splunk_Enterprise" target="_blank">了解详情</a>。'
tokenRequired: Token必须填写
source: 日志源 source: 日志源
sourcePlaceholder: '例如: fluentd' sourcePlaceholder: '例如: fluentd'
sourceHelpText: '标识事件来源的默认字段,即事件发生的位置,<a href="https://docs.splunk.com/Splexicon:Source" target="_blank">了解详情</a>。' sourceHelpText: '标识事件来源的默认字段,即事件发生的位置,<a href="https://docs.splunk.com/Splexicon:Source" target="_blank">了解详情</a>。'