diff --git a/app/scripts/modules/core/src/deploymentStrategy/strategies/monitored/monitored.strategy.ts b/app/scripts/modules/core/src/deploymentStrategy/strategies/monitored/monitored.strategy.ts index 1ea5f2044f4..112fbc85ced 100644 --- a/app/scripts/modules/core/src/deploymentStrategy/strategies/monitored/monitored.strategy.ts +++ b/app/scripts/modules/core/src/deploymentStrategy/strategies/monitored/monitored.strategy.ts @@ -1,3 +1,4 @@ +import { isEmpty, defaultsDeep } from 'lodash'; import { DeploymentStrategyRegistry } from 'core/deploymentStrategy/deploymentStrategy.registry'; import { AdditionalFields } from './AdditionalFields'; @@ -10,11 +11,15 @@ DeploymentStrategyRegistry.registerStrategy({ additionalFields: ['deploySteps', 'scaleDown'], AdditionalFieldsComponent: AdditionalFields, initializationMethod: command => { - if (!command.deploySteps) { + defaultsDeep(command, { + rollback: { onFailure: true }, + deploymentMonitor: { id: '' }, + maxRemainingAsgs: 2, + }); + + // defaultsDeep will merge the arrays, which we don't want hence check deploySteps separately + if (isEmpty(command.deploySteps)) { command.deploySteps = [10, 40, 100]; - command.rollback.onFailure = true; - command.deploymentMonitor = { id: '' }; - command.maxRemainingAsgs = 2; } }, }); diff --git a/app/scripts/modules/core/src/pipeline/config/stages/monitoreddeploy/DeploymentMonitorExecutionDetails.tsx b/app/scripts/modules/core/src/pipeline/config/stages/monitoreddeploy/DeploymentMonitorExecutionDetails.tsx index 475b3b9faec..b57121da6e1 100644 --- a/app/scripts/modules/core/src/pipeline/config/stages/monitoreddeploy/DeploymentMonitorExecutionDetails.tsx +++ b/app/scripts/modules/core/src/pipeline/config/stages/monitoreddeploy/DeploymentMonitorExecutionDetails.tsx @@ -15,8 +15,11 @@ interface IAdditionalData { } function getDeploymentMonitorSummary(stage: IExecutionStage) { - const { context } = stage; + if (stage.hasNotStarted) { + return "Not available because the stage hasn't run yet"; + } + const { context } = stage; return get(context, 'deploymentMonitorReasons.summary', ''); } @@ -108,17 +111,21 @@ export class DeploymentMonitorExecutionDetails extends React.Component<
Summary
{getDeploymentMonitorSummary(stage)}
-
Deploy %
-
- {stage.context.currentProgress}% -
-
Details
-
{details || notProvidedFragment}
-
Log
-
{log ?
{log}
: notProvidedFragment}
-
More info
-
{additionalDetails ? '' : notProvidedFragment}
- {additionalDetails} + {stage.hasNotStarted ? null : ( + <> +
Deploy %
+
+ {stage.context.currentProgress}% +
+
Details
+
{details || notProvidedFragment}
+
Log
+
{log ?
{log}
: notProvidedFragment}
+
More info
+
{additionalDetails ? null : notProvidedFragment}
+ {additionalDetails} + + )}
{deploymentMonitors && (