mirror of https://github.com/rancher/ui.git
Support FS Group policy
This commit is contained in:
parent
75f2f8b8f3
commit
4b421e2649
|
|
@ -0,0 +1,57 @@
|
||||||
|
import Component from '@ember/component';
|
||||||
|
import { inject as service } from '@ember/service';
|
||||||
|
import layout from './template';
|
||||||
|
|
||||||
|
export default Component.extend({
|
||||||
|
layout,
|
||||||
|
|
||||||
|
classNames: ['accordion-wrapper'],
|
||||||
|
|
||||||
|
authzStore: service('authz-store'),
|
||||||
|
|
||||||
|
model: null,
|
||||||
|
|
||||||
|
init() {
|
||||||
|
this._super(...arguments);
|
||||||
|
this.set('model.fsGroup', this.get('model.fsGroup') || this.get('authzStore').createRecord({
|
||||||
|
type: 'fsGroupStrategyOptions',
|
||||||
|
rule: 'RunAsAny',
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
add: function() {
|
||||||
|
this.get('model.fsGroup.ranges').pushObject(
|
||||||
|
this.get('authzStore').createRecord({
|
||||||
|
type: 'idRange',
|
||||||
|
min: 0,
|
||||||
|
max: 6,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
},
|
||||||
|
remove: function(obj) {
|
||||||
|
this.get('model.fsGroup.ranges').removeObject(obj);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
ruleDidChange: function() {
|
||||||
|
const rule = this.get('model.fsGroup.rule');
|
||||||
|
if (rule === 'MustRunAs') {
|
||||||
|
this.set('model.fsGroup.ranges', []);
|
||||||
|
this.send('add');
|
||||||
|
} else {
|
||||||
|
this.set('model.fsGroup.ranges', null);
|
||||||
|
}
|
||||||
|
}.observes('model.fsGroup.rule'),
|
||||||
|
|
||||||
|
didReceiveAttrs() {
|
||||||
|
if (!this.get('expandFn')) {
|
||||||
|
this.set('expandFn', function (item) {
|
||||||
|
item.toggleProperty('expanded');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
statusClass: null,
|
||||||
|
status: null,
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
{{#accordion-list-item
|
||||||
|
title=(t 'formFsGroupPodSecurityPolicy.title')
|
||||||
|
detail=(t 'formFsGroupPodSecurityPolicy.detail')
|
||||||
|
status=status
|
||||||
|
statusClass=statusClass
|
||||||
|
expandAll=expandAll
|
||||||
|
expand=(action expandFn)
|
||||||
|
}}
|
||||||
|
<div class="row">
|
||||||
|
<div class="radio input">
|
||||||
|
<label>{{radio-button selection=model.fsGroup.rule value="MustRunAs"}} {{t 'formFsGroupPodSecurityPolicy.rule.mustRunAs'}}</label>
|
||||||
|
</div>
|
||||||
|
<div class="radio input">
|
||||||
|
<label>{{radio-button selection=model.fsGroup.rule value="RunAsAny"}} {{t 'formFsGroupPodSecurityPolicy.rule.runAsAny'}}</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{#if (eq model.fsGroup.rule "MustRunAs")}}
|
||||||
|
<div class="row mt-20">
|
||||||
|
<div>
|
||||||
|
<button class="btn bg-link icon-btn" {{action "add"}}>
|
||||||
|
<span class="darken"><i class="icon icon-plus text-small"/></span>
|
||||||
|
<span>{{t 'formFsGroupPodSecurityPolicy.range.addLabel'}}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{#if (eq model.fsGroup.rule "MustRunAs")}}
|
||||||
|
<table class="table fixed no-lines no-top-padding mt-10">
|
||||||
|
<tr class="hidden-sm hidden-xs">
|
||||||
|
<th>{{t 'formFsGroupPodSecurityPolicy.range.min.label'}}{{field-required}}</th>
|
||||||
|
<th width="30"> </th>
|
||||||
|
<th>{{t 'formFsGroupPodSecurityPolicy.range.max.label'}}{{field-required}}</th>
|
||||||
|
<th width="40"> </th>
|
||||||
|
</tr>
|
||||||
|
{{#each model.fsGroup.ranges as |range|}}
|
||||||
|
<tr class="sm-noborder">
|
||||||
|
<td data-title="{{t 'formFsGroupPodSecurityPolicy.range.min.label'}}">
|
||||||
|
{{input class="form-control input-sm" type="number" value=range.min placeholder=(t 'formFsGroupPodSecurityPolicy.range.min.placeholder')}}
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<p><i class="icon icon-chevron-right"></i></p>
|
||||||
|
</td>
|
||||||
|
<td data-title="{{t 'formFsGroupPodSecurityPolicy.range.max.label'}}">
|
||||||
|
{{input class="form-control input-sm" type="number" value=range.max placeholder=(t 'formFsGroupPodSecurityPolicy.range.max.placeholder')}}
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
<button class="btn bg-primary btn-sm" {{action "remove" range}}><i class="icon icon-minus"/><span class="sr-only">{{t 'generic.remove'}}</span></button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</table>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{/accordion-list-item}}
|
||||||
Loading…
Reference in New Issue