Updated backend to provide support for the overview tab

Updated frontend to parse chunks
This commit is contained in:
Noe 2024-06-27 16:47:33 +02:00
parent d7b91d4dec
commit da24c43a7d
7 changed files with 54 additions and 53 deletions

View File

@ -152,7 +152,7 @@ public static partial class Db
public static void AddCsvTimestamp(CsvTimestamp newCsvTimestamp,int installationId) public static void AddCsvTimestamp(CsvTimestamp newCsvTimestamp,int installationId)
{ {
var maxCSvPerInstallation = 2 * 60 * 24; var maxCSvPerInstallation = 60 * 24;
//Find the total number of warnings for this installation //Find the total number of warnings for this installation
var totalCsvNames = CsvTimestamps.Count(csvTimestamp => csvTimestamp.InstallationId == installationId); var totalCsvNames = CsvTimestamps.Count(csvTimestamp => csvTimestamp.InstallationId == installationId);
@ -172,7 +172,7 @@ public static partial class Db
} }
else else
{ {
Console.WriteLine("---------------Added the new Csv Timestamp to the database-----------------"); //Console.WriteLine("---------------Added the new Csv Timestamp to the database-----------------");
Create(newCsvTimestamp); Create(newCsvTimestamp);
} }
} }

View File

@ -61,7 +61,7 @@ public static class RabbitMqManager
{ {
Installation installation = Db.Installations.FirstOrDefault(f => f.Product == receivedStatusMessage.Product && f.S3BucketId == receivedStatusMessage.InstallationId); Installation installation = Db.Installations.FirstOrDefault(f => f.Product == receivedStatusMessage.Product && f.S3BucketId == receivedStatusMessage.InstallationId);
int installationId = (int )installation.Id; int installationId = (int )installation.Id;
Console.WriteLine("Received a message from installation: " + installationId + " , product is: "+receivedStatusMessage.Product+ " and status is: " + receivedStatusMessage.Status); //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. //This is a heartbit message, just update the timestamp for this installation.
//There is no need to notify the corresponding front-ends. //There is no need to notify the corresponding front-ends.

View File

@ -1,4 +1,4 @@
#define Amax #undef Amax
#undef GridLimit #undef GridLimit
using System.Diagnostics; using System.Diagnostics;
@ -728,7 +728,7 @@ internal static class Program
Console.WriteLine("ERROR: PUT"); Console.WriteLine("ERROR: PUT");
var error = await response.GetStringAsync(); var error = await response.GetStringAsync();
Console.WriteLine(error); Console.WriteLine(error);
Heartbit(0); Heartbit(new DateTime(0));
return false; return false;
} }
@ -745,6 +745,7 @@ internal static class Program
{ {
var s3Bucket = Config.Load().S3?.Bucket; var s3Bucket = Config.Load().S3?.Bucket;
int.TryParse(s3Bucket?.Split("-")[0], out var installationId); int.TryParse(s3Bucket?.Split("-")[0], out var installationId);
int.TryParse(timeStamp.ToUnixTime().ToString(), out var nameOfCsvFile); int.TryParse(timeStamp.ToUnixTime().ToString(), out var nameOfCsvFile);
var returnedStatus = new StatusMessage var returnedStatus = new StatusMessage

View File

@ -418,20 +418,20 @@ function MainStats(props: MainStatsProps) {
<ArrowBackIcon /> <ArrowBackIcon />
</IconButton> </IconButton>
<Button {/*<Button*/}
variant="contained" {/* variant="contained"*/}
onClick={handleSetDate} {/* onClick={handleSetDate}*/}
disabled={loading} {/* disabled={loading}*/}
sx={{ {/* sx={{*/}
marginTop: '20px', {/* marginTop: '20px',*/}
marginLeft: '20px', {/* marginLeft: '20px',*/}
backgroundColor: dateOpen ? '#808080' : '#ffc04d', {/* backgroundColor: dateOpen ? '#808080' : '#ffc04d',*/}
color: '#000000', {/* color: '#000000',*/}
'&:hover': { bgcolor: '#f7b34d' } {/* '&:hover': { bgcolor: '#f7b34d' }*/}
}} {/* }}*/}
> {/*>*/}
<FormattedMessage id="set_date" defaultMessage="Set Date" /> {/* <FormattedMessage id="set_date" defaultMessage="Set Date" />*/}
</Button> {/*</Button>*/}
</Grid> </Grid>
<Grid <Grid
container container

View File

@ -482,20 +482,20 @@ function Overview(props: OverviewProps) {
<FormattedMessage id="lastweek" defaultMessage="Last week" /> <FormattedMessage id="lastweek" defaultMessage="Last week" />
</Button> </Button>
<Button {/*<Button*/}
variant="contained" {/* variant="contained"*/}
onClick={handleSetDate} {/* onClick={handleSetDate}*/}
disabled={loading} {/* disabled={loading}*/}
sx={{ {/* sx={{*/}
marginTop: '20px', {/* marginTop: '20px',*/}
marginLeft: '10px', {/* marginLeft: '10px',*/}
backgroundColor: dateOpen ? '#808080' : '#ffc04d', {/* backgroundColor: dateOpen ? '#808080' : '#ffc04d',*/}
color: '#000000', {/* color: '#000000',*/}
'&:hover': { bgcolor: '#f7b34d' } {/* '&:hover': { bgcolor: '#f7b34d' }*/}
}} {/* }}*/}
> {/*>*/}
<FormattedMessage id="lastmonth" defaultMessage="Set Date" /> {/* <FormattedMessage id="lastmonth" defaultMessage="Set Date" />*/}
</Button> {/*</Button>*/}
</Grid> </Grid>
<Grid <Grid

View File

@ -319,22 +319,22 @@ function SalidomoOverview(props: salidomoOverviewProps) {
</LocalizationProvider> </LocalizationProvider>
)} )}
<Grid container> <Grid container>
<Grid item xs={6} md={6}> {/*<Grid item xs={6} md={6}>*/}
<Button {/* <Button*/}
variant="contained" {/* variant="contained"*/}
onClick={handleSetDate} {/* onClick={handleSetDate}*/}
disabled={loading} {/* disabled={loading}*/}
sx={{ {/* sx={{*/}
marginTop: '20px', {/* marginTop: '20px',*/}
marginLeft: '10px', {/* marginLeft: '10px',*/}
backgroundColor: dateOpen ? '#808080' : '#ffc04d', {/* backgroundColor: dateOpen ? '#808080' : '#ffc04d',*/}
color: '#000000', {/* color: '#000000',*/}
'&:hover': { bgcolor: '#f7b34d' } {/* '&:hover': { bgcolor: '#f7b34d' }*/}
}} {/* }}*/}
> {/* >*/}
<FormattedMessage id="lastmonth" defaultMessage="Set Date" /> {/* <FormattedMessage id="lastmonth" defaultMessage="Set Date" />*/}
</Button> {/* </Button>*/}
</Grid> {/*</Grid>*/}
<Grid <Grid
container container

View File

@ -92,10 +92,10 @@ function SalidomoInstallationTabs() {
/> />
) )
}, },
{ // {
value: 'overview', // value: 'overview',
label: <FormattedMessage id="overview" defaultMessage="Overview" /> // label: <FormattedMessage id="overview" defaultMessage="Overview" />
}, // },
{ {
value: 'log', value: 'log',
label: <FormattedMessage id="log" defaultMessage="Log" /> label: <FormattedMessage id="log" defaultMessage="Log" />