Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Show system roles on Roles page #355

Merged
merged 2 commits into from
May 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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[]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need as Role[] here?

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