Reorganize Node components and state

This commit is contained in:
maciejhirsz
2018-08-10 14:36:05 +02:00
parent 7f4b87eae4
commit ba545799fe
14 changed files with 218 additions and 177 deletions
+11 -2
View File
@@ -1,6 +1,15 @@
import { Node } from './components/Node';
import { Types, Maybe } from '@dotstats/common';
export namespace State {
export interface Node {
id: Types.NodeId;
nodeDetails: Types.NodeDetails;
nodeStats: Types.NodeStats;
blockDetails: Types.BlockDetails;
location: Maybe<Types.NodeLocation>;
}
}
export interface State {
status: 'online' | 'offline' | 'upgrade-requested';
best: Types.BlockNumber;
@@ -9,7 +18,7 @@ export interface State {
timeDiff: Types.Milliseconds;
subscribed: Maybe<Types.ChainLabel>;
chains: Map<Types.ChainLabel, Types.NodeCount>;
nodes: Map<Types.NodeId, Node.Props>;
nodes: Map<Types.NodeId, State.Node>;
}
export type Update = <K extends keyof State>(changes: Pick<State, K> | null) => Readonly<State>;