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}} {{/if}}
<td data-title="Image:" class="clip"> <td data-title="Image:" class="clip">
{{model.displayImage}} {{model.displayImage}}
{{#if (eq showCommand "inline")~}} {{#if (and (eq showCommand "inline") model.command)~}}
({{model.command}}) ({{model.command}})
{{/if}} {{/if}}
</td> </td>

View File

@ -1,35 +1,28 @@
import Ember from 'ember'; import Ember from 'ember';
export default Ember.Component.extend({ export default Ember.Component.extend({
choices: [ rSelected: false,
{value: 'r', label: 'read'}, wSelected: false,
{value: 'w', label: 'write'}, mSelected: false,
{value: 'm', label: 'mknod'}
],
selection: null, selection: null,
init: function() { init: function() {
this._super(); this._super();
if ( !this.get('selection') ) var sel = this.get('initialSelection');
{ this.setProperties({
var parts = this.get('selectionAsString').split(''); rSelected: sel.indexOf('r') >= 0,
var selection = this.get('choices').filter(function(choice) { wSelected: sel.indexOf('w') >= 0,
return parts.indexOf(choice.value) >= 0; mSelected: sel.indexOf('m') >= 0,
}); });
this.set('selection', selection);
}
this.selectionDidChange();
}, },
selectionAsString: '', actions: {
selectionDidChange: function() { selectChanged(x, ele) {
var str = ''; var str = $(ele.target).val().join('');
this.get('selection').forEach(function(choice) { this.sendAction('changed', str);
str += choice.value; },
}); },
this.set('selectionAsString', str);
}.observes('selection.[]'),
didInsertElement: function() { didInsertElement: function() {
var moreClass = this.get('buttonClass')||''; 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>
<td>&nbsp;</td> <td>&nbsp;</td>
<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>
<td class="text-right"> <td class="text-right">
<button class="btn btn-primary btn-sm" {{action "removeDevice" device}}><i class="icon icon-minus"/></button> <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="row form-group">
<div class="col-sm-12 col-md-2 form-label"> <div class="col-sm-12 col-md-2 form-label">
<label class="form-control-static">AMI</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>
<div class="col-sm-12 col-md-3"> <div class="col-sm-12 col-md-3">
{{input type="text" classNames="form-control" placeholder="An Ubuntu AMI" value=amazonec2Config.ami}} {{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>
<div class="col-sm-12 col-md-2 form-label"> <div class="col-sm-12 col-md-2 form-label">
<label class="form-control-static">SSH User</label> <label class="form-control-static">SSH User</label>

View File

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

View File

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