Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
> v0.1.12 ~ "IAM dialogs open from anywhere"
> v0.1.13 ~ "Extensions can add columns, actions and buttons to IAM tables and dialogs"

---
## Highlights

- **IAM dialogs are reusable services.** New `user-actions`, `group-actions`, `role-actions` and `policy-actions` services hold the create, edit, invite and permission dialogs that lived in the index controllers, so other engines can open them — Fleetbase AI uses this to open **New User** from its confirmation cards. The IAM pages delegate to the same services, so buttons, row actions and deep links behave as before. ([#33](https://github.com/fleetbase/iam-engine/pull/33))
- **Resource view registries.** Extensions can add the following for `user`, `group`, `role` and `policy`:
- columns, row actions, bulk actions and toolbar buttons, through `iam:<resource>:table:<slot>`;
- buttons and menu items in the edit dialogs, through `iam:<resource>:details:<slot>`.
- **Groups, roles and policies use the standard table layout**, with filters and a column picker, like users.
- **Fix: the delete-groups confirmation read a misspelt translation key.**

---
## Upgrading
Needs fleetbase/ember-core v0.3.25 and fleetbase/ember-ui v0.4.5.

---
## Need help?
- [GitHub Discussions](https://github.com/fleetbase/fleetbase/discussions)
- [Discord](https://discord.gg/HnTqQ6zAVn)
---
55 changes: 53 additions & 2 deletions addon/controllers/groups/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class GroupsIndexController extends Controller {
*
* @var {Array}
*/
queryParams = ['view_group', 'page', 'limit', 'sort', 'query', 'type', 'created_by', 'updated_by', 'status'];
queryParams = this.groupActions.queryParamsFor(['view_group', 'page', 'limit', 'sort', 'query', 'type', 'created_by', 'updated_by', 'status']);

/**
* The current page of data being viewed
Expand Down Expand Up @@ -54,13 +54,58 @@ export default class GroupsIndexController extends Controller {
*/
@tracked sort = '-created_at';

/**
* Header buttons. Extensions add to them through `iam:group:table:actions`.
*
* @var {Array}
*/
get actionButtons() {
return [
{
id: 'create',
text: this.intl.t('iam.common.new'),
type: 'primary',
icon: 'plus',
iconPrefix: 'fas',
onClick: this.createGroup,
permission: 'iam create group',
},
{
id: 'export',
text: this.intl.t('iam.common.export'),
icon: 'long-arrow-up',
iconClass: 'rotate-icon-45',
onClick: this.exportGroups,
permission: 'iam export group',
},
];
}

/**
* Bulk actions for the selected rows. Extensions add to them through `iam:group:table:bulk-actions`.
*
* @var {Array}
*/
get bulkActions() {
return [
{
id: 'bulk-delete',
label: this.intl.t('iam.groups.index.delete-groups'),
class: 'text-red-500',
fn: this.bulkDeleteGroups,
permission: 'iam delete group',
},
];
}

/**
* All columns applicable for groups
*
* @var {Array}
*/
@tracked columns = [
{
id: 'name',
label: this.intl.t('iam.common.name'),
valuePath: 'name',
cellComponent: 'table/cell/anchor',
Expand All @@ -70,12 +115,14 @@ export default class GroupsIndexController extends Controller {
sortable: false,
},
{
id: 'description',
label: this.intl.t('iam.common.description'),
valuePath: 'description',
sortable: false,
width: '25%',
},
{
id: 'users',
label: this.intl.t('iam.common.member'),
valuePath: 'users',
cellComponent: 'table/cell/group-members',
Expand All @@ -86,6 +133,7 @@ export default class GroupsIndexController extends Controller {
width: '35%',
},
{
id: 'created-at',
label: this.intl.t('iam.groups.index.created'),
valuePath: 'createdAt',
sortable: false,
Expand All @@ -94,6 +142,7 @@ export default class GroupsIndexController extends Controller {
cellClassNames: 'overflow-visible',
},
{
id: 'row-actions',
label: '',
cellComponent: 'table/cell/dropdown',
ddButtonText: false,
Expand All @@ -105,11 +154,13 @@ export default class GroupsIndexController extends Controller {
width: '10%',
actions: [
{
id: 'edit-group',
label: this.intl.t('iam.groups.index.edit-group'),
fn: this.editGroup,
permission: 'iam view group',
},
{
id: 'delete-group',
label: this.intl.t('iam.groups.index.delete-group-label'),
fn: this.deleteGroup,
className: 'text-red-700 hover:text-red-800',
Expand Down Expand Up @@ -154,7 +205,7 @@ export default class GroupsIndexController extends Controller {

this.crud.bulkDelete(selected, {
modelNamePath: `name`,
acceptButtonText: this.intl.t('aim.groups.index.delete-group'),
acceptButtonText: this.intl.t('iam.groups.index.delete-group'),
onSuccess: () => {
return this.hostRouter.refresh();
},
Expand Down
46 changes: 45 additions & 1 deletion addon/controllers/policies/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class PoliciesIndexController extends Controller {
*
* @var {Array}
*/
queryParams = ['view_policy', 'page', 'limit', 'sort', 'query', 'type', 'created_by', 'updated_by', 'status', 'service', 'type'];
queryParams = this.policyActions.queryParamsFor(['view_policy', 'page', 'limit', 'sort', 'query', 'type', 'created_by', 'updated_by', 'status', 'service', 'type']);

/**
* The current page of data being viewed
Expand Down Expand Up @@ -69,13 +69,50 @@ export default class PoliciesIndexController extends Controller {
*/
@tracked types = this.iam.schemeTypes;

/**
* Header buttons. Extensions add to them through `iam:policy:table:actions`.
*
* @var {Array}
*/
get actionButtons() {
return [
{
id: 'create',
text: this.intl.t('iam.common.new'),
type: 'primary',
icon: 'plus',
iconPrefix: 'fas',
onClick: this.createPolicy,
permission: 'iam create policy',
},
];
}

/**
* Bulk actions for the selected rows. Extensions add to them through `iam:policy:table:bulk-actions`.
*
* @var {Array}
*/
get bulkActions() {
return [
{
id: 'bulk-delete',
label: this.intl.t('iam.policies.index.delete-policies'),
class: 'text-red-500',
fn: this.bulkDeletePolicies,
permission: 'iam delete policy',
},
];
}

/**
* All columns applicable for roles
*
* @var {Array}
*/
@tracked columns = [
{
id: 'name',
label: this.intl.t('iam.common.name'),
valuePath: 'name',
cellComponent: 'table/cell/anchor',
Expand All @@ -85,12 +122,14 @@ export default class PoliciesIndexController extends Controller {
sortable: false,
},
{
id: 'description',
label: this.intl.t('iam.common.description'),
valuePath: 'description',
sortable: false,
width: '35%',
},
{
id: 'service',
label: this.intl.t('iam.common.service'),
valuePath: 'service',
sortable: false,
Expand All @@ -100,6 +139,7 @@ export default class PoliciesIndexController extends Controller {
filterOptions: this.services,
},
{
id: 'type',
label: this.intl.t('iam.common.type'),
valuePath: 'type',
sortable: false,
Expand All @@ -111,6 +151,7 @@ export default class PoliciesIndexController extends Controller {
filterOptions: this.types,
},
{
id: 'created-at',
label: this.intl.t('iam.common.create'),
valuePath: 'createdAt',
sortable: false,
Expand All @@ -119,6 +160,7 @@ export default class PoliciesIndexController extends Controller {
cellClassNames: 'overflow-visible',
},
{
id: 'row-actions',
label: '',
cellComponent: 'table/cell/dropdown',
ddButtonText: false,
Expand All @@ -130,11 +172,13 @@ export default class PoliciesIndexController extends Controller {
width: '15%',
actions: [
{
id: 'edit-policy',
label: this.intl.t('iam.policies.index.edit-policy'),
fn: this.editPolicy,
permission: 'iam view policy',
},
{
id: 'delete-policy',
label: this.intl.t('iam.policies.index.delete-policy'),
fn: this.deletePolicy,
className: 'text-red-700 hover:text-red-800',
Expand Down
46 changes: 45 additions & 1 deletion addon/controllers/roles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class RolesIndexController extends Controller {
*
* @var {Array}
*/
queryParams = ['view_role', 'page', 'limit', 'sort', 'query', 'service', 'type'];
queryParams = this.roleActions.queryParamsFor(['view_role', 'page', 'limit', 'sort', 'query', 'service', 'type']);

/**
* The current page of data being viewed
Expand Down Expand Up @@ -69,13 +69,50 @@ export default class RolesIndexController extends Controller {
*/
@tracked types = this.iam.schemeTypes;

/**
* Header buttons. Extensions add to them through `iam:role:table:actions`.
*
* @var {Array}
*/
get actionButtons() {
return [
{
id: 'create',
text: this.intl.t('iam.common.new'),
type: 'primary',
icon: 'plus',
iconPrefix: 'fas',
onClick: this.createRole,
permission: 'iam create role',
},
];
}

/**
* Bulk actions for the selected rows. Extensions add to them through `iam:role:table:bulk-actions`.
*
* @var {Array}
*/
get bulkActions() {
return [
{
id: 'bulk-delete',
label: this.intl.t('iam.roles.index.delete-roles'),
class: 'text-red-500',
fn: this.bulkDeleteRoles,
permission: 'iam delete role',
},
];
}

/**
* All columns applicable for roles
*
* @var {Array}
*/
@tracked columns = [
{
id: 'name',
label: this.intl.t('iam.common.name'),
valuePath: 'name',
cellComponent: 'table/cell/anchor',
Expand All @@ -85,12 +122,14 @@ export default class RolesIndexController extends Controller {
sortable: false,
},
{
id: 'description',
label: this.intl.t('iam.common.description'),
valuePath: 'description',
sortable: false,
width: '28%',
},
{
id: 'service',
label: this.intl.t('iam.common.service'),
valuePath: 'service',
sortable: false,
Expand All @@ -100,6 +139,7 @@ export default class RolesIndexController extends Controller {
filterOptions: this.services,
},
{
id: 'type',
label: this.intl.t('iam.common.type'),
valuePath: 'type',
sortable: false,
Expand All @@ -111,6 +151,7 @@ export default class RolesIndexController extends Controller {
filterOptions: this.types,
},
{
id: 'created-at',
label: this.intl.t('iam.common.create'),
valuePath: 'createdAt',
sortable: false,
Expand All @@ -119,6 +160,7 @@ export default class RolesIndexController extends Controller {
cellClassNames: 'overflow-visible',
},
{
id: 'row-actions',
label: '',
cellComponent: 'table/cell/dropdown',
ddButtonText: false,
Expand All @@ -130,11 +172,13 @@ export default class RolesIndexController extends Controller {
width: '15%',
actions: [
{
id: 'edit-role',
label: this.intl.t('iam.roles.index.edit-role'),
fn: this.editRole,
permission: 'iam view role',
},
{
id: 'delete-role',
label: this.intl.t('iam.roles.index.delete-role'),
fn: this.deleteRole,
className: 'text-red-700 hover:text-red-800',
Expand Down
Loading
Loading