mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
tweak
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
1c55e2f7f2
commit
5e19ca17c4
@ -47,6 +47,7 @@ import { eventStore } from "./+events/event.store";
|
||||
import { reaction, computed } from "mobx";
|
||||
import { nodesStore } from "./+nodes/nodes.store";
|
||||
import { podsStore } from "./+workloads-pods/pods.store";
|
||||
import { sum } from "lodash";
|
||||
|
||||
@observer
|
||||
export class App extends React.Component {
|
||||
@ -83,10 +84,13 @@ export class App extends React.Component {
|
||||
promises.push(nodesStore.loadAll());
|
||||
}
|
||||
await Promise.all(promises);
|
||||
|
||||
eventStore.subscribe();
|
||||
nodesStore.subscribe();
|
||||
podsStore.subscribe();
|
||||
if (eventStore.isLoaded && podsStore.isLoaded) {
|
||||
eventStore.subscribe();
|
||||
podsStore.subscribe();
|
||||
}
|
||||
if (nodesStore.isLoaded) {
|
||||
nodesStore.subscribe();
|
||||
}
|
||||
|
||||
reaction(() => this.warningsCount, (count) => {
|
||||
broadcastMessage(`cluster-warning-event-count:${cluster.id}`, count);
|
||||
@ -95,10 +99,8 @@ export class App extends React.Component {
|
||||
|
||||
@computed
|
||||
get warningsCount() {
|
||||
let warnings = 0;
|
||||
nodesStore.items.forEach(node => {
|
||||
warnings = warnings + node.getWarningConditions().length;
|
||||
});
|
||||
let warnings = sum(nodesStore.items
|
||||
.map(node => node.getWarningConditions().length));
|
||||
warnings = warnings + eventStore.getWarnings().length;
|
||||
|
||||
return warnings;
|
||||
|
||||
@ -41,9 +41,7 @@ export class ClusterIcon extends React.Component<Props> {
|
||||
|
||||
componentDidMount() {
|
||||
const subscriber = subscribeToBroadcast(this.eventCountBroadcast, (ev, eventCount) => {
|
||||
if (eventCount != this.eventCount) {
|
||||
this.eventCount = eventCount;
|
||||
}
|
||||
this.eventCount = eventCount;
|
||||
});
|
||||
|
||||
disposeOnUnmount(this, [
|
||||
|
||||
Loading…
Reference in New Issue
Block a user