Merge branch 'telemetry' into 'dev'

Telemetry

See merge request kluppsoftware/smart-energia-web!122
This commit is contained in:
José Corte 2022-07-21 19:30:56 +00:00
commit b8d7fd138c
18 changed files with 33 additions and 57 deletions

View File

@ -114,8 +114,6 @@ export function LineBarChart({ title, subtitle, data1, data2, data3, label, red,
}, },
}; };
console.log(data3)
const data = data2? { const data = data2? {
labels: label.length < 28? ['1', '2', '3', '4', '5', '6', '7', '8', '8', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'] : label, labels: label.length < 28? ['1', '2', '3', '4', '5', '6', '7', '8', '8', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'] : label,
datasets: [ datasets: [

View File

@ -82,8 +82,6 @@ export default function FatorPotenciaChart({ title, subtitle, data1, data2, labe
const labels = label; const labels = label;
console.log(data1)
const data = { const data = {
labels, labels,
datasets: [ datasets: [

View File

@ -32,8 +32,6 @@ export function GrossAnualChart({ title, subtitle, dataProps, label, dataset, ba
function spacement(string) { function spacement(string) {
const spaces = string.length===1?'' : string.length===2? '' : string.length===3? ' ' : string.length===4? ' ' : string.length===5? ' ' : '' const spaces = string.length===1?'' : string.length===2? '' : string.length===3? ' ' : string.length===4? ' ' : string.length===5? ' ' : ''
console.log(string.length)
return spaces return spaces
} }
@ -76,13 +74,12 @@ export function GrossAnualChart({ title, subtitle, dataProps, label, dataset, ba
}, },
display: true, display: true,
anchor: "end", anchor: "end",
offset: !miniature?20 : -30, offset: !miniature?20 : 10,
align: "start", align: "start",
font: { font: {
size: !miniature? 30 : 10, size: !miniature? 30 : 10,
}, },
color: (value) => { color: (value) => {
console.log(value.dataset.label)
return value.dataset.label==='Consolidada'? '#fff' : '#255488' return value.dataset.label==='Consolidada'? '#fff' : '#255488'
}, },
}, },

View File

@ -46,8 +46,6 @@ export default function GrossMensalChart({ title, data1, data2, label, subtitle,
const spaces = string.length===1?'' : string.length===2? '' : string.length===3? ' ' : string.length===4? ' ' : string.length===5? ' ' : '' const spaces = string.length===1?'' : string.length===2? '' : string.length===3? ' ' : string.length===4? ' ' : string.length===5? ' ' : ''
// const spaces = string.length===1?'' : string.length===2? '' : string.length===3? '' : string.length===4? '' : string.length===5? '' : '' // const spaces = string.length===1?'' : string.length===2? '' : string.length===3? '' : string.length===4? '' : string.length===5? '' : ''
console.log(string.length)
return spaces return spaces
} }

View File

@ -145,15 +145,11 @@ export default function clients({ clients, userName }) {
newImageUrls.push(URL.createObjectURL(image)) newImageUrls.push(URL.createObjectURL(image))
) )
setImageURLs(newImageUrls) setImageURLs(newImageUrls)
console.log('ola')
}, [images]) }, [images])
function onImageChange(e: any) { function onImageChange(e: any) {
console.log('olá');
setImages([...e.target.files]) setImages([...e.target.files])
setLogo(e.target.files[0]) setLogo(e.target.files[0])
console.log(e.target.files[0]);
} }
return ( return (
@ -315,7 +311,6 @@ export default function clients({ clients, userName }) {
<div className="imgContainer"> <div className="imgContainer">
<article> <article>
{imageURLS.map((imageSrc, index) => { {imageURLS.map((imageSrc, index) => {
console.log('olá')
return <Image return <Image
src={imageSrc} src={imageSrc}
key={index} key={index}

View File

@ -25,7 +25,6 @@ export default function industryInfo({userName, pdfUrl}: any) {
const [pdf, setPdf] = useState<any>(); const [pdf, setPdf] = useState<any>();
function onChange(e) { function onChange(e) {
console.log(e.target.files)
setPdf(e.target.files[0]) setPdf(e.target.files[0])
} }
@ -55,7 +54,7 @@ export default function industryInfo({userName, pdfUrl}: any) {
api.get('/download').then(res => { api.get('/download').then(res => {
window.open(res.data.path); window.open(res.data.path);
}).catch(res => { }).catch(res => {
console.log(res) // console.log(res)
}) })
} }
@ -79,7 +78,7 @@ export default function industryInfo({userName, pdfUrl}: any) {
<PageTitle title='Info Setorial' subtitle='Realize o upload da última versão de info setorial' /> <PageTitle title='Info Setorial' subtitle='Realize o upload da última versão de info setorial' />
<form action=""> <form action="">
<label htmlFor="">Escolher arquivo</label> <label htmlFor="">Escolher arquivo</label>
<input type="file" name='arquivo' id='arquivo' onChange={onChange}/> <input type="file" name='arquivo' placeholder='' id='arquivo' onChange={onChange}/>
</form> </form>
</div> </div>
@ -107,7 +106,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
apiClient.get('/download').then(res => { apiClient.get('/download').then(res => {
pdfUrl = res.data.path pdfUrl = res.data.path
}).catch(res => { }).catch(res => {
console.log('exception', res) // console.log('exception', res)
}) })
if (!token) { if (!token) {

View File

@ -43,7 +43,6 @@ export default function CostIndicator({graphData, userName, clients}: any) {
] ]
}:{}).then(res => { }:{}).then(res => {
setGraphDataState(res.data.data) setGraphDataState(res.data.data)
console.log()
}).catch(res => { }).catch(res => {
// console.log(res) // console.log(res)
}) })
@ -113,7 +112,6 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
"codigo_scde"], "codigo_scde"],
"distinct": true "distinct": true
}).then(res => { }).then(res => {
console.log(res.data.data)
clients = res.data.data clients = res.data.data
}).catch(res => { }).catch(res => {
// console.log(res) // console.log(res)

View File

@ -105,15 +105,15 @@ export default function economy({userName, anual, years, brutaMensal, yearsBruta
</TableHeader> </TableHeader>
{ {
economyMenu === 0? economyMenu === 0?
<p style={{marginLeft: '3%'}}>Economia Bruta Anual - Valores em R$ x mil</p> <p style={{marginLeft: '3%'}}>Economia Bruta Estimada e Acumulada Anual - Valores em R$ x mil</p>
: :
economyMenu === 1? economyMenu === 1?
<p style={{marginLeft: '3%'}}>Economia Bruta Mensal - Valores em R$ x mil</p> <p style={{marginLeft: '3%'}}>Economia Bruta Estimada e Acumulada Anual - Valores em R$ x mil</p>
: :
economyMenu === 2? economyMenu === 2?
<p style={{marginLeft: '3%'}}>Economia Estimada x Consolidada - Valores em R$ x mil</p> <p style={{marginLeft: '3%'}}>Comparativo de Custo Estimado - Valores em R$ x mil</p>
: :
<p style={{marginLeft: '3%'}}>Economia Custo R$/MWH - Valores em R$ x mil</p> <p style={{marginLeft: '3%'}}>Indicador de Custo - Valores em R$/MWh</p>
} }
{ {
typeof window === 'undefined' || typeof window === undefined? null : typeof window === 'undefined' || typeof window === undefined? null :
@ -141,7 +141,7 @@ export default function economy({userName, anual, years, brutaMensal, yearsBruta
<RenderIf isTrue={economyMenu===2}> <RenderIf isTrue={economyMenu===2}>
<div style={{paddingLeft: '3%'}}> <div style={{paddingLeft: '3%'}}>
<FormControl sx={{ m: 1, minWidth: 120, width: 200, height: '64px' }} size="small"> <FormControl sx={{ m: 1, minWidth: 120, width: 200, height: '65px'}} size="small">
<InputLabel id="demo-select-small">Unidade</InputLabel> <InputLabel id="demo-select-small">Unidade</InputLabel>
<Select <Select
labelId="demo-select-small" labelId="demo-select-small"
@ -248,7 +248,6 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
"codigo_scde"], "codigo_scde"],
"distinct": true "distinct": true
}).then(res => { }).then(res => {
console.log(res.data.data)
clients = res.data.data clients = res.data.data
}).catch(res => { }).catch(res => {
// console.log(res) // console.log(res)

View File

@ -30,7 +30,6 @@ export default function EstimatedCost({graphData, userName, clients}: any) {
] ]
}:{}).then(res => { }:{}).then(res => {
setGraphDataState(res.data.data) setGraphDataState(res.data.data)
console.log()
}).catch(res => { }).catch(res => {
// console.log(res) // console.log(res)
}) })
@ -92,7 +91,6 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
"codigo_scde"], "codigo_scde"],
"distinct": true "distinct": true
}).then(res => { }).then(res => {
console.log(res.data.data)
clients = res.data.data clients = res.data.data
}).catch(res => { }).catch(res => {
// console.log(res) // console.log(res)

View File

@ -124,7 +124,7 @@ export default function Home() {
<TextField id="outlined-basic" <TextField id="outlined-basic"
sx={{ m: 1, width: '90%' }} label="Login" value={email} variant="outlined" onKeyDown={(e) => e.key==='Enter'? console.log(field.current.children[0].focus()) : null} sx={{ m: 1, width: '90%' }} label="Login" value={email} variant="outlined" onKeyDown={(e) => e.key==='Enter'? field.current.children[0].focus() : null}
onChange={value => { onChange={value => {
setEmail(value.target.value.toLowerCase()) setEmail(value.target.value.toLowerCase())
}}/> }}/>

View File

@ -62,7 +62,6 @@ export default function pld({tableData, userName, clientMonth}: pldInterface) {
function getPageYAfterScroll(){ function getPageYAfterScroll(){
setPageYPosition(window.scrollY); setPageYPosition(window.scrollY);
console.log(window.scrollY)
} }
const handleChange = (event: SelectChangeEvent) => { const handleChange = (event: SelectChangeEvent) => {
@ -70,18 +69,14 @@ export default function pld({tableData, userName, clientMonth}: pldInterface) {
}; };
const handleChangeDay = (event: SelectChangeEvent) => { const handleChangeDay = (event: SelectChangeEvent) => {
setMonth(event.target.value); setMonth(event.target.value);
console.log(new Date().toLocaleDateString().slice(3, 10))
console.log('select', event.target.value)
}; };
const handleChangeDate = (newValue: Date | null) => { const handleChangeDate = (newValue: Date | null) => {
setDate(newValue) setDate(newValue)
console.log(newValue.toLocaleDateString().replace('/', '-').split('-').reverse().join('-'))
}; };
function getDataByDay() { function getDataByDay() {
console.log(month)
api.post('/pld/daily', { api.post('/pld/daily', {
"filters": [ "filters": [
{"type" : "=", "field" : "year_month_formatted", "value": month}, {"type" : "=", "field" : "year_month_formatted", "value": month},
@ -91,7 +86,7 @@ export default function pld({tableData, userName, clientMonth}: pldInterface) {
}).then(res => { }).then(res => {
setDataByDay(res.data.data) setDataByDay(res.data.data)
}).catch(exception => { }).catch(exception => {
console.log(exception) // console.log(exception)
}) })
} }
@ -201,7 +196,6 @@ export default function pld({tableData, userName, clientMonth}: pldInterface) {
useEffect(() => { useEffect(() => {
getDataByHour() getDataByHour()
getDataByDay() getDataByDay()
console.log(month)
}, [date, month, select]) }, [date, month, select])
useEffect(() => { useEffect(() => {

View File

@ -44,7 +44,6 @@ export default function ResumoOperacao({tableData, clients, userName, clientMont
function getPageYAfterScroll(){ function getPageYAfterScroll(){
setPageYPosition(window.scrollY); setPageYPosition(window.scrollY);
console.log(window.scrollY)
} }
function downloadCSVFile(csv, filename) { function downloadCSVFile(csv, filename) {
@ -71,7 +70,6 @@ export default function ResumoOperacao({tableData, clients, userName, clientMont
} }
useEffect(() => { useEffect(() => {
console.log(unidade)
if (unidade!=='' || month!==''){ if (unidade!=='' || month!==''){
api.post('/operation/summary', month && !unidade? { api.post('/operation/summary', month && !unidade? {
"filters": [ "filters": [
@ -91,7 +89,7 @@ export default function ResumoOperacao({tableData, clients, userName, clientMont
} : {} } : {}
).then(res => { ).then(res => {
setTableDataState(res.data.data) setTableDataState(res.data.data)
}).catch(res => console.log(res)) })
} else { } else {
setTableDataState(tableData) setTableDataState(tableData)
} }
@ -249,7 +247,6 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
"codigo_scde"], "codigo_scde"],
"distinct": true "distinct": true
}).then(res => { }).then(res => {
console.log(res.data)
clients = res.data.data clients = res.data.data
}).catch(res => { }).catch(res => {
// console.log(res) // console.log(res)

View File

@ -113,16 +113,12 @@ export default function Telemetria({userName, clients}: any) {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const handleChangeStartDate = (newValue: Date | null) => { const handleChangeStartDate = (newValue: Date | null) => {
console.log(newValue)
setStartDate(newValue) setStartDate(newValue)
}; };
const handleChangeEndDate = (newValue: Date | null) => { const handleChangeEndDate = (newValue: Date | null) => {
console.log(newValue)
setEndDate(newValue) setEndDate(newValue)
}; };
console.log(currentDate.slice(0, 8) + '01')
const [demRegXDemCon2, setDemRegXDemCon2] = useState([]); const [demRegXDemCon2, setDemRegXDemCon2] = useState([]);
async function getTableData() { async function getTableData() {

View File

@ -82,7 +82,4 @@ export async function logout() {
await api.post('/auth/logout', {}) await api.post('/auth/logout', {})
// eslint-disable-next-line @typescript-eslint/no-empty-function // eslint-disable-next-line @typescript-eslint/no-empty-function
.then(res => {}) .then(res => {})
.catch(res => {
console.log(res)
})
} }

View File

@ -10,7 +10,6 @@ export async function getDiscretization(
endDate: Date, endDate: Date,
discretization: string discretization: string
) { ) {
console.log(new Date(startDate).toLocaleDateString().split('/').reverse().join('-'), endDate.toLocaleDateString())
const { data } = await api.post('/telemetry/discretization', { const { data } = await api.post('/telemetry/discretization', {
"type": discretization, "type": discretization,
// "type": "1_hora", // "type": "1_hora",

View File

@ -40,11 +40,18 @@ export const GlobalStyle = createGlobalStyle`
box-sizing: border-box; box-sizing: border-box;
} }
/* .MuiInputLabel-outlined {
margin-top: 11px;
}
.Mui-focused {
margin-top: 0!important;
} */
.datePicker { .datePicker {
.MuiOutlinedInput-input, .MuiInputBase-input, .MuiInputBase-inputAdornedEnd, .css-nxo287-MuiInputBase-input-MuiOutlinedInput-input { .MuiOutlinedInput-input, .MuiInputBase-input, .MuiInputBase-inputAdornedEnd, .css-nxo287-MuiInputBase-input-MuiOutlinedInput-input {
padding: 0 0 0 15px; padding: 0 0 0 15px;
width: 100%; width: 100%;
height: 63px; height: 63px!important;
} }
.css-1u3bzj6-MuiFormControl-root-MuiTextField-root, .css-1u3bzj6-MuiFormControl-root-MuiTextField-root,
.css-o9k5xi-MuiInputBase-root-MuiOutlinedInput-root, .css-o9k5xi-MuiInputBase-root-MuiOutlinedInput-root,

View File

@ -188,9 +188,12 @@ export const TelemetriaView = styled.main`
} }
.input { .input {
.MuiInputLabel-root, .MuiInputLabel-formControl { .MuiInputLabel-outlined {
margin-top: 11px; margin-top: 11px;
} }
.Mui-focused {
margin-top: 0!important;
}
} }
span { span {

View File

@ -13,20 +13,23 @@ export const EconomyView = styled.main`
margin-top: 10px; margin-top: 10px;
.MuiInputLabel-root, .MuiInputLabel-formControl {
margin-top: 11px;
}
section { section {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.MuiInputLabel-outlined {
margin-top: 11px;
}
.Mui-focused {
margin-top: 0!important;
}
.chartBox { .chartBox {
} }
input { /* input {
width: 16.6rem; width: 16.6rem;
height: 63px!important; height: 63px!important;
@ -37,5 +40,5 @@ export const EconomyView = styled.main`
border: solid gray 1px; border: solid gray 1px;
background-color: #F9F9F9; background-color: #F9F9F9;
} } */
` `