import React, { useContext, useState } from "react"; import { Table, Button, Popconfirm, Space, Tag } from "antd"; import { EditOutlined, DeleteOutlined } from "@ant-design/icons"; import { ControlContext, useAccount, useRoles } from "@clusterio/web_ui"; import * as messages from "../../messages"; import RoleMappingForm from "./RoleMappingForm"; export default function RoleMappingsTable() { const control = useContext(ControlContext); const plugin = control.plugins.get("exp_groups") as any; const account = useAccount(); const [roleMappings, synced] = plugin.useRoleMappings(); const [groups] = plugin.useGroups(); const [roles] = useRoles(); const [editing, setEditing] = useState(null); const [open, setOpen] = useState(false); return <> [...m.roleIds].map((id: number) => { const role = roles.get(id); return {role?.name ?? id}; }), }, { title: "Group", render: (_: any, m: any) => groups.get(m.groupId)?.name ?? m.groupId, }, { title: "Enabled", render: (_: any, m: any) => m.enabled ? "Yes" : "No", }, { title: "Actions", render: (_: any, record: any) => ( {account.hasPermission("exp_groups.role_mapping.update") &&