import { UISref } from '@uirouter/react'; import { get } from 'lodash'; import { DateTime } from 'luxon'; import React from 'react'; import type { IManifest } from '@spinnaker/core'; import { AccountTag, CloudProviderLogo, CollapsibleSection, Spinner, timestamp } from '@spinnaker/core'; import { ManifestLabels } from '../manifest/ManifestLabels'; import { KubernetesManifestService } from '../manifest/manifest.service'; import { ManifestCondition } from '../manifest/status/ManifestCondition'; import { ManifestEvents } from '../pipelines/stages/deployManifest/manifestStatus/ManifestEvents'; export interface IKubernetesResourceDetailsProps { app: any; kubernetesResource: any; } export interface IKubernetesResourceDetailsState { manifest?: IManifest; loading: boolean; } export class KubernetesResourceDetails extends React.Component< IKubernetesResourceDetailsProps, IKubernetesResourceDetailsState > { private unsubscribeManifest?: () => void; constructor(props: IKubernetesResourceDetailsProps) { super(props); this.state = { loading: true, manifest: null, }; } public componentDidMount() { const { kubernetesResource } = this.props; const params = { account: kubernetesResource.accountId, location: kubernetesResource.region, name: kubernetesResource.kubernetesResource, }; this.unsubscribeManifest = KubernetesManifestService.subscribe(this.props.app, params, (manifest) => { if (this.unsubscribeManifest != null) { this.setState({ manifest, loading: false }); } }); } public componentWillUnmount() { if (this.unsubscribeManifest) { this.unsubscribeManifest(); this.unsubscribeManifest = null; } } public render() { const { manifest } = this.state; const metadata = get(manifest, ['manifest', 'metadata'], null); const creationUnixMs = get(metadata, 'creationTimestamp') && DateTime.fromISO(metadata.creationTimestamp).toMillis(); return (