mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Improve Table typing and remove annotations on callbacks (#2981)
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
c6a4d55d86
commit
64ac04186b
59 files changed
+487
-482
No files matched your search
@@ -24,7 +24,6 @@ import "./view.scss";
|
||||
import { observer } from "mobx-react";
|
||||
import React from "react";
|
||||
import type { RouteComponentProps } from "react-router";
|
||||
import type { ClusterRoleBinding } from "../../../api/endpoints";
|
||||
import { KubeObjectListLayout } from "../../kube-object";
|
||||
import { KubeObjectStatusIcon } from "../../kube-object-status-icon";
|
||||
import { ClusterRoleBindingDialog } from "./dialog";
|
||||
@@ -55,13 +54,13 @@ export class ClusterRoleBindings extends React.Component<Props> {
|
||||
store={clusterRoleBindingsStore}
|
||||
dependentStores={[clusterRolesStore, serviceAccountsStore]}
|
||||
sortingCallbacks={{
|
||||
[columnId.name]: (binding: ClusterRoleBinding) => binding.getName(),
|
||||
[columnId.bindings]: (binding: ClusterRoleBinding) => binding.getSubjectNames(),
|
||||
[columnId.age]: (binding: ClusterRoleBinding) => binding.getTimeDiffFromNow(),
|
||||
[columnId.name]: binding => binding.getName(),
|
||||
[columnId.bindings]: binding => binding.getSubjectNames(),
|
||||
[columnId.age]: binding => binding.getTimeDiffFromNow(),
|
||||
}}
|
||||
searchFilters={[
|
||||
(binding: ClusterRoleBinding) => binding.getSearchFields(),
|
||||
(binding: ClusterRoleBinding) => binding.getSubjectNames(),
|
||||
binding => binding.getSearchFields(),
|
||||
binding => binding.getSubjectNames(),
|
||||
]}
|
||||
renderHeaderTitle="Cluster Role Bindings"
|
||||
renderTableHeader={[
|
||||
@@ -70,7 +69,7 @@ export class ClusterRoleBindings extends React.Component<Props> {
|
||||
{ title: "Bindings", className: "bindings", sortBy: columnId.bindings, id: columnId.bindings },
|
||||
{ title: "Age", className: "age", sortBy: columnId.age, id: columnId.age },
|
||||
]}
|
||||
renderTableContents={(binding: ClusterRoleBinding) => [
|
||||
renderTableContents={binding => [
|
||||
binding.getName(),
|
||||
<KubeObjectStatusIcon key="icon" object={binding} />,
|
||||
binding.getSubjectNames(),
|
||||
|
||||
@@ -24,7 +24,6 @@ import "./view.scss";
|
||||
import { observer } from "mobx-react";
|
||||
import React from "react";
|
||||
import type { RouteComponentProps } from "react-router";
|
||||
import type { ClusterRole } from "../../../api/endpoints";
|
||||
import { KubeObjectListLayout } from "../../kube-object";
|
||||
import { KubeObjectStatusIcon } from "../../kube-object-status-icon";
|
||||
import { AddClusterRoleDialog } from "./add-dialog";
|
||||
@@ -51,11 +50,11 @@ export class ClusterRoles extends React.Component<Props> {
|
||||
className="ClusterRoles"
|
||||
store={clusterRolesStore}
|
||||
sortingCallbacks={{
|
||||
[columnId.name]: (clusterRole: ClusterRole) => clusterRole.getName(),
|
||||
[columnId.age]: (clusterRole: ClusterRole) => clusterRole.getTimeDiffFromNow(),
|
||||
[columnId.name]: clusterRole => clusterRole.getName(),
|
||||
[columnId.age]: clusterRole => clusterRole.getTimeDiffFromNow(),
|
||||
}}
|
||||
searchFilters={[
|
||||
(clusterRole: ClusterRole) => clusterRole.getSearchFields(),
|
||||
clusterRole => clusterRole.getSearchFields(),
|
||||
]}
|
||||
renderHeaderTitle="Cluster Roles"
|
||||
renderTableHeader={[
|
||||
@@ -63,7 +62,7 @@ export class ClusterRoles extends React.Component<Props> {
|
||||
{ className: "warning", showWithColumn: columnId.name },
|
||||
{ title: "Age", className: "age", sortBy: columnId.age, id: columnId.age },
|
||||
]}
|
||||
renderTableContents={(clusterRole: ClusterRole) => [
|
||||
renderTableContents={clusterRole => [
|
||||
clusterRole.getName(),
|
||||
<KubeObjectStatusIcon key="icon" object={clusterRole} />,
|
||||
clusterRole.getAge(),
|
||||
|
||||
@@ -23,7 +23,6 @@ import "./view.scss";
|
||||
import { observer } from "mobx-react";
|
||||
import React from "react";
|
||||
import type { RouteComponentProps } from "react-router";
|
||||
import type { RoleBinding } from "../../../api/endpoints";
|
||||
import { KubeObjectListLayout } from "../../kube-object";
|
||||
import { KubeObjectStatusIcon } from "../../kube-object-status-icon";
|
||||
import { RoleBindingDialog } from "./dialog";
|
||||
@@ -55,14 +54,14 @@ export class RoleBindings extends React.Component<Props> {
|
||||
store={roleBindingsStore}
|
||||
dependentStores={[rolesStore, clusterRolesStore, serviceAccountsStore]}
|
||||
sortingCallbacks={{
|
||||
[columnId.name]: (binding: RoleBinding) => binding.getName(),
|
||||
[columnId.namespace]: (binding: RoleBinding) => binding.getNs(),
|
||||
[columnId.bindings]: (binding: RoleBinding) => binding.getSubjectNames(),
|
||||
[columnId.age]: (binding: RoleBinding) => binding.getTimeDiffFromNow(),
|
||||
[columnId.name]: binding => binding.getName(),
|
||||
[columnId.namespace]: binding => binding.getNs(),
|
||||
[columnId.bindings]: binding => binding.getSubjectNames(),
|
||||
[columnId.age]: binding => binding.getTimeDiffFromNow(),
|
||||
}}
|
||||
searchFilters={[
|
||||
(binding: RoleBinding) => binding.getSearchFields(),
|
||||
(binding: RoleBinding) => binding.getSubjectNames(),
|
||||
binding => binding.getSearchFields(),
|
||||
binding => binding.getSubjectNames(),
|
||||
]}
|
||||
renderHeaderTitle="Role Bindings"
|
||||
renderTableHeader={[
|
||||
@@ -72,7 +71,7 @@ export class RoleBindings extends React.Component<Props> {
|
||||
{ title: "Bindings", className: "bindings", sortBy: columnId.bindings, id: columnId.bindings },
|
||||
{ title: "Age", className: "age", sortBy: columnId.age, id: columnId.age },
|
||||
]}
|
||||
renderTableContents={(binding: RoleBinding) => [
|
||||
renderTableContents={binding => [
|
||||
binding.getName(),
|
||||
<KubeObjectStatusIcon key="icon" object={binding} />,
|
||||
binding.getNs(),
|
||||
|
||||
@@ -24,7 +24,6 @@ import "./view.scss";
|
||||
import { observer } from "mobx-react";
|
||||
import React from "react";
|
||||
import type { RouteComponentProps } from "react-router";
|
||||
import type { Role } from "../../../api/endpoints";
|
||||
import { KubeObjectListLayout } from "../../kube-object";
|
||||
import { KubeObjectStatusIcon } from "../../kube-object-status-icon";
|
||||
import { AddRoleDialog } from "./add-dialog";
|
||||
@@ -51,12 +50,12 @@ export class Roles extends React.Component<Props> {
|
||||
className="Roles"
|
||||
store={rolesStore}
|
||||
sortingCallbacks={{
|
||||
[columnId.name]: (role: Role) => role.getName(),
|
||||
[columnId.namespace]: (role: Role) => role.getNs(),
|
||||
[columnId.age]: (role: Role) => role.getTimeDiffFromNow(),
|
||||
[columnId.name]: role => role.getName(),
|
||||
[columnId.namespace]: role => role.getNs(),
|
||||
[columnId.age]: role => role.getTimeDiffFromNow(),
|
||||
}}
|
||||
searchFilters={[
|
||||
(role: Role) => role.getSearchFields(),
|
||||
role => role.getSearchFields(),
|
||||
]}
|
||||
renderHeaderTitle="Roles"
|
||||
renderTableHeader={[
|
||||
@@ -65,7 +64,7 @@ export class Roles extends React.Component<Props> {
|
||||
{ title: "Namespace", className: "namespace", sortBy: columnId.namespace, id: columnId.namespace },
|
||||
{ title: "Age", className: "age", sortBy: columnId.age, id: columnId.age },
|
||||
]}
|
||||
renderTableContents={(role: Role) => [
|
||||
renderTableContents={role => [
|
||||
role.getName(),
|
||||
<KubeObjectStatusIcon key="icon" object={role} />,
|
||||
role.getNs(),
|
||||
|
||||
@@ -54,12 +54,12 @@ export class ServiceAccounts extends React.Component<Props> {
|
||||
tableId="access_service_accounts"
|
||||
className="ServiceAccounts" store={serviceAccountsStore}
|
||||
sortingCallbacks={{
|
||||
[columnId.name]: (account: ServiceAccount) => account.getName(),
|
||||
[columnId.namespace]: (account: ServiceAccount) => account.getNs(),
|
||||
[columnId.age]: (account: ServiceAccount) => account.getTimeDiffFromNow(),
|
||||
[columnId.name]: account => account.getName(),
|
||||
[columnId.namespace]: account => account.getNs(),
|
||||
[columnId.age]: account => account.getTimeDiffFromNow(),
|
||||
}}
|
||||
searchFilters={[
|
||||
(account: ServiceAccount) => account.getSearchFields(),
|
||||
account => account.getSearchFields(),
|
||||
]}
|
||||
renderHeaderTitle="Service Accounts"
|
||||
renderTableHeader={[
|
||||
@@ -68,7 +68,7 @@ export class ServiceAccounts extends React.Component<Props> {
|
||||
{ title: "Namespace", className: "namespace", sortBy: columnId.namespace, id: columnId.namespace },
|
||||
{ title: "Age", className: "age", sortBy: columnId.age, id: columnId.age },
|
||||
]}
|
||||
renderTableContents={(account: ServiceAccount) => [
|
||||
renderTableContents={account => [
|
||||
account.getName(),
|
||||
<KubeObjectStatusIcon key="icon" object={account} />,
|
||||
account.getNs(),
|
||||
|
||||
Reference in new issue
Block a user