diff --git a/src/components/page-active-component/active-component-overview.tsx b/src/components/page-active-component/active-component-overview.tsx index 39b5fab1a..b5a1aa10e 100644 --- a/src/components/page-active-component/active-component-overview.tsx +++ b/src/components/page-active-component/active-component-overview.tsx @@ -142,7 +142,7 @@ export const ActiveComponentOverview: FunctionComponent<{ {component.horizontalScalingSummary && ( )} diff --git a/src/components/page-active-component/dev.tsx b/src/components/page-active-component/dev.tsx index f9780d921..546a38833 100644 --- a/src/components/page-active-component/dev.tsx +++ b/src/components/page-active-component/dev.tsx @@ -1,6 +1,7 @@ import { HorizontalScalingSummary } from './horizontal-scaling-summary'; +import { HorizontalScalingSummary as HorizontalScalingSummaryModel } from '../../store/radix-api'; -const testData: Array[0]> = [ +const testData: Array = [ { minReplicas: 4, maxReplicas: 20, @@ -40,7 +41,7 @@ export default ( backgroundColor: 'var(--eds_ui_background__default)', }} > - + ))} diff --git a/src/components/page-active-component/horizontal-scaling-summary.tsx b/src/components/page-active-component/horizontal-scaling-summary.tsx index 4a84498a7..378d4d9bb 100644 --- a/src/components/page-active-component/horizontal-scaling-summary.tsx +++ b/src/components/page-active-component/horizontal-scaling-summary.tsx @@ -1,7 +1,6 @@ import { Accordion, Typography } from '@equinor/eds-core-react'; import { isNil } from 'lodash'; import * as PropTypes from 'prop-types'; -import { FunctionComponent } from 'react'; import { HorizontalScalingSummary as HorizontalScalingSummaryModel, @@ -10,9 +9,11 @@ import { import { pluraliser } from '../../utils/string'; import { Alert } from '../alert'; -export const HorizontalScalingSummary: FunctionComponent< - HorizontalScalingSummaryModel -> = (data) => ( +type Props = { + summary: HorizontalScalingSummaryModel; +}; + +export const HorizontalScalingSummary = ({ summary }: Props) => ( @@ -27,51 +28,51 @@ export const HorizontalScalingSummary: FunctionComponent<
Current replicas: - {data.currentReplicas} + {summary.currentReplicas} Desired replicas: - {data.desiredReplicas} + {summary.desiredReplicas} - {!isNil(data.minReplicas) && ( + {!isNil(summary.minReplicas) && ( <> Min replicas: - {data.minReplicas} + {summary.minReplicas} )} - {!isNil(data.maxReplicas) && ( + {!isNil(summary.maxReplicas) && ( <> Max replicas: - {data.maxReplicas} + {summary.maxReplicas} )} - {data.pollingInterval > 0 && ( + {summary.pollingInterval > 0 && ( <> Polling interval: - {data.pollingInterval}sec + {summary.pollingInterval}sec )} - {data.cooldownPeriod > 0 && ( + {summary.cooldownPeriod > 0 && ( <> Cooldown period: - {data.cooldownPeriod}sec + {summary.cooldownPeriod}sec )} - {data.triggers.map((trigger, i) => ( + {summary.triggers.map((trigger, i) => ( ))}
diff --git a/src/components/page-active-component/overview.tsx b/src/components/page-active-component/overview.tsx index 5f0f4be13..1dc4e602c 100644 --- a/src/components/page-active-component/overview.tsx +++ b/src/components/page-active-component/overview.tsx @@ -44,11 +44,18 @@ export const Overview: FunctionComponent<{ const dnsExternalAliasUrls = dnsExternalAliases ? dnsExternalAliases.map((alias) => alias.fqdn) : []; + + const isStopped = component.status == 'Stopped'; + const isScaledDown = + component.horizontalScalingSummary?.desiredReplicas === 0 && isStopped; + + console.log({ component, isScaledDown, isStopped }); + return (
Overview - {component.status === 'Stopped' && ( + {isStopped && !isScaledDown && ( Component has been manually stopped; please note that a new deployment will cause it to be restarted unless you set replicas of @@ -61,6 +68,7 @@ export const Overview: FunctionComponent<{ )} + {isScaledDown && Component has been stopped by autoscaler.}
diff --git a/src/store/radix-api.ts b/src/store/radix-api.ts index 5b45371f2..08375f5a9 100644 --- a/src/store/radix-api.ts +++ b/src/store/radix-api.ts @@ -2203,13 +2203,13 @@ export type ExternalDns = { }; export type HorizontalScalingSummaryTriggerStatus = { /** CurrentUtilization is the last measured utilization */ - current_utilization?: string; + currentUtilization?: string; /** Error contains short description if trigger have problems */ error?: string; /** Name of trigger */ name?: string; /** TargetUtilization is the average target across replicas */ - target_utilization?: string; + targetUtilization?: string; /** Type of trigger */ type?: string; }; @@ -2220,6 +2220,10 @@ export type HorizontalScalingSummary = { currentCPUUtilizationPercentage?: number; /** Deprecated: Component current average memory utilization over all pods, represented as a percentage of requested memory. Use Triggers instead. Will be removed from Radix API 2025-01-01. */ currentMemoryUtilizationPercentage?: number; + /** CurrentReplicas returns the current number of replicas */ + currentReplicas?: number; + /** DesiredReplicas returns the target number of replicas across all triggers */ + desiredReplicas?: number; /** Component maximum replicas. From radixconfig.yaml */ maxReplicas?: number; /** Component minimum replicas. From radixconfig.yaml */