mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
revert to simpler NamespaceSelectFilter fix
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
e048cf9062
commit
c6bfb7d1b8
@ -42,6 +42,8 @@ import { MenuItem } from "../menu";
|
|||||||
import { Checkbox } from "../checkbox";
|
import { Checkbox } from "../checkbox";
|
||||||
import { UserStore } from "../../../common/user-store";
|
import { UserStore } from "../../../common/user-store";
|
||||||
import { namespaceStore } from "../+namespaces/namespace.store";
|
import { namespaceStore } from "../+namespaces/namespace.store";
|
||||||
|
import { KubeObjectStore } from "../../kube-object.store";
|
||||||
|
import { NamespaceSelectFilter } from "../+namespaces/namespace-select-filter";
|
||||||
|
|
||||||
// todo: refactor, split to small re-usable components
|
// todo: refactor, split to small re-usable components
|
||||||
|
|
||||||
@ -390,15 +392,22 @@ export class ItemListLayout extends React.Component<ItemListLayoutProps> {
|
|||||||
renderHeader() {
|
renderHeader() {
|
||||||
const { showHeader, customizeHeader, renderHeaderTitle, headerClassName } = this.props;
|
const { showHeader, customizeHeader, renderHeaderTitle, headerClassName } = this.props;
|
||||||
|
|
||||||
if (!showHeader) return null;
|
if (!showHeader) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const showNamespaceSelectFilter = this.props.store instanceof KubeObjectStore && this.props.store.api.isNamespaced;
|
||||||
const title = typeof renderHeaderTitle === "function" ? renderHeaderTitle(this) : renderHeaderTitle;
|
const title = typeof renderHeaderTitle === "function" ? renderHeaderTitle(this) : renderHeaderTitle;
|
||||||
const placeholders: IHeaderPlaceholders = {
|
const placeholders: IHeaderPlaceholders = {
|
||||||
title: <h5 className="title">{title}</h5>,
|
title: <h5 className="title">{title}</h5>,
|
||||||
info: this.renderInfo(),
|
info: this.renderInfo(),
|
||||||
filters: (
|
filters: (
|
||||||
|
<>
|
||||||
|
{showNamespaceSelectFilter && <NamespaceSelectFilter />}
|
||||||
<PageFiltersSelect allowEmpty disableFilters={{
|
<PageFiltersSelect allowEmpty disableFilters={{
|
||||||
[FilterType.NAMESPACE]: true, // namespace-select used instead
|
[FilterType.NAMESPACE]: true, // namespace-select used instead
|
||||||
}} />
|
}} />
|
||||||
|
</>
|
||||||
),
|
),
|
||||||
search: <SearchInputUrl />,
|
search: <SearchInputUrl />,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -30,7 +30,6 @@ import { KubeObjectMenu } from "./kube-object-menu";
|
|||||||
import { kubeSelectedUrlParam, showDetails } from "./kube-object-details";
|
import { kubeSelectedUrlParam, showDetails } from "./kube-object-details";
|
||||||
import { kubeWatchApi } from "../../api/kube-watch-api";
|
import { kubeWatchApi } from "../../api/kube-watch-api";
|
||||||
import { clusterContext } from "../context";
|
import { clusterContext } from "../context";
|
||||||
import { NamespaceSelectFilter } from "../+namespaces/namespace-select-filter";
|
|
||||||
|
|
||||||
export interface KubeObjectListLayoutProps extends ItemListLayoutProps {
|
export interface KubeObjectListLayoutProps extends ItemListLayoutProps {
|
||||||
store: KubeObjectStore;
|
store: KubeObjectStore;
|
||||||
@ -77,15 +76,6 @@ export class KubeObjectListLayout extends React.Component<KubeObjectListLayoutPr
|
|||||||
items={items}
|
items={items}
|
||||||
preloadStores={false} // loading handled in kubeWatchApi.subscribeStores()
|
preloadStores={false} // loading handled in kubeWatchApi.subscribeStores()
|
||||||
detailsItem={this.selectedItem}
|
detailsItem={this.selectedItem}
|
||||||
customizeHeader={({ filters, ...placeholders }) => ({
|
|
||||||
filters: (
|
|
||||||
<>
|
|
||||||
{store.api.isNamespaced && <NamespaceSelectFilter />}
|
|
||||||
{filters}
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
...placeholders,
|
|
||||||
})}
|
|
||||||
renderItemMenu={(item: KubeObject) => <KubeObjectMenu object={item} />} // safe because we are dealing with KubeObjects here
|
renderItemMenu={(item: KubeObject) => <KubeObjectMenu object={item} />} // safe because we are dealing with KubeObjects here
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user