UNPKG

@dbs-portal/module-identity

Version:

Identity management module for user and role management

44 lines 2.18 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; /** * Role List Component */ import React from 'react'; import { Table, Button, Space, Tag } from 'antd'; import { EditOutlined, DeleteOutlined, SafetyOutlined } from '@ant-design/icons'; export const RoleList = ({ roles, loading = false, onEdit, onDelete }) => { const columns = [ { title: 'Role', key: 'role', render: (_, record) => (_jsxs(Space, { children: [_jsx(SafetyOutlined, {}), _jsxs("div", { children: [_jsx("div", { className: "font-medium", children: record.displayName || record.name }), _jsx("div", { className: "text-sm text-gray-500", children: record.description })] })] })), }, { title: 'Properties', key: 'properties', render: (_, record) => (_jsxs(Space, { wrap: true, children: [record.isDefault && _jsx(Tag, { color: "blue", children: "Default" }), record.isStatic && _jsx(Tag, { color: "orange", children: "Static" })] })), }, { title: 'Permissions', dataIndex: 'permissions', key: 'permissions', render: (permissions) => (_jsxs("span", { children: [permissions.length, " permissions"] })), }, { title: 'Users', dataIndex: 'userCount', key: 'userCount', render: (count) => count || 0, }, { title: 'Actions', key: 'actions', render: (_, record) => (_jsxs(Space, { children: [onEdit && (_jsx(Button, { type: "text", icon: _jsx(EditOutlined, {}), onClick: () => onEdit(record), title: "Edit Role" })), onDelete && !record.isStatic && (_jsx(Button, { type: "text", danger: true, icon: _jsx(DeleteOutlined, {}), onClick: () => onDelete(record), title: "Delete Role" }))] })), }, ]; return (_jsx(Table, { columns: columns, dataSource: roles, loading: loading, rowKey: "id", pagination: { showSizeChanger: true, showQuickJumper: true, showTotal: (total, range) => `${range[0]}-${range[1]} of ${total} roles`, } })); }; //# sourceMappingURL=RoleList.js.map