Applied csv file compression to both backend and front end

Fixed bug when clicking to vrm link
Fixed bug in front end dependencies
This commit is contained in:
Noe 2024-05-03 22:56:36 +02:00
parent ccec20432b
commit 4eee1aaf86
13 changed files with 224 additions and 31352 deletions

View File

@ -79,7 +79,7 @@ public static class SessionMethods
process.StartInfo.FileName = "/bin/bash"; process.StartInfo.FileName = "/bin/bash";
process.StartInfo.Arguments = $"{scriptPath} {vpnIp} {batteryNode} {version}"; process.StartInfo.Arguments = $"{scriptPath} {vpnIp} {batteryNode} {version}";
process.StartInfo.UseShellExecute = false; process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardOutput = true;
process.Start(); process.Start();
string output = process.StandardOutput.ReadToEnd(); string output = process.StandardOutput.ReadToEnd();

View File

@ -18,7 +18,6 @@ dotnet publish \
echo -e "\n============================ Deploy ============================\n" 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")
for ip_address in "${ip_addresses[@]}"; do for ip_address in "${ip_addresses[@]}"; do
rsync -v \ rsync -v \
--exclude '*.pdb' \ --exclude '*.pdb' \

View File

@ -1,8 +1,10 @@
#undef Amax #define Amax
#undef GridLimit #undef GridLimit
using System.IO.Compression;
using System.Reactive.Linq; using System.Reactive.Linq;
using System.Reactive.Threading.Tasks; using System.Reactive.Threading.Tasks;
using System.Text;
using Flurl.Http; using Flurl.Http;
using InnovEnergy.App.SaliMax.Devices; using InnovEnergy.App.SaliMax.Devices;
using InnovEnergy.App.SaliMax.Ess; using InnovEnergy.App.SaliMax.Ess;
@ -672,16 +674,40 @@ internal static class Program
var s3Path = timeStamp.ToUnixTime() + ".csv"; var s3Path = timeStamp.ToUnixTime() + ".csv";
var request = s3Config.CreatePutRequest(s3Path); var request = s3Config.CreatePutRequest(s3Path);
var response = await request.PutAsync(new StringContent(csv));
// Compress CSV data to a byte array
byte[] compressedBytes;
using (var memoryStream = new MemoryStream())
{
//Create a zip directory and put the compressed file inside
using (var archive = new ZipArchive(memoryStream, ZipArchiveMode.Create, true))
{
var entry = archive.CreateEntry("data.csv", CompressionLevel.SmallestSize); // Add CSV data to the ZIP archive
using (var entryStream = entry.Open())
using (var writer = new StreamWriter(entryStream))
{
writer.Write(csv);
}
}
// This is temporary for Wittman compressedBytes = memoryStream.ToArray();
//await File.WriteAllTextAsync("/var/www/html/status.csv", csv.SplitLines().Where(l => !l.Contains("Secret")).JoinLines()); }
// Encode the compressed byte array as a Base64 string
string base64String = Convert.ToBase64String(compressedBytes);
// Create StringContent from Base64 string
var stringContent = new StringContent(base64String, Encoding.UTF8, "application/base64");
// Upload the compressed data (ZIP archive) to S3
var response = await request.PutAsync(stringContent);
if (response.StatusCode != 200) if (response.StatusCode != 200)
{ {
Console.WriteLine("ERROR: PUT"); Console.WriteLine("ERROR: PUT");
var error = await response.GetStringAsync(); var error = await response.GetStringAsync();
Console.WriteLine(error); Console.WriteLine(error);
return false;
} }
return true; return true;

View File

@ -59,7 +59,7 @@ public record S3Config
String date, String date,
String s3Key, String s3Key,
String s3Secret, String s3Secret,
String contentType = "", String contentType = "application/base64",
String md5Hash = "") String md5Hash = "")
{ {
// StringToSign = HTTP-Verb + "\n" + // StringToSign = HTTP-Verb + "\n" +
@ -68,7 +68,10 @@ public record S3Config
// Date + "\n" + // Date + "\n" +
// CanonicalizedAmzHeaders + // CanonicalizedAmzHeaders +
// CanonicalizedResource; // CanonicalizedResource;
contentType = "application/base64; charset=utf-8";
var payload = $"{method}\n{md5Hash}\n{contentType}\n{date}\n/{bucket.Trim('/')}/{s3Path.Trim('/')}"; var payload = $"{method}\n{md5Hash}\n{contentType}\n{date}\n/{bucket.Trim('/')}/{s3Path.Trim('/')}";
using var hmacSha1 = new HMACSHA1(UTF8.GetBytes(s3Secret)); using var hmacSha1 = new HMACSHA1(UTF8.GetBytes(s3Secret));

View File

@ -23,6 +23,7 @@
"chart.js": "^4.2.1", "chart.js": "^4.2.1",
"dayjs": "^1.11.7", "dayjs": "^1.11.7",
"formik": "^2.2.9", "formik": "^2.2.9",
"jszip": "^3.10.1",
"linq-to-typescript": "^11.0.0", "linq-to-typescript": "^11.0.0",
"plotly.js": "^2.20.0", "plotly.js": "^2.20.0",
"react": "^18.2.0", "react": "^18.2.0",
@ -11824,6 +11825,11 @@
"quantize": "^1.0.2" "quantize": "^1.0.2"
} }
}, },
"node_modules/immediate": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ=="
},
"node_modules/immer": { "node_modules/immer": {
"version": "9.0.19", "version": "9.0.19",
"resolved": "https://registry.npmjs.org/immer/-/immer-9.0.19.tgz", "resolved": "https://registry.npmjs.org/immer/-/immer-9.0.19.tgz",
@ -14842,6 +14848,49 @@
"node": ">=4.0" "node": ">=4.0"
} }
}, },
"node_modules/jszip": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz",
"integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==",
"dependencies": {
"lie": "~3.3.0",
"pako": "~1.0.2",
"readable-stream": "~2.3.6",
"setimmediate": "^1.0.5"
}
},
"node_modules/jszip/node_modules/isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
},
"node_modules/jszip/node_modules/readable-stream": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
"dependencies": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"node_modules/jszip/node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"node_modules/jszip/node_modules/string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dependencies": {
"safe-buffer": "~5.1.0"
}
},
"node_modules/jwa": { "node_modules/jwa": {
"version": "1.4.1", "version": "1.4.1",
"resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz",
@ -14923,6 +14972,14 @@
"node": ">= 0.8.0" "node": ">= 0.8.0"
} }
}, },
"node_modules/lie": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
"integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==",
"dependencies": {
"immediate": "~3.0.5"
}
},
"node_modules/lilconfig": { "node_modules/lilconfig": {
"version": "2.0.6", "version": "2.0.6",
"resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.6.tgz", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.6.tgz",
@ -16043,6 +16100,11 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/pako": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="
},
"node_modules/param-case": { "node_modules/param-case": {
"version": "3.0.4", "version": "3.0.4",
"resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz",
@ -19270,6 +19332,11 @@
"resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz", "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz",
"integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==" "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ=="
}, },
"node_modules/setimmediate": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
"integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA=="
},
"node_modules/setprototypeof": { "node_modules/setprototypeof": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
@ -31433,6 +31500,11 @@
"quantize": "^1.0.2" "quantize": "^1.0.2"
} }
}, },
"immediate": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ=="
},
"immer": { "immer": {
"version": "9.0.19", "version": "9.0.19",
"resolved": "https://registry.npmjs.org/immer/-/immer-9.0.19.tgz", "resolved": "https://registry.npmjs.org/immer/-/immer-9.0.19.tgz",
@ -33604,6 +33676,51 @@
"object.assign": "^4.1.3" "object.assign": "^4.1.3"
} }
}, },
"jszip": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz",
"integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==",
"requires": {
"lie": "~3.3.0",
"pako": "~1.0.2",
"readable-stream": "~2.3.6",
"setimmediate": "^1.0.5"
},
"dependencies": {
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
},
"readable-stream": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"
}
}
}
},
"jwa": { "jwa": {
"version": "1.4.1", "version": "1.4.1",
"resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz",
@ -33670,6 +33787,14 @@
"type-check": "~0.4.0" "type-check": "~0.4.0"
} }
}, },
"lie": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
"integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==",
"requires": {
"immediate": "~3.0.5"
}
},
"lilconfig": { "lilconfig": {
"version": "2.0.6", "version": "2.0.6",
"resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.6.tgz", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.6.tgz",
@ -34514,6 +34639,11 @@
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
}, },
"pako": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="
},
"param-case": { "param-case": {
"version": "3.0.4", "version": "3.0.4",
"resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz",
@ -36746,6 +36876,11 @@
"resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz", "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz",
"integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==" "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ=="
}, },
"setimmediate": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
"integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA=="
},
"setprototypeof": { "setprototypeof": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",

View File

@ -18,6 +18,7 @@
"chart.js": "^4.2.1", "chart.js": "^4.2.1",
"dayjs": "^1.11.7", "dayjs": "^1.11.7",
"formik": "^2.2.9", "formik": "^2.2.9",
"jszip": "^3.10.1",
"linq-to-typescript": "^11.0.0", "linq-to-typescript": "^11.0.0",
"plotly.js": "^2.20.0", "plotly.js": "^2.20.0",
"react": "^18.2.0", "react": "^18.2.0",
@ -35,7 +36,6 @@
"yup": "^1.1.0" "yup": "^1.1.0"
}, },
"scripts": { "scripts": {
"start": "react-scripts start", "start": "react-scripts start",
"build": "react-scripts build", "build": "react-scripts build",
"test": "react-scripts test", "test": "react-scripts test",

View File

@ -4,9 +4,7 @@
"es2021": true "es2021": true
}, },
"extends": [ "extends": [
"plugin:react/recommended",
"airbnb-typescript", "airbnb-typescript",
"plugin:react/jsx-runtime",
"plugin:prettier/recommended" "plugin:prettier/recommended"
], ],
"parser": "@typescript-eslint/parser", "parser": "@typescript-eslint/parser",
@ -18,7 +16,9 @@
"project": "./tsconfig.json", "project": "./tsconfig.json",
"sourceType": "module" "sourceType": "module"
}, },
"plugins": ["react", "@typescript-eslint"], "plugins": [
"@typescript-eslint"
],
"settings": { "settings": {
"react": { "react": {
"pragma": "React", "pragma": "React",
@ -57,13 +57,27 @@
} }
], ],
"indent": "off", "indent": "off",
"@typescript-eslint/indent": [0], "@typescript-eslint/indent": [
0
],
"no-use-before-define": "off", "no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["off"], "@typescript-eslint/no-use-before-define": [
"@typescript-eslint/no-unused-vars": ["off"], "off"
"@typescript-eslint/no-shadow": ["off"], ],
"@typescript-eslint/dot-notation": ["off"], "@typescript-eslint/no-unused-vars": [
"react/prop-types": ["off"], "off"
"@typescript-eslint/naming-convention": ["off"] ],
"@typescript-eslint/no-shadow": [
"off"
],
"@typescript-eslint/dot-notation": [
"off"
],
"react/prop-types": [
"off"
],
"@typescript-eslint/naming-convention": [
"off"
]
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,6 @@
"react-redux": "^8.1.3", "react-redux": "^8.1.3",
"react-router": "6.3.0", "react-router": "6.3.0",
"react-router-dom": "6.3.0", "react-router-dom": "6.3.0",
"react-scripts": "5.0.1",
"redux": "^4.2.1", "redux": "^4.2.1",
"rxjs": "^7.8.1", "rxjs": "^7.8.1",
"simplytyped": "^3.3.0", "simplytyped": "^3.3.0",
@ -81,6 +80,7 @@
"eslint-plugin-prettier": "4.0.0", "eslint-plugin-prettier": "4.0.0",
"eslint-plugin-react": "7.30.0", "eslint-plugin-react": "7.30.0",
"eslint-plugin-react-hooks": "4.5.0", "eslint-plugin-react-hooks": "4.5.0",
"prettier": "2.6.2" "prettier": "2.6.2",
"react-scripts": "^5.0.1"
} }
} }

View File

@ -4,6 +4,7 @@ import { FetchResult } from 'src/dataCache/dataCache';
import { DataRecord } from 'src/dataCache/data'; import { DataRecord } from 'src/dataCache/data';
import { S3Access } from 'src/dataCache/S3/S3Access'; import { S3Access } from 'src/dataCache/S3/S3Access';
import { parseCsv } from '../Log/graph.util'; import { parseCsv } from '../Log/graph.util';
import JSZip from 'jszip';
export const fetchDailyData = ( export const fetchDailyData = (
date: string, date: string,
@ -50,14 +51,23 @@ export const fetchData = (
s3Credentials.s3Key, s3Credentials.s3Key,
s3Credentials.s3Secret s3Credentials.s3Secret
); );
return s3Access return s3Access
.get(s3Path) .get(s3Path)
.then(async (r) => { .then(async (r) => {
if (r.status === 404) { if (r.status === 404) {
return Promise.resolve(FetchResult.notAvailable); return Promise.resolve(FetchResult.notAvailable);
} else if (r.status === 200) { } else if (r.status === 200) {
const text = await r.text(); const base64String = await r.text(); // Assuming the server returns the Base64 encoded ZIP file as text
return parseCsv(text); const byteArray = Uint8Array.from(atob(base64String), (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);
} else { } else {
return Promise.resolve(FetchResult.notAvailable); return Promise.resolve(FetchResult.notAvailable);
} }

View File

@ -114,7 +114,7 @@ function Log(props: LogProps) {
<Button <Button
variant="contained" variant="contained"
onClick={handleErrorButtonPressed} onClick={handleErrorButtonPressed}
sx={{ marginTop: '20px' }} sx={{ marginTop: '20px', backgroundColor: errorButtonPressed ? '#808080' : 'default'}}
> >
<FormattedMessage id="Show Errors" defaultMessage="Show Errors" /> <FormattedMessage id="Show Errors" defaultMessage="Show Errors" />
</Button> </Button>
@ -425,7 +425,8 @@ function Log(props: LogProps) {
<Button <Button
variant="contained" variant="contained"
onClick={handleWarningButtonPressed} onClick={handleWarningButtonPressed}
sx={{ marginTop: '20px' }} sx={{ marginTop: '20px', backgroundColor: warningButtonPressed ? '#808080' : 'default'}}
> >
<FormattedMessage <FormattedMessage
id="Show Warnings" id="Show Warnings"

View File

@ -190,6 +190,11 @@ const FlatInstallationView = (props: FlatInstallationViewProps) => {
href={installation.vrmLink} href={installation.vrmLink}
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
style={{
display: 'inline-block',
padding: '0'
}} // Style the link
onClick={(e) => e.stopPropagation()} // Prevent the click event from bubbling up to the table row
> >
VRM link VRM link
</a> </a>

View File

@ -14,7 +14,7 @@ import { fetchData } from 'src/content/dashboards/Installations/fetchData';
import { Navigate, Route, Routes, useLocation } from 'react-router-dom'; import { Navigate, Route, Routes, useLocation } from 'react-router-dom';
import routes from '../../../Resources/routes.json'; import routes from '../../../Resources/routes.json';
import InformationSalidomo from '../Information/InformationSalidomo'; import InformationSalidomo from '../Information/InformationSalidomo';
import BatteryView from "../BatteryView/BatteryView"; import BatteryView from '../BatteryView/BatteryView';
interface singleInstallationProps { interface singleInstallationProps {
current_installation?: I_Installation; current_installation?: I_Installation;
@ -31,7 +31,7 @@ function Installation(props: singleInstallationProps) {
const [currentTab, setCurrentTab] = useState<string>(undefined); const [currentTab, setCurrentTab] = useState<string>(undefined);
const [values, setValues] = useState<TopologyValues | null>(null); const [values, setValues] = useState<TopologyValues | null>(null);
const status = getStatus(props.current_installation.id); const status = getStatus(props.current_installation.id);
const [ const [
failedToCommunicateWithInstallation, failedToCommunicateWithInstallation,
setFailedToCommunicateWithInstallation setFailedToCommunicateWithInstallation
] = useState(0); ] = useState(0);
@ -72,8 +72,7 @@ function Installation(props: singleInstallationProps) {
}) })
); );
return true; return true;
} } else {
else {
setFailedToCommunicateWithInstallation((prevCount) => { setFailedToCommunicateWithInstallation((prevCount) => {
if (prevCount + 1 >= 3) { if (prevCount + 1 >= 3) {
setConnected(false); setConnected(false);
@ -135,8 +134,8 @@ function Installation(props: singleInstallationProps) {
}; };
} }
}, [currentTab, location]); }, [currentTab, location]);
useEffect(() => { useEffect(() => {
if (status === -1) { if (status === -1) {
setConnected(false); setConnected(false);
} }
@ -172,7 +171,7 @@ function Installation(props: singleInstallationProps) {
fontSize: '14px' fontSize: '14px'
}} }}
> >
{props.current_installation.name} {props.current_installation.installationName}
</Typography> </Typography>
</div> </div>