diff --git a/csharp/App/Backend/Websockets/RabbitMQManager.cs b/csharp/App/Backend/Websockets/RabbitMQManager.cs
index fb300b18f..0ca03cdb5 100644
--- a/csharp/App/Backend/Websockets/RabbitMQManager.cs
+++ b/csharp/App/Backend/Websockets/RabbitMQManager.cs
@@ -57,9 +57,9 @@ public static class RabbitMqManager
if (receivedStatusMessage != null)
{
Console.WriteLine("----------------------------------------------");
- Console.WriteLine("Received a message from installation: " + receivedStatusMessage.InstallationId + " and status is: " + receivedStatusMessage.Status);
- int installationId = (int)Db.Installations.Where(f => f.Product == 0 && f.S3BucketId == receivedStatusMessage.InstallationId).Select(f => f.Id).FirstOrDefault();
+ int installationId = (int)Db.Installations.Where(f => f.Product == receivedStatusMessage.Product && f.S3BucketId == receivedStatusMessage.InstallationId).Select(f => f.Id).FirstOrDefault();
+ Console.WriteLine("Received a message from installation: " + installationId + " , product is: "+receivedStatusMessage.Product+ " and status is: " + receivedStatusMessage.Status);
//This is a heartbit message, just update the timestamp for this installation.
//There is no need to notify the corresponding front-ends.
@@ -77,7 +77,7 @@ public static class RabbitMqManager
{
Warning newWarning = new Warning
{
- InstallationId = receivedStatusMessage.InstallationId,
+ InstallationId = installationId,
Description = warning.Description,
Date = warning.Date,
Time = warning.Time,
@@ -85,7 +85,7 @@ public static class RabbitMqManager
Seen = false
};
//Create a new warning and add it to the database
- Db.HandleWarning(newWarning, receivedStatusMessage.InstallationId);
+ Db.HandleWarning(newWarning, installationId);
}
}
@@ -93,12 +93,12 @@ public static class RabbitMqManager
//Traverse the Alarm list, and store each of them to the database
if (receivedStatusMessage.Alarms != null)
{
- Console.WriteLine("Add an alarm for installation "+receivedStatusMessage.InstallationId);
+ Console.WriteLine("Add an alarm for installation "+installationId);
foreach (var alarm in receivedStatusMessage.Alarms)
{
Error newError = new Error
{
- InstallationId = receivedStatusMessage.InstallationId,
+ InstallationId = installationId,
Description = alarm.Description,
Date = alarm.Date,
Time = alarm.Time,
@@ -106,7 +106,7 @@ public static class RabbitMqManager
Seen = false
};
//Create a new error and add it to the database
- Db.HandleError(newError, receivedStatusMessage.InstallationId);
+ Db.HandleError(newError, installationId);
}
}
}
diff --git a/csharp/App/SaliMax/deploy_all_installations.sh b/csharp/App/SaliMax/deploy_all_installations.sh
index 8b3c12c57..4f5c7fd27 100755
--- a/csharp/App/SaliMax/deploy_all_installations.sh
+++ b/csharp/App/SaliMax/deploy_all_installations.sh
@@ -16,8 +16,10 @@ dotnet publish \
-r linux-x64
echo -e "\n============================ Deploy ============================\n"
-ip_addresses=("10.2.3.115" "10.2.3.104" "10.2.4.33" "10.2.4.32" "10.2.4.36" "10.2.4.35" "10.2.4.154" "10.2.4.113" "10.2.4.29")
+#ip_addresses=("10.2.3.115" "10.2.3.104" "10.2.4.33" "10.2.4.32" "10.2.4.36" "10.2.4.35" "10.2.4.154" "10.2.4.113" "10.2.4.29")
#ip_addresses=("10.2.4.154" "10.2.4.29")
+ip_addresses=("10.2.3.115" "10.2.3.104" "10.2.4.33" "10.2.4.32" "10.2.4.36" "10.2.4.35" "10.2.4.154" "10.2.4.29")
+
for ip_address in "${ip_addresses[@]}"; do
diff --git a/csharp/App/SaliMax/src/Program.cs b/csharp/App/SaliMax/src/Program.cs
index 50b5049d4..0db6ecbf1 100644
--- a/csharp/App/SaliMax/src/Program.cs
+++ b/csharp/App/SaliMax/src/Program.cs
@@ -1,4 +1,4 @@
-#define Amax
+#undef Amax
#undef GridLimit
using System.IO.Compression;
@@ -486,6 +486,7 @@ internal static class Program
var returnedStatus = new StatusMessage
{
InstallationId = installationId,
+ Product = 0,
Status = salimaxAlarmsState,
Type = MessageType.AlarmOrWarning,
Alarms = alarmList,
diff --git a/typescript/frontend-marios2/src/content/dashboards/Installations/fetchData.tsx b/typescript/frontend-marios2/src/content/dashboards/Installations/fetchData.tsx
index a141f0558..1f14194f2 100644
--- a/typescript/frontend-marios2/src/content/dashboards/Installations/fetchData.tsx
+++ b/typescript/frontend-marios2/src/content/dashboards/Installations/fetchData.tsx
@@ -25,9 +25,29 @@ export const fetchDailyData = (
if (r.status === 404) {
return Promise.resolve(FetchResult.notAvailable);
} else if (r.status === 200) {
- const text = await r.text();
+ // const text = await r.text();
+ const csvtext = await r.text(); // Assuming the server returns the Base64 encoded ZIP file as text
+
+ //const response = await fetch(url); // Fetch the resource from the server
+ const contentEncoding = r.headers.get('content-type');
+
+ if (contentEncoding != 'application/base64; charset=utf-8') {
+ return parseCsv(csvtext);
+ }
+
+ const byteArray = Uint8Array.from(atob(csvtext), (c) =>
+ c.charCodeAt(0)
+ );
+
+ //Decompress the byte array using JSZip
+ const zip = await JSZip.loadAsync(byteArray);
+ // Assuming the CSV file is named "data.csv" inside the ZIP archive
+ const csvContent = await zip.file('data.csv').async('text');
+
+ return parseCsv(csvContent);
+
//console.log(parseCsv(text));
- return parseCsv(text);
+ //return parseCsv(text);
} else {
return Promise.resolve(FetchResult.notAvailable);
}
diff --git a/typescript/frontend-marios2/src/content/dashboards/Installations/index.tsx b/typescript/frontend-marios2/src/content/dashboards/Installations/index.tsx
index 197a141dc..4b12b2c00 100644
--- a/typescript/frontend-marios2/src/content/dashboards/Installations/index.tsx
+++ b/typescript/frontend-marios2/src/content/dashboards/Installations/index.tsx
@@ -135,6 +135,33 @@ function InstallationTabs() {
)
}
]
+ : currentUser.userType == UserType.partner
+ ? [
+ {
+ value: 'live',
+ label:
+ },
+ {
+ value: 'overview',
+ label:
+ },
+ {
+ value: 'batteryview',
+ label: (
+
+ )
+ },
+
+ {
+ value: 'information',
+ label: (
+
+ )
+ }
+ ]
: [
{
value: 'live',
@@ -219,7 +246,8 @@ function InstallationTabs() {
)
}
]
- : [
+ : currentUser.userType == UserType.partner
+ ? [
{
value: 'list',
icon:
@@ -249,6 +277,37 @@ function InstallationTabs() {
)
},
+ {
+ value: 'information',
+ label: (
+
+ )
+ }
+ ]
+ : [
+ {
+ value: 'list',
+ icon:
+ },
+ {
+ value: 'tree',
+ icon:
+ },
+
+ {
+ value: 'live',
+ label:
+ },
+ {
+ value: 'overview',
+ label: (
+
+ )
+ },
+
{
value: 'information',
label: (
diff --git a/typescript/frontend-marios2/src/content/dashboards/Tree/InstallationTree.tsx b/typescript/frontend-marios2/src/content/dashboards/Tree/InstallationTree.tsx
index afb84ab99..3f842fd4c 100644
--- a/typescript/frontend-marios2/src/content/dashboards/Tree/InstallationTree.tsx
+++ b/typescript/frontend-marios2/src/content/dashboards/Tree/InstallationTree.tsx
@@ -9,11 +9,30 @@ import { InstallationsContext } from 'src/contexts/InstallationsContextProvider'
import { Route, Routes } from 'react-router-dom';
import routes from '../../../Resources/routes.json';
import Folder from './Folder';
+import { WebSocketContext } from '../../../contexts/WebSocketContextProvider';
function InstallationTree() {
const { foldersAndInstallations, fetchAllFoldersAndInstallations } =
useContext(InstallationsContext);
+ const webSocketContext = useContext(WebSocketContext);
+ const { getStatus } = webSocketContext;
+
+ const sortedInstallations = [...foldersAndInstallations].sort((a, b) => {
+ // Compare the status field of each installation and sort them based on the status.
+ //Installations with alarms go first
+ let a_status = getStatus(a.id);
+ let b_status = getStatus(b.id);
+
+ if (a_status > b_status) {
+ return -1;
+ }
+ if (a_status < b_status) {
+ return 1;
+ }
+ return 0;
+ });
+
useEffect(() => {
fetchAllFoldersAndInstallations();
}, []);
@@ -23,7 +42,7 @@ function InstallationTree() {
return (
node.parentId == parent_id && (
- {foldersAndInstallations.map((subnode) => {
+ {sortedInstallations.map((subnode) => {
return (
subnode != node &&
subnode.parentId == node.id && (