mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Make customizing ItemListLayout header explicitly reducable (#2956)
- Add search placeholder text for helm releases Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
757fed47fa
commit
ae2fa15b20
11 files changed
+122
-84
No files matched your search
@@ -30,7 +30,7 @@ import { EventStore, eventStore } from "./event.store";
|
||||
import { getDetailsUrl, KubeObjectListLayout, KubeObjectListLayoutProps } from "../kube-object";
|
||||
import type { KubeEvent } from "../../api/endpoints/events.api";
|
||||
import type { TableSortCallbacks, TableSortParams, TableProps } from "../table";
|
||||
import type { IHeaderPlaceholders } from "../item-object-list";
|
||||
import type { HeaderCustomizer } from "../item-object-list";
|
||||
import { Tooltip } from "../tooltip";
|
||||
import { Link } from "react-router-dom";
|
||||
import { cssNames, IClassName, stopPropagation } from "../../utils";
|
||||
@@ -112,19 +112,21 @@ export class Events extends React.Component<Props> {
|
||||
return this.items;
|
||||
}
|
||||
|
||||
customizeHeader = ({ info, title }: IHeaderPlaceholders) => {
|
||||
customizeHeader: HeaderCustomizer = ({ info, title, ...headerPlaceholders }) => {
|
||||
const { compact } = this.props;
|
||||
const { store, items, visibleItems } = this;
|
||||
const allEventsAreShown = visibleItems.length === items.length;
|
||||
|
||||
// handle "compact"-mode header
|
||||
if (compact) {
|
||||
if (allEventsAreShown) return title; // title == "Events"
|
||||
if (allEventsAreShown) {
|
||||
return { title };
|
||||
}
|
||||
|
||||
return <>
|
||||
{title}
|
||||
<span> ({visibleItems.length} of <Link to={eventsURL()}>{items.length}</Link>)</span>
|
||||
</>;
|
||||
return {
|
||||
title,
|
||||
info: <span> ({visibleItems.length} of <Link to={eventsURL()}>{items.length}</Link>)</span>,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -136,7 +138,9 @@ export class Events extends React.Component<Props> {
|
||||
className="help-icon"
|
||||
tooltip={`Limited to ${store.limit}`}
|
||||
/>
|
||||
</>
|
||||
</>,
|
||||
title,
|
||||
...headerPlaceholders
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user