-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1007 from MTES-MCT/feat-add-analysis-dashboard
Add analysis dashboard
- Loading branch information
Showing
10 changed files
with
67 additions
and
34 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
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 |
---|---|---|
@@ -1,22 +1,17 @@ | ||
import { DashboardDTO, Resource } from '@zerologementvacant/models'; | ||
import { zlvApi } from './api.service'; | ||
|
||
interface FindOneOptions { | ||
id: Resource; | ||
} | ||
|
||
type Resource = '6-utilisateurs-de-zlv-sur-votre-structure' | '7-autres-structures-de-votre-territoires-inscrites-sur-zlv'; | ||
|
||
interface Dashboard { | ||
url: string; | ||
} | ||
|
||
export const dashboardApi = zlvApi.injectEndpoints({ | ||
endpoints: (builder) => ({ | ||
findOneDashboard: builder.query<Dashboard, FindOneOptions>({ | ||
findOneDashboard: builder.query<DashboardDTO, FindOneOptions>({ | ||
query: (opts) => `dashboards/${opts.id}`, | ||
providesTags: (result, error, arg) => [{ type: 'Stats', id: arg.id }], | ||
}), | ||
}), | ||
providesTags: (result, error, arg) => [{ type: 'Stats', id: arg.id }] | ||
}) | ||
}) | ||
}); | ||
|
||
export const { useFindOneDashboardQuery } = dashboardApi; |
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,19 @@ | ||
import { useDocumentTitle } from '../../hooks/useDocumentTitle'; | ||
import MainContainer from '../../components/MainContainer/MainContainer'; | ||
import { useFindOneDashboardQuery } from '../../services/dashboard.service'; | ||
|
||
function AnalysisView() { | ||
useDocumentTitle('Analyse'); | ||
|
||
const { data: dashboard } = useFindOneDashboardQuery({ | ||
id: '13-analyses' | ||
}); | ||
|
||
return ( | ||
<MainContainer> | ||
<iframe src={dashboard?.url} width="100%" height={600} title="Analyses" /> | ||
</MainContainer> | ||
); | ||
} | ||
|
||
export default AnalysisView; |
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,10 @@ | ||
export interface DashboardDTO { | ||
url: string; | ||
} | ||
|
||
export const RESOURCE_VALUES = [ | ||
'6-utilisateurs-de-zlv-sur-votre-structure', | ||
'7-autres-structures-de-votre-territoires-inscrites-sur-zlv', | ||
'13-analyses' | ||
] as const; | ||
export type Resource = (typeof RESOURCE_VALUES)[number]; |
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