diff --git a/src/components/docs/versions/image-versions.tsx b/src/components/docs/versions/image-versions.tsx index f9adcec4..711f5bca 100644 --- a/src/components/docs/versions/image-versions.tsx +++ b/src/components/docs/versions/image-versions.tsx @@ -1,6 +1,7 @@ import React, { useState } from 'react'; import SignInSignOutButton from '@site/src/components/auth/sign-in-sign-out-button'; import CleanUpStuckBuildsButton from './clean-up-stuck-builds-button'; +import ResetAllFailedBuildsButton from './reset-all-failed-builds-button'; import UnityVersions from './unity-versions'; import styles from './unity-version.module.scss'; @@ -30,6 +31,7 @@ const ImageVersions = ({ versions }: Props) => { })} + diff --git a/src/components/docs/versions/reset-all-failed-builds-button.tsx b/src/components/docs/versions/reset-all-failed-builds-button.tsx new file mode 100644 index 00000000..f92068a2 --- /dev/null +++ b/src/components/docs/versions/reset-all-failed-builds-button.tsx @@ -0,0 +1,57 @@ +import React, { useState } from 'react'; +import { MdRestartAlt } from 'react-icons/md'; +import { SimpleAuthCheck } from '@site/src/components/auth/safe-auth-check'; +import { useAuthenticatedEndpoint } from '@site/src/core/hooks/use-authenticated-endpoint'; +import { useNotification } from '@site/src/core/hooks/use-notification'; +import Spinner from '@site/src/components/molecules/spinner'; +import Tooltip from '@site/src/components/molecules/tooltip/tooltip'; + +const ResetAllFailedBuildsButton = () => { + const [running, setRunning] = useState(false); + const notify = useNotification(); + const resetAll = useAuthenticatedEndpoint('resetFailedBuilds', {}); + + const onClick = async () => { + try { + setRunning(true); + await notify.promise(resetAll(), { + loading: , + success: (response) => { + const results = response.results || []; + return results.length > 0 ? results.join('\n') : response.message; + }, + error: (error) => error.message || 'Reset failed', + }); + } finally { + setRunning(false); + } + }; + + return ( + } requiredClaims={{ admin: true }}> + + + + + ); +}; + +export default ResetAllFailedBuildsButton;