mirror of https://github.com/rancher/ui.git
Support host path policy
This commit is contained in:
parent
a87b1958e4
commit
ba8a899219
|
|
@ -0,0 +1,50 @@
|
|||
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,
|
||||
paths: null,
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.set('model.allowedHostPaths', this.get('model.allowedHostPaths') || []);
|
||||
this.set('paths', this.get('model.allowedHostPaths'));
|
||||
},
|
||||
|
||||
actions: {
|
||||
add: function() {
|
||||
this.get('paths').pushObject(
|
||||
this.get('authzStore').createRecord({
|
||||
type: 'allowedHostPath',
|
||||
pathPrefix: '',
|
||||
})
|
||||
);
|
||||
},
|
||||
remove: function(obj) {
|
||||
this.get('paths').removeObject(obj);
|
||||
},
|
||||
},
|
||||
|
||||
pathDidChange: function() {
|
||||
this.set('model.allowedHostPaths', this.get('paths').filter(p => p.pathPrefix));
|
||||
}.observes('paths.@each.pathPrefix'),
|
||||
|
||||
didReceiveAttrs() {
|
||||
if (!this.get('expandFn')) {
|
||||
this.set('expandFn', function (item) {
|
||||
item.toggleProperty('expanded');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
statusClass: null,
|
||||
status: null,
|
||||
});
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
{{#accordion-list-item
|
||||
title=(t 'formAllowedHostPathsPodSecurityPolicy.title')
|
||||
detail=(t 'formAllowedHostPathsPodSecurityPolicy.detail')
|
||||
status=status
|
||||
statusClass=statusClass
|
||||
expandAll=expandAll
|
||||
expand=(action expandFn)
|
||||
}}
|
||||
<div class="row">
|
||||
<div>
|
||||
<button class="btn bg-link icon-btn" {{action "add"}}>
|
||||
<span class="darken"><i class="icon icon-plus text-small"/></span>
|
||||
<span>{{t 'formAllowedHostPathsPodSecurityPolicy.path.addLabel'}}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{{#if paths.length}}
|
||||
<div>
|
||||
{{#each paths as |item|}}
|
||||
<div class="row pt-20">
|
||||
<div class="col span-11">{{input type="text" value=item.pathPrefix classNames="form-control input-sm" placeholder=(t 'formAllowedHostPathsPodSecurityPolicy.path.placeholder')}}</div>
|
||||
<div class="col"><button class="btn bg-primary btn-sm" {{action "remove" item}}><i class="icon icon-minus"/></button></div>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/accordion-list-item}}
|
||||
|
|
@ -45,6 +45,54 @@
|
|||
}}
|
||||
</div>
|
||||
|
||||
<div class="mt-20">
|
||||
{{form-hostpath-policy
|
||||
model=model.policy
|
||||
expandAll=al.expandAll
|
||||
expandFn=expandFn
|
||||
}}
|
||||
</div>
|
||||
|
||||
<div class="mt-20">
|
||||
{{form-fsgroup-policy
|
||||
model=model.policy
|
||||
expandAll=al.expandAll
|
||||
expandFn=expandFn
|
||||
}}
|
||||
</div>
|
||||
|
||||
<div class="mt-20">
|
||||
{{form-hostports-policy
|
||||
model=model.policy
|
||||
expandAll=al.expandAll
|
||||
expandFn=expandFn
|
||||
}}
|
||||
</div>
|
||||
|
||||
<div class="mt-20">
|
||||
{{form-runasuser-policy
|
||||
model=model.policy
|
||||
expandAll=al.expandAll
|
||||
expandFn=expandFn
|
||||
}}
|
||||
</div>
|
||||
|
||||
<div class="mt-20">
|
||||
{{form-selinux-policy
|
||||
model=model.policy
|
||||
expandAll=al.expandAll
|
||||
expandFn=expandFn
|
||||
}}
|
||||
</div>
|
||||
|
||||
<div class="mt-20">
|
||||
{{form-supplementalgroups-policy
|
||||
model=model.policy
|
||||
expandAll=al.expandAll
|
||||
expandFn=expandFn
|
||||
}}
|
||||
</div>
|
||||
|
||||
{{/accordion-list}}
|
||||
</section>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue