Skip to content

Commit

Permalink
ui: Latency page UI improvements
Browse files Browse the repository at this point in the history
- use connectivity endpoint as a source of connection statuses and latency;
- remove popup with disconnected peers, instead it will be shown
on latency matrix;

Release note: None
  • Loading branch information
koorosh committed Jun 20, 2023
1 parent 977a2cd commit c4960a8
Show file tree
Hide file tree
Showing 14 changed files with 677 additions and 583 deletions.
5 changes: 4 additions & 1 deletion pkg/ui/workspaces/db-console/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,10 @@ export const App: React.FC<AppProps> = (props: AppProps) => {
path={`/reports/network/:${nodeIDAttr}`}
component={Network}
/>
<Route exact path="/reports/network" component={Network} />
<Redirect
from={`/reports/network`}
to={`/reports/network/region`}
/>
<Route exact path="/reports/nodes" component={Nodes} />
<Route
exact
Expand Down
11 changes: 11 additions & 0 deletions pkg/ui/workspaces/db-console/src/redux/apiReducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,15 @@ const tenantsListObj = new CachedDataReducer(

export const refreshTenantsList = tenantsListObj.refresh;

const connectivityObj = new CachedDataReducer(
api.getNetworkConnectivity,
"connectivity",
moment.duration(30, "s"),
moment.duration(1, "minute"),
);

export const refreshConnectivity = connectivityObj.refresh;

export interface APIReducersState {
cluster: CachedDataReducerState<api.ClusterResponseMessage>;
events: CachedDataReducerState<
Expand Down Expand Up @@ -592,6 +601,7 @@ export interface APIReducersState {
snapshot: KeyedCachedDataReducerState<clusterUiApi.GetTracingSnapshotResponse>;
rawTrace: KeyedCachedDataReducerState<clusterUiApi.GetTraceResponse>;
tenants: CachedDataReducerState<api.ListTenantsResponseMessage>;
connectivity: CachedDataReducerState<api.NetworkConnectivityResponse>;
}

export const apiReducersReducer = combineReducers<APIReducersState>({
Expand Down Expand Up @@ -647,6 +657,7 @@ export const apiReducersReducer = combineReducers<APIReducersState>({
[statementFingerprintInsightsReducerObj.actionNamespace]:
statementFingerprintInsightsReducerObj.reducer,
[tenantsListObj.actionNamespace]: tenantsListObj.reducer,
[connectivityObj.actionNamespace]: connectivityObj.reducer,
});

export { CachedDataReducerState, KeyedCachedDataReducerState };
Expand Down
4 changes: 4 additions & 0 deletions pkg/ui/workspaces/db-console/src/redux/connectivity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { AdminUIState } from "src/redux/state";

export const connectivitySelector = (state: AdminUIState) =>
state.cachedData.connectivity;
17 changes: 17 additions & 0 deletions pkg/ui/workspaces/db-console/src/util/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ export type ListTenantsRequestMessage =
export type ListTenantsResponseMessage =
protos.cockroach.server.serverpb.ListTenantsResponse;

export type NetworkConnectivityRequest =
protos.cockroach.server.serverpb.NetworkConnectivityRequest;
export type NetworkConnectivityResponse =
protos.cockroach.server.serverpb.NetworkConnectivityResponse;

// API constants

export const API_PREFIX = "_admin/v1";
Expand Down Expand Up @@ -851,6 +856,18 @@ export function getTenants(
);
}

export function getNetworkConnectivity(
req: NetworkConnectivityRequest,
timeout?: moment.Duration,
): Promise<NetworkConnectivityResponse> {
return timeoutFetch(
serverpb.NetworkConnectivityResponse,
`${STATUS_PREFIX}/connectivity`,
req as any,
timeout,
);
}

export function IsValidateUriName(...args: string[]): Promise<any> {
for (const name of args) {
if (name.includes("/")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ import React from "react";
import "./styles.styl";

interface IChipProps {
title: string;
type?: "green" | "lightgreen" | "grey" | "blue" | "lightblue" | "yellow";
title: React.ReactChild;
type?:
| "green"
| "lightgreen"
| "grey"
| "blue"
| "lightblue"
| "yellow"
| "red"
| "white";
}

export const Chip: React.SFC<IChipProps> = ({ title, type }) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@
background $chip-blue
&--yellow
background $chip-yellow
&--red
background $chip-red
&--white
background $colors--neutral-0
border-color #c0c6d9
border-style solid
border-width 1px
Loading

0 comments on commit c4960a8

Please sign in to comment.