Skip to content

Commit 1a4692b

Browse files
committed
[grid] Polling data from GraphQL
- Deleting unused files as well
1 parent 9b327e9 commit 1a4692b

File tree

7 files changed

+7
-107
lines changed

7 files changed

+7
-107
lines changed

javascript/grid-ui/public/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<link href="%PUBLIC_URL%/manifest.json" rel="manifest"/>
1010
<link href="%PUBLIC_URL%/css/bootstrap.min.css" rel="stylesheet">
1111
<link href="%PUBLIC_URL%/css/fontawesome.min.css" rel="stylesheet">
12-
<title>Grid Console</title>
12+
<title>Selenium Grid</title>
1313
</head>
1414

1515
<body>

javascript/grid-ui/src/components/Node/Node.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ export default function Node(props) {
9797
};
9898
const nodeInfo: NodeType = props.node;
9999
const sessionCount = nodeInfo.sessionCount ?? 0;
100-
const currentLoad = sessionCount / nodeInfo.maxSession;
100+
const currentLoad = sessionCount === 0 ? 0 :
101+
Math.min(((sessionCount / nodeInfo.maxSession) * 100), 100).toFixed(2);
101102
// Assuming we will put 3 stereotypes per column.
102103
const stereotypeColumns = Math.round(nodeInfo.slotStereotypes.length / 3);
103104
// Then we need to know how many columns we will display.

javascript/grid-ui/src/components/TopBar.tsx

-32
This file was deleted.

javascript/grid-ui/src/config.ts

+1-13
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,13 @@
22
export const GridConfig = {
33
/** core/Status.ts */
44
status: {
5-
/** The xhr polling time interval used in core/Status.ts */
5+
/** How often we poll the GraphQL endpoint */
66
xhrPollingIntervalMillis: 5000,
77
},
88

9-
/** RingSystem.tsx */
10-
ringsystem: {
11-
defaultRingRadius: 100,
12-
defaultRingStroke: 10,
13-
},
14-
159
/** Server config */
1610
serverUri:
1711
process.env.NODE_ENV === "development"
1812
? "http://localhost:4444/graphql"
1913
: document.location.protocol + "//" + document.location.host + "/graphql",
20-
21-
/** Keybinds config */
22-
globalKeybinds: {
23-
toggleKeybindsPage: "ctrl + /",
24-
},
25-
/* Look at console.keybinds.ts for keybinds for the console.tsx */
2614
};

javascript/grid-ui/src/screens/Overview/Overview.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {useQuery} from "@apollo/client";
2626
import NodeType from "../../models/node";
2727
import {Link} from "@material-ui/core";
2828
import OsInfoType from "../../models/os-info";
29+
import {GridConfig} from "../../config";
2930

3031
function Copyright() {
3132
return (
@@ -147,7 +148,8 @@ export default function Overview() {
147148
};
148149
const fixedHeightPaper = clsx(classes.paper, classes.fixedHeight);
149150

150-
const {loading, error, data} = useQuery(GRID_QUERY);
151+
const {loading, error, data} = useQuery(GRID_QUERY,
152+
{pollInterval: GridConfig.status.xhrPollingIntervalMillis, fetchPolicy: "network-only"});
151153
if (loading) return <p>Loading...</p>;
152154
if (error) return <p>`Error! ${error.message}`</p>;
153155

javascript/grid-ui/src/tests/components/ColorInfo.test.tsx

-32
This file was deleted.

javascript/grid-ui/src/tests/components/Ring.test.tsx

-27
This file was deleted.

0 commit comments

Comments
 (0)