import { ApolloProvider } from '@apollo/client'; import { module } from 'angular'; import classNames from 'classnames'; import React from 'react'; import { react2angular } from 'react2angular'; import type { Application } from '../../application'; import { createApolloClient } from '../graphql/client'; import { FetchApplicationManagementDataDocument, useFetchApplicationManagementStatusQuery, useToggleManagementMutation, } from '../graphql/graphql-sdk'; import { withErrorBoundary } from '../../presentation/SpinErrorBoundary'; import { ValidationMessage } from '../../presentation/forms/validation'; import { logger } from '../../utils'; import { getDocsUrl } from '../utils/defaults'; import { Spinner } from '../../widgets/spinners/Spinner'; import './ManagedResourceConfig.less'; export interface IManagedResourceConfigProps { application: Application; } const logClick = (label: string, application: string) => logger.log({ category: 'Managed Resource Config', action: `${label} clicked`, data: { label: application }, }); const getManagementStatus = (paused: boolean) => { if (paused) { return ( <>
Spinnaker is configured to manage some of this application's resources, but management has been paused. When resumed, Spinnaker will take action to make each resource match its desired state.
> ); } else { return ( <>🌈 Spinnaker is managing some resources.
If you need to temporarily stop Spinnaker from managing resources — for example, if something is wrong and manual intervention is required — you can pause management and resume it later. Pausing affects all managed resources within this application.
> ); } }; const ManagedResourceConfigInternal = ({ application }: IManagedResourceConfigProps) => { const appName = application.name; const { data, loading } = useFetchApplicationManagementStatusQuery({ variables: { appName } }); const [toggleManagement, { loading: pausePending, error: pauseFailed }] = useToggleManagementMutation({ refetchQueries: [{ query: FetchApplicationManagementDataDocument, variables: { appName } }], }); if (loading) { return