Cleaning up

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev committed 2021-07-21 11:35:34 +03:00
1 parent 286beb4b26
commit 1443074632
4 files changed
+17 -10

No files matched your search

+12 -7
View File
@@ -44,6 +44,7 @@ import { CatalogMenu } from "./catalog-menu";
import { HotbarIcon } from "../hotbar/hotbar-icon";
import { RenderDelay } from "../render-delay/render-delay";
import { CatalogTopbar } from "../cluster-manager/catalog-topbar";
import type { TableSortCallback } from "../table";
export const previousActiveTab = createAppStorage("catalog-previous-active-tab", "");
@@ -194,8 +195,17 @@ export class Catalog extends React.Component<Props> {
renderList() {
const { activeCategory } = this.catalogEntityStore;
const tableId = activeCategory ? `catalog-items-${activeCategory.metadata.name.replace(" ", "")}` : "catalog-items";
let sortingCallbacks: { [sortBy: string]: TableSortCallback } = {
[sortBy.name]: (item: CatalogEntityItem<CatalogEntity>) => item.name,
[sortBy.source]: (item: CatalogEntityItem<CatalogEntity>) => item.source,
[sortBy.status]: (item: CatalogEntityItem<CatalogEntity>) => item.phase,
};
const tableId = activeCategory ? `catalog-items-${activeCategory?.metadata.name.replace(" ", "")}` : "catalog-items";
sortingCallbacks = activeCategory ? sortingCallbacks : {
...sortingCallbacks,
[sortBy.kind]: (item: CatalogEntityItem<CatalogEntity>) => item.kind,
};
if (this.activeTab === undefined) {
return null;
@@ -209,12 +219,7 @@ export class Catalog extends React.Component<Props> {
isConfigurable={true}
className="CatalogItemList"
store={this.catalogEntityStore}
sortingCallbacks={{
[sortBy.name]: (item: CatalogEntityItem<CatalogEntity>) => item.name,
[sortBy.kind]: (item: CatalogEntityItem<CatalogEntity>) => item.kind,
[sortBy.source]: (item: CatalogEntityItem<CatalogEntity>) => item.source,
[sortBy.status]: (item: CatalogEntityItem<CatalogEntity>) => item.phase,
}}
sortingCallbacks={sortingCallbacks}
searchFilters={[
(entity: CatalogEntityItem<CatalogEntity>) => entity.searchFields,
]}
+1 -1
View File
@@ -260,7 +260,7 @@ export class Menu extends React.Component<MenuProps, State> {
}
onBlur() {
if (!this.isOpen) return;
if (!this.isOpen) return; // Prevents triggering document.activeElement for each <Menu/> instance
if (document.activeElement?.tagName == "IFRAME") {
this.close();
@@ -39,7 +39,9 @@ export class RenderDelay extends React.Component<Props> {
}
componentDidMount() {
window.requestIdleCallback(this.showContents);
const guaranteedFireTime = 1000;
window.requestIdleCallback(this.showContents, { timeout: guaranteedFireTime });
}
componentWillUnmount() {