1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2021-04-07 19:19:29 +03:00
parent 6a0dc61601
commit 6e79144b6d

View File

@ -1,8 +1,8 @@
import "./catalog.scss";
import React from "react";
import { observer } from "mobx-react";
import { disposeOnUnmount, observer } from "mobx-react";
import { ItemListLayout } from "../item-object-list";
import { IReactionDisposer, observable } from "mobx";
import { observable } from "mobx";
import { CatalogEntityItem, CatalogEntityStore } from "./catalog-entity.store";
import { navigate } from "../../navigation";
import { kebabCase } from "lodash";
@ -26,7 +26,6 @@ enum sortBy {
export class Catalog extends React.Component {
@observable private catalogEntityStore?: CatalogEntityStore;
@observable.deep private contextMenu: CatalogEntityContextMenuContext;
private disposers: IReactionDisposer[] = [];
componentDidMount() {
this.contextMenu = {
@ -34,7 +33,9 @@ export class Catalog extends React.Component {
navigate: (url: string) => navigate(url)
};
this.catalogEntityStore = new CatalogEntityStore();
this.disposers.push(this.catalogEntityStore.watch());
disposeOnUnmount(this, [
this.catalogEntityStore.watch()
]);
if (this.catalogEntityStore.items.length === 0) {
Notifications.info(<><b>Welcome!</b><p>Get started by associating one or more clusters to Lens</p></>, {
@ -44,10 +45,6 @@ export class Catalog extends React.Component {
}
}
componentWillUnmount() {
this.disposers.forEach((d) => d());
}
addToHotbar(item: CatalogEntityItem) {
const hotbar = hotbarStore.getByName("default"); // FIXME