mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Watch-api streaming reworks (#1990)
* loading k8s resources into stores per selected namespaces -- part 1 Signed-off-by: Roman <ixrock@gmail.com> * loading k8s resources into stores per selected namespaces -- part 2 - fix: generating helm chart id Signed-off-by: Roman <ixrock@gmail.com> * loading k8s resources into stores per selected namespaces -- part 3 Signed-off-by: Roman <ixrock@gmail.com> * fixes Signed-off-by: Roman <ixrock@gmail.com> * fixes / responding to comments Signed-off-by: Roman <ixrock@gmail.com> * chore / small fixes Signed-off-by: Roman <ixrock@gmail.com> * Watch api does not work for non-admins with lots of namespaces #1898 -- part 1 Signed-off-by: Roman <ixrock@gmail.com> * fixes & refactoring Signed-off-by: Roman <ixrock@gmail.com> * make lint happy Signed-off-by: Roman <ixrock@gmail.com> * reset store on loading error Signed-off-by: Roman <ixrock@gmail.com> * added new cluster method: cluster.isAllowedResource Signed-off-by: Roman <ixrock@gmail.com> * fix: loading namespaces optimizations Signed-off-by: Roman <ixrock@gmail.com> * fixes & refactoring Signed-off-by: Roman <ixrock@gmail.com> * fix: parse multiple kube-events from stream's chunk Signed-off-by: Roman <ixrock@gmail.com> * fix: mobx issue with accessing empty observable array by index (removes warning), use common logger Signed-off-by: Roman <ixrock@gmail.com> * fine-tuning Signed-off-by: Roman <ixrock@gmail.com> * fix: parse json stream chunks at client-side (might be partial, depends on network speed) Signed-off-by: Roman <ixrock@gmail.com> * store subscribing refactoring -- part 1 Signed-off-by: Roman <ixrock@gmail.com> * store subscribing refactoring -- part 2 Signed-off-by: Roman <ixrock@gmail.com> * store subscribing refactoring -- part 3 Signed-off-by: Roman <ixrock@gmail.com> * store subscribing refactoring -- part 4 Signed-off-by: Roman <ixrock@gmail.com> * auto-reconnect on online/offline status change, interval connection check Signed-off-by: Roman <ixrock@gmail.com> * check connection every 5m Signed-off-by: Roman <ixrock@gmail.com> * split concurrent watch-api requests by 10 at a time + 150ms delay before next call Signed-off-by: Roman <ixrock@gmail.com> * refactoring / clean up Signed-off-by: Roman <ixrock@gmail.com> * use `plimit` + delay for k8s watch requests Signed-off-by: Roman <ixrock@gmail.com> * lint fix Signed-off-by: Roman <ixrock@gmail.com> * added explicit `preload: true` when subscribing stores Signed-off-by: Roman <ixrock@gmail.com> * kubeWatchApi refactoring / fine-tuning Signed-off-by: Roman <ixrock@gmail.com> * clean up Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
1 parent
7490b15aad
commit
078f952b36
20 files changed
+519
-395
No files matched your search
@@ -1,15 +1,17 @@
|
||||
import React from "react";
|
||||
import { computed } from "mobx";
|
||||
import { observer } from "mobx-react";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import { cssNames } from "../../utils";
|
||||
import { KubeObject } from "../../api/kube-object";
|
||||
import { ItemListLayout, ItemListLayoutProps } from "../item-object-list/item-list-layout";
|
||||
import { KubeObjectStore } from "../../kube-object.store";
|
||||
import { KubeObjectMenu } from "./kube-object-menu";
|
||||
import { kubeSelectedUrlParam, showDetails } from "./kube-object-details";
|
||||
import { kubeWatchApi } from "../../api/kube-watch-api";
|
||||
|
||||
export interface KubeObjectListLayoutProps extends ItemListLayoutProps {
|
||||
store: KubeObjectStore;
|
||||
dependentStores?: KubeObjectStore[];
|
||||
}
|
||||
|
||||
@observer
|
||||
@@ -18,6 +20,17 @@ export class KubeObjectListLayout extends React.Component<KubeObjectListLayoutPr
|
||||
return this.props.store.getByPath(kubeSelectedUrlParam.get());
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { store, dependentStores = [] } = this.props;
|
||||
const stores = Array.from(new Set([store, ...dependentStores]));
|
||||
|
||||
disposeOnUnmount(this, [
|
||||
kubeWatchApi.subscribeStores(stores, {
|
||||
preload: true
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
||||
onDetails = (item: KubeObject) => {
|
||||
if (this.props.onDetails) {
|
||||
this.props.onDetails(item);
|
||||
@@ -33,6 +46,7 @@ export class KubeObjectListLayout extends React.Component<KubeObjectListLayoutPr
|
||||
<ItemListLayout
|
||||
{...layoutProps}
|
||||
className={cssNames("KubeObjectListLayout", className)}
|
||||
preloadStores={false} // loading handled in kubeWatchApi.subscribeStores()
|
||||
detailsItem={this.selectedItem}
|
||||
onDetails={this.onDetails}
|
||||
renderItemMenu={(item) => {
|
||||
|
||||
Reference in new issue
Block a user