parent
aca9aa0a7a
commit
e76603ce7e
@ -12,7 +12,7 @@
|
||||
- [Backup reports] Add job and run ID [#3488](https://github.com/vatesfr/xen-orchestra/issues/3488) (PR [#3516](https://github.com/vatesfr/xen-orchestra/pull/3516))
|
||||
- [Usage Report] Add top 3 VMs which use the most IOPS read/write/total [#3308](https://github.com/vatesfr/xen-orchestra/issues/3308) (PR [#3463](https://github.com/vatesfr/xen-orchestra/pull/3463))
|
||||
- [Settings/logs] Homogenize action buttons in table and enable bulk deletion [#3179](https://github.com/vatesfr/xen-orchestra/issues/3179) (PR [#3528](https://github.com/vatesfr/xen-orchestra/pull/3528))
|
||||
|
||||
- [Settings/acls] Add bulk deletion [#3179](https://github.com/vatesfr/xen-orchestra/issues/3179) (PR [#3536](https://github.com/vatesfr/xen-orchestra/pull/3536))
|
||||
|
||||
### Bug fixes
|
||||
|
||||
|
@ -569,6 +569,11 @@ const messages = {
|
||||
noUserInGroup: 'No user in group',
|
||||
countUsers: '{users, number} user{users, plural, one {} other {s}}',
|
||||
selectPermission: 'Select Permission',
|
||||
deleteAcl: 'Delete ACL',
|
||||
deleteSelectedAcls: 'Delete selected ACLs',
|
||||
deleteAclsModalTitle: 'Delete ACL{nAcls, plural, one {} other {s}}',
|
||||
deleteAclsModalMessage:
|
||||
'Are you sure you want to delete {nAcls, number} ACL{nAcls, plural, one {} other {s}}?',
|
||||
|
||||
// ----- Plugins ------
|
||||
noPlugins: 'No plugins found',
|
||||
|
@ -2241,6 +2241,22 @@ export const removeAcl = ({ subject, object, action }) =>
|
||||
err => error('Remove ACL', err.message || String(err))
|
||||
)
|
||||
|
||||
export const removeAcls = acls =>
|
||||
confirm({
|
||||
title: _('deleteAclsModalTitle', { nAcls: acls.length }),
|
||||
body: <p>{_('deleteAclsModalMessage', { nAcls: acls.length })}</p>,
|
||||
}).then(
|
||||
() =>
|
||||
Promise.all(
|
||||
map(acls, ({ subject, object, action }) =>
|
||||
_call('acl.remove', resolveIds({ subject, object, action }))
|
||||
)
|
||||
)::tap(subscribeAcls.forceRefresh, err =>
|
||||
error('Remove ACLs', err.message || String(err))
|
||||
),
|
||||
noop
|
||||
)
|
||||
|
||||
export const editAcl = (
|
||||
{ subject, object, action },
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
import _ from 'intl'
|
||||
import ActionButton from 'action-button'
|
||||
import ActionRowButton from 'action-row-button'
|
||||
import ButtonGroup from 'button-group'
|
||||
import Component from 'base-component'
|
||||
import filter from 'lodash/filter'
|
||||
@ -31,6 +30,7 @@ import {
|
||||
addAcl,
|
||||
editAcl,
|
||||
removeAcl,
|
||||
removeAcls,
|
||||
subscribeAcls,
|
||||
subscribeGroups,
|
||||
subscribeRoles,
|
||||
@ -67,16 +67,16 @@ const ACL_COLUMNS = [
|
||||
),
|
||||
sortCriteria: acl => (acl.action.name || '').toLowerCase(),
|
||||
},
|
||||
]
|
||||
|
||||
const ACL_ACTIONS = [
|
||||
{
|
||||
name: '',
|
||||
itemRenderer: acl => (
|
||||
<ActionRowButton
|
||||
icon='delete'
|
||||
btnStyle='danger'
|
||||
handler={removeAcl}
|
||||
handlerParam={acl}
|
||||
/>
|
||||
),
|
||||
handler: removeAcls,
|
||||
icon: 'delete',
|
||||
individualHandler: removeAcl,
|
||||
individualLabel: _('deleteAcl'),
|
||||
label: _('deleteSelectedAcls'),
|
||||
level: 'danger',
|
||||
},
|
||||
]
|
||||
|
||||
@ -107,7 +107,8 @@ class AclTable extends Component {
|
||||
const { xoObjects } = this.props
|
||||
const { acls, roles } = this.state
|
||||
const resolvedAcls = filter(
|
||||
map(acls, ({ subject, object, action }) => ({
|
||||
map(acls, ({ id, subject, object, action }) => ({
|
||||
id,
|
||||
subject: subjects[subject] || subject,
|
||||
object: xoObjects[object] || object,
|
||||
action: roles[action] || action,
|
||||
@ -157,7 +158,11 @@ class AclTable extends Component {
|
||||
<em>{_('aclNoneFound')}</em>
|
||||
</p>
|
||||
) : (
|
||||
<SortedTable collection={resolvedAcls} columns={ACL_COLUMNS} />
|
||||
<SortedTable
|
||||
actions={ACL_ACTIONS}
|
||||
collection={resolvedAcls}
|
||||
columns={ACL_COLUMNS}
|
||||
/>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user