Fix permissions control, bugs

This commit is contained in:
Vincent Fiduccia 2016-03-15 23:47:35 -07:00
parent 456e44dfd2
commit a2c2896919
7 changed files with 35 additions and 29 deletions

View File

@ -18,7 +18,7 @@
{{/if}}
<td data-title="Image:" class="clip">
{{model.displayImage}}
{{#if (eq showCommand "inline")~}}
{{#if (and (eq showCommand "inline") model.command)~}}
({{model.command}})
{{/if}}
</td>

View File

@ -1,35 +1,28 @@
import Ember from 'ember';
export default Ember.Component.extend({
choices: [
{value: 'r', label: 'read'},
{value: 'w', label: 'write'},
{value: 'm', label: 'mknod'}
],
rSelected: false,
wSelected: false,
mSelected: false,
selection: null,
init: function() {
this._super();
if ( !this.get('selection') )
{
var parts = this.get('selectionAsString').split('');
var selection = this.get('choices').filter(function(choice) {
return parts.indexOf(choice.value) >= 0;
});
this.set('selection', selection);
}
this.selectionDidChange();
var sel = this.get('initialSelection');
this.setProperties({
rSelected: sel.indexOf('r') >= 0,
wSelected: sel.indexOf('w') >= 0,
mSelected: sel.indexOf('m') >= 0,
});
},
selectionAsString: '',
selectionDidChange: function() {
var str = '';
this.get('selection').forEach(function(choice) {
str += choice.value;
});
this.set('selectionAsString', str);
}.observes('selection.[]'),
actions: {
selectChanged(x, ele) {
var str = $(ele.target).val().join('');
this.sendAction('changed', str);
},
},
didInsertElement: function() {
var moreClass = this.get('buttonClass')||'';

View File

@ -1 +1,5 @@
{{view "select" class="form-control" content=view.choices selection=view.selection multiple="true" optionValuePath="content.value" optionLabelPath="content.label"}}
<select class="form-control" multiple=true onchange={{action "selectChanged" target.value}}>
<option value="r" selected={{rSelected}}>read</option>
<option value="w" selected={{wSelected}}>write</option>
<option value="m" selected={{mSelected}}>mknod</option>
</select>

View File

@ -112,7 +112,7 @@
</td>
<td>&nbsp;</td>
<td>
{{device-permissions buttonClass="btn-sm" selectionAsString=device.permissions}}
{{device-permissions buttonClass="btn-sm" initialSelection=device.permissions changed=(action (mut device.permissions))}}
</td>
<td class="text-right">
<button class="btn btn-primary btn-sm" {{action "removeDevice" device}}><i class="icon icon-minus"/></button>

View File

@ -214,12 +214,14 @@
<div class="row form-group">
<div class="col-sm-12 col-md-2 form-label">
<label class="form-control-static">AMI</label>
<p class="help-block">
<a href="https://github.com/rancher/os/blob/master/README.md/#user-content-amazon" target="_blank">Rancher AMI Options</a>
</p>
</div>
<div class="col-sm-12 col-md-3">
{{input type="text" classNames="form-control" placeholder="An Ubuntu AMI" value=amazonec2Config.ami}}
{{#unless settings.isPrivateLabel}}
<p class="help-block">
<a href="https://github.com/rancher/os/blob/master/README.md/#user-content-amazon" target="_blank">RancherOS AMI List</a>
</p>
{{/unless}}
</div>
<div class="col-sm-12 col-md-2 form-label">
<label class="form-control-static">SSH User</label>

View File

@ -16,7 +16,7 @@ export default Ember.Controller.extend(NewOrEdit, {
},
cancel: function() {
this.transitionTo('registries');
this.transitionToRoute('registries');
},
},

View File

@ -25,4 +25,11 @@ export default Ember.Route.extend({
controller.set('model',model);
controller.send('selectDriver','dockerhub');
},
resetController: function (controller, isExiting/*, transition*/) {
if (isExiting)
{
controller.set('errors', null);
}
},
});