Engine install URL options (rancher/rancher#5170)

This commit is contained in:
Vincent Fiduccia 2016-06-16 18:37:07 -07:00
parent 9bc925e005
commit bcdaa7b8c4
3 changed files with 32 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import C from 'ui/utils/constants';
export default Ember.Component.extend({
machine: null,
settings: Ember.inject.service(),
intl: Ember.inject.service(),
showEngineUrl: null,
didReceiveAttrs() {
@ -12,4 +13,22 @@ export default Ember.Component.extend({
this.set('machine.engineInstallUrl', this.get(`settings.${C.SETTING.ENGINE_URL}`) || '');
}
},
engineUrlChoices: function() {
let def = this.get(`settings.${C.SETTING.ENGINE_URL}`);
let out = [
{label: this.get('intl').t('formEngineOpts.engineInstallUrl.recommended'), value: def},
{label: 'v1.10.x', value: 'https://releases.rancher.com/install-docker/1.10.sh'},
{label: 'v1.11.x', value: 'https://releases.rancher.com/install-docker/1.11.sh'},
{label: this.get('intl').t('formEngineOpts.engineInstallUrl.latest'), value: 'https://get.docker.com'},
];
return out;
}.property('intl._locale',`settings.${C.SETTING.ENGINE_URL}`),
actions: {
setEngine(url) {
this.set('machine.engineInstallUrl', url);
}
}
});

View File

@ -4,7 +4,17 @@
<label class="form-control-static">{{t 'formEngineOpts.engineInstallUrl.label'}}</label>
</div>
<div class="col-md-10">
{{input type="text" value=machine.engineInstallUrl classNames="form-control" placeholder=(t 'formEngineOpts.engineInstallUrl.placeholder')}}
<div class="input-group">
{{input type="text" value=machine.engineInstallUrl classNames="form-control" placeholder=(t 'formEngineOpts.engineInstallUrl.placeholder')}}
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><i class="icon icon-chevron-down"></i></button>
<ul class="dropdown-menu dropdown-menu-right" role="menu" style="min-width: 250px; max-height: 300px; overflow-y: auto;">
{{#each engineUrlChoices as |choice|}}
<li><a href="#" {{action "setEngine" choice.value}}>{{choice.label}}</a></li>
{{/each}}
</ul>
</div>
</div>
</div>
</div>
{{/if}}

View File

@ -1586,6 +1586,8 @@ formEngineOpts:
engineInstallUrl:
label: Docker Install URL
placeholder: e.g. http://get.docker.com/
recommended: Recommended
latest: Latest
engineStorageDriver:
label: Storage Driver
placeholder: e.g. overlay