Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • web-et-numerique/factory/llle_project/ecolyo
1 result
Show changes
Commits on Source (6)
Showing
with 425 additions and 418 deletions
......@@ -31,7 +31,8 @@
***
5. **Analyse et conso**
- [ ] La profondeur de données va jusqu'à 1 an dans la conso pour les pas de temps journalier
- [ ] La profondeur de données à la 1/2h va jusqu'à 3 mois.
- [ ] La profondeur de données à la 1/2h va jusqu'à 1 semaine au premier lancement, puis 1 mois le lendemain.
- [ ] La profondeur de données à la 1/2h va jusqu'à 1 mois le lendemain.
- [ ] La profondeur de données va jusqu'à 3 mois antérieur dans l'analyse
- [ ] Les modules de l'analyse sont tous fonctionnels (à l'exception du special elec qui devra être déclenché par un service)
***
......
......@@ -9,6 +9,7 @@ import { FluidType } from 'enums'
import { Account, AccountAuthData } from 'models'
import React, { useEffect, useState } from 'react'
import { useAppSelector } from 'store/hooks'
import logApp from 'utils/logger'
import { getPartnerPicto } from 'utils/picto'
import './formLogin.scss'
......@@ -75,7 +76,8 @@ const FormLogin = () => {
await update()
}
} catch (error) {
Sentry.captureException(JSON.stringify({ error }))
logApp.error(error)
Sentry.captureException(error)
setLoading(false)
}
}
......
......@@ -3,7 +3,7 @@ import { Button } from '@material-ui/core'
import { mount } from 'enzyme'
import toJson from 'enzyme-to-json'
import React from 'react'
import ErrorPage from './ErrorPage'
import EcogestureNotFound from './EcogestureNotFound'
const mockedNavigate = jest.fn()
jest.mock('react-router-dom', () => ({
......@@ -15,14 +15,18 @@ jest.mock('components/Header/Header', () => 'mock-header')
jest.mock('components/Header/CozyBar', () => 'mock-cozybar')
jest.mock('components/Content/Content', () => 'mock-content')
describe('ErrorPage component', () => {
describe('EcogestureNotFound component', () => {
it('should be rendered correctly', async () => {
const wrapper = mount(<ErrorPage text="test" returnPage="ecogestures" />)
const wrapper = mount(
<EcogestureNotFound text="test" returnPage="ecogestures" />
)
expect(toJson(wrapper)).toMatchSnapshot()
})
it('should click on button and be redirected', () => {
const wrapper = mount(<ErrorPage text="test" returnPage="ecogestures" />)
const wrapper = mount(
<EcogestureNotFound text="test" returnPage="ecogestures" />
)
wrapper.find(Button).simulate('click')
expect(mockedNavigate).toHaveBeenCalledWith('/ecogestures')
})
......
......@@ -7,14 +7,15 @@ import Header from 'components/Header/Header'
import { useI18n } from 'cozy-ui/transpiled/react/I18n'
import React, { useState } from 'react'
import { useNavigate } from 'react-router-dom'
import './errorPage.scss'
import './ecogestureNotFound.scss'
interface ErrorPageProps {
const EcogestureNotFound = ({
text,
returnPage,
}: {
text: string
returnPage: string
}
const ErrorPage = ({ text, returnPage }: ErrorPageProps) => {
}) => {
const { t } = useI18n()
const navigate = useNavigate()
const [headerHeight, setHeaderHeight] = useState<number>(0)
......@@ -49,4 +50,4 @@ const ErrorPage = ({ text, returnPage }: ErrorPageProps) => {
)
}
export default ErrorPage
export default EcogestureNotFound
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ErrorPage component should be rendered correctly 1`] = `
<ErrorPage
exports[`EcogestureNotFound component should be rendered correctly 1`] = `
<EcogestureNotFound
returnPage="ecogestures"
text="test"
>
......@@ -193,5 +193,5 @@ exports[`ErrorPage component should be rendered correctly 1`] = `
</WithStyles(ForwardRef(Button))>
</div>
</mock-content>
</ErrorPage>
</EcogestureNotFound>
`;
import { Collapse } from '@material-ui/core'
import IconButton from '@material-ui/core/IconButton'
import * as Sentry from '@sentry/react'
import doingDisabledIcon from 'assets/icons/ico/doing-disabled.svg'
import doingEnabledIcon from 'assets/icons/ico/doing-enabled.svg'
import objectiveDisabledIcon from 'assets/icons/ico/objective-disabled.svg'
import objectiveEnabledIcon from 'assets/icons/ico/objective-enabled.svg'
import defaultIcon from 'assets/icons/visu/ecogesture/default.svg'
import ErrorPage from 'components/CommonKit/ErrorPage/ErrorPage'
import StyledIcon from 'components/CommonKit/Icon/StyledIcon'
import Content from 'components/Content/Content'
import ErrorPage from 'components/Ecogesture/EcogestureNotFound/EcogestureNotFound'
import CozyBar from 'components/Header/CozyBar'
import Header from 'components/Header/Header'
import useExploration from 'components/Hooks/useExploration'
......@@ -20,6 +21,7 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'
import { useParams } from 'react-router-dom'
import EcogestureService from 'services/ecogesture.service'
import { useAppSelector } from 'store/hooks'
import logApp from 'utils/logger'
import { importIconById } from 'utils/utils'
import EfficiencyRating from './EfficiencyRating/EfficiencyRating'
import './singleEcogestureView.scss'
......@@ -89,6 +91,9 @@ const SingleEcogestureView = () => {
setValidExploration(currentChallenge.exploration.id)
}
}
} else {
logApp.error(`Could not find ecogesture ${ecogestureID}`)
Sentry.captureException(new Error('Could not find ecogesture'))
}
setIsLoading(false)
}
......
......@@ -83,7 +83,7 @@ const useKonnectorAuth = (
setLoading(false)
sendUsageEventError(konnectorSlug)
logApp.error(error)
Sentry.captureException(JSON.stringify({ error }))
Sentry.captureException(error)
}
}
......
......@@ -19,7 +19,7 @@ const KonnectorViewerList = () => {
}
return (
<>
<div className="konnectorsList">
{fluidStatus.map((fluidStatusItem: FluidStatus, key: number) => (
<StyledCard
key={key}
......@@ -41,7 +41,7 @@ const KonnectorViewerList = () => {
</div>
</StyledCard>
))}
</>
</div>
)
}
......
@import 'src/styles/base/color';
@import 'src/styles/base/breakpoint';
button.connection-card {
height: 80px;
margin-bottom: 1rem;
&.electricity {
border: 1px solid var(--elecColor40);
}
&.gas {
border: 1px solid var(--gasColor40);
}
&.water {
border: 1px solid var(--waterColor40);
.konnectorsList {
display: flex;
flex-direction: column;
gap: 1rem;
padding-top: 1rem;
button.connection-card {
height: 80px;
&.electricity {
border: 1px solid var(--elecColor40);
}
&.gas {
border: 1px solid var(--gasColor40);
}
&.water {
border: 1px solid var(--waterColor40);
}
}
}
......@@ -373,7 +373,7 @@ const SplashRoot = ({ fadeTimer = 1000, children }: SplashRootProps) => {
setInitStepErrors(InitStepsErrors.UNKNOWN_ERROR)
}
logApp.error(`[Initialization] Error : ${error}`)
Sentry.captureException(JSON.stringify({ error }))
Sentry.captureException(error)
} finally {
transaction.finish()
}
......
......@@ -8,10 +8,9 @@ import './splashScreen.scss'
const SplashScreen = ({ initStep }: { initStep: InitSteps }) => {
const { t } = useI18n()
const getProgress = () => {
const total: number = Object.values(InitSteps).length / 2
const progress: number =
initStep === 0 ? 10 : Math.round((initStep / total) * 100)
return progress
const total = Object.values(InitSteps).length / 2
const progress = initStep === 0 ? 10 : Math.round((initStep / total) * 100)
return progress - 90 /* hack to make the progress bar start way left */
}
return (
<>
......@@ -23,7 +22,7 @@ const SplashScreen = ({ initStep }: { initStep: InitSteps }) => {
<div className="splash-progress-bar-container">
<div
className="splash-progress-bar-content"
style={{ width: `${getProgress()}%` }}
style={{ left: `${getProgress()}%` }}
/>
</div>
</div>
......
......@@ -48,7 +48,7 @@ exports[`SplashRoot component should be rendered correctly 1`] = `
className="splash-progress-bar-content"
style={
Object {
"width": "17%",
"left": "-73%",
}
}
/>
......
......@@ -27,7 +27,7 @@ exports[`SplashScreen component should be rendered correctly 1`] = `
className="splash-progress-bar-content"
style={
Object {
"width": "17%",
"left": "-73%",
}
}
/>
......
......@@ -72,7 +72,6 @@
border-radius: 12px;
box-sizing: border-box;
max-width: 350px;
.splash-progress-bar-container {
flex: 1;
height: 12px;
......@@ -90,29 +89,16 @@
background-size: 9px 9px;
border: solid 1px $gold-shadow;
border-radius: 12px;
overflow: hidden;
position: relative;
.splash-progress-bar-content {
height: 12px;
box-sizing: border-box;
background-color: $gold-shadow;
border: solid 1px $gold-shadow;
border-radius: 12px 4px 0 12px;
border-right: none;
transition: all 300ms ease;
position: relative;
overflow: hidden;
top: -1px;
left: -1px;
&:after {
content: '';
position: absolute;
display: block;
transform: rotate(45deg);
background-color: $dark-2;
width: 15px;
height: 15px;
right: -9px;
top: -8px;
}
position: absolute;
bottom: -150px;
left: -100%;
height: 300px;
width: 100%;
transform: rotate(45deg);
}
}
}
......@@ -173,7 +173,7 @@ export async function migrate(
}
} catch (error: any) {
console.error(error)
Sentry.captureException(JSON.stringify({ error }))
Sentry.captureException(error)
result = {
type: MIGRATION_RESULT_FAILED,
errors: [error.toString()],
......
......@@ -57,7 +57,7 @@ export default class AccountService {
const errorMessage = `Get account failed :${JSON.stringify(error)}`
logStack('error', errorMessage)
logApp.error(errorMessage)
Sentry.captureException(errorMessage)
Sentry.captureException(error)
throw new Error('Get account failed')
}
}
......@@ -106,7 +106,7 @@ export default class AccountService {
const errorMessage = `Error GetAccountByType: ${JSON.stringify(error)}`
logStack('error', errorMessage)
logApp.error(errorMessage)
Sentry.captureException(errorMessage)
Sentry.captureException(error)
return null
}
}
......@@ -124,7 +124,7 @@ export default class AccountService {
const errorMessage = `Error: GetAccountsByType: ${JSON.stringify(error)}`
logStack('error', errorMessage)
logApp.error(errorMessage)
Sentry.captureException(errorMessage)
Sentry.captureException(error)
return []
}
}
......@@ -137,7 +137,7 @@ export default class AccountService {
const errorMessage = `Update account failed: ${JSON.stringify(error)}`
logStack('error', errorMessage)
logApp.error(errorMessage)
Sentry.captureException(errorMessage)
Sentry.captureException(error)
throw new Error('Update account failed')
}
}
......@@ -150,7 +150,7 @@ export default class AccountService {
const errorMessage = `Delete account failed`
logStack('error', errorMessage)
logApp.error(errorMessage)
Sentry.captureException(errorMessage)
Sentry.captureException(error)
throw new Error(errorMessage)
}
}
......
......@@ -459,7 +459,7 @@ export default class ChallengeService {
)}`
logStack('error', errorMessage)
logApp.error(errorMessage)
Sentry.captureException(errorMessage)
Sentry.captureException(error)
throw error
}
}
......@@ -513,7 +513,7 @@ export default class ChallengeService {
)}`
logStack('error', errorMessage)
logApp.error(errorMessage)
Sentry.captureException(errorMessage)
Sentry.captureException(error)
throw error
}
}
......@@ -555,7 +555,7 @@ export default class ChallengeService {
)}`
logStack('error', errorMessage)
logApp.error(errorMessage)
Sentry.captureException(errorMessage)
Sentry.captureException(error)
throw error
}
}
......@@ -775,7 +775,7 @@ export default class ChallengeService {
)}`
logStack('error', errorMessage)
logApp.error(errorMessage)
Sentry.captureException(errorMessage)
Sentry.captureException(error)
throw error
}
}
......
......@@ -39,7 +39,7 @@ export default class CustomPopupService {
)}`
logStack('error', errorMessage)
logApp.error(errorMessage)
Sentry.captureException(errorMessage)
Sentry.captureException(error)
}
}
}