mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Move <NamespaceSelectFilter> to KubeObjectListLayout
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
9ec6466ea7
commit
e048cf9062
@ -36,14 +36,12 @@ import { SearchInputUrl } from "../input";
|
||||
import { Filter, FilterType, pageFilters } from "./page-filters.store";
|
||||
import { PageFiltersList } from "./page-filters-list";
|
||||
import { PageFiltersSelect } from "./page-filters-select";
|
||||
import { NamespaceSelectFilter } from "../+namespaces/namespace-select-filter";
|
||||
import { ThemeStore } from "../../theme.store";
|
||||
import { MenuActions } from "../menu/menu-actions";
|
||||
import { MenuItem } from "../menu";
|
||||
import { Checkbox } from "../checkbox";
|
||||
import { UserStore } from "../../../common/user-store";
|
||||
import { namespaceStore } from "../+namespaces/namespace.store";
|
||||
import { KubeObjectStore } from "../../kube-object.store";
|
||||
|
||||
// todo: refactor, split to small re-usable components
|
||||
|
||||
@ -191,21 +189,6 @@ export class ItemListLayout extends React.Component<ItemListLayoutProps> {
|
||||
},
|
||||
};
|
||||
|
||||
@computed get isNamespaced(): boolean {
|
||||
const { store, dependentStores = [] } = this.props;
|
||||
const stores = new Set([store, ...dependentStores]);
|
||||
|
||||
for (const store of stores) {
|
||||
if (store instanceof KubeObjectStore) {
|
||||
if (store.api.isNamespaced) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@computed get isReady() {
|
||||
return this.props.isReady ?? this.props.store.isLoaded;
|
||||
}
|
||||
@ -412,12 +395,11 @@ export class ItemListLayout extends React.Component<ItemListLayoutProps> {
|
||||
const placeholders: IHeaderPlaceholders = {
|
||||
title: <h5 className="title">{title}</h5>,
|
||||
info: this.renderInfo(),
|
||||
filters: <>
|
||||
{this.isNamespaced && <NamespaceSelectFilter />}
|
||||
filters: (
|
||||
<PageFiltersSelect allowEmpty disableFilters={{
|
||||
[FilterType.NAMESPACE]: true, // namespace-select used instead
|
||||
}} />
|
||||
</>,
|
||||
),
|
||||
search: <SearchInputUrl />,
|
||||
};
|
||||
let header = this.renderHeaderContent(placeholders);
|
||||
|
||||
@ -30,6 +30,7 @@ import { KubeObjectMenu } from "./kube-object-menu";
|
||||
import { kubeSelectedUrlParam, showDetails } from "./kube-object-details";
|
||||
import { kubeWatchApi } from "../../api/kube-watch-api";
|
||||
import { clusterContext } from "../context";
|
||||
import { NamespaceSelectFilter } from "../+namespaces/namespace-select-filter";
|
||||
|
||||
export interface KubeObjectListLayoutProps extends ItemListLayoutProps {
|
||||
store: KubeObjectStore;
|
||||
@ -76,6 +77,15 @@ export class KubeObjectListLayout extends React.Component<KubeObjectListLayoutPr
|
||||
items={items}
|
||||
preloadStores={false} // loading handled in kubeWatchApi.subscribeStores()
|
||||
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
|
||||
/>
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user