Skip to content
Snippets Groups Projects
Commit 1075c60d authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

Merge remote-tracking branch 'origin/dev' into feat/grdf-error-messages

parents 3ebe217c 89a65fa3
No related branches found
No related tags found
2 merge requests!1154feat: GRDF consent email,!1137feat(grdf)!: update error messages
Showing with 76 additions and 74 deletions
...@@ -35,6 +35,7 @@ const ElecHalfHourMonthlyAnalysis = ({ ...@@ -35,6 +35,7 @@ const ElecHalfHourMonthlyAnalysis = ({
const { t } = useI18n() const { t } = useI18n()
const client = useClient() const client = useClient()
const { analysisMonth } = useAppSelector(state => state.ecolyo.analysis) const { analysisMonth } = useAppSelector(state => state.ecolyo.analysis)
const [isWeekend, setIsWeekend] = useState<boolean>(true) const [isWeekend, setIsWeekend] = useState<boolean>(true)
const [isHalfHourActivated, setIsHalfHourActivated] = useState<boolean>(true) const [isHalfHourActivated, setIsHalfHourActivated] = useState<boolean>(true)
const [isLoading, setIsLoading] = useState<boolean>(true) const [isLoading, setIsLoading] = useState<boolean>(true)
...@@ -51,19 +52,21 @@ const ElecHalfHourMonthlyAnalysis = ({ ...@@ -51,19 +52,21 @@ const ElecHalfHourMonthlyAnalysis = ({
setIsWeekend(prev => !prev) setIsWeekend(prev => !prev)
}, []) }, [])
const toggleOpenModal = useCallback(() => { const toggleInfoModal = useCallback(() => {
setOpenInfoModal(prev => !prev) setOpenInfoModal(prev => !prev)
}, []) }, [])
const isDataFullyComplete = useCallback(monthDataloads => {
if ( const isDataFullyComplete = useCallback(
monthDataloads?.weekend && (monthDataloads: AggregatedEnedisMonthlyDataloads | undefined) => {
monthDataloads.week && return (
monthDataloads.weekend[0]?.value !== null && monthDataloads?.weekend &&
monthDataloads.week[0]?.value !== null monthDataloads.week &&
) { monthDataloads.weekend[0]?.value !== null &&
return true monthDataloads.week[0]?.value !== null
} else return false )
}, []) },
[]
)
const getPowerChart = useCallback((): JSX.Element => { const getPowerChart = useCallback((): JSX.Element => {
if (monthDataloads && isDataFullyComplete(monthDataloads)) { if (monthDataloads && isDataFullyComplete(monthDataloads)) {
...@@ -73,9 +76,8 @@ const ElecHalfHourMonthlyAnalysis = ({ ...@@ -73,9 +76,8 @@ const ElecHalfHourMonthlyAnalysis = ({
isWeekend={isWeekend} isWeekend={isWeekend}
/> />
) )
} else {
return <p className="text-20-bold no_data">{t('analysis.no_data')}</p>
} }
return <p className="text-20-bold no_data">{t('analysis.no_data')}</p>
}, [isDataFullyComplete, isWeekend, monthDataloads, t]) }, [isDataFullyComplete, isWeekend, monthDataloads, t])
useEffect(() => { useEffect(() => {
...@@ -279,7 +281,7 @@ const ElecHalfHourMonthlyAnalysis = ({ ...@@ -279,7 +281,7 @@ const ElecHalfHourMonthlyAnalysis = ({
</div> </div>
</div> </div>
<Button className="btnText" onClick={toggleOpenModal}> <Button className="btnText" onClick={toggleInfoModal}>
{t('special_elec.showModal')} {t('special_elec.showModal')}
</Button> </Button>
</div> </div>
...@@ -291,7 +293,7 @@ const ElecHalfHourMonthlyAnalysis = ({ ...@@ -291,7 +293,7 @@ const ElecHalfHourMonthlyAnalysis = ({
<ElecInfoModal <ElecInfoModal
open={openInfoModal} open={openInfoModal}
offPeakHours={offPeakHours} offPeakHours={offPeakHours}
handleCloseClick={toggleOpenModal} handleCloseClick={toggleInfoModal}
/> />
</div> </div>
) )
......
...@@ -45,12 +45,12 @@ const SingleEcogestureView = () => { ...@@ -45,12 +45,12 @@ const SingleEcogestureView = () => {
const [, setValidExploration] = useExploration() const [, setValidExploration] = useExploration()
const updateEcogesture = useCallback( const updateEcogesture = useCallback(
async (objective, doing) => { async (objective: boolean, doing: boolean) => {
if (ecogesture) { if (ecogesture) {
const updates: Ecogesture = { const updates: Ecogesture = {
...ecogesture, ...ecogesture,
objective: objective, objective,
doing: doing, doing,
} }
const result = await ecogestureService.updateEcogesture(updates) const result = await ecogestureService.updateEcogesture(updates)
if (result) { if (result) {
......
import { TextField } from '@material-ui/core' import { OutlinedInput } from '@material-ui/core'
import StyledSwitch from 'components/CommonKit/Switch/StyledSwitch' import StyledSwitch from 'components/CommonKit/Switch/StyledSwitch'
import { useClient } from 'cozy-client' import { useClient } from 'cozy-client'
import { useI18n } from 'cozy-ui/transpiled/react/I18n' import { useI18n } from 'cozy-ui/transpiled/react/I18n'
...@@ -37,7 +37,9 @@ const ReportOptions = () => { ...@@ -37,7 +37,9 @@ const ReportOptions = () => {
fluidStatus[FluidType.WATER].status !== FluidState.KONNECTOR_NOT_FOUND && fluidStatus[FluidType.WATER].status !== FluidState.KONNECTOR_NOT_FOUND &&
fluidStatus[FluidType.WATER].status !== FluidState.LOGIN_FAILED fluidStatus[FluidType.WATER].status !== FluidState.LOGIN_FAILED
const setWaterLimit = (e: React.ChangeEvent<HTMLInputElement>) => { const setWaterLimit = (
e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement, Element>
) => {
if (e.target.value !== null && parseInt(e.target.value) > 0) { if (e.target.value !== null && parseInt(e.target.value) > 0) {
dispatch( dispatch(
updateProfile({ updateProfile({
...@@ -134,8 +136,7 @@ const ReportOptions = () => { ...@@ -134,8 +136,7 @@ const ReportOptions = () => {
{t('profile.report.input_label_alert')} {t('profile.report.input_label_alert')}
</div> </div>
<div className="switch-container-alert"> <div className="switch-container-alert">
<TextField <OutlinedInput
variant="outlined"
className="inputNumber text-18" className="inputNumber text-18"
type="number" type="number"
defaultValue={ defaultValue={
...@@ -144,7 +145,12 @@ const ReportOptions = () => { ...@@ -144,7 +145,12 @@ const ReportOptions = () => {
: profile.waterDailyConsumptionLimit : profile.waterDailyConsumptionLimit
} }
onBlur={setWaterLimit} onBlur={setWaterLimit}
label={t('profile.accessibility.input_water_alert_report')} inputProps={{
min: 0,
}}
aria-label={t(
'profile.accessibility.input_water_alert_report'
)}
inputMode="numeric" inputMode="numeric"
/> />
<span className="switch-label text-16-normal">L</span> <span className="switch-label text-16-normal">L</span>
......
...@@ -53,7 +53,7 @@ const ProfileTypeFinished = ({ profileType }: { profileType: ProfileType }) => { ...@@ -53,7 +53,7 @@ const ProfileTypeFinished = ({ profileType }: { profileType: ProfileType }) => {
}), }),
} }
const profileTypeEntityService = new ProfileTypeEntityService(client) const profileTypeEntityService = new ProfileTypeEntityService(client)
const myProfileTypes: ProfileType[] | null = const myProfileTypes =
await profileTypeEntityService.getAllProfileTypes(chosenPeriod) await profileTypeEntityService.getAllProfileTypes(chosenPeriod)
if (myProfileTypes !== null) { if (myProfileTypes !== null) {
const destroyPT = const destroyPT =
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
"coldWater": "individual", "coldWater": "individual",
"hotWater": "individual", "hotWater": "individual",
"individualInsulationWork": ["window_replacement"], "individualInsulationWork": ["window_replacement"],
"facilitiesInstallation": "none",
"hotWaterEquipment": "solar", "hotWaterEquipment": "solar",
"hasInstalledVentilation": "unknown", "hasInstalledVentilation": "unknown",
"hasReplacedHeater": "unknown", "hasReplacedHeater": "unknown",
......
/* eslint-disable camelcase */ export interface AccountAttributes {
account_type: string
auth?: AccountEGLData | AccountSgeData | AccountGRDFData
identifier?: string
state?: string | null
name?: string
data?: SgeAccountData
}
export interface Account extends AccountAttributes { export interface Account extends AccountAttributes {
_id: string _id: string
id?: string id?: string
...@@ -12,17 +20,6 @@ export interface SgeAccountData { ...@@ -12,17 +20,6 @@ export interface SgeAccountData {
offPeakHours?: string offPeakHours?: string
} }
export interface AccountAttributes {
account_type: string
auth?: AccountEGLData | AccountSgeData | AccountGRDFData
identifier?: string
state?: string | null
name?: string
data?: SgeAccountData
// TODO remove this ?
oauth_callback_results?: Record<string, any>
}
export interface AccountEGLData { export interface AccountEGLData {
login: string login: string
credentials_encrypted?: string credentials_encrypted?: string
......
...@@ -533,11 +533,10 @@ describe('ProfileType service', () => { ...@@ -533,11 +533,10 @@ describe('ProfileType service', () => {
DateTime.fromISO('2021-01-01T00:00:00.000Z', { zone: 'utc' }) DateTime.fromISO('2021-01-01T00:00:00.000Z', { zone: 'utc' })
) )
const expectedResult = { const expectedResult: ProfileType = {
...mockProfile, ...mockProfile,
warmingFluid: null, warmingFluid: null,
individualInsulationWork: [], individualInsulationWork: [],
facilitiesInstallation: [],
hotWaterFluid: null, hotWaterFluid: null,
hotWaterEquipment: HotWaterEquipment.OTHER, hotWaterEquipment: HotWaterEquipment.OTHER,
} }
......
...@@ -479,7 +479,6 @@ export default class ProfileTypeService { ...@@ -479,7 +479,6 @@ export default class ProfileTypeService {
if (profileType.heating === IndividualOrCollective.COLLECTIVE) { if (profileType.heating === IndividualOrCollective.COLLECTIVE) {
profileType.warmingFluid = null profileType.warmingFluid = null
profileType.individualInsulationWork = [] profileType.individualInsulationWork = []
profileType.facilitiesInstallation = []
} }
if (profileType.hotWater === IndividualOrCollective.COLLECTIVE) { if (profileType.hotWater === IndividualOrCollective.COLLECTIVE) {
profileType.hotWaterFluid = null profileType.hotWaterFluid = null
......
...@@ -7,23 +7,24 @@ export const accountsData: Account[] = [ ...@@ -7,23 +7,24 @@ export const accountsData: Account[] = [
_rev: '1-88e68b8450cee09fe2f077610901094d', _rev: '1-88e68b8450cee09fe2f077610901094d',
account_type: 'enedissgegrandlyon', account_type: 'enedissgegrandlyon',
name: '', name: '',
oauth: {
access_token: 'MY_ACCESS_TOKEN',
expires_at: '2020-10-09T08:00:00.285910671+02:00',
refresh_token: '',
token_type: 'Bearer',
},
oauth_callback_results: {
issued_at: '1592232569642',
refresh_token_issued_at: '1592232569642',
scope: '/my_enedis_scope',
usage_points_id: '',
},
cozyMetadata: { cozyMetadata: {
createdAt: '2020-11-10T16:42:11.132Z', createdAt: '2020-11-10T16:42:11.132Z',
metadataVersion: 1, metadataVersion: 1,
updatedAt: '2020-11-10T16:42:11.132Z', updatedAt: '2020-11-10T16:42:11.132Z',
}, },
auth: {
address: '6 Rue Vaillant Couturier',
city: 'Vénissieux',
firstname: 'Jane',
lastname: 'Doe',
pointId: '19170766804121',
postalCode: '69200',
},
data: {
consentId: 43,
expirationDate: '2023-09-26',
offPeakHours: '22H00-6H00',
},
}, },
{ {
_id: '90e68b8450cee09fe2f077610901094d', _id: '90e68b8450cee09fe2f077610901094d',
...@@ -51,16 +52,13 @@ export const accountsData: Account[] = [ ...@@ -51,16 +52,13 @@ export const accountsData: Account[] = [
_rev: '1-89e68b8450cee09fe2f077610901094d', _rev: '1-89e68b8450cee09fe2f077610901094d',
account_type: 'grdfgrandlyon', account_type: 'grdfgrandlyon',
name: '', name: '',
oauth: { identifier: 'email',
access_token: 'MY_ACCESS_TOKEN', auth: {
expires_at: '2020-10-09T08:00:00.285910671+02:00', email: 'jane@grandlyon.com',
refresh_token: '', firstname: 'Jane',
token_type: 'Bearer', lastname: 'Doe',
}, pce: '12345678901234',
oauth_callback_results: { postalCode: '69003',
id_token: 'MY_ID_TOKEN',
pce: '12345678987654',
scope: '/my_grdf_scope',
}, },
cozyMetadata: { cozyMetadata: {
createdAt: '2020-11-10T16:42:11.132Z', createdAt: '2020-11-10T16:42:11.132Z',
......
...@@ -13,6 +13,7 @@ export const mockEnedisMonthlyAnalysis: EnedisMonthlyAnalysisData = { ...@@ -13,6 +13,7 @@ export const mockEnedisMonthlyAnalysis: EnedisMonthlyAnalysisData = {
year: 2021, year: 2021,
minimumLoad: 3, minimumLoad: 3,
maxPower: 2, maxPower: 2,
offPeakHoursRatio: null,
} }
export const mockEnedisMonthlyAnalysisArray: EnedisMonthlyAnalysisData[] = [ export const mockEnedisMonthlyAnalysisArray: EnedisMonthlyAnalysisData[] = [
...@@ -23,6 +24,7 @@ export const mockEnedisMonthlyAnalysisArray: EnedisMonthlyAnalysisData[] = [ ...@@ -23,6 +24,7 @@ export const mockEnedisMonthlyAnalysisArray: EnedisMonthlyAnalysisData[] = [
year: 2021, year: 2021,
minimumLoad: 3, minimumLoad: 3,
maxPower: 2, maxPower: 2,
offPeakHoursRatio: null,
}, },
{ {
weekDaysHalfHourAverageValues: [0.35, 0.34, 0.33, 0.32, 0.31, 0.3], weekDaysHalfHourAverageValues: [0.35, 0.34, 0.33, 0.32, 0.31, 0.3],
...@@ -31,6 +33,7 @@ export const mockEnedisMonthlyAnalysisArray: EnedisMonthlyAnalysisData[] = [ ...@@ -31,6 +33,7 @@ export const mockEnedisMonthlyAnalysisArray: EnedisMonthlyAnalysisData[] = [
year: 2021, year: 2021,
minimumLoad: 3, minimumLoad: 3,
maxPower: 2, maxPower: 2,
offPeakHoursRatio: null,
}, },
{ {
weekDaysHalfHourAverageValues: [0.35, 0.34, 0.33, 0.32, 0.31, 0.3], weekDaysHalfHourAverageValues: [0.35, 0.34, 0.33, 0.32, 0.31, 0.3],
...@@ -39,6 +42,7 @@ export const mockEnedisMonthlyAnalysisArray: EnedisMonthlyAnalysisData[] = [ ...@@ -39,6 +42,7 @@ export const mockEnedisMonthlyAnalysisArray: EnedisMonthlyAnalysisData[] = [
year: 2021, year: 2021,
minimumLoad: 3, minimumLoad: 3,
maxPower: 2, maxPower: 2,
offPeakHoursRatio: null,
}, },
{ {
weekDaysHalfHourAverageValues: [0.35, 0.34, 0.33, 0.32, 0.31, 0.3], weekDaysHalfHourAverageValues: [0.35, 0.34, 0.33, 0.32, 0.31, 0.3],
...@@ -47,6 +51,7 @@ export const mockEnedisMonthlyAnalysisArray: EnedisMonthlyAnalysisData[] = [ ...@@ -47,6 +51,7 @@ export const mockEnedisMonthlyAnalysisArray: EnedisMonthlyAnalysisData[] = [
year: 2021, year: 2021,
minimumLoad: 3, minimumLoad: 3,
maxPower: 2, maxPower: 2,
offPeakHoursRatio: null,
}, },
] ]
......
...@@ -7,6 +7,7 @@ export const fluidPrices: FluidPrice[] = [ ...@@ -7,6 +7,7 @@ export const fluidPrices: FluidPrice[] = [
fluidType: 0, fluidType: 0,
price: 0.1429, price: 0.1429,
startDate: '2020-08-01T00:00:00.000Z', startDate: '2020-08-01T00:00:00.000Z',
UpdatedAt: '',
}, },
{ {
_id: '03045ea1afecc7a86e5443a52e00b07d', _id: '03045ea1afecc7a86e5443a52e00b07d',
...@@ -14,6 +15,7 @@ export const fluidPrices: FluidPrice[] = [ ...@@ -14,6 +15,7 @@ export const fluidPrices: FluidPrice[] = [
fluidType: 0, fluidType: 0,
price: 0.1529, price: 0.1529,
startDate: '2021-01-01T00:00:00.000Z', startDate: '2021-01-01T00:00:00.000Z',
UpdatedAt: '',
}, },
{ {
_id: '03045ea1afecc7a86e5443a52e00b07d', _id: '03045ea1afecc7a86e5443a52e00b07d',
...@@ -21,6 +23,7 @@ export const fluidPrices: FluidPrice[] = [ ...@@ -21,6 +23,7 @@ export const fluidPrices: FluidPrice[] = [
fluidType: 0, fluidType: 0,
price: 0.1329, price: 0.1329,
startDate: '2021-10-10T00:00:00.000Z', startDate: '2021-10-10T00:00:00.000Z',
UpdatedAt: '',
}, },
{ {
_id: '03045ea1afecc7a86e5443a52e00b07d', _id: '03045ea1afecc7a86e5443a52e00b07d',
...@@ -28,6 +31,7 @@ export const fluidPrices: FluidPrice[] = [ ...@@ -28,6 +31,7 @@ export const fluidPrices: FluidPrice[] = [
fluidType: 1, fluidType: 1,
price: 0.0039, price: 0.0039,
startDate: '2013-08-01T00:00:00.000Z', startDate: '2013-08-01T00:00:00.000Z',
UpdatedAt: '',
}, },
{ {
_id: '03045ea1afecc7a86e5443a52e00b07d', _id: '03045ea1afecc7a86e5443a52e00b07d',
...@@ -35,6 +39,7 @@ export const fluidPrices: FluidPrice[] = [ ...@@ -35,6 +39,7 @@ export const fluidPrices: FluidPrice[] = [
fluidType: 2, fluidType: 2,
price: 1.029, price: 1.029,
startDate: '2013-08-01T00:00:00.000Z', startDate: '2013-08-01T00:00:00.000Z',
UpdatedAt: '',
}, },
{ {
_id: '03045ea1afecc7a86e5443a52e00b07d', _id: '03045ea1afecc7a86e5443a52e00b07d',
...@@ -42,6 +47,7 @@ export const fluidPrices: FluidPrice[] = [ ...@@ -42,6 +47,7 @@ export const fluidPrices: FluidPrice[] = [
fluidType: 2, fluidType: 2,
price: 1.029, price: 1.029,
startDate: '2014-11-01T00:00:00.000Z', startDate: '2014-11-01T00:00:00.000Z',
UpdatedAt: '',
}, },
] ]
...@@ -52,6 +58,7 @@ export const allLastFluidPrices: FluidPrice[] = [ ...@@ -52,6 +58,7 @@ export const allLastFluidPrices: FluidPrice[] = [
fluidType: 0, fluidType: 0,
price: 0.1329, price: 0.1329,
startDate: '2021-10-10T00:00:00.000Z', startDate: '2021-10-10T00:00:00.000Z',
UpdatedAt: '',
}, },
{ {
_id: '03045ea1afecc7a86e5443a52e00b07d', _id: '03045ea1afecc7a86e5443a52e00b07d',
...@@ -59,6 +66,7 @@ export const allLastFluidPrices: FluidPrice[] = [ ...@@ -59,6 +66,7 @@ export const allLastFluidPrices: FluidPrice[] = [
fluidType: 1, fluidType: 1,
price: 0.0039, price: 0.0039,
startDate: '2013-08-01T00:00:00.000Z', startDate: '2013-08-01T00:00:00.000Z',
UpdatedAt: '',
}, },
{ {
_id: '03045ea1afecc7a86e5443a52e00b07d', _id: '03045ea1afecc7a86e5443a52e00b07d',
...@@ -66,5 +74,6 @@ export const allLastFluidPrices: FluidPrice[] = [ ...@@ -66,5 +74,6 @@ export const allLastFluidPrices: FluidPrice[] = [
fluidType: 2, fluidType: 2,
price: 1.029, price: 1.029,
startDate: '2014-11-01T00:00:00.000Z', startDate: '2014-11-01T00:00:00.000Z',
UpdatedAt: '',
}, },
] ]
...@@ -194,18 +194,6 @@ export const SgeStatusWithAccount: FluidStatus = { ...@@ -194,18 +194,6 @@ export const SgeStatusWithAccount: FluidStatus = {
_rev: '1-88e68b8450cee09fe2f077610901094d', _rev: '1-88e68b8450cee09fe2f077610901094d',
account_type: 'enedissgegrandlyon', account_type: 'enedissgegrandlyon',
name: '', name: '',
oauth: {
access_token: 'MY_ACCESS_TOKEN',
expires_at: '2020-10-09T08:00:00.285910671+02:00',
refresh_token: '',
token_type: 'Bearer',
},
oauth_callback_results: {
issued_at: '1592232569642',
refresh_token_issued_at: '1592232569642',
scope: '/my_enedis_scope',
usage_points_id: '',
},
cozyMetadata: { cozyMetadata: {
createdAt: '2020-11-10T16:42:11.132Z', createdAt: '2020-11-10T16:42:11.132Z',
metadataVersion: 1, metadataVersion: 1,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment