diff --git a/typescript/frontend-marios2/src/content/dashboards/Information/Information.tsx b/typescript/frontend-marios2/src/content/dashboards/Information/Information.tsx
index 313740c16..daf83ecec 100644
--- a/typescript/frontend-marios2/src/content/dashboards/Information/Information.tsx
+++ b/typescript/frontend-marios2/src/content/dashboards/Information/Information.tsx
@@ -180,12 +180,7 @@ function Information(props: InformationProps) {
>
- }
+ label={}
name="name"
value={formValues.name}
onChange={handleChange}
diff --git a/typescript/frontend-marios2/src/content/dashboards/Information/InformationSalidomo.tsx b/typescript/frontend-marios2/src/content/dashboards/Information/InformationSalidomo.tsx
index 3aa6c093e..2113dc5de 100644
--- a/typescript/frontend-marios2/src/content/dashboards/Information/InformationSalidomo.tsx
+++ b/typescript/frontend-marios2/src/content/dashboards/Information/InformationSalidomo.tsx
@@ -25,6 +25,7 @@ import { InstallationsContext } from '../../../contexts/InstallationsContextProv
import { UserContext } from '../../../contexts/userContext';
import routes from '../../../Resources/routes.json';
import { useNavigate } from 'react-router-dom';
+import { UserType } from '../../../interfaces/UserTypes';
interface InformationSalidomoProps {
values: I_Installation;
@@ -41,7 +42,7 @@ function InformationSalidomo(props: InformationSalidomoProps) {
const { currentUser } = context;
const theme = useTheme();
const [formValues, setFormValues] = useState(props.values);
- const requiredFields = ['installationName', 'region', 'location', 'country'];
+ const requiredFields = ['name', 'region', 'location', 'country'];
const [openModalDeleteInstallation, setOpenModalDeleteInstallation] =
useState(false);
const navigate = useNavigate();
@@ -336,38 +337,42 @@ function InformationSalidomo(props: InformationSalidomoProps) {
/>
-
-
-
+ {currentUser.userType == UserType.admin && (
+ <>
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
+ >
+ )}
-
+ {currentUser.userType == UserType.admin && (
+
+ )}
{loading && (
{
- const [isRowHovered, setHoveredRow] = useState(-1);
const webSocketContext = useContext(WebSocketContext);
const { getStatus, getTestingMode } = webSocketContext;
const navigate = useNavigate();
@@ -70,13 +70,12 @@ const FlatInstallationView = (props: FlatInstallationViewProps) => {
const theme = useTheme();
- const handleRowMouseEnter = (id: number) => {
- setHoveredRow(id);
- };
-
- const handleRowMouseLeave = () => {
- setHoveredRow(-1);
- };
+ const HoverableTableRow = styled(TableRow)(({ theme }) => ({
+ cursor: 'pointer',
+ '&:hover': {
+ backgroundColor: theme.palette.action.hover // Or any other color
+ }
+ }));
return (
@@ -126,27 +125,13 @@ const FlatInstallationView = (props: FlatInstallationViewProps) => {
installation.s3BucketId === selectedInstallation;
const status = getStatus(installation.id);
- const rowStyles =
- isRowHovered === installation.s3BucketId
- ? {
- cursor: 'pointer',
- backgroundColor: theme.colors.primary.lighter
- }
- : {};
return (
-
handleSelectOneInstallation(installation.s3BucketId)
}
- onMouseEnter={() =>
- handleRowMouseEnter(installation.s3BucketId)
- }
- onMouseLeave={() => handleRowMouseLeave()}
>
{
)}
-
+
);
})}
diff --git a/typescript/frontend-marios2/src/content/dashboards/Tree/CustomTreeItem.tsx b/typescript/frontend-marios2/src/content/dashboards/Tree/CustomTreeItem.tsx
index 9e2bef622..9349f1e3c 100644
--- a/typescript/frontend-marios2/src/content/dashboards/Tree/CustomTreeItem.tsx
+++ b/typescript/frontend-marios2/src/content/dashboards/Tree/CustomTreeItem.tsx
@@ -96,7 +96,11 @@ function CustomTreeItem(props: CustomTreeItemProps) {
nodeId={props.node.id.toString() + props.node.type}
label={
-
+
{renderIcon()}
{
}
}, 10000); // Send a ping every 10 seconds
- // Listen for messages
+ let messageBuffer = [];
+ let isProcessing = false;
+
socket.addEventListener('message', (event) => {
const message = JSON.parse(event.data); // Parse the JSON data
+
if (Array.isArray(message)) {
+ // Existing code for handling arrays, if necessary
setInstallationMode((prevMode) => {
const newMode = new Map(prevMode);
message.forEach((item) => {
@@ -66,20 +70,41 @@ const WebSocketContextProvider = ({ children }: { children: ReactNode }) => {
return newStatus;
});
} else if (message.id != -1) {
- const installation_id = message.id;
+ // Accumulate messages in the buffer
+ messageBuffer.push(message);
- setInstallationMode((prevMode) => {
- const newMode = new Map(prevMode);
- newMode.set(message.id, message.testingMode);
- return newMode;
- });
- setInstallationStatus((prevStatus) => {
- const newStatus = new Map(prevStatus);
- newStatus.set(message.id, message.status);
- return newStatus;
- });
+ // Process the buffer if not already processing
+ if (!isProcessing) {
+ isProcessing = true;
+
+ // Use setTimeout to process the buffer periodically
+ setTimeout(() => {
+ const newInstallationMode = new Map();
+ const newInstallationStatus = new Map();
+
+ // Process all accumulated messages
+ messageBuffer.forEach((msg) => {
+ newInstallationMode.set(msg.id, msg.testingMode);
+ newInstallationStatus.set(msg.id, msg.status);
+ });
+
+ // Update the state with the accumulated messages
+ setInstallationMode(
+ (prevMode) => new Map([...prevMode, ...newInstallationMode])
+ );
+ setInstallationStatus(
+ (prevStatus) =>
+ new Map([...prevStatus, ...newInstallationStatus])
+ );
+
+ // Clear the buffer after processing
+ messageBuffer = [];
+ isProcessing = false; // Reset processing flag
+ }, 100); // Adjust the delay as needed to control processing frequency
+ }
}
});
+
setSocket(socket);
}
}, [installations]);