mirror of https://github.com/rancher/ui.git
concurrency change
This commit is contained in:
parent
5f88b591b0
commit
426fbdf653
|
|
@ -4,6 +4,8 @@ import ShellQuote from 'npm:shell-quote';
|
|||
import C from 'ui/utils/constants';
|
||||
import Util from 'ui/utils/util';
|
||||
import { compare as compareVersion } from 'ui/utils/parse-version';
|
||||
import { task } from 'ember-concurrency';
|
||||
|
||||
|
||||
export default Ember.Component.extend(NewOrEdit, {
|
||||
intl: Ember.inject.service(),
|
||||
|
|
@ -112,7 +114,7 @@ export default Ember.Component.extend(NewOrEdit, {
|
|||
return null;
|
||||
}.property('templateResource.defaultVersion','versionLinks'),
|
||||
|
||||
templateChanged: function() {
|
||||
getTemplate: task(function * () {
|
||||
var url = this.get('selectedTemplateUrl');
|
||||
|
||||
if ( url === 'default' ) {
|
||||
|
|
@ -125,20 +127,20 @@ export default Ember.Component.extend(NewOrEdit, {
|
|||
}
|
||||
|
||||
if (url) {
|
||||
this.set('loading', true);
|
||||
|
||||
var version = this.get('settings.rancherVersion');
|
||||
|
||||
if ( version ) {
|
||||
url = Util.addQueryParam(url, 'rancherVersion', version);
|
||||
}
|
||||
|
||||
var current = this.get('stackResource.environment');
|
||||
|
||||
if ( !current ) {
|
||||
current = {};
|
||||
this.set('stackResource.environment', current);
|
||||
}
|
||||
|
||||
this.get('store').request({
|
||||
var selectedTemplateModel = yield this.get('store').request({
|
||||
url: url
|
||||
}).then((response) => {
|
||||
if (response.questions) {
|
||||
|
|
@ -162,18 +164,23 @@ export default Ember.Component.extend(NewOrEdit, {
|
|||
item.answer = item.default;
|
||||
}
|
||||
});
|
||||
return response;
|
||||
}
|
||||
|
||||
this.set('selectedTemplateModel', response);
|
||||
this.set('previewTab', Object.keys(response.get('files')||[])[0]);
|
||||
this.updateReadme();
|
||||
this.set('loading', false);
|
||||
}, ( /*error*/ ) => {});
|
||||
});
|
||||
|
||||
this.set('selectedTemplateModel', selectedTemplateModel);
|
||||
this.set('previewTab', Object.keys(selectedTemplateModel.get('files')||[])[0]);
|
||||
} else {
|
||||
this.set('selectedTemplateModel', null);
|
||||
this.updateReadme();
|
||||
this.set('readmeContent', null);
|
||||
}
|
||||
|
||||
this.updateReadme();
|
||||
}),
|
||||
|
||||
templateChanged: function() {
|
||||
this.get('getTemplate').perform();
|
||||
}.observes('selectedTemplateUrl','templateResource.defaultVersion'),
|
||||
|
||||
answers: function() {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
optionLabelPath="version"
|
||||
optionValuePath="link"
|
||||
value=selectedTemplateUrl
|
||||
disabled=loading
|
||||
disabled=getTemplate.isRunning
|
||||
}}
|
||||
<p class="text-info">{{t (if editing selectVersionUpgrade selectVersionAdd)}}</p>
|
||||
</div>
|
||||
|
|
@ -84,14 +84,14 @@
|
|||
{{/if}}
|
||||
|
||||
<section class="{{sectionClass}}">
|
||||
{{#if loading}}
|
||||
{{#if getTemplate.isRunning}}
|
||||
<div class="text-center">
|
||||
<i class="icon icon-spinner icon-spin" style="font-size:36px;"></i>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if selectedTemplateModel}}
|
||||
<form {{action "submitTemplate" on="submit"}} class="{{if loading 'hide'}}">
|
||||
<form {{action "submitTemplate" on="submit"}} class="{{if getTemplate.isRunning 'hide'}}">
|
||||
<h4>{{t 'newCatalog.config'}}</h4>
|
||||
<hr/>
|
||||
|
||||
|
|
@ -126,7 +126,7 @@
|
|||
{{/if}}
|
||||
</section>
|
||||
|
||||
{{#if (and selectedTemplateModel (not loading))}}
|
||||
{{#if (and selectedTemplateModel (not getTemplate.isRunning))}}
|
||||
{{#if showPreview}}
|
||||
<section>
|
||||
<div class="over-hr"><span {{action "togglePreview"}}>{{t 'newCatalog.preview'}} <i class="icon {{if previewOpen 'icon-chevron-up' 'icon-chevron-down'}}"></i></span></div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue