mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Show system roles on Roles page (#355)
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
5cd00bd77a
commit
1c324a3ced
@ -9,7 +9,7 @@ import { Dialog, DialogProps } from "../dialog";
|
|||||||
import { Wizard, WizardStep } from "../wizard";
|
import { Wizard, WizardStep } from "../wizard";
|
||||||
import { Select, SelectOption } from "../select";
|
import { Select, SelectOption } from "../select";
|
||||||
import { SubTitle } from "../layout/sub-title";
|
import { SubTitle } from "../layout/sub-title";
|
||||||
import { IRoleBindingSubject, RoleBinding, ServiceAccount } from "../../api/endpoints";
|
import { IRoleBindingSubject, RoleBinding, ServiceAccount, Role } from "../../api/endpoints";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import { Input } from "../input";
|
import { Input } from "../input";
|
||||||
import { NamespaceSelect } from "../+namespaces/namespace-select";
|
import { NamespaceSelect } from "../+namespaces/namespace-select";
|
||||||
@ -152,7 +152,7 @@ export class AddRoleBindingDialog extends React.Component<Props> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
@computed get roleOptions(): BindingSelectOption[] {
|
@computed get roleOptions(): BindingSelectOption[] {
|
||||||
let roles = rolesStore.items.filter(KubeObject.isNonSystem);
|
let roles = rolesStore.items as Role[]
|
||||||
if (this.bindContext) {
|
if (this.bindContext) {
|
||||||
// show only cluster-roles or roles for selected context namespace
|
// show only cluster-roles or roles for selected context namespace
|
||||||
roles = roles.filter(role => !role.getNs() || role.getNs() === this.bindContext);
|
roles = roles.filter(role => !role.getNs() || role.getNs() === this.bindContext);
|
||||||
|
|||||||
@ -42,22 +42,6 @@ export class RoleBindings extends React.Component<Props> {
|
|||||||
(binding: RoleBinding) => binding.getSubjectNames(),
|
(binding: RoleBinding) => binding.getSubjectNames(),
|
||||||
]}
|
]}
|
||||||
renderHeaderTitle={<Trans>Role Bindings</Trans>}
|
renderHeaderTitle={<Trans>Role Bindings</Trans>}
|
||||||
filterItems={[
|
|
||||||
(items: RoleBinding[]) => items.filter(KubeObject.isNonSystem),
|
|
||||||
]}
|
|
||||||
customizeHeader={({ info }) => ({
|
|
||||||
info: (
|
|
||||||
<>
|
|
||||||
{info}
|
|
||||||
<Icon
|
|
||||||
small
|
|
||||||
material="help_outline"
|
|
||||||
className="help-icon"
|
|
||||||
tooltip={<Trans>Excluded items with "system:" prefix</Trans>}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
renderTableHeader={[
|
renderTableHeader={[
|
||||||
{ title: <Trans>Name</Trans>, className: "name", sortBy: sortBy.name },
|
{ title: <Trans>Name</Trans>, className: "name", sortBy: sortBy.name },
|
||||||
{ title: <Trans>Bindings</Trans>, className: "bindings", sortBy: sortBy.bindings },
|
{ title: <Trans>Bindings</Trans>, className: "bindings", sortBy: sortBy.bindings },
|
||||||
|
|||||||
@ -10,8 +10,6 @@ import { rolesStore } from "./roles.store";
|
|||||||
import { clusterRoleApi, Role, roleApi } from "../../api/endpoints";
|
import { clusterRoleApi, Role, roleApi } from "../../api/endpoints";
|
||||||
import { KubeObjectListLayout } from "../kube-object";
|
import { KubeObjectListLayout } from "../kube-object";
|
||||||
import { AddRoleDialog } from "./add-role-dialog";
|
import { AddRoleDialog } from "./add-role-dialog";
|
||||||
import { Icon } from "../icon";
|
|
||||||
import { KubeObject } from "../../api/kube-object";
|
|
||||||
import { apiManager } from "../../api/api-manager";
|
import { apiManager } from "../../api/api-manager";
|
||||||
|
|
||||||
enum sortBy {
|
enum sortBy {
|
||||||
@ -39,23 +37,7 @@ export class Roles extends React.Component<Props> {
|
|||||||
searchFilters={[
|
searchFilters={[
|
||||||
(role: Role) => role.getSearchFields(),
|
(role: Role) => role.getSearchFields(),
|
||||||
]}
|
]}
|
||||||
filterItems={[
|
|
||||||
(items: Role[]) => items.filter(KubeObject.isNonSystem),
|
|
||||||
]}
|
|
||||||
renderHeaderTitle={<Trans>Roles</Trans>}
|
renderHeaderTitle={<Trans>Roles</Trans>}
|
||||||
customizeHeader={({ info }) => ({
|
|
||||||
info: (
|
|
||||||
<>
|
|
||||||
{info}
|
|
||||||
<Icon
|
|
||||||
small
|
|
||||||
material="help_outline"
|
|
||||||
className="help-icon"
|
|
||||||
tooltip={<Trans>Excluded items with "system:" prefix</Trans>}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
renderTableHeader={[
|
renderTableHeader={[
|
||||||
{ title: <Trans>Name</Trans>, className: "name", sortBy: sortBy.name },
|
{ title: <Trans>Name</Trans>, className: "name", sortBy: sortBy.name },
|
||||||
{ title: <Trans>Namespace</Trans>, className: "namespace", sortBy: sortBy.namespace },
|
{ title: <Trans>Namespace</Trans>, className: "namespace", sortBy: sortBy.namespace },
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user