mirror of https://github.com/rancher/ui.git
Notify users that Elasticsearch endpoint has to be an URL
https://github.com/rancher/rancher/issues/13943
This commit is contained in:
parent
6aee5eb3ea
commit
a81a7bc1d9
|
|
@ -107,12 +107,13 @@ export default Component.extend(NewOrEdit, {
|
|||
set(model, 'outputTags', get(model, `${targetType}.outputTags`));
|
||||
set(model, 'dockerRoot', get(model, `${targetType}.dockerRoot`));
|
||||
|
||||
const formatConfig = get(model, `${targetType}.config`).clone()
|
||||
if (targetType === 'elasticsearch') {
|
||||
Object.assign(formatConfig, {endpoint: this.formatUrl(formatConfig.endpoint)})
|
||||
}
|
||||
let formatConfig = get(model, `${targetType}.config`)
|
||||
|
||||
set(model, `${targetType}Config`, formatConfig);
|
||||
|
||||
if (targetType === 'elasticsearch') {
|
||||
set(model, `${targetType}Config`, {endpoint: this.formatUrl(formatConfig.endpoint)})
|
||||
}
|
||||
this._super(cb);
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2,12 +2,19 @@ import Component from '@ember/component';
|
|||
import es from 'logging/mixins/target-elasticsearch';
|
||||
import { get, computed, setProperties, set } from '@ember/object';
|
||||
import { alias } from '@ember/object/computed'
|
||||
import parseUri from 'shared/utils/parse-uri';
|
||||
|
||||
const endpointText = {
|
||||
hostError: 'loggingPage.elasticsearch.endpointHostError',
|
||||
protocolError: 'loggingPage.elasticsearch.endpointProtocolError',
|
||||
}
|
||||
|
||||
export default Component.extend(es, {
|
||||
showAdvanced: false,
|
||||
config: alias('model.config'),
|
||||
sslVerify: alias('model.config.sslVerify'),
|
||||
endpointError: false,
|
||||
endpointErrorText: null,
|
||||
|
||||
didInsertElement() {
|
||||
this.$('#elasticsearch-endpoint').focus()
|
||||
|
|
@ -39,10 +46,16 @@ export default Component.extend(es, {
|
|||
|
||||
actions: {
|
||||
alertMessage(value='') {
|
||||
const urlParser = parseUri(value) || {}
|
||||
set(this, 'endpointError', true)
|
||||
if (value.startsWith('https://') || value.startsWith('http://')) {
|
||||
set(this, 'endpointError', false)
|
||||
if (urlParser.host) {
|
||||
set(this, 'endpointError', false)
|
||||
} else {
|
||||
set(this, 'endpointErrorText', endpointText.hostError)
|
||||
}
|
||||
} else {
|
||||
set(this, 'endpointError', true)
|
||||
set(this, 'endpointErrorText', endpointText.protocolError)
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
}}
|
||||
</div>
|
||||
{{#if endpointError}}
|
||||
<p class="text-error text-small">{{t 'loggingPage.elasticsearch.endpointErrorText'}}</p>
|
||||
<p class="text-error text-small">{{t endpointErrorText}}</p>
|
||||
{{else}}
|
||||
<p class="text-info text-small">{{t 'loggingPage.elasticsearch.endpointHelpText'}}</p>
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,8 @@ loggingPage:
|
|||
elasticsearch:
|
||||
header: Elasticsearch Configuration
|
||||
endpointHelpText: Copy your endpoint from Elastic Cloud, or input the reachable endpoint of your self-hosted Elacticsearch.
|
||||
endpointErrorText: Endpoint should start with "http://" or "https://"
|
||||
endpointProtocolError: Endpoint should starts with "http://" or "https://".
|
||||
endpointHostError: Please enter host name or domain name.
|
||||
xpack:
|
||||
header: X-Pack Security
|
||||
headerOptional: (optional)
|
||||
|
|
|
|||
Loading…
Reference in New Issue