mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
sync activeEntity to cluster renderer (#3323)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
538c6c2013
commit
ff704b5d3d
@ -19,7 +19,7 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { observable, makeObservable } from "mobx";
|
import { observable, makeObservable, reaction } from "mobx";
|
||||||
import { disposeOnUnmount, observer } from "mobx-react";
|
import { disposeOnUnmount, observer } from "mobx-react";
|
||||||
import { Redirect, Route, Router, Switch } from "react-router";
|
import { Redirect, Route, Router, Switch } from "react-router";
|
||||||
import { history } from "../navigation";
|
import { history } from "../navigation";
|
||||||
@ -69,6 +69,7 @@ import { Nodes } from "./+nodes";
|
|||||||
import { Workloads } from "./+workloads";
|
import { Workloads } from "./+workloads";
|
||||||
import { Config } from "./+config";
|
import { Config } from "./+config";
|
||||||
import { Storage } from "./+storage";
|
import { Storage } from "./+storage";
|
||||||
|
import { catalogEntityRegistry } from "../api/catalog-entity-registry";
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class App extends React.Component {
|
export class App extends React.Component {
|
||||||
@ -78,6 +79,7 @@ export class App extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async init() {
|
static async init() {
|
||||||
|
catalogEntityRegistry.init();
|
||||||
const frameId = webFrame.routingId;
|
const frameId = webFrame.routingId;
|
||||||
const clusterId = getHostedClusterId();
|
const clusterId = getHostedClusterId();
|
||||||
|
|
||||||
@ -86,6 +88,15 @@ export class App extends React.Component {
|
|||||||
|
|
||||||
await requestMain(clusterSetFrameIdHandler, clusterId);
|
await requestMain(clusterSetFrameIdHandler, clusterId);
|
||||||
await getHostedCluster().whenReady; // cluster.activate() is done at this point
|
await getHostedCluster().whenReady; // cluster.activate() is done at this point
|
||||||
|
|
||||||
|
const activeEntityDisposer = reaction(() => catalogEntityRegistry.getById(clusterId), (entity) => {
|
||||||
|
if (!entity) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catalogEntityRegistry.activeEntity = entity;
|
||||||
|
activeEntityDisposer();
|
||||||
|
}, {fireImmediately: true});
|
||||||
|
|
||||||
ExtensionLoader.getInstance().loadOnClusterRenderer();
|
ExtensionLoader.getInstance().loadOnClusterRenderer();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
appEventBus.emit({
|
appEventBus.emit({
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user