-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Thibault Barske <[email protected]>
- Loading branch information
Showing
35 changed files
with
910 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
packages/manager/apps/hycu/public/translations/dashboard/Messages_fr_FR.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_fr_FR.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"title": "Dashboard page", | ||
"error_service": "No services info", | ||
"back_link": "Retour à la liste", | ||
"hycu_dashboard_generals_informations_title": "Informations générales", | ||
"hycu_dashboard_label_name": "Nom", | ||
"hycu_dashboard_label_status": "Statut", | ||
"hycu_dashboard_label_pack_type": "Type de pack", | ||
"hycu_dashboard_label_controller_id": "Controller ID", | ||
"hycu_dashboard_label_license_key": "Clé de licence", | ||
"hycu_dashboard_shortcuts_title": "Raccourcis", | ||
"hycu_dashboard_link_activate": "Activer la licence", | ||
"hycu_dashboard_link_reactivate": "Regénérer la licence", | ||
"hycu_dashboard_link_terminated": "Résilier la licence", | ||
"hycu_dashboard_link_change_pack_type": "Modifier le type de pack", | ||
"hycu_dashboard_field_label_contacts": "Contacts", | ||
"hycu_dashboard_contact_type_administrator": "Administrateur", | ||
"hycu_dashboard_contact_type_technical": "Technique", | ||
"hycu_dashboard_contact_type_billing": "Facturation", | ||
"hycu_dashboard_action_billing_terminate": "Résilier", | ||
"hycu_dashboard_field_label_manage_contacts": "Gérer les contacts", | ||
"hycu_dashboard_label_renew": "Renouvellement automatique", | ||
"hycu_dashboard_subscription_title": "Abonnement", | ||
"hycu_dashboard_field_label_date_creation": "Date de création", | ||
"hycu_dashboard_download_license_file": "Télécharger la license" | ||
} |
4 changes: 0 additions & 4 deletions
4
packages/manager/apps/hycu/public/translations/hycu/listing/Messages_fr_FR.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/manager/apps/hycu/src/components/Loading/Loading.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { AxiosResponse } from 'axios'; | ||
import { DefinedInitialDataOptions, useQuery } from '@tanstack/react-query'; | ||
import { getlicenseHycuService } from '@/data/api/hycu'; | ||
import { IHycuDetails } from '@/type/hycu.details.interface'; | ||
|
||
export const useDetailsLicenseHYCU = ( | ||
serviceName: string, | ||
options?: DefinedInitialDataOptions<AxiosResponse<IHycuDetails>>, | ||
) => { | ||
return useQuery({ | ||
queryKey: ['license/hycu', 'get', serviceName], | ||
queryFn: () => getlicenseHycuService({ serviceName }), | ||
...(options ?? {}), | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
packages/manager/apps/hycu/src/hooks/shell/useNavigationGetUrl.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { ShellContext } from '@ovh-ux/manager-react-shell-client'; | ||
import { vitest } from 'vitest'; | ||
import { ParamValueType } from '@ovh-ux/url-builder'; | ||
import React, { PropsWithChildren, useState } from 'react'; | ||
import { renderHook, waitFor } from '@testing-library/react'; | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | ||
import { useNavigationGetUrl } from './useNavigationGetUrl'; | ||
|
||
const mockGetURL = vitest.fn(); | ||
|
||
const wrapper = ({ children }: PropsWithChildren) => { | ||
const [queryClient] = useState(new QueryClient()); | ||
const [mockContextValue] = useState({ | ||
shell: { navigation: { getURL: mockGetURL } }, | ||
}); | ||
return ( | ||
<ShellContext.Provider value={mockContextValue as never}> | ||
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider> | ||
</ShellContext.Provider> | ||
); | ||
}; | ||
|
||
describe('useNavigationGetUrl', () => { | ||
it('should call navigation.getURL with correct linkParams', async () => { | ||
const linkParams: [string, string, Record<string, ParamValueType>] = [ | ||
'param1', | ||
'param2', | ||
{ key: 'value' }, | ||
]; | ||
mockGetURL.mockResolvedValue('mockedUrl'); | ||
|
||
const { result } = renderHook( | ||
() => useNavigationGetUrl(linkParams, { retry: false }), | ||
{ | ||
wrapper, | ||
}, | ||
); | ||
|
||
await waitFor(() => result.current.isSuccess); | ||
|
||
await waitFor(() => expect(mockGetURL).toHaveBeenCalledWith(...linkParams)); | ||
expect(result.current.data).toBe('mockedUrl'); | ||
}); | ||
}); |
21 changes: 21 additions & 0 deletions
21
packages/manager/apps/hycu/src/hooks/shell/useNavigationGetUrl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ParamValueType } from '@ovh-ux/url-builder'; | ||
import { ShellContext } from '@ovh-ux/manager-react-shell-client'; | ||
import { DefinedInitialDataOptions, useQuery } from '@tanstack/react-query'; | ||
import { useContext } from 'react'; | ||
|
||
export const useNavigationGetUrl = ( | ||
linkParams: [string, string, Record<string, ParamValueType>], | ||
options?: Partial<DefinedInitialDataOptions<unknown>>, | ||
) => { | ||
const { | ||
shell: { navigation }, | ||
} = useContext(ShellContext); | ||
|
||
return useQuery({ | ||
queryKey: ['shell', 'getUrl', linkParams], | ||
queryFn: () => navigation.getURL(...linkParams), | ||
refetchOnReconnect: false, | ||
refetchOnWindowFocus: false, | ||
...(options ?? {}), | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './licenseHycu/licenseHycu'; | ||
export * from './serviceLicenseHycu/serviceLicenseHycu'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.