mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Configurable columns in Access Control section
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
e55bce8d4d
commit
3ef06b961a
@ -7,7 +7,7 @@ import { podSecurityPoliciesStore } from "./pod-security-policies.store";
|
|||||||
import { PodSecurityPolicy } from "../../api/endpoints";
|
import { PodSecurityPolicy } from "../../api/endpoints";
|
||||||
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
||||||
|
|
||||||
enum sortBy {
|
enum columnId {
|
||||||
name = "name",
|
name = "name",
|
||||||
volumes = "volumes",
|
volumes = "volumes",
|
||||||
privileged = "privileged",
|
privileged = "privileged",
|
||||||
@ -19,14 +19,16 @@ export class PodSecurityPolicies extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<KubeObjectListLayout
|
<KubeObjectListLayout
|
||||||
|
isConfigurable
|
||||||
|
tableId="access_roles"
|
||||||
className="PodSecurityPolicies"
|
className="PodSecurityPolicies"
|
||||||
isClusterScoped={true}
|
isClusterScoped={true}
|
||||||
store={podSecurityPoliciesStore}
|
store={podSecurityPoliciesStore}
|
||||||
sortingCallbacks={{
|
sortingCallbacks={{
|
||||||
[sortBy.name]: (item: PodSecurityPolicy) => item.getName(),
|
[columnId.name]: (item: PodSecurityPolicy) => item.getName(),
|
||||||
[sortBy.volumes]: (item: PodSecurityPolicy) => item.getVolumes(),
|
[columnId.volumes]: (item: PodSecurityPolicy) => item.getVolumes(),
|
||||||
[sortBy.privileged]: (item: PodSecurityPolicy) => +item.isPrivileged(),
|
[columnId.privileged]: (item: PodSecurityPolicy) => +item.isPrivileged(),
|
||||||
[sortBy.age]: (item: PodSecurityPolicy) => item.metadata.creationTimestamp,
|
[columnId.age]: (item: PodSecurityPolicy) => item.metadata.creationTimestamp,
|
||||||
}}
|
}}
|
||||||
searchFilters={[
|
searchFilters={[
|
||||||
(item: PodSecurityPolicy) => item.getSearchFields(),
|
(item: PodSecurityPolicy) => item.getSearchFields(),
|
||||||
@ -35,11 +37,11 @@ export class PodSecurityPolicies extends React.Component {
|
|||||||
]}
|
]}
|
||||||
renderHeaderTitle="Pod Security Policies"
|
renderHeaderTitle="Pod Security Policies"
|
||||||
renderTableHeader={[
|
renderTableHeader={[
|
||||||
{ title: "Name", className: "name", sortBy: sortBy.name },
|
{ title: "Name", className: "name", sortBy: columnId.name, id: columnId.name },
|
||||||
{ className: "warning" },
|
{ className: "warning", showWithColumn: columnId.name },
|
||||||
{ title: "Privileged", className: "privileged", sortBy: sortBy.privileged },
|
{ title: "Privileged", className: "privileged", sortBy: columnId.privileged, id: columnId.privileged },
|
||||||
{ title: "Volumes", className: "volumes", sortBy: sortBy.volumes },
|
{ title: "Volumes", className: "volumes", sortBy: columnId.volumes, id: columnId.volumes },
|
||||||
{ title: "Age", className: "age", sortBy: sortBy.age },
|
{ title: "Age", className: "age", sortBy: columnId.age, id: columnId.age },
|
||||||
]}
|
]}
|
||||||
renderTableContents={(item: PodSecurityPolicy) => {
|
renderTableContents={(item: PodSecurityPolicy) => {
|
||||||
return [
|
return [
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import { KubeObjectListLayout } from "../kube-object";
|
|||||||
import { AddRoleBindingDialog } from "./add-role-binding-dialog";
|
import { AddRoleBindingDialog } from "./add-role-binding-dialog";
|
||||||
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
||||||
|
|
||||||
enum sortBy {
|
enum columnId {
|
||||||
name = "name",
|
name = "name",
|
||||||
namespace = "namespace",
|
namespace = "namespace",
|
||||||
bindings = "bindings",
|
bindings = "bindings",
|
||||||
@ -25,13 +25,15 @@ export class RoleBindings extends React.Component<Props> {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<KubeObjectListLayout
|
<KubeObjectListLayout
|
||||||
|
isConfigurable
|
||||||
|
tableId="access_role_bindings"
|
||||||
className="RoleBindings"
|
className="RoleBindings"
|
||||||
store={roleBindingsStore}
|
store={roleBindingsStore}
|
||||||
sortingCallbacks={{
|
sortingCallbacks={{
|
||||||
[sortBy.name]: (binding: RoleBinding) => binding.getName(),
|
[columnId.name]: (binding: RoleBinding) => binding.getName(),
|
||||||
[sortBy.namespace]: (binding: RoleBinding) => binding.getNs(),
|
[columnId.namespace]: (binding: RoleBinding) => binding.getNs(),
|
||||||
[sortBy.bindings]: (binding: RoleBinding) => binding.getSubjectNames(),
|
[columnId.bindings]: (binding: RoleBinding) => binding.getSubjectNames(),
|
||||||
[sortBy.age]: (binding: RoleBinding) => binding.metadata.creationTimestamp,
|
[columnId.age]: (binding: RoleBinding) => binding.metadata.creationTimestamp,
|
||||||
}}
|
}}
|
||||||
searchFilters={[
|
searchFilters={[
|
||||||
(binding: RoleBinding) => binding.getSearchFields(),
|
(binding: RoleBinding) => binding.getSearchFields(),
|
||||||
@ -39,11 +41,11 @@ export class RoleBindings extends React.Component<Props> {
|
|||||||
]}
|
]}
|
||||||
renderHeaderTitle="Role Bindings"
|
renderHeaderTitle="Role Bindings"
|
||||||
renderTableHeader={[
|
renderTableHeader={[
|
||||||
{ title: "Name", className: "name", sortBy: sortBy.name },
|
{ title: "Name", className: "name", sortBy: columnId.name, id: columnId.name },
|
||||||
{ className: "warning" },
|
{ className: "warning", showWithColumn: columnId.name },
|
||||||
{ title: "Bindings", className: "bindings", sortBy: sortBy.bindings },
|
{ title: "Namespace", className: "namespace", sortBy: columnId.namespace, id: columnId.namespace },
|
||||||
{ title: "Namespace", className: "namespace", sortBy: sortBy.namespace },
|
{ title: "Bindings", className: "bindings", sortBy: columnId.bindings, id: columnId.bindings },
|
||||||
{ title: "Age", className: "age", sortBy: sortBy.age },
|
{ title: "Age", className: "age", sortBy: columnId.age, id: columnId.age },
|
||||||
]}
|
]}
|
||||||
renderTableContents={(binding: RoleBinding) => [
|
renderTableContents={(binding: RoleBinding) => [
|
||||||
binding.getName(),
|
binding.getName(),
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import { KubeObjectListLayout } from "../kube-object";
|
|||||||
import { AddRoleDialog } from "./add-role-dialog";
|
import { AddRoleDialog } from "./add-role-dialog";
|
||||||
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
||||||
|
|
||||||
enum sortBy {
|
enum columnId {
|
||||||
name = "name",
|
name = "name",
|
||||||
namespace = "namespace",
|
namespace = "namespace",
|
||||||
age = "age",
|
age = "age",
|
||||||
@ -25,22 +25,24 @@ export class Roles extends React.Component<Props> {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<KubeObjectListLayout
|
<KubeObjectListLayout
|
||||||
|
isConfigurable
|
||||||
|
tableId="access_roles"
|
||||||
className="Roles"
|
className="Roles"
|
||||||
store={rolesStore}
|
store={rolesStore}
|
||||||
sortingCallbacks={{
|
sortingCallbacks={{
|
||||||
[sortBy.name]: (role: Role) => role.getName(),
|
[columnId.name]: (role: Role) => role.getName(),
|
||||||
[sortBy.namespace]: (role: Role) => role.getNs(),
|
[columnId.namespace]: (role: Role) => role.getNs(),
|
||||||
[sortBy.age]: (role: Role) => role.metadata.creationTimestamp,
|
[columnId.age]: (role: Role) => role.metadata.creationTimestamp,
|
||||||
}}
|
}}
|
||||||
searchFilters={[
|
searchFilters={[
|
||||||
(role: Role) => role.getSearchFields(),
|
(role: Role) => role.getSearchFields(),
|
||||||
]}
|
]}
|
||||||
renderHeaderTitle="Roles"
|
renderHeaderTitle="Roles"
|
||||||
renderTableHeader={[
|
renderTableHeader={[
|
||||||
{ title: "Name", className: "name", sortBy: sortBy.name },
|
{ title: "Name", className: "name", sortBy: columnId.name, id: columnId.name },
|
||||||
{ className: "warning" },
|
{ className: "warning", showWithColumn: columnId.name },
|
||||||
{ title: "Namespace", className: "namespace", sortBy: sortBy.namespace },
|
{ title: "Namespace", className: "namespace", sortBy: columnId.namespace, id: columnId.namespace },
|
||||||
{ title: "Age", className: "age", sortBy: sortBy.age },
|
{ title: "Age", className: "age", sortBy: columnId.age, id: columnId.age },
|
||||||
]}
|
]}
|
||||||
renderTableContents={(role: Role) => [
|
renderTableContents={(role: Role) => [
|
||||||
role.getName(),
|
role.getName(),
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import { CreateServiceAccountDialog } from "./create-service-account-dialog";
|
|||||||
import { kubeObjectMenuRegistry } from "../../../extensions/registries/kube-object-menu-registry";
|
import { kubeObjectMenuRegistry } from "../../../extensions/registries/kube-object-menu-registry";
|
||||||
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
||||||
|
|
||||||
enum sortBy {
|
enum columnId {
|
||||||
name = "name",
|
name = "name",
|
||||||
namespace = "namespace",
|
namespace = "namespace",
|
||||||
age = "age",
|
age = "age",
|
||||||
@ -30,21 +30,23 @@ export class ServiceAccounts extends React.Component<Props> {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<KubeObjectListLayout
|
<KubeObjectListLayout
|
||||||
|
isConfigurable
|
||||||
|
tableId="access_service_accounts"
|
||||||
className="ServiceAccounts" store={serviceAccountsStore}
|
className="ServiceAccounts" store={serviceAccountsStore}
|
||||||
sortingCallbacks={{
|
sortingCallbacks={{
|
||||||
[sortBy.name]: (account: ServiceAccount) => account.getName(),
|
[columnId.name]: (account: ServiceAccount) => account.getName(),
|
||||||
[sortBy.namespace]: (account: ServiceAccount) => account.getNs(),
|
[columnId.namespace]: (account: ServiceAccount) => account.getNs(),
|
||||||
[sortBy.age]: (account: ServiceAccount) => account.metadata.creationTimestamp,
|
[columnId.age]: (account: ServiceAccount) => account.metadata.creationTimestamp,
|
||||||
}}
|
}}
|
||||||
searchFilters={[
|
searchFilters={[
|
||||||
(account: ServiceAccount) => account.getSearchFields(),
|
(account: ServiceAccount) => account.getSearchFields(),
|
||||||
]}
|
]}
|
||||||
renderHeaderTitle="Service Accounts"
|
renderHeaderTitle="Service Accounts"
|
||||||
renderTableHeader={[
|
renderTableHeader={[
|
||||||
{ title: "Name", className: "name", sortBy: sortBy.name },
|
{ title: "Name", className: "name", sortBy: columnId.name, id: columnId.name },
|
||||||
{ className: "warning" },
|
{ className: "warning", showWithColumn: columnId.name },
|
||||||
{ title: "Namespace", className: "namespace", sortBy: sortBy.namespace },
|
{ title: "Namespace", className: "namespace", sortBy: columnId.namespace, id: columnId.namespace },
|
||||||
{ title: "Age", className: "age", sortBy: sortBy.age },
|
{ title: "Age", className: "age", sortBy: columnId.age, id: columnId.age },
|
||||||
]}
|
]}
|
||||||
renderTableContents={(account: ServiceAccount) => [
|
renderTableContents={(account: ServiceAccount) => [
|
||||||
account.getName(),
|
account.getName(),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user