mirror of https://github.com/rancher/ui.git
add context qp
This commit is contained in:
parent
dfcebc90ed
commit
7edbb4fb31
|
|
@ -152,7 +152,7 @@ export default Component.extend(NewOrEdit, {
|
|||
},
|
||||
|
||||
goBack() {
|
||||
get(this, 'router').transitionTo('global-admin.security.roles.index');
|
||||
get(this, 'router').transitionTo('global-admin.security.roles.index', { queryParams: { context: get(this, 'roleType') } });
|
||||
},
|
||||
|
||||
validate() {
|
||||
|
|
|
|||
|
|
@ -39,16 +39,18 @@ const headers = [
|
|||
];
|
||||
|
||||
export default Controller.extend(FilterState, {
|
||||
queryParams: ['context'],
|
||||
|
||||
model: null,
|
||||
sortBy: 'name',
|
||||
mode: 'global',
|
||||
context: 'global',
|
||||
headers,
|
||||
searchText: '',
|
||||
filterableContent: null,
|
||||
showOnlyDefaults: false,
|
||||
|
||||
readableMode: computed('mode', function() {
|
||||
return get(this, 'mode').capitalize();
|
||||
readableMode: computed('context', function() {
|
||||
return get(this, 'context').capitalize();
|
||||
}),
|
||||
|
||||
globalRows: computed('filtered.@each.{name,state}', function() {
|
||||
|
|
@ -69,13 +71,13 @@ export default Controller.extend(FilterState, {
|
|||
}),
|
||||
|
||||
_showOnlyDefaults: observer('showOnlyDefaults', function() {
|
||||
this.send('changeView', get(this, 'mode'));
|
||||
this.send('changeView', get(this, 'context'));
|
||||
}),
|
||||
|
||||
actions: {
|
||||
changeView(viewName) {
|
||||
|
||||
set(this, 'mode', viewName);
|
||||
set(this, 'context', viewName);
|
||||
|
||||
this.setContent();
|
||||
}
|
||||
|
|
@ -84,7 +86,7 @@ export default Controller.extend(FilterState, {
|
|||
setContent() {
|
||||
|
||||
let content = null;
|
||||
const type = get(this, 'mode');
|
||||
const type = get(this, 'context');
|
||||
const showDef = get(this, 'showOnlyDefaults');
|
||||
const headers = [...get(this, 'headers')];
|
||||
const dynamicHeader = headers.findBy('name', 'Default');
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ export default Route.extend({
|
|||
roleTemplateService: service('roleTemplate'),
|
||||
globalStore: service(),
|
||||
|
||||
model() {
|
||||
queryParams: { context: { refreshModel: true } },
|
||||
|
||||
model(/* params */) {
|
||||
return hash({
|
||||
roleTemplates: get(this, 'roleTemplateService').fetchFilteredRoleTemplates(null, null),
|
||||
globalRoles: get(this, 'globalStore').find('globalRole'),
|
||||
|
|
@ -18,8 +19,10 @@ export default Route.extend({
|
|||
setupController(controller, model) {
|
||||
|
||||
this._super(...arguments);
|
||||
controller.set('filterableContent', get(model, 'globalRoles'));
|
||||
// controller.set('model', model);
|
||||
|
||||
controller.set('model', model);
|
||||
|
||||
controller.setContent();
|
||||
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,12 +1,18 @@
|
|||
<section class="header has-tabs clearfix p-0">
|
||||
<ul class="tab-nav">
|
||||
<li><a href="#" {{action "changeView" "global"}} class="{{if (eq mode "global") "active" ""}}">Global</a></li>
|
||||
<li><a href="#" {{action "changeView" "cluster"}} class="{{if (eq mode "cluster") "active" ""}}">Cluster</a></li>
|
||||
<li><a href="#" {{action "changeView" "project"}} class="{{if (eq mode "project") "active" ""}}">Project</a></li>
|
||||
<li>
|
||||
<a href="#" {{action "changeView" "global"}} class="{{if (eq context "global") "active" ""}}">Global</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" {{action "changeView" "cluster"}} class="{{if (eq context "cluster") "active" ""}}">Cluster</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" {{action "changeView" "project"}} class="{{if (eq context "project") "active" ""}}">Project</a>
|
||||
</li>
|
||||
</ul>
|
||||
{{#unless (eq mode "global")}}
|
||||
{{#unless (eq context "global")}}
|
||||
<div class="right-buttons">
|
||||
{{#link-to "security.roles.new" (query-params context=mode) classNames="btn btn-sm bg-primary right-divider-btn" disabled=(rbac-prevents resource="roletemplate" scope="global" permission="create")}} {{t 'rolesPage.addRole' context=readableMode}}{{/link-to}}
|
||||
{{#link-to "security.roles.new" (query-params context=context) classNames="btn btn-sm bg-primary right-divider-btn" disabled=(rbac-prevents resource="roletemplate" scope="global" permission="create")}} {{t 'rolesPage.addRole' context=readableMode}}{{/link-to}}
|
||||
<span id="header-search"/>
|
||||
</div>
|
||||
{{/unless}}
|
||||
|
|
|
|||
Loading…
Reference in New Issue