1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fixing role binding details view without subjects (#688)

Signed-off-by: alexfront <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2020-08-14 14:39:28 +03:00 committed by GitHub
parent e249769562
commit 30c14eb6da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,6 +64,7 @@ export class RoleBindingDetails extends React.Component<Props> {
} }
const name = roleBinding.getName(); const name = roleBinding.getName();
const { roleRef } = roleBinding; const { roleRef } = roleBinding;
const subjects = roleBinding.getSubjects();
return ( return (
<div className="RoleBindingDetails"> <div className="RoleBindingDetails">
<KubeObjectMeta object={roleBinding}/> <KubeObjectMeta object={roleBinding}/>
@ -83,6 +84,7 @@ export class RoleBindingDetails extends React.Component<Props> {
</Table> </Table>
<DrawerTitle title={<Trans>Bindings</Trans>}/> <DrawerTitle title={<Trans>Bindings</Trans>}/>
{subjects.length > 0 && (
<Table selectable className="bindings box grow"> <Table selectable className="bindings box grow">
<TableHead> <TableHead>
<TableCell checkbox/> <TableCell checkbox/>
@ -91,7 +93,7 @@ export class RoleBindingDetails extends React.Component<Props> {
<TableCell className="type"><Trans>Namespace</Trans></TableCell> <TableCell className="type"><Trans>Namespace</Trans></TableCell>
</TableHead> </TableHead>
{ {
roleBinding.getSubjects().map((subject, i) => { subjects.map((subject, i) => {
const { kind, name, namespace } = subject; const { kind, name, namespace } = subject;
const isSelected = selectedSubjects.includes(subject); const isSelected = selectedSubjects.includes(subject);
return ( return (
@ -108,6 +110,7 @@ export class RoleBindingDetails extends React.Component<Props> {
}) })
} }
</Table> </Table>
)}
<KubeEventDetails object={roleBinding}/> <KubeEventDetails object={roleBinding}/>