2019-07-21 18:05:07 +00:00
|
|
|
import { RouterState } from "connected-react-router";
|
|
|
|
|
2018-08-27 15:27:09 +00:00
|
|
|
export enum ActionType {
|
2019-07-23 12:20:34 +00:00
|
|
|
// Instance details
|
2019-07-21 18:05:07 +00:00
|
|
|
REQUEST_INSTANCE_DETAILS = "REQUEST_INSTANCE_DETAILS",
|
2019-07-23 12:20:34 +00:00
|
|
|
RECEIVE_INSTANCE_DETAILS = "RECEIVE_INSTANCE_DETAILS",
|
|
|
|
INSTANCE_LOAD_ERROR = "INSTANCE_LOAD_ERROR",
|
|
|
|
// Graph
|
2019-04-17 10:44:48 +00:00
|
|
|
REQUEST_GRAPH = "REQUEST_GRAPH",
|
|
|
|
RECEIVE_GRAPH = "RECEIVE_GRAPH",
|
|
|
|
GRAPH_LOAD_ERROR = "GRAPH_LOAD_ERROR",
|
2019-07-23 12:20:34 +00:00
|
|
|
// Nav
|
|
|
|
DESELECT_INSTANCE = "DESELECT_INSTANCE",
|
|
|
|
// Search
|
|
|
|
REQUEST_SEARCH_RESULTS = "REQUEST_SEARCH_RESULTS",
|
|
|
|
RECEIVE_SEARCH_RESULTS = "RECEIVE_SEARCH_RESULTS",
|
|
|
|
SEARCH_RESULTS_ERROR = "SEARCH_RESULTS_ERROR",
|
2019-07-26 22:30:11 +00:00
|
|
|
RESET_SEARCH = "RESET_SEARCH",
|
|
|
|
// Search -- hovering over results
|
|
|
|
SET_SEARCH_RESULT_HOVER = "SET_SEARCH_RESULT_HOVER"
|
2018-08-27 15:27:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IAction {
|
2019-04-17 10:44:48 +00:00
|
|
|
type: ActionType;
|
|
|
|
payload: any;
|
2018-08-27 15:27:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IInstance {
|
2019-04-17 10:44:48 +00:00
|
|
|
name: string;
|
2018-08-27 15:27:09 +00:00
|
|
|
}
|
|
|
|
|
2019-07-23 12:20:34 +00:00
|
|
|
export interface ISearchResultInstance {
|
|
|
|
name: string;
|
|
|
|
description?: string;
|
|
|
|
userCount?: number;
|
2019-07-24 15:51:44 +00:00
|
|
|
type?: string;
|
2019-07-23 12:20:34 +00:00
|
|
|
}
|
|
|
|
|
2018-09-01 17:24:05 +00:00
|
|
|
export interface IInstanceDetails {
|
2019-04-17 10:44:48 +00:00
|
|
|
name: string;
|
|
|
|
description?: string;
|
|
|
|
version?: string;
|
2019-07-18 15:20:09 +00:00
|
|
|
userCount?: number;
|
|
|
|
insularity?: number;
|
|
|
|
statusCount?: number;
|
|
|
|
domainCount?: number;
|
|
|
|
peers?: IInstance[];
|
2019-04-17 10:44:48 +00:00
|
|
|
lastUpdated?: string;
|
|
|
|
status: string;
|
2019-07-24 16:25:20 +00:00
|
|
|
type?: string;
|
2018-09-01 17:24:05 +00:00
|
|
|
}
|
|
|
|
|
2018-09-01 13:32:04 +00:00
|
|
|
interface IGraphNode {
|
2019-07-18 10:21:12 +00:00
|
|
|
data: {
|
|
|
|
id: string;
|
|
|
|
label: string;
|
|
|
|
size: number;
|
|
|
|
};
|
|
|
|
position: {
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
};
|
2018-09-01 13:32:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
interface IGraphEdge {
|
2019-07-18 10:21:12 +00:00
|
|
|
data: {
|
|
|
|
source: string;
|
|
|
|
target: string;
|
|
|
|
id: string;
|
|
|
|
weight: number;
|
|
|
|
};
|
2018-09-01 13:32:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IGraph {
|
2019-04-17 10:44:48 +00:00
|
|
|
nodes: IGraphNode[];
|
|
|
|
edges: IGraphEdge[];
|
2018-09-01 13:32:04 +00:00
|
|
|
}
|
|
|
|
|
2019-07-23 12:20:34 +00:00
|
|
|
export interface ISearchResponse {
|
|
|
|
results: ISearchResultInstance[];
|
|
|
|
next: string | null;
|
|
|
|
}
|
|
|
|
|
2018-09-01 13:32:04 +00:00
|
|
|
// Redux state
|
|
|
|
|
2019-07-21 18:05:07 +00:00
|
|
|
// The current instance name is stored in the URL. See state -> router -> location
|
2018-09-01 17:24:05 +00:00
|
|
|
export interface ICurrentInstanceState {
|
2019-04-17 10:44:48 +00:00
|
|
|
currentInstanceDetails: IInstanceDetails | null;
|
|
|
|
isLoadingInstanceDetails: boolean;
|
|
|
|
error: boolean;
|
2018-09-01 17:24:05 +00:00
|
|
|
}
|
|
|
|
|
2018-08-27 15:27:09 +00:00
|
|
|
export interface IDataState {
|
2019-04-17 10:44:48 +00:00
|
|
|
graph?: IGraph;
|
|
|
|
isLoadingGraph: boolean;
|
|
|
|
error: boolean;
|
2018-08-27 15:27:09 +00:00
|
|
|
}
|
|
|
|
|
2019-07-23 12:20:34 +00:00
|
|
|
export interface ISearchState {
|
|
|
|
error: boolean;
|
|
|
|
isLoadingResults: boolean;
|
|
|
|
next: string;
|
|
|
|
query: string;
|
|
|
|
results: ISearchResultInstance[];
|
2019-07-26 22:30:11 +00:00
|
|
|
hoveringOverResult?: string;
|
2019-07-23 12:20:34 +00:00
|
|
|
}
|
|
|
|
|
2018-08-27 15:27:09 +00:00
|
|
|
export interface IAppState {
|
2019-07-21 18:05:07 +00:00
|
|
|
router: RouterState;
|
2019-04-17 10:44:48 +00:00
|
|
|
currentInstance: ICurrentInstanceState;
|
|
|
|
data: IDataState;
|
2019-07-23 12:20:34 +00:00
|
|
|
search: ISearchState;
|
2018-09-01 17:24:05 +00:00
|
|
|
}
|