index.community/frontend/src/redux/types.ts

82 lines
1.5 KiB
TypeScript
Raw Normal View History

2018-08-27 15:27:09 +00:00
export enum ActionType {
SELECT_INSTANCE = "SELECT_INSTANCE",
REQUEST_INSTANCES = "REQUEST_INSTANCES",
RECEIVE_INSTANCES = "RECEIVE_INSTANCES",
REQUEST_GRAPH = "REQUEST_GRAPH",
RECEIVE_GRAPH = "RECEIVE_GRAPH",
RECEIVE_INSTANCE_DETAILS = "RECEIVE_INSTANCE_DETAILS",
DESELECT_INSTANCE = "DESELECT_INSTANCE",
GRAPH_LOAD_ERROR = "GRAPH_LOAD_ERROR",
INSTANCE_LOAD_ERROR = "INSTANCE_LOAD_ERROR"
2018-08-27 15:27:09 +00:00
}
export interface IAction {
type: ActionType;
payload: any;
2018-08-27 15:27:09 +00:00
}
export interface IInstance {
name: string;
2018-08-27 15:27:09 +00:00
}
2018-09-01 17:24:05 +00:00
export interface IInstanceDetails {
name: string;
description?: string;
version?: string;
2019-07-18 15:20:09 +00:00
userCount?: number;
insularity?: number;
statusCount?: number;
domainCount?: number;
peers?: IInstance[];
lastUpdated?: string;
status: string;
2018-09-01 17:24:05 +00:00
}
interface IGraphNode {
data: {
id: string;
label: string;
size: number;
};
position: {
x: number;
y: number;
};
}
interface IGraphEdge {
data: {
source: string;
target: string;
id: string;
weight: number;
};
}
export interface IGraph {
nodes: IGraphNode[];
edges: IGraphEdge[];
}
// Redux state
2018-09-01 17:24:05 +00:00
export interface ICurrentInstanceState {
currentInstanceDetails: IInstanceDetails | null;
currentInstanceName: string | null;
isLoadingInstanceDetails: boolean;
error: boolean;
2018-09-01 17:24:05 +00:00
}
2018-08-27 15:27:09 +00:00
export interface IDataState {
instances?: IInstance[];
graph?: IGraph;
isLoadingInstances: boolean;
isLoadingGraph: boolean;
error: boolean;
2018-08-27 15:27:09 +00:00
}
export interface IAppState {
currentInstance: ICurrentInstanceState;
data: IDataState;
2018-09-01 17:24:05 +00:00
}