Skip to content

Commit d404773

Browse files
committed
Auto reconnect
1 parent 823daae commit d404773

File tree

3 files changed

+286
-233
lines changed

3 files changed

+286
-233
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jderobot-ide-interface",
3-
"version": "0.2.14",
3+
"version": "0.2.15",
44
"main": "dist/main.js",
55
"typings": "dist/index.d.ts",
66
"files": [
@@ -45,7 +45,7 @@
4545
},
4646
"dependencies": {
4747
"@monaco-editor/react": "^4.7.0",
48-
"jderobot-commsmanager": "1.0.4",
48+
"jderobot-commsmanager": "^1.0.10",
4949
"jszip": "^3.10.1",
5050
"lodash": "^4.17.21",
5151
"monaco-editor": "^0.52.2",

src/components/StatusBar/StatusBar.tsx

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ const StatusBar = ({
2727
}) => {
2828
const theme = useTheme();
2929
const [dockerData, setDockerData] = useState<any>(
30-
commsManager?.getHostData(),
30+
commsManager?.getHostData()
3131
);
3232
const [state, setState] = useState<string | undefined>(
33-
commsManager?.getState(),
33+
commsManager?.getState()
3434
);
3535
const connectWithRetry = async () => {
3636
const data = commsManager?.getHostData();
@@ -81,12 +81,12 @@ const StatusBar = ({
8181
hoverColor={theme.palette.button.hoverWarning}
8282
id={`reset-connection`}
8383
onClick={() => {
84-
resetManager();
84+
// resetManager();
8585
}}
86-
title="Reconnect with Robotics Backend"
86+
title="Connecting with Robotics Backend"
8787
>
8888
<ResetIcon viewBox="0 0 20 20" stroke={theme.palette.darkText} />
89-
<label>Reconnect</label>
89+
<label>Connecting ...</label>
9090
</StyledStatusBarButton>
9191
)}
9292
<StyledStatusBarEntry
@@ -110,7 +110,7 @@ const StatusBar = ({
110110
baseUniverse={baseUniverse}
111111
/>
112112
)}
113-
<div style={{"marginLeft": "auto"}}/>
113+
<div style={{ marginLeft: "auto" }} />
114114
{extraComponents.extras.map((component: any) => {
115115
return component;
116116
})}
@@ -124,7 +124,7 @@ const DefaultUniverseSelector = ({
124124
project,
125125
commsManager,
126126
api,
127-
baseUniverse
127+
baseUniverse,
128128
}: {
129129
project: string;
130130
commsManager: CommsManager | null;
@@ -133,7 +133,7 @@ const DefaultUniverseSelector = ({
133133
}) => {
134134
const { warning, error } = useError();
135135
const [universe, setUniverse] = useState<string | undefined>(
136-
commsManager?.getUniverse(),
136+
commsManager?.getUniverse()
137137
);
138138

139139
const [universeList, setUniverseList] = useState<string[]>([]);
@@ -155,14 +155,14 @@ const DefaultUniverseSelector = ({
155155

156156
useEffect(() => {
157157
if (baseUniverse !== undefined) {
158-
selectUniverse(baseUniverse)
158+
selectUniverse(baseUniverse);
159159
}
160160
}, [baseUniverse]);
161161

162162
const terminateUniverse = async () => {
163163
if (!commsManager) {
164164
warning(
165-
"Failed to connect with the Robotics Backend docker. Please make sure it is connected.",
165+
"Failed to connect with the Robotics Backend docker. Please make sure it is connected."
166166
);
167167
return;
168168
}
@@ -175,7 +175,7 @@ const DefaultUniverseSelector = ({
175175
const launchUniverse = async (universe: string) => {
176176
if (!commsManager) {
177177
warning(
178-
"Failed to connect with the Robotics Backend docker. Please make sure it is connected.",
178+
"Failed to connect with the Robotics Backend docker. Please make sure it is connected."
179179
);
180180
return;
181181
}
@@ -230,9 +230,11 @@ const DefaultUniverseSelector = ({
230230
const checkManager = () => {
231231
if (commsManager === null || commsManager.getState() === "idle") {
232232
error("The Robotics Backend is disconnected. Make sure to reconnect.");
233-
throw Error("The Robotics Backend is disconnected. Make sure to reconnect.")
233+
throw Error(
234+
"The Robotics Backend is disconnected. Make sure to reconnect."
235+
);
234236
}
235-
}
237+
};
236238

237239
return (
238240
<DropdownStatusBar
@@ -271,7 +273,7 @@ export const StatusBarCustomUniverseSelector = ({
271273
const [open, setOpen] = useState<boolean>(false);
272274
const { warning, error } = useError();
273275
const [universe, setUniverse] = useState<string | undefined>(
274-
commsManager?.getUniverse(),
276+
commsManager?.getUniverse()
275277
);
276278

277279
useEffect(() => {
@@ -284,7 +286,7 @@ export const StatusBarCustomUniverseSelector = ({
284286
const terminateUniverse = async () => {
285287
if (!commsManager) {
286288
warning(
287-
"Failed to connect with the Robotics Backend docker. Please make sure it is connected.",
289+
"Failed to connect with the Robotics Backend docker. Please make sure it is connected."
288290
);
289291
return;
290292
}
@@ -297,7 +299,7 @@ export const StatusBarCustomUniverseSelector = ({
297299
const launchUniverse = async (universe: string) => {
298300
if (!commsManager) {
299301
warning(
300-
"Failed to connect with the Robotics Backend docker. Please make sure it is connected.",
302+
"Failed to connect with the Robotics Backend docker. Please make sure it is connected."
301303
);
302304
return;
303305
}

0 commit comments

Comments
 (0)