Skip to content

Commit

Permalink
Show system roles on Roles page (#355)
Browse files Browse the repository at this point in the history
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
  • Loading branch information
nevalla authored May 9, 2020
1 parent 5cd00bd commit 1c324a3
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Dialog, DialogProps } from "../dialog";
import { Wizard, WizardStep } from "../wizard";
import { Select, SelectOption } from "../select";
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 { Input } from "../input";
import { NamespaceSelect } from "../+namespaces/namespace-select";
Expand Down Expand Up @@ -152,7 +152,7 @@ export class AddRoleBindingDialog extends React.Component<Props> {
};

@computed get roleOptions(): BindingSelectOption[] {
let roles = rolesStore.items.filter(KubeObject.isNonSystem);
let roles = rolesStore.items as Role[]
if (this.bindContext) {
// show only cluster-roles or roles for selected context namespace
roles = roles.filter(role => !role.getNs() || role.getNs() === this.bindContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,6 @@ export class RoleBindings extends React.Component<Props> {
(binding: RoleBinding) => binding.getSubjectNames(),
]}
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={[
{ title: <Trans>Name</Trans>, className: "name", sortBy: sortBy.name },
{ title: <Trans>Bindings</Trans>, className: "bindings", sortBy: sortBy.bindings },
Expand Down
18 changes: 0 additions & 18 deletions dashboard/client/components/+user-management-roles/roles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { rolesStore } from "./roles.store";
import { clusterRoleApi, Role, roleApi } from "../../api/endpoints";
import { KubeObjectListLayout } from "../kube-object";
import { AddRoleDialog } from "./add-role-dialog";
import { Icon } from "../icon";
import { KubeObject } from "../../api/kube-object";
import { apiManager } from "../../api/api-manager";

enum sortBy {
Expand Down Expand Up @@ -39,23 +37,7 @@ export class Roles extends React.Component<Props> {
searchFilters={[
(role: Role) => role.getSearchFields(),
]}
filterItems={[
(items: Role[]) => items.filter(KubeObject.isNonSystem),
]}
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={[
{ title: <Trans>Name</Trans>, className: "name", sortBy: sortBy.name },
{ title: <Trans>Namespace</Trans>, className: "namespace", sortBy: sortBy.namespace },
Expand Down

0 comments on commit 1c324a3

Please # to comment.