import React from 'react'; import { Dropdown, MenuItem } from 'react-bootstrap'; import type { Application } from '../../application'; import { SETTINGS } from '../../config/settings'; import type { IManagedResourceSummary } from '../../domain'; import { HelpField } from '../../help'; import managedDeliveryLogo from '../icons/md-logo-color.svg'; import { HoverablePopover } from '../../presentation'; import { ReactInjector } from '../../reactShims'; import { showManagedResourceHistoryModal } from '../resourceHistory/ManagedResourceHistoryModal'; import { toggleResourcePause } from './toggleResourceManagement'; import { logger } from '../../utils/Logger'; import { getDocsUrl } from '../utils/defaults'; import './ManagedResourceDetailsIndicator.css'; export interface IManagedResourceDetailsIndicatorProps { resourceSummary: IManagedResourceSummary; application: Application; } const logClick = (label: string, resourceId: string) => logger.log({ category: 'Managed Resource Menu', action: `${label} clicked`, data: { label: resourceId }, }); export const ManagedResourceDetailsIndicator = ({ resourceSummary, application, }: IManagedResourceDetailsIndicatorProps) => { if (!resourceSummary) { return null; } const { id, isPaused } = resourceSummary; const helpText = ( <>
Spinnaker is managing this resource.
If a difference from the desired state is detected, Spinnaker will act to correct it.{' '} logClick('Learn More', id)} href={getDocsUrl('root')}> Learn More
> ); // events are getting trapped by React bootstrap menu const allowNavigation = (e: React.MouseEvent) => { const target = e.target as HTMLElement; const href = target?.getAttribute('href'); if (href) { window.location.href = href; } }; const appPausedHelpContent = `Resource management is currently disabled for the entire application. Resume application management
`; return (