Skip to content

Commit 57756ff

Browse files
committed
fix: small change on translation file and modal fix
1 parent 11084f5 commit 57756ff

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/components/common/NetworkMonitoringModal.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,21 @@ const extractTsharkError = (msg: string): string => {
225225
return error;
226226
};
227227

228+
// Helper function to check monitoring status from backend
229+
const checkMonitoringStatus = async (networkId: number): Promise<boolean> => {
230+
try {
231+
const port = `39${networkId.toString().padStart(3, '0')}`;
232+
const response = await fetch(`http://localhost:${port}/status`, { method: 'GET' });
233+
if (response.ok) {
234+
const data = await response.json();
235+
return data.isMonitoringActive || false;
236+
}
237+
} catch (error) {
238+
console.error('Error checking monitoring status:', error);
239+
}
240+
return false;
241+
};
242+
228243
const NetworkMonitoringModal: React.FC<NetworkMonitoringModalProps> = ({
229244
networkId,
230245
testLoading,
@@ -297,6 +312,10 @@ const NetworkMonitoringModal: React.FC<NetworkMonitoringModalProps> = ({
297312
fetchJsonData(setJsonData, setLoading, networkId, configNowExists, isMountedRef);
298313
const pcapInfo = getPcapFileInfo(networkId, configNowExists);
299314
setPcapFileName(pcapInfo ? pcapInfo.name : null);
315+
// Check the current monitoring status from backend
316+
checkMonitoringStatus(networkId).then(actualStatus => {
317+
setIsRunning(actualStatus);
318+
});
300319
}
301320
// Optionally, clear data when modal closes
302321
if (!visible) {

src/i18n/locales/en-US.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"enums.status.Stopping": "Stopping",
55
"enums.status.Stopped": "Stopped",
66
"enums.status.Error": "Error",
7-
"cmps.forms.monitorCheck": "Enable Network Monitoring",
7+
"cmps.forms.monitorCheck": "Network Monitoring",
88
"cmps.forms.required": "required",
99
"cmps.common.form.DockerCommandInput.label": "Docker Startup Command",
1010
"cmps.common.form.DockerCommandInput.help": "The docker command to execute when starting this node. If left blank, the default command will be used.",

0 commit comments

Comments
 (0)