Skip to content

Commit

Permalink
Changing cached data alert options to refresh automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
joaopaulonsoares committed Jun 30, 2021
1 parent be804c8 commit 7171ea1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
17 changes: 14 additions & 3 deletions src/components/Alert/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/* eslint-disable max-len */
/* eslint-disable import/prefer-default-export */
/* eslint-disable react/destructuring-assignment */
/* eslint-disable react/prop-types */
import React from 'react';
import React, { useEffect } from 'react';
import CircularProgress from '@material-ui/core/CircularProgress';
import { Grid, Box, Typography } from '@material-ui/core';
import WarningIcon from '@material-ui/icons/Warning';
import Paper from '@material-ui/core/Paper';
Expand All @@ -10,6 +12,12 @@ import { useStyles } from './style';
export function AlertCachedData({ apiLastCacheMade }) {
const classes = useStyles();

useEffect(() => {
setTimeout(() => {
document.location.reload(true);
}, 35000);
}, []);

return (
<Grid item xs={12} className={classes.gridItem}>
<Paper className={classes.paper}>
Expand All @@ -18,12 +26,15 @@ export function AlertCachedData({ apiLastCacheMade }) {
</Box>
<Box className={classes.textBox}>
<Typography className={classes.textTypography}>
Erro ao tentar obter os dados solicitados. Os dados exibidos são de cache referentes a
Os dados exibidos são de cache referentes a
{' '}
{apiLastCacheMade}
.
. Os dados mais recentes estão sendo obtidos e a página será atualizada automaticamente quando concluído.
</Typography>
</Box>
<Box className={classes.spinnerBox}>
<CircularProgress />
</Box>
</Paper>
</Grid>
);
Expand Down
8 changes: 8 additions & 0 deletions src/components/Alert/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,12 @@ export const useStyles = makeStyles((theme) => ({
fontSize: '0.813rem',
fontWeight: 600,
},
spinnerBox: {
height: '100%',
width: '10%',
flexGrow: 1,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
},
}));
4 changes: 2 additions & 2 deletions src/settings/applicationOptions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export const DEFAULT_YEAR_PERIOD = '0'; // All years options
export const DEFAULT_SEARCH_QUERY = '?period=yearly&ordering=start_date'; // Query that get informations of all years

// =================== API's ================
export const REFRESH_API_CACHE_DATA_INTERVAL = 900; // In seconds. (3600 seconds = 1 hour)
export const SHOW_API_CACHE_ERROR_MESSAGE_LIMIT_TIME = 120; // In minutes (120 minutes = 2 hours)
export const REFRESH_API_CACHE_DATA_INTERVAL = 900;// 900; // In seconds. (3600 seconds = 1 hour)
export const SHOW_API_CACHE_ERROR_MESSAGE_LIMIT_TIME = 720; // In minutes (720 minutes = 12 hours)

// =============== HOUR SETTINGS ===============
export const START_TIME_OF_DATA_CONSOLIDATION = '1:00'; // In 24h format, in the format h:mm
Expand Down
2 changes: 1 addition & 1 deletion src/settings/texts/AudienciasPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Page Texts
export const pageToolTitle = 'Audiências Interativas';
export const pageHTMLTitle = 'Dashboard Audiências';
export const pageHTMLTitle = 'Audiências Interativas | Painel da Participação';
export const pageTitle = 'A Participação em Audiências Interativas';
export const pageSubTitle = 'Painel de estatísticas de participação dos cidadãos em audiências públicas e eventos interativos da Câmara dos Deputados.';
export const pageColor = '#DA7F0B';
Expand Down
2 changes: 1 addition & 1 deletion src/settings/texts/WikilegisPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Page Texts
export const pageToolTitle = 'Wikilegis';
export const pageHTMLTitle = 'Dashboard Wikilegis';
export const pageHTMLTitle = 'Wikilegis | Painel da Participação ';
export const pageTitle = 'Participação na Wikilegis';
export const pageSubTitle = 'Painel de estatísticas da participação dos cidadãos nas propostas legislativas da Câmara dos Deputados.';
export const pageColor = '#00C354';
Expand Down

0 comments on commit 7171ea1

Please sign in to comment.