mirror of https://github.com/rancher/ui.git
alert global role remover how many users have role
rancher/rancher#24301
This commit is contained in:
parent
cbdd32f493
commit
56305e3f18
|
|
@ -1,6 +1,7 @@
|
|||
import Resource from '@rancher/ember-api-store/models/resource';
|
||||
import { get, computed } from '@ember/object';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { hasMany } from '@rancher/ember-api-store/utils/denormalize';
|
||||
|
||||
const BASE = 'user-base';
|
||||
const USER = 'user';
|
||||
|
|
@ -9,9 +10,10 @@ const SPECIAL = [BASE, ADMIN, USER];
|
|||
|
||||
export default Resource.extend({
|
||||
|
||||
access: service(),
|
||||
intl: service(),
|
||||
router: service(),
|
||||
access: service(),
|
||||
intl: service(),
|
||||
router: service(),
|
||||
globalRoleBindings: hasMany('id', 'globalRoleBinding', 'globalRoleId'),
|
||||
|
||||
// I think its safe to hack around this - wjw
|
||||
_displayState: 'active',
|
||||
|
|
@ -46,6 +48,10 @@ export default Resource.extend({
|
|||
return !get(this, 'isAdmin') && !get(this, 'isBase') && !get(this, 'isUser');
|
||||
}),
|
||||
|
||||
globalRoleAssociatedUserCount: computed('globalRoleBindings.@each.{id,state,newUserDefault}', function() {
|
||||
return ( get(this, 'globalRoleBindings') || [] ).length;
|
||||
}),
|
||||
|
||||
displayName: computed('id', 'name', 'intl.locale', function() {
|
||||
const intl = get(this, 'intl');
|
||||
const id = get(this, 'id');
|
||||
|
|
|
|||
|
|
@ -90,6 +90,10 @@ export default Component.extend(ModalBase, {
|
|||
return !!get(this, 'resources').findBy('type', 'clusterRoleTemplateBinding');
|
||||
}),
|
||||
|
||||
isGlobalRole: computed('resources', function() {
|
||||
return !!get(this, 'resources').findBy('type', 'globalRole');
|
||||
}),
|
||||
|
||||
isSystemProject: computed('resources', function() {
|
||||
const project = get(this, 'resources').findBy('type', 'project');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<div class="container-header-text">
|
||||
<h3>
|
||||
{{#if resourceType}}
|
||||
{{t
|
||||
"confirmDelete.titleWithResourceType"
|
||||
{{t
|
||||
"confirmDelete.titleWithResourceType"
|
||||
resourceType=(t (concat "confirmDelete.resourceType." resourceType))
|
||||
htmlSafe=true
|
||||
}}
|
||||
|
|
@ -88,6 +88,13 @@
|
|||
{{t "confirmDelete.clusterRoleTemplateBindingNote"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if (and isGlobalRole (gte resources.firstObject.globalRoleAssociatedUserCount 1))}}
|
||||
<div class="mb-15 text-center">
|
||||
{{t "confirmDelete.globalRoleNote" count=resources.firstObject.globalRoleAssociatedUserCount }}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="footer-actions">
|
||||
<button {{action "confirm"}} class="btn bg-error">
|
||||
{{t "confirmDelete.confirmAction"}}
|
||||
|
|
|
|||
|
|
@ -4395,6 +4395,7 @@ confirmDelete:
|
|||
cancelAction: Cancel
|
||||
largeDeleteText: '{key} and {othersCount} others'
|
||||
systemChartNote: 'You are removing a system app. It may cause issues with the cluster if it is removed.'
|
||||
globalRoleNote: "{count} users are assigned this role"
|
||||
forceDelete:
|
||||
label: Force Delete
|
||||
warning: "IMPORTANT: Force deleting pods does not wait for confirmation that the pod's processes have been terminated. This may result in <b>data corruption or inconsistencies</b>."
|
||||
|
|
|
|||
Loading…
Reference in New Issue