mirror of https://github.com/rancher/ui.git
commit
31a7a0dec1
|
|
@ -3,6 +3,7 @@ import { inject as service } from '@ember/service';
|
||||||
import { get, set } from '@ember/object';
|
import { get, set } from '@ember/object';
|
||||||
import { reads } from '@ember/object/computed';
|
import { reads } from '@ember/object/computed';
|
||||||
import NewOrEdit from 'ui/mixins/new-or-edit';
|
import NewOrEdit from 'ui/mixins/new-or-edit';
|
||||||
|
import parseUri from 'shared/utils/parse-uri';
|
||||||
|
|
||||||
export default Ember.Component.extend(NewOrEdit, {
|
export default Ember.Component.extend(NewOrEdit, {
|
||||||
scope: service(),
|
scope: service(),
|
||||||
|
|
@ -36,6 +37,19 @@ export default Ember.Component.extend(NewOrEdit, {
|
||||||
&& get(this, 'targetType') === 'none';
|
&& get(this, 'targetType') === 'none';
|
||||||
}.property('originalModel.{id,targetType}', 'targetType'),
|
}.property('originalModel.{id,targetType}', 'targetType'),
|
||||||
|
|
||||||
|
formatUrl: function(url) {
|
||||||
|
const urlParser = parseUri(url) || {}
|
||||||
|
if (!urlParser.port) {
|
||||||
|
if (urlParser.protocol === 'http') {
|
||||||
|
return `${urlParser.protocol}://${urlParser.host}:80`
|
||||||
|
}
|
||||||
|
if (urlParser.protocol === 'https') {
|
||||||
|
return `${urlParser.protocol}://${urlParser.host}:443`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return url
|
||||||
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
save(cb) {
|
save(cb) {
|
||||||
const targetType = get(this, 'targetType');
|
const targetType = get(this, 'targetType');
|
||||||
|
|
@ -91,7 +105,13 @@ export default Ember.Component.extend(NewOrEdit, {
|
||||||
}
|
}
|
||||||
set(model, 'outputFlushInterval', get(model, `${targetType}.outputFlushInterval`));
|
set(model, 'outputFlushInterval', get(model, `${targetType}.outputFlushInterval`));
|
||||||
set(model, 'outputTags', get(model, `${targetType}.outputTags`));
|
set(model, 'outputTags', get(model, `${targetType}.outputTags`));
|
||||||
set(model, `${targetType}Config`, get(model, `${targetType}.config`));
|
|
||||||
|
const formatConfig = get(model, `${targetType}.config`)
|
||||||
|
if (targetType === 'elasticsearch') {
|
||||||
|
Object.assign(formatConfig, {endpoint: this.formatUrl(formatConfig.endpoint)})
|
||||||
|
}
|
||||||
|
|
||||||
|
set(model, `${targetType}Config`, formatConfig);
|
||||||
this._super(cb);
|
this._super(cb);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,9 @@ export default Component.extend({
|
||||||
let repositories = get(this, 'modalOpts.routeState.repositories');
|
let repositories = get(this, 'modalOpts.routeState.repositories');
|
||||||
set(this, 'repositories', repositories);
|
set(this, 'repositories', repositories);
|
||||||
set(this, 'statusFetching',false);
|
set(this, 'statusFetching',false);
|
||||||
|
|
||||||
|
const initUrl = repositories.content && repositories.content[0] && repositories.content[0].url
|
||||||
|
set(this, 'selectedModel.sourceCodeConfig.url', initUrl)
|
||||||
this.urlObserve();
|
this.urlObserve();
|
||||||
},
|
},
|
||||||
urlObserve: function(){
|
urlObserve: function(){
|
||||||
|
|
|
||||||
|
|
@ -4253,7 +4253,7 @@ modalWelcome:
|
||||||
namespaceGroup:
|
namespaceGroup:
|
||||||
label: "Namespace: {name}"
|
label: "Namespace: {name}"
|
||||||
none: Pod
|
none: Pod
|
||||||
project: Not in a project
|
project: "Namespace: All"
|
||||||
|
|
||||||
nodeGroup:
|
nodeGroup:
|
||||||
label: "Node: {name}"
|
label: "Node: {name}"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue