this.getNamePreview = function() { var command = $scope.command; if (!command) { return ''; } return NameUtils.getClusterName($scope.application.name, command.stack, command.freeFormDetails); };
function configureWaitingMessages(deployedArtifacts) { $scope.showWaitingMessage = false; $scope.waitingForUpInstances = false; $scope.showScalingActivitiesLink = false; $scope.showPlatformHealthOverrideMessage = false; if (!deployedArtifacts.length) { return; } const deployed = deployedArtifacts[0]; const stage = $scope.stage; const activeWaitTask = (stage.tasks || []).find( t => ['RUNNING', 'TERMINAL'].includes(t.status) && t.name === 'waitForUpInstances', ); if (activeWaitTask && stage.context.lastCapacityCheck) { $scope.showWaitingMessage = true; $scope.waitingForUpInstances = activeWaitTask.status === 'RUNNING'; const lastCapacity = stage.context.lastCapacityCheck; const waitDurationExceeded = activeWaitTask.runningTimeInMs > Duration.fromObject({ minutes: 5 }).as('milliseconds'); lastCapacity.total = lastCapacity.up + lastCapacity.down + lastCapacity.outOfService + lastCapacity.unknown + lastCapacity.succeeded + lastCapacity.failed; if (CloudProviderRegistry.getValue(stage.context.cloudProvider, 'serverGroup.scalingActivitiesEnabled')) { // after three minutes, if desired capacity is less than total number of instances, // show the scaling activities link if (waitDurationExceeded && lastCapacity.total < stage.context.capacity.desired) { $scope.showScalingActivitiesLink = true; $scope.scalingActivitiesTarget = { name: deployed.serverGroup, app: deployed.application, account: deployed.account, region: deployed.region, cluster: NameUtils.getClusterNameFromServerGroupName(deployed.serverGroup), cloudProvider: deployed.cloudProvider, }; } } // Also show platform health warning after three minutes if instances are in an unknown state if ( waitDurationExceeded && stage.context.lastCapacityCheck.unknown > 0 && stage.context.lastCapacityCheck.unknown === stage.context.lastCapacityCheck.total && !stage.context.interestingHealthProviderNames && !_.get($scope.application.attributes, 'platformHealthOverride', false) ) { $scope.showPlatformHealthOverrideMessage = true; } } }
this.getLatestServerGroup = function() { var command = $scope.command; var cluster = NameUtils.getClusterName($scope.application.name, command.stack, command.freeFormDetails); var inCluster = $scope.application.serverGroups.data .filter(function(serverGroup) { return ( serverGroup.cluster === cluster && serverGroup.account === command.credentials && serverGroup.region === command.region ); }) .sort(function(a, b) { return a.createdTime - b.createdTime; }); return inCluster.length ? inCluster.pop() : null; };