Skip to content

Commit

Permalink
feat/addBrokenLinksReporter
Browse files Browse the repository at this point in the history
  • Loading branch information
kishore03109 committed Feb 22, 2024
1 parent 201a8b3 commit 66882da
Show file tree
Hide file tree
Showing 13 changed files with 1,237 additions and 0 deletions.
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"marked": "^4.0.12",
"moment": "^2.29.4",
"moment-timezone": "^0.5.35",
"papaparse": "^5.4.1",
"postcss": "^8.4.21",
"postcss-loader": "^7.2.4",
"prop-types": "^15.8.1",
Expand Down
698 changes: 698 additions & 0 deletions src/assets/images/NoBrokenLinksImage.tsx

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/assets/images/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ export * from "./EditorAccordionImage"
export * from "./EditorCardsImage"
export * from "./EditorDividerImage"
export * from "./EditorCardsPlaceholderImage"
export * from "./NoBrokenLinksImage"
1 change: 1 addition & 0 deletions src/constants/queryKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const SITE_DASHBOARD_INFO_KEY = "site-dashboard-info"
export const SITE_DASHBOARD_REVIEW_REQUEST_KEY = "site-dashboard-review-request"
export const SITE_DASHBOARD_COLLABORATORS_KEY = "site-dashboard-collaborators"
export const SITE_DASHBOARD_LAUNCH_STATUS_KEY = "site-dashboard-launch-status"
export const SITE_LINK_CHECKER_STATUS_KEY = "site-link-checker-status"
export const NOTIFICATIONS_KEY = "notifications-content"
export const ALL_NOTIFICATIONS_KEY = "all-notifications"
export const LIST_COLLABORATORS_KEY = "list-collaborators"
Expand Down
22 changes: 22 additions & 0 deletions src/hooks/siteDashboardHooks/useGetLinkChecker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { UseQueryResult, useQuery } from "react-query"

import { SITE_LINK_CHECKER_STATUS_KEY } from "constants/queryKeys"

import * as LinkCheckerService from "services/LinkCheckerService"

import { RepoErrorDto } from "types/linkReport"

export const useGetBrokenLinks = (
siteName: string
): UseQueryResult<RepoErrorDto> => {
return useQuery<RepoErrorDto>(
[SITE_LINK_CHECKER_STATUS_KEY, siteName],
() => {
return LinkCheckerService.getLinkCheckerStatus({ siteName })
},
{
retry: false,
refetchInterval: 1000 * 10,
}
)
}
22 changes: 22 additions & 0 deletions src/hooks/siteDashboardHooks/useRefreshLinkChecker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { AxiosError } from "axios"
import { useMutation, UseMutationResult, useQueryClient } from "react-query"

import { SITE_LINK_CHECKER_STATUS_KEY } from "constants/queryKeys"

import * as LinkCheckerService from "services/LinkCheckerService"

export const useRefreshLinkChecker = (
siteName: string
): UseMutationResult<void, AxiosError, string> => {
const queryClient = useQueryClient()
return useMutation<void, AxiosError, string>(
async () => {
await LinkCheckerService.refreshLinkChecker({ siteName })
},
{
onSettled: () => {
queryClient.invalidateQueries([SITE_LINK_CHECKER_STATUS_KEY, siteName])
},
}
)
}
Loading

0 comments on commit 66882da

Please sign in to comment.