From 8ed111fc6a57c48f8fd7de8c9d5e39a5bfa4e5af Mon Sep 17 00:00:00 2001 From: joseCorte-exe Date: Mon, 25 Jul 2022 14:55:38 -0300 Subject: [PATCH] updates --- .../NotificationQuestionsCardView.ts | 2 -- .../faqQuestionsCard/FaqQuestionsCardView.ts | 2 +- .../graph/graphCard/ChartCardView.ts | 2 +- src/pages/telemetria/index.tsx | 35 +++++++++---------- .../charts/telemetry/getDiscretization.ts | 6 +--- .../layouts/Telemetria/TelemetriaView.ts | 6 ++-- src/styles/layouts/aboutUs/AboutUsView.ts | 2 +- src/styles/layouts/commonQuestions/FaqView.ts | 2 +- src/styles/layouts/economy/economy.ts | 2 +- .../layouts/industryInfo/IndustryInfoView.ts | 2 +- src/styles/layouts/news/NewsView.ts | 2 +- src/styles/layouts/pld/PldView.ts | 2 +- 12 files changed, 28 insertions(+), 37 deletions(-) diff --git a/src/components/NotificationQuestionsCard/NotificationQuestionsCardView.ts b/src/components/NotificationQuestionsCard/NotificationQuestionsCardView.ts index 4e12edb..73a22f1 100644 --- a/src/components/NotificationQuestionsCard/NotificationQuestionsCardView.ts +++ b/src/components/NotificationQuestionsCard/NotificationQuestionsCardView.ts @@ -10,8 +10,6 @@ export const FaqQuestionsCardHeader = styled.div` flex-direction: row; - margin-top: 53px; - width: 100%; cursor: pointer; diff --git a/src/components/faqQuestionsCard/FaqQuestionsCardView.ts b/src/components/faqQuestionsCard/FaqQuestionsCardView.ts index 4e12edb..41a58b9 100644 --- a/src/components/faqQuestionsCard/FaqQuestionsCardView.ts +++ b/src/components/faqQuestionsCard/FaqQuestionsCardView.ts @@ -10,7 +10,7 @@ export const FaqQuestionsCardHeader = styled.div` flex-direction: row; - margin-top: 53px; + /* margin-bottom: 53px; */ width: 100%; cursor: pointer; diff --git a/src/components/graph/graphCard/ChartCardView.ts b/src/components/graph/graphCard/ChartCardView.ts index 8a78f83..ddd8109 100644 --- a/src/components/graph/graphCard/ChartCardView.ts +++ b/src/components/graph/graphCard/ChartCardView.ts @@ -13,7 +13,7 @@ export const ChartCardView = styled.article` box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; -webkit-box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; -moz-box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; - border-radius: 20px; + border-radius: 10px; background-color: #FFFFFF; diff --git a/src/pages/telemetria/index.tsx b/src/pages/telemetria/index.tsx index 1915750..88f3d73 100644 --- a/src/pages/telemetria/index.tsx +++ b/src/pages/telemetria/index.tsx @@ -17,7 +17,6 @@ import { api } from '../../services/api'; import Snackbar from '@mui/material/Snackbar' import MuiAlert, { AlertProps } from '@mui/material/Alert' import getAPIClient from '../../services/ssrApi'; -import router from 'next/router'; import { DemRegXDemConChart } from '../../components/graph/DemRegXDemConChart'; import Tabs from '@mui/material/Tabs'; @@ -29,7 +28,6 @@ import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns'; import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; import BasicButton from '../../components/buttons/basicButton/BasicButton'; import { DiscretizedConsumptionChart } from '../../components/graph/DiscretizedConsumptionChart'; -import DiscretizedConsumptionChartLine from '../../components/graph/DiscretizedConsumptionChartLine'; import FatorPotenciaChart from '../../components/graph/fatorPotenciaChart'; import { getDiscretization } from '../../services/charts/telemetry/getDiscretization'; import { getPowerFactorData } from '../../services/charts/telemetry/getPowerFactor'; @@ -103,6 +101,8 @@ export default function Telemetria({userName, clients}: any) { const [tableData, setTableData] = useState(null) + const [loader, setLoader] = useState(false) + const [menu, setMenu] = useState(0); const [showChart, setShowChart] = useState(false); @@ -136,9 +136,11 @@ export default function Telemetria({userName, clients}: any) { setOpenSnackError(false) setOpenSnackSuccess(true) setOpen(false) + setLoader(true) htmlToCSV(html, "telemetria.csv") }).catch(res => { setSend(false) + setLoader(false) setException(true) setOpenSnackError(true) setOpenSnackSuccess(false) @@ -155,10 +157,8 @@ export default function Telemetria({userName, clients}: any) { }).then(res => { setDemRegXDemCon2(res.data.data) htmlToCSV(html, "telemetria.csv") - }).catch(res => { - // console.log(res) - // router.push('/telemetria') }) + setLoader(true) } const [filters, setFilters] = useState() @@ -326,10 +326,10 @@ export default function Telemetria({userName, clients}: any) {
{ - setSend(true) + setLoader(true) getDiscretization(unity, startDate, endDate, discretization) - .then(result => {setDiscretizedConsumptionData(result); setSend(false)}) - .catch(exception => {setSend(false); setOpenSnackFields(true)}) + .then(result => {setDiscretizedConsumptionData(result); setSend(false); setLoader(false)}) + .catch(exception => {setSend(false); setOpenSnackFields(true); setLoader(false)}) }}/>
@@ -423,10 +423,10 @@ export default function Telemetria({userName, clients}: any) {
{ - setSend(true) + setLoader(true) getDemand(unity, startDate, endDate, discretization) - .then(result => {setDemRegXDemCon(result); setSend(false)}) - .catch(exception => {setSend(false); setOpenSnackFields(true)}) + .then(result => {setDemRegXDemCon(result); setSend(false); setLoader(false)}) + .catch(exception => {setSend(false); setOpenSnackFields(true); setLoader(false)}) }}/>
@@ -516,10 +516,10 @@ export default function Telemetria({userName, clients}: any) {
{ - setSend(true) + setLoader(true) getPowerFactorData(unity, startDate, endDate, discretization) - .then(result => {setFatorPotenciaData(result); setSend(false)}) - .catch(exception => {setSend(false); setOpenSnackFields(true)}) + .then(result => {setFatorPotenciaData(result); setSend(false); setLoader(false)}) + .catch(exception => {setSend(false); setOpenSnackFields(true); setLoader(false)}) }}/>
@@ -578,10 +578,9 @@ export default function Telemetria({userName, clients}: any) {
{ + setLoader(true) setSend(true) - getDemand(unity, startDate, endDate, discretization) - .then(result => {setDiscretizedConsumptionData(result); setSend(false)}) - .catch(exception => {setSend(false); setOpenSnackFields(true)}) + getChartData() }}/>
@@ -591,7 +590,7 @@ export default function Telemetria({userName, clients}: any) { - +
diff --git a/src/services/charts/telemetry/getDiscretization.ts b/src/services/charts/telemetry/getDiscretization.ts index 86ba65f..d197e98 100644 --- a/src/services/charts/telemetry/getDiscretization.ts +++ b/src/services/charts/telemetry/getDiscretization.ts @@ -8,18 +8,14 @@ export async function getDiscretization( unity: string, startDate: Date, endDate: Date, - discretization: string + discretization: string, ) { const { data } = await api.post('/telemetry/discretization', { "type": discretization, - // "type": "1_hora", "filters": [ {"type" : "=", "field": "med_5min.ponto", "value": unity}, {"type" : "between", "field": "dia_num", "value": [startDate.toLocaleDateString().split('/').reverse().join('-'), endDate.toLocaleDateString().split('/').reverse().join('-')]} ] - // "filters": [ - // {"type" : "=", "field": "med_5min.ponto", "value": "RSZFNAENTR101P"} - // ] } ) diff --git a/src/styles/layouts/Telemetria/TelemetriaView.ts b/src/styles/layouts/Telemetria/TelemetriaView.ts index 09bbad3..bd75acb 100644 --- a/src/styles/layouts/Telemetria/TelemetriaView.ts +++ b/src/styles/layouts/Telemetria/TelemetriaView.ts @@ -14,12 +14,10 @@ export const TelemetriaView = styled.main` box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; -webkit-box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; -moz-box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; - border-radius: 20px; + border-radius: 10px; background-color: #FFFFFF; - /* margin-top: 10px; */ - .modal { position: absolute; @@ -34,7 +32,7 @@ export const TelemetriaView = styled.main` left: 0; width: 100%; - height: 100vh; + height: 150vh; z-index: 999; } diff --git a/src/styles/layouts/aboutUs/AboutUsView.ts b/src/styles/layouts/aboutUs/AboutUsView.ts index be1aa68..91ce58a 100644 --- a/src/styles/layouts/aboutUs/AboutUsView.ts +++ b/src/styles/layouts/aboutUs/AboutUsView.ts @@ -9,7 +9,7 @@ export const AboutUsView = styled.main` box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; -webkit-box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; -moz-box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; - border-radius: 20px; + border-radius: 10px; background-color: #FFFFFF; diff --git a/src/styles/layouts/commonQuestions/FaqView.ts b/src/styles/layouts/commonQuestions/FaqView.ts index 273497a..38e968c 100644 --- a/src/styles/layouts/commonQuestions/FaqView.ts +++ b/src/styles/layouts/commonQuestions/FaqView.ts @@ -12,7 +12,7 @@ export const FaqView = styled.main` box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; -webkit-box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; -moz-box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; - border-radius: 20px; + border-radius: 10px; background-color: #FFFFFF; diff --git a/src/styles/layouts/economy/economy.ts b/src/styles/layouts/economy/economy.ts index 6c370c4..38fe86f 100644 --- a/src/styles/layouts/economy/economy.ts +++ b/src/styles/layouts/economy/economy.ts @@ -7,7 +7,7 @@ export const EconomyView = styled.main` box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; -webkit-box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; -moz-box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; - border-radius: 20px; + border-radius: 10px; background-color: #FFFFFF; diff --git a/src/styles/layouts/industryInfo/IndustryInfoView.ts b/src/styles/layouts/industryInfo/IndustryInfoView.ts index 36ddef8..fa95077 100644 --- a/src/styles/layouts/industryInfo/IndustryInfoView.ts +++ b/src/styles/layouts/industryInfo/IndustryInfoView.ts @@ -9,7 +9,7 @@ export const IndustryInfoView = styled.main` box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; -webkit-box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; -moz-box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; - border-radius: 20px; + border-radius: 10px; background-color: #FFFFFF; diff --git a/src/styles/layouts/news/NewsView.ts b/src/styles/layouts/news/NewsView.ts index 861d19c..c1072c6 100644 --- a/src/styles/layouts/news/NewsView.ts +++ b/src/styles/layouts/news/NewsView.ts @@ -15,7 +15,7 @@ export const NewsView = styled.main` box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; -webkit-box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; -moz-box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; - border-radius: 20px; + border-radius: 10px; background-color: #FFFFFF; diff --git a/src/styles/layouts/pld/PldView.ts b/src/styles/layouts/pld/PldView.ts index a3fec56..f2e4ffc 100644 --- a/src/styles/layouts/pld/PldView.ts +++ b/src/styles/layouts/pld/PldView.ts @@ -432,7 +432,7 @@ export const PldGraphView = styled.main` box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; -webkit-box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; -moz-box-shadow: 0 0 11px rgba(0, 0, 0, 0.2) ; - border-radius: 20px; + border-radius: 10px; background-color: #FFFFFF;