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 2020-11-25 18:03:12 +02:00
parent 1c55e2f7f2
commit 5e19ca17c4
2 changed files with 11 additions and 11 deletions

View File

@ -47,6 +47,7 @@ import { eventStore } from "./+events/event.store";
import { reaction, computed } from "mobx"; import { reaction, computed } from "mobx";
import { nodesStore } from "./+nodes/nodes.store"; import { nodesStore } from "./+nodes/nodes.store";
import { podsStore } from "./+workloads-pods/pods.store"; import { podsStore } from "./+workloads-pods/pods.store";
import { sum } from "lodash";
@observer @observer
export class App extends React.Component { export class App extends React.Component {
@ -83,10 +84,13 @@ export class App extends React.Component {
promises.push(nodesStore.loadAll()); promises.push(nodesStore.loadAll());
} }
await Promise.all(promises); await Promise.all(promises);
if (eventStore.isLoaded && podsStore.isLoaded) {
eventStore.subscribe(); eventStore.subscribe();
nodesStore.subscribe(); podsStore.subscribe();
podsStore.subscribe(); }
if (nodesStore.isLoaded) {
nodesStore.subscribe();
}
reaction(() => this.warningsCount, (count) => { reaction(() => this.warningsCount, (count) => {
broadcastMessage(`cluster-warning-event-count:${cluster.id}`, count); broadcastMessage(`cluster-warning-event-count:${cluster.id}`, count);
@ -95,10 +99,8 @@ export class App extends React.Component {
@computed @computed
get warningsCount() { get warningsCount() {
let warnings = 0; let warnings = sum(nodesStore.items
nodesStore.items.forEach(node => { .map(node => node.getWarningConditions().length));
warnings = warnings + node.getWarningConditions().length;
});
warnings = warnings + eventStore.getWarnings().length; warnings = warnings + eventStore.getWarnings().length;
return warnings; return warnings;

View File

@ -41,9 +41,7 @@ export class ClusterIcon extends React.Component<Props> {
componentDidMount() { componentDidMount() {
const subscriber = subscribeToBroadcast(this.eventCountBroadcast, (ev, eventCount) => { const subscriber = subscribeToBroadcast(this.eventCountBroadcast, (ev, eventCount) => {
if (eventCount != this.eventCount) { this.eventCount = eventCount;
this.eventCount = eventCount;
}
}); });
disposeOnUnmount(this, [ disposeOnUnmount(this, [