mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-10 17:53:36 +02:00
* fix: group project access inconsistencies * fix relative path * wip * refactor: make project tabs work as routes * refactor: finish refactoring project assign forms * fix: update snaps * fix: update snaps * add some basic cypress e2e tests to groups * add remaining cypress e2e tests for group CRUD * add groups e2e to gh workflows * refactor: simplify useMemo usage * add GO_BACK navigate const * fix: remove trailing slash on user creation request Co-authored-by: olav <mail@olav.io> Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
47 lines
1.6 KiB
TypeScript
47 lines
1.6 KiB
TypeScript
import { useHealthReport } from 'hooks/api/getters/useHealthReport/useHealthReport';
|
||
import ApiError from 'component/common/ApiError/ApiError';
|
||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||
import { usePageTitle } from 'hooks/usePageTitle';
|
||
import { ReportCard } from './ReportTable/ReportCard/ReportCard';
|
||
import { ReportTable } from './ReportTable/ReportTable';
|
||
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
||
import { useProjectNameOrId } from 'hooks/api/getters/useProject/useProject';
|
||
|
||
const ProjectHealth = () => {
|
||
const projectId = useRequiredPathParam('projectId');
|
||
const projectName = useProjectNameOrId(projectId);
|
||
usePageTitle(`Project health – ${projectName}`);
|
||
|
||
const { healthReport, refetchHealthReport, error } = useHealthReport(
|
||
projectId,
|
||
{ refreshInterval: 15 * 1000 }
|
||
);
|
||
|
||
if (!healthReport) {
|
||
return null;
|
||
}
|
||
|
||
return (
|
||
<div>
|
||
<ConditionallyRender
|
||
condition={Boolean(error)}
|
||
show={
|
||
<ApiError
|
||
data-loading
|
||
style={{ maxWidth: '500px', marginTop: '1rem' }}
|
||
onClick={refetchHealthReport}
|
||
text={`Could not fetch health rating for ${projectId}`}
|
||
/>
|
||
}
|
||
/>
|
||
<ReportCard healthReport={healthReport} />
|
||
<ReportTable
|
||
projectId={projectId}
|
||
features={healthReport.features}
|
||
/>
|
||
</div>
|
||
);
|
||
};
|
||
|
||
export default ProjectHealth;
|