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
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
22c9d03edb
commit
defb0ea0dd
55 files changed
+498
-490
No files matched your search
@@ -25,7 +25,6 @@ import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import type { RouteComponentProps } from "react-router-dom";
|
||||
import type { EndpointRouteParams } from "./endpoints.route";
|
||||
import type { Endpoint } from "../../api/endpoints/endpoint.api";
|
||||
import { endpointStore } from "./endpoints.store";
|
||||
import { KubeObjectListLayout } from "../kube-object";
|
||||
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
||||
@@ -49,12 +48,12 @@ export class Endpoints extends React.Component<Props> {
|
||||
tableId="network_endpoints"
|
||||
className="Endpoints" store={endpointStore}
|
||||
sortingCallbacks={{
|
||||
[columnId.name]: (endpoint: Endpoint) => endpoint.getName(),
|
||||
[columnId.namespace]: (endpoint: Endpoint) => endpoint.getNs(),
|
||||
[columnId.age]: (endpoint: Endpoint) => endpoint.getTimeDiffFromNow(),
|
||||
[columnId.name]: endpoint => endpoint.getName(),
|
||||
[columnId.namespace]: endpoint => endpoint.getNs(),
|
||||
[columnId.age]: endpoint => endpoint.getTimeDiffFromNow(),
|
||||
}}
|
||||
searchFilters={[
|
||||
(endpoint: Endpoint) => endpoint.getSearchFields()
|
||||
endpoint => endpoint.getSearchFields()
|
||||
]}
|
||||
renderHeaderTitle="Endpoints"
|
||||
renderTableHeader={[
|
||||
@@ -64,7 +63,7 @@ export class Endpoints extends React.Component<Props> {
|
||||
{ title: "Endpoints", className: "endpoints", id: columnId.endpoints },
|
||||
{ title: "Age", className: "age", sortBy: columnId.age, id: columnId.age },
|
||||
]}
|
||||
renderTableContents={(endpoint: Endpoint) => [
|
||||
renderTableContents={endpoint => [
|
||||
endpoint.getName(),
|
||||
<KubeObjectStatusIcon key="icon" object={endpoint} />,
|
||||
endpoint.getNs(),
|
||||
@@ -72,7 +71,7 @@ export class Endpoints extends React.Component<Props> {
|
||||
endpoint.getAge(),
|
||||
]}
|
||||
tableProps={{
|
||||
customRowHeights: (item: Endpoint, lineHeight, paddings) => {
|
||||
customRowHeights: (item, lineHeight, paddings) => {
|
||||
const lines = item.getEndpointSubsets().length || 1;
|
||||
|
||||
return lines * lineHeight + paddings;
|
||||
|
||||
Reference in new issue
Block a user