@spinnaker/appengine
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -62,3 +62,3 @@ import { module } from 'angular'; | ||
logo: { | ||
path: require('./logo/appengine.logo.svg'), | ||
path: require('./logo/appengine.logo.png'), | ||
}, | ||
@@ -65,0 +65,0 @@ }); |
import { module } from 'angular'; | ||
import { cloneDeep, flattenDeep } from 'lodash'; | ||
import { CONFIRMATION_MODAL_SERVICE, INSTANCE_WRITE_SERVICE, InstanceReader, RecentHistoryService, } from '@spinnaker/core'; | ||
import { ConfirmationModalService, INSTANCE_WRITE_SERVICE, InstanceReader, RecentHistoryService, } from '@spinnaker/core'; | ||
class AppengineInstanceDetailsController { | ||
constructor($q, app, instanceWriter, confirmationModalService, instance) { | ||
constructor($q, app, instanceWriter, instance) { | ||
this.$q = $q; | ||
this.app = app; | ||
this.instanceWriter = instanceWriter; | ||
this.confirmationModalService = confirmationModalService; | ||
this.state = { loading: true }; | ||
@@ -43,3 +42,3 @@ this.upToolTip = "An App Engine instance is 'Up' if a load balancer is directing traffic to its server group."; | ||
}; | ||
this.confirmationModalService.confirm({ | ||
ConfirmationModalService.confirm({ | ||
header: 'Really terminate ' + shortName + '?', | ||
@@ -59,3 +58,3 @@ buttonText: 'Terminate ' + shortName, | ||
this.app.getDataSource('loadBalancers').data, | ||
this.app.getDataSource('loadBalancers').data.map(loadBalancer => loadBalancer.serverGroups), | ||
this.app.getDataSource('loadBalancers').data.map((loadBalancer) => loadBalancer.serverGroups), | ||
]); | ||
@@ -83,5 +82,5 @@ const instanceManager = dataSources.find(instanceLocatorPredicate); | ||
} | ||
AppengineInstanceDetailsController.$inject = ['$q', 'app', 'instanceWriter', 'confirmationModalService', 'instance']; | ||
AppengineInstanceDetailsController.$inject = ['$q', 'app', 'instanceWriter', 'instance']; | ||
export const APPENGINE_INSTANCE_DETAILS_CTRL = 'spinnaker.appengine.instanceDetails.controller'; | ||
module(APPENGINE_INSTANCE_DETAILS_CTRL, [INSTANCE_WRITE_SERVICE, CONFIRMATION_MODAL_SERVICE]).controller('appengineInstanceDetailsCtrl', AppengineInstanceDetailsController); | ||
module(APPENGINE_INSTANCE_DETAILS_CTRL, [INSTANCE_WRITE_SERVICE]).controller('appengineInstanceDetailsCtrl', AppengineInstanceDetailsController); | ||
//# sourceMappingURL=details.controller.js.map |
import { module } from 'angular'; | ||
import { cloneDeep } from 'lodash'; | ||
import { LoadBalancerWriter, TaskMonitor } from '@spinnaker/core'; | ||
import { AppengineLoadBalancerUpsertDescription, } from 'appengine/loadBalancer/transformer'; | ||
import { AppengineLoadBalancerUpsertDescription, } from '../../transformer'; | ||
import './wizard.less'; | ||
@@ -6,0 +6,0 @@ class AppengineLoadBalancerWizardController { |
import { module } from 'angular'; | ||
import { cloneDeep } from 'lodash'; | ||
import { CONFIRMATION_MODAL_SERVICE, LoadBalancerWriter, } from '@spinnaker/core'; | ||
import { ConfirmationModalService, LoadBalancerWriter, } from '@spinnaker/core'; | ||
class AppengineLoadBalancerDetailsController { | ||
constructor($uibModal, $state, $scope, loadBalancer, app, confirmationModalService) { | ||
constructor($uibModal, $state, $scope, loadBalancer, app) { | ||
this.$uibModal = $uibModal; | ||
@@ -10,3 +10,2 @@ this.$state = $state; | ||
this.app = app; | ||
this.confirmationModalService = confirmationModalService; | ||
this.state = { loading: true }; | ||
@@ -46,3 +45,3 @@ this.dispatchRules = []; | ||
}; | ||
this.confirmationModalService.confirm({ | ||
ConfirmationModalService.confirm({ | ||
header: 'Really delete ' + this.loadBalancer.name + '?', | ||
@@ -90,4 +89,3 @@ buttonText: 'Delete ' + this.loadBalancer.name, | ||
const listOfServerGroupNames = serverGroupNames.map(name => `<li>${name}</li>`).join(''); | ||
return ` | ||
<div class="alert alert-warning"> | ||
return `<div class="alert alert-warning"> | ||
<p> | ||
@@ -103,4 +101,3 @@ Deleting <b>${this.loadBalancer.name}</b> will destroy the following server groups: | ||
else { | ||
return ` | ||
<div class="alert alert-warning"> | ||
return `<div class="alert alert-warning"> | ||
<p> | ||
@@ -127,5 +124,5 @@ Deleting <b>${this.loadBalancer.name}</b> will destroy <b>${serverGroupNames[0]}</b>. | ||
} | ||
AppengineLoadBalancerDetailsController.$inject = ['$uibModal', '$state', '$scope', 'loadBalancer', 'app', 'confirmationModalService']; | ||
AppengineLoadBalancerDetailsController.$inject = ['$uibModal', '$state', '$scope', 'loadBalancer', 'app']; | ||
export const APPENGINE_LOAD_BALANCER_DETAILS_CTRL = 'spinnaker.appengine.loadBalancerDetails.controller'; | ||
module(APPENGINE_LOAD_BALANCER_DETAILS_CTRL, [CONFIRMATION_MODAL_SERVICE]).controller('appengineLoadBalancerDetailsCtrl', AppengineLoadBalancerDetailsController); | ||
module(APPENGINE_LOAD_BALANCER_DETAILS_CTRL, []).controller('appengineLoadBalancerDetailsCtrl', AppengineLoadBalancerDetailsController); | ||
//# sourceMappingURL=details.controller.js.map |
import { module } from 'angular'; | ||
import { camelCase, chain, cloneDeep, filter, get, has, reduce } from 'lodash'; | ||
export class AppengineLoadBalancerUpsertDescription { | ||
static convertTrafficSplitToTrafficSplitDescription(split) { | ||
const allocationDescriptions = reduce(split.allocations, (acc, allocation, serverGroupName) => { | ||
return acc.concat({ serverGroupName, allocation, locatorType: 'fromExisting' }); | ||
}, []); | ||
return { shardBy: split.shardBy, allocationDescriptions }; | ||
} | ||
constructor(loadBalancer) { | ||
@@ -20,2 +14,8 @@ this.credentials = loadBalancer.account || loadBalancer.credentials; | ||
} | ||
static convertTrafficSplitToTrafficSplitDescription(split) { | ||
const allocationDescriptions = reduce(split.allocations, (acc, allocation, serverGroupName) => { | ||
return acc.concat({ serverGroupName, allocation, locatorType: 'fromExisting' }); | ||
}, []); | ||
return { shardBy: split.shardBy, allocationDescriptions }; | ||
} | ||
mapAllocationsToDecimals() { | ||
@@ -22,0 +22,0 @@ this.splitDescription.allocationDescriptions.forEach(description => { |
@@ -35,5 +35,3 @@ import { module } from 'angular'; | ||
.then(() => { | ||
this.loadBalancers = this.application | ||
.getDataSource('loadBalancers') | ||
.data.filter(candidate => candidate.cloudProvider === 'appengine'); | ||
this.loadBalancers = this.application.loadBalancers.data.filter(candidate => candidate.cloudProvider === 'appengine'); | ||
if (this.loadBalancers.length) { | ||
@@ -40,0 +38,0 @@ this.selectedLoadBalancer = this.loadBalancers[0]; |
@@ -88,3 +88,3 @@ import { module } from 'angular'; | ||
return this.buildNewServerGroupCommand(app, 'appengine', 'editPipeline').then((command) => { | ||
command = Object.assign({}, command, cluster, { backingData: Object.assign({}, command.backingData, { triggerOptions: AppengineServerGroupCommandBuilder.getTriggerOptions(pipeline), expectedArtifacts: AppengineServerGroupCommandBuilder.getExpectedArtifacts(pipeline) }), credentials: cluster.account || command.credentials, viewState: Object.assign({}, command.viewState, { stage: _stage, pipeline }) }); | ||
command = Object.assign(Object.assign(Object.assign({}, command), cluster), { backingData: Object.assign(Object.assign({}, command.backingData), { triggerOptions: AppengineServerGroupCommandBuilder.getTriggerOptions(pipeline), expectedArtifacts: AppengineServerGroupCommandBuilder.getExpectedArtifacts(pipeline) }), credentials: cluster.account || command.credentials, viewState: Object.assign(Object.assign({}, command.viewState), { stage: _stage, pipeline }) }); | ||
return command; | ||
@@ -91,0 +91,0 @@ }); |
@@ -1,3 +0,3 @@ | ||
import * as React from 'react'; | ||
import * as classNames from 'classnames'; | ||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
import { StageArtifactSelectorDelegate } from '@spinnaker/core'; | ||
@@ -15,3 +15,3 @@ export const ConfigFileArtifactList = (props) => { | ||
const newConfigArtifacts = [...props.configArtifacts]; | ||
newConfigArtifacts.splice(index, 1, Object.assign({}, newConfigArtifacts[index], { id: null, artifact })); | ||
newConfigArtifacts.splice(index, 1, Object.assign(Object.assign({}, newConfigArtifacts[index]), { id: null, artifact })); | ||
props.updateConfigArtifacts(newConfigArtifacts); | ||
@@ -24,3 +24,3 @@ }; | ||
const newConfigArtifacts = [...props.configArtifacts]; | ||
newConfigArtifacts.splice(index, 1, Object.assign({}, newConfigArtifacts[index], { id, artifact: null })); | ||
newConfigArtifacts.splice(index, 1, Object.assign(Object.assign({}, newConfigArtifacts[index]), { id, artifact: null })); | ||
props.updateConfigArtifacts(newConfigArtifacts); | ||
@@ -30,3 +30,3 @@ }; | ||
const newConfigArtifacts = [...props.configArtifacts]; | ||
newConfigArtifacts.splice(index, 1, Object.assign({}, newConfigArtifacts[index], { account })); | ||
newConfigArtifacts.splice(index, 1, Object.assign(Object.assign({}, newConfigArtifacts[index]), { account })); | ||
props.updateConfigArtifacts(newConfigArtifacts); | ||
@@ -33,0 +33,0 @@ }; |
@@ -11,7 +11,7 @@ import { module } from 'angular'; | ||
this.account = artifact.account; | ||
Object.defineProperty(this, '$scope', Object.assign({}, unserializable, { value: $scope })); | ||
Object.defineProperty(this, '$scope', Object.assign(Object.assign({}, unserializable), { value: $scope })); | ||
const delegate = new NgAppengineConfigArtifactDelegate(this); | ||
const controller = new ExpectedArtifactSelectorViewController(delegate); | ||
Object.defineProperty(this, 'delegate', Object.assign({}, unserializable, { value: delegate })); | ||
Object.defineProperty(this, 'controller', Object.assign({}, unserializable, { value: controller })); | ||
Object.defineProperty(this, 'delegate', Object.assign(Object.assign({}, unserializable), { value: delegate })); | ||
Object.defineProperty(this, 'controller', Object.assign(Object.assign({}, unserializable), { value: controller })); | ||
} | ||
@@ -18,0 +18,0 @@ } |
import { module } from 'angular'; | ||
import { cloneDeep, get, map, mapValues, reduce } from 'lodash'; | ||
import { CONFIRMATION_MODAL_SERVICE, SERVER_GROUP_WRITER, ServerGroupReader, ServerGroupWarningMessageService, } from '@spinnaker/core'; | ||
import { cloneDeep, map, mapValues, reduce } from 'lodash'; | ||
import { ConfirmationModalService, SERVER_GROUP_WRITER, ServerGroupReader, ServerGroupWarningMessageService, } from '@spinnaker/core'; | ||
import { AppengineHealth } from 'appengine/common/appengineHealth'; | ||
import { APPENGINE_SERVER_GROUP_WRITER } from '../writer/serverGroup.write.service'; | ||
class AppengineServerGroupDetailsController { | ||
constructor($state, $scope, $uibModal, serverGroup, app, serverGroupWriter, confirmationModalService, appengineServerGroupWriter, appengineServerGroupCommandBuilder) { | ||
constructor($state, $scope, $uibModal, serverGroup, app, serverGroupWriter, appengineServerGroupWriter, appengineServerGroupCommandBuilder) { | ||
this.$state = $state; | ||
@@ -13,3 +13,2 @@ this.$scope = $scope; | ||
this.serverGroupWriter = serverGroupWriter; | ||
this.confirmationModalService = confirmationModalService; | ||
this.appengineServerGroupWriter = appengineServerGroupWriter; | ||
@@ -84,12 +83,17 @@ this.appengineServerGroupCommandBuilder = appengineServerGroupCommandBuilder; | ||
destroyServerGroup() { | ||
const stateParams = { | ||
name: this.serverGroup.name, | ||
accountId: this.serverGroup.account, | ||
region: this.serverGroup.region, | ||
}; | ||
const taskMonitor = { | ||
application: this.app, | ||
title: 'Destroying ' + this.serverGroup.name, | ||
onTaskComplete: () => { | ||
if (this.$state.includes('**.serverGroup', stateParams)) { | ||
this.$state.go('^'); | ||
} | ||
}, | ||
}; | ||
const submitMethod = (params) => this.serverGroupWriter.destroyServerGroup(this.serverGroup, this.app, params); | ||
const stateParams = { | ||
name: this.serverGroup.name, | ||
accountId: this.serverGroup.account, | ||
region: this.serverGroup.region, | ||
}; | ||
const confirmationModalParams = { | ||
@@ -99,3 +103,2 @@ header: 'Really destroy ' + this.serverGroup.name + '?', | ||
account: this.serverGroup.account, | ||
provider: 'appengine', | ||
taskMonitorConfig: taskMonitor, | ||
@@ -107,7 +110,2 @@ submitMethod, | ||
body: this.getBodyTemplate(this.serverGroup, this.app), | ||
onTaskComplete: () => { | ||
if (this.$state.includes('**.serverGroup', stateParams)) { | ||
this.$state.go('^'); | ||
} | ||
}, | ||
interestingHealthProviderNames: [], | ||
@@ -118,3 +116,3 @@ }; | ||
} | ||
this.confirmationModalService.confirm(confirmationModalParams); | ||
ConfirmationModalService.confirm(confirmationModalParams); | ||
} | ||
@@ -127,4 +125,3 @@ enableServerGroup() { | ||
const submitMethod = (params) => this.serverGroupWriter.enableServerGroup(this.serverGroup, this.app, Object.assign({}, params)); | ||
const modalBody = ` | ||
<div class="well well-sm"> | ||
const modalBody = `<div class="well well-sm"> | ||
<p> | ||
@@ -143,3 +140,2 @@ Enabling <b>${this.serverGroup.name}</b> will set its traffic allocation for | ||
buttonText: 'Enable ' + this.serverGroup.name, | ||
provider: 'appengine', | ||
body: modalBody, | ||
@@ -157,3 +153,3 @@ account: this.serverGroup.account, | ||
} | ||
this.confirmationModalService.confirm(confirmationModalParams); | ||
ConfirmationModalService.confirm(confirmationModalParams); | ||
} | ||
@@ -167,4 +163,3 @@ disableServerGroup() { | ||
const expectedAllocations = this.expectedAllocationsAfterDisableOperation(this.serverGroup, this.app); | ||
const modalBody = ` | ||
<div class="well well-sm"> | ||
const modalBody = `<div class="well well-sm"> | ||
<p> | ||
@@ -189,3 +184,2 @@ For App Engine, a disable operation sets this server group's allocation | ||
buttonText: 'Disable ' + this.serverGroup.name, | ||
provider: 'appengine', | ||
body: modalBody, | ||
@@ -203,3 +197,3 @@ account: this.serverGroup.account, | ||
} | ||
this.confirmationModalService.confirm(confirmationModalParams); | ||
ConfirmationModalService.confirm(confirmationModalParams); | ||
} | ||
@@ -214,4 +208,3 @@ stopServerGroup() { | ||
if (!this.serverGroup.disabled) { | ||
modalBody = ` | ||
<div class="alert alert-danger"> | ||
modalBody = `<div class="alert alert-danger"> | ||
<p>Stopping this server group will scale it down to zero instances.</p> | ||
@@ -227,3 +220,2 @@ <p> | ||
buttonText: 'Stop ' + this.serverGroup.name, | ||
provider: 'appengine', | ||
account: this.serverGroup.account, | ||
@@ -237,3 +229,3 @@ body: modalBody, | ||
}; | ||
this.confirmationModalService.confirm(confirmationModalParams); | ||
ConfirmationModalService.confirm(confirmationModalParams); | ||
} | ||
@@ -249,3 +241,2 @@ startServerGroup() { | ||
buttonText: 'Start ' + this.serverGroup.name, | ||
provider: 'appengine', | ||
account: this.serverGroup.account, | ||
@@ -258,3 +249,3 @@ platformHealthOnlyShowOverride: this.app.attributes.platformHealthOnlyShowOverride, | ||
}; | ||
this.confirmationModalService.confirm(confirmationModalParams); | ||
ConfirmationModalService.confirm(confirmationModalParams); | ||
} | ||
@@ -291,6 +282,5 @@ cloneServerGroup() { | ||
canStartOrStopServerGroup() { | ||
var _a; | ||
const isFlex = this.serverGroup.env === 'FLEXIBLE'; | ||
const usesManualScaling = get(this.serverGroup, 'scalingPolicy.type') === 'MANUAL'; | ||
const usesBasicScaling = get(this.serverGroup, 'scalingPolicy.type') === 'BASIC'; | ||
return isFlex || usesManualScaling || usesBasicScaling; | ||
return isFlex || ['MANUAL', 'BASIC'].includes((_a = this.serverGroup.scalingPolicy) === null || _a === void 0 ? void 0 : _a.type); | ||
} | ||
@@ -332,3 +322,4 @@ getBodyTemplate(serverGroup, app) { | ||
const loadBalancer = app.getDataSource('loadBalancers').data.find((toCheck) => { | ||
const allocations = get(toCheck, 'split.allocations', {}); | ||
var _a, _b; | ||
const allocations = (_b = (_a = toCheck.split) === null || _a === void 0 ? void 0 : _a.allocations, (_b !== null && _b !== void 0 ? _b : {})); | ||
const enabledServerGroups = Object.keys(allocations); | ||
@@ -366,3 +357,3 @@ return enabledServerGroups.includes(serverGroup.name); | ||
if (!fromApp) { | ||
this.app.getDataSource('loadBalancers').data.some(loadBalancer => { | ||
this.app.getDataSource('loadBalancers').data.some((loadBalancer) => { | ||
if (loadBalancer.account === fromParams.accountId) { | ||
@@ -378,5 +369,8 @@ return loadBalancer.serverGroups.some((toCheck) => { | ||
} | ||
else { | ||
return false; | ||
} | ||
}); | ||
} | ||
this.serverGroup = Object.assign({}, serverGroupDetails, fromApp); | ||
this.serverGroup = Object.assign(Object.assign({}, serverGroupDetails), fromApp); | ||
this.state.loading = false; | ||
@@ -393,3 +387,2 @@ }); | ||
'serverGroupWriter', | ||
'confirmationModalService', | ||
'appengineServerGroupWriter', | ||
@@ -399,7 +392,3 @@ 'appengineServerGroupCommandBuilder', | ||
export const APPENGINE_SERVER_GROUP_DETAILS_CTRL = 'spinnaker.appengine.serverGroup.details.controller'; | ||
module(APPENGINE_SERVER_GROUP_DETAILS_CTRL, [ | ||
APPENGINE_SERVER_GROUP_WRITER, | ||
CONFIRMATION_MODAL_SERVICE, | ||
SERVER_GROUP_WRITER, | ||
]).controller('appengineServerGroupDetailsCtrl', AppengineServerGroupDetailsController); | ||
module(APPENGINE_SERVER_GROUP_DETAILS_CTRL, [APPENGINE_SERVER_GROUP_WRITER, SERVER_GROUP_WRITER]).controller('appengineServerGroupDetailsCtrl', AppengineServerGroupDetailsController); | ||
//# sourceMappingURL=details.controller.js.map |
@@ -5,3 +5,4 @@ import { ApplicationNameValidator } from '@spinnaker/core'; | ||
validate(name = '') { | ||
const warnings = [], errors = []; | ||
const warnings = []; | ||
const errors = []; | ||
if (name.length) { | ||
@@ -8,0 +9,0 @@ this.validateSpecialCharacters(name, errors); |
{ | ||
"name": "@spinnaker/appengine", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"main": "lib/lib.js", | ||
@@ -5,0 +5,0 @@ "typings": "lib/index.d.ts", |
@@ -68,3 +68,3 @@ import { module } from 'angular'; | ||
logo: { | ||
path: require('./logo/appengine.logo.svg'), | ||
path: require('./logo/appengine.logo.png'), | ||
}, | ||
@@ -71,0 +71,0 @@ }); |
@@ -6,3 +6,2 @@ import { IController, IPromise, IQService, module } from 'angular'; | ||
Application, | ||
CONFIRMATION_MODAL_SERVICE, | ||
ConfirmationModalService, | ||
@@ -13,2 +12,3 @@ INSTANCE_WRITE_SERVICE, | ||
RecentHistoryService, | ||
ILoadBalancer, | ||
} from '@spinnaker/core'; | ||
@@ -38,3 +38,3 @@ | ||
public static $inject = ['$q', 'app', 'instanceWriter', 'confirmationModalService', 'instance']; | ||
public static $inject = ['$q', 'app', 'instanceWriter', 'instance']; | ||
constructor( | ||
@@ -44,3 +44,2 @@ private $q: IQService, | ||
private instanceWriter: InstanceWriter, | ||
private confirmationModalService: ConfirmationModalService, | ||
instance: InstanceFromStateParams, | ||
@@ -81,3 +80,3 @@ ) { | ||
this.confirmationModalService.confirm({ | ||
ConfirmationModalService.confirm({ | ||
header: 'Really terminate ' + shortName + '?', | ||
@@ -99,3 +98,3 @@ buttonText: 'Terminate ' + shortName, | ||
this.app.getDataSource('loadBalancers').data, | ||
this.app.getDataSource('loadBalancers').data.map(loadBalancer => loadBalancer.serverGroups), | ||
this.app.getDataSource('loadBalancers').data.map((loadBalancer: ILoadBalancer) => loadBalancer.serverGroups), | ||
]); | ||
@@ -132,5 +131,5 @@ | ||
module(APPENGINE_INSTANCE_DETAILS_CTRL, [INSTANCE_WRITE_SERVICE, CONFIRMATION_MODAL_SERVICE]).controller( | ||
module(APPENGINE_INSTANCE_DETAILS_CTRL, [INSTANCE_WRITE_SERVICE]).controller( | ||
'appengineInstanceDetailsCtrl', | ||
AppengineInstanceDetailsController, | ||
); |
import { IController, IComponentOptions, module } from 'angular'; | ||
import { AppengineLoadBalancerUpsertDescription } from 'appengine/loadBalancer/transformer'; | ||
import { AppengineLoadBalancerUpsertDescription } from '../../transformer'; | ||
@@ -4,0 +4,0 @@ class AppengineLoadBalancerAdvancedSettingsCtrl implements IController { |
import { IController, IComponentOptions, module } from 'angular'; | ||
import { uniq } from 'lodash'; | ||
import { IAppengineAllocationDescription } from 'appengine/loadBalancer/transformer'; | ||
import { IAppengineAllocationDescription } from '../../transformer'; | ||
@@ -5,0 +5,0 @@ class AppengineAllocationConfigurationRowCtrl implements IController { |
import { IController, module } from 'angular'; | ||
import { difference } from 'lodash'; | ||
import { AppengineLoadBalancerUpsertDescription } from 'appengine/loadBalancer/transformer'; | ||
import { AppengineLoadBalancerUpsertDescription } from '../../transformer'; | ||
@@ -6,0 +6,0 @@ class AppengineLoadBalancerSettingsController implements IController { |
@@ -6,3 +6,3 @@ import { IController, IComponentOptions, module } from 'angular'; | ||
import { IAppengineAllocationDescription } from 'appengine/loadBalancer/transformer'; | ||
import { IAppengineAllocationDescription } from '../../transformer'; | ||
@@ -9,0 +9,0 @@ class AppengineStageAllocationLabelCtrl implements IController { |
@@ -12,3 +12,3 @@ import { IController, module } from 'angular'; | ||
IAppengineTrafficSplitDescription, | ||
} from 'appengine/loadBalancer/transformer'; | ||
} from '../../transformer'; | ||
@@ -15,0 +15,0 @@ import './wizard.less'; |
@@ -8,3 +8,2 @@ import { IController, IScope, module } from 'angular'; | ||
Application, | ||
CONFIRMATION_MODAL_SERVICE, | ||
ConfirmationModalService, | ||
@@ -30,3 +29,3 @@ ILoadBalancer, | ||
public static $inject = ['$uibModal', '$state', '$scope', 'loadBalancer', 'app', 'confirmationModalService']; | ||
public static $inject = ['$uibModal', '$state', '$scope', 'loadBalancer', 'app']; | ||
constructor( | ||
@@ -38,3 +37,2 @@ private $uibModal: IModalService, | ||
private app: Application, | ||
private confirmationModalService: ConfirmationModalService, | ||
) { | ||
@@ -77,3 +75,3 @@ this.loadBalancerFromParams = loadBalancer; | ||
this.confirmationModalService.confirm({ | ||
ConfirmationModalService.confirm({ | ||
header: 'Really delete ' + this.loadBalancer.name + '?', | ||
@@ -126,4 +124,3 @@ buttonText: 'Delete ' + this.loadBalancer.name, | ||
const listOfServerGroupNames = serverGroupNames.map(name => `<li>${name}</li>`).join(''); | ||
return ` | ||
<div class="alert alert-warning"> | ||
return `<div class="alert alert-warning"> | ||
<p> | ||
@@ -138,4 +135,3 @@ Deleting <b>${this.loadBalancer.name}</b> will destroy the following server groups: | ||
} else { | ||
return ` | ||
<div class="alert alert-warning"> | ||
return `<div class="alert alert-warning"> | ||
<p> | ||
@@ -163,5 +159,5 @@ Deleting <b>${this.loadBalancer.name}</b> will destroy <b>${serverGroupNames[0]}</b>. | ||
export const APPENGINE_LOAD_BALANCER_DETAILS_CTRL = 'spinnaker.appengine.loadBalancerDetails.controller'; | ||
module(APPENGINE_LOAD_BALANCER_DETAILS_CTRL, [CONFIRMATION_MODAL_SERVICE]).controller( | ||
module(APPENGINE_LOAD_BALANCER_DETAILS_CTRL, []).controller( | ||
'appengineLoadBalancerDetailsCtrl', | ||
AppengineLoadBalancerDetailsController, | ||
); |
@@ -47,5 +47,5 @@ import { IController, module } from 'angular'; | ||
.then(() => { | ||
this.loadBalancers = this.application | ||
.getDataSource('loadBalancers') | ||
.data.filter(candidate => candidate.cloudProvider === 'appengine'); | ||
this.loadBalancers = (this.application.loadBalancers.data as ILoadBalancer[]).filter( | ||
candidate => candidate.cloudProvider === 'appengine', | ||
); | ||
@@ -52,0 +52,0 @@ if (this.loadBalancers.length) { |
import { IController, IScope, module } from 'angular'; | ||
import { IModalService } from 'angular-ui-bootstrap'; | ||
import { cloneDeep, get, map, mapValues, reduce } from 'lodash'; | ||
import { cloneDeep, map, mapValues, reduce } from 'lodash'; | ||
import { | ||
Application, | ||
CONFIRMATION_MODAL_SERVICE, | ||
ConfirmationModalService, | ||
@@ -16,2 +15,3 @@ IConfirmationModalParams, | ||
ServerGroupWriter, | ||
ILoadBalancer, | ||
} from '@spinnaker/core'; | ||
@@ -68,3 +68,2 @@ | ||
'serverGroupWriter', | ||
'confirmationModalService', | ||
'appengineServerGroupWriter', | ||
@@ -80,3 +79,2 @@ 'appengineServerGroupCommandBuilder', | ||
private serverGroupWriter: ServerGroupWriter, | ||
private confirmationModalService: ConfirmationModalService, | ||
private appengineServerGroupWriter: AppengineServerGroupWriter, | ||
@@ -131,5 +129,16 @@ private appengineServerGroupCommandBuilder: AppengineServerGroupCommandBuilder, | ||
public destroyServerGroup(): void { | ||
const stateParams = { | ||
name: this.serverGroup.name, | ||
accountId: this.serverGroup.account, | ||
region: this.serverGroup.region, | ||
}; | ||
const taskMonitor = { | ||
application: this.app, | ||
title: 'Destroying ' + this.serverGroup.name, | ||
onTaskComplete: () => { | ||
if (this.$state.includes('**.serverGroup', stateParams)) { | ||
this.$state.go('^'); | ||
} | ||
}, | ||
}; | ||
@@ -139,8 +148,2 @@ | ||
const stateParams = { | ||
name: this.serverGroup.name, | ||
accountId: this.serverGroup.account, | ||
region: this.serverGroup.region, | ||
}; | ||
const confirmationModalParams = { | ||
@@ -150,3 +153,2 @@ header: 'Really destroy ' + this.serverGroup.name + '?', | ||
account: this.serverGroup.account, | ||
provider: 'appengine', | ||
taskMonitorConfig: taskMonitor, | ||
@@ -158,7 +160,2 @@ submitMethod, | ||
body: this.getBodyTemplate(this.serverGroup, this.app), | ||
onTaskComplete: () => { | ||
if (this.$state.includes('**.serverGroup', stateParams)) { | ||
this.$state.go('^'); | ||
} | ||
}, | ||
interestingHealthProviderNames: [] as string[], | ||
@@ -171,3 +168,3 @@ }; | ||
this.confirmationModalService.confirm(confirmationModalParams); | ||
ConfirmationModalService.confirm(confirmationModalParams); | ||
} | ||
@@ -184,4 +181,3 @@ | ||
const modalBody = ` | ||
<div class="well well-sm"> | ||
const modalBody = `<div class="well well-sm"> | ||
<p> | ||
@@ -201,3 +197,2 @@ Enabling <b>${this.serverGroup.name}</b> will set its traffic allocation for | ||
buttonText: 'Enable ' + this.serverGroup.name, | ||
provider: 'appengine', | ||
body: modalBody, | ||
@@ -217,3 +212,3 @@ account: this.serverGroup.account, | ||
this.confirmationModalService.confirm(confirmationModalParams); | ||
ConfirmationModalService.confirm(confirmationModalParams); | ||
} | ||
@@ -231,4 +226,3 @@ | ||
const expectedAllocations = this.expectedAllocationsAfterDisableOperation(this.serverGroup, this.app); | ||
const modalBody = ` | ||
<div class="well well-sm"> | ||
const modalBody = `<div class="well well-sm"> | ||
<p> | ||
@@ -254,3 +248,2 @@ For App Engine, a disable operation sets this server group's allocation | ||
buttonText: 'Disable ' + this.serverGroup.name, | ||
provider: 'appengine', | ||
body: modalBody, | ||
@@ -270,3 +263,3 @@ account: this.serverGroup.account, | ||
this.confirmationModalService.confirm(confirmationModalParams); | ||
ConfirmationModalService.confirm(confirmationModalParams); | ||
} | ||
@@ -284,4 +277,3 @@ | ||
if (!this.serverGroup.disabled) { | ||
modalBody = ` | ||
<div class="alert alert-danger"> | ||
modalBody = `<div class="alert alert-danger"> | ||
<p>Stopping this server group will scale it down to zero instances.</p> | ||
@@ -298,3 +290,2 @@ <p> | ||
buttonText: 'Stop ' + this.serverGroup.name, | ||
provider: 'appengine', | ||
account: this.serverGroup.account, | ||
@@ -309,3 +300,3 @@ body: modalBody, | ||
this.confirmationModalService.confirm(confirmationModalParams); | ||
ConfirmationModalService.confirm(confirmationModalParams); | ||
} | ||
@@ -324,3 +315,2 @@ | ||
buttonText: 'Start ' + this.serverGroup.name, | ||
provider: 'appengine', | ||
account: this.serverGroup.account, | ||
@@ -334,3 +324,3 @@ platformHealthOnlyShowOverride: this.app.attributes.platformHealthOnlyShowOverride, | ||
this.confirmationModalService.confirm(confirmationModalParams); | ||
ConfirmationModalService.confirm(confirmationModalParams); | ||
} | ||
@@ -371,5 +361,3 @@ | ||
const isFlex = this.serverGroup.env === 'FLEXIBLE'; | ||
const usesManualScaling = get(this.serverGroup, 'scalingPolicy.type') === 'MANUAL'; | ||
const usesBasicScaling = get(this.serverGroup, 'scalingPolicy.type') === 'BASIC'; | ||
return isFlex || usesManualScaling || usesBasicScaling; | ||
return isFlex || ['MANUAL', 'BASIC'].includes(this.serverGroup.scalingPolicy?.type); | ||
} | ||
@@ -419,3 +407,3 @@ | ||
const loadBalancer = app.getDataSource('loadBalancers').data.find((toCheck: IAppengineLoadBalancer): boolean => { | ||
const allocations = get(toCheck, 'split.allocations', {}); | ||
const allocations = toCheck.split?.allocations ?? {}; | ||
const enabledServerGroups = Object.keys(allocations); | ||
@@ -465,3 +453,3 @@ return enabledServerGroups.includes(serverGroup.name); | ||
if (!fromApp) { | ||
this.app.getDataSource('loadBalancers').data.some(loadBalancer => { | ||
this.app.getDataSource('loadBalancers').data.some((loadBalancer: ILoadBalancer) => { | ||
if (loadBalancer.account === fromParams.accountId) { | ||
@@ -476,2 +464,4 @@ return loadBalancer.serverGroups.some((toCheck: IServerGroup) => { | ||
}); | ||
} else { | ||
return false; | ||
} | ||
@@ -489,6 +479,5 @@ }); | ||
module(APPENGINE_SERVER_GROUP_DETAILS_CTRL, [ | ||
APPENGINE_SERVER_GROUP_WRITER, | ||
CONFIRMATION_MODAL_SERVICE, | ||
SERVER_GROUP_WRITER, | ||
]).controller('appengineServerGroupDetailsCtrl', AppengineServerGroupDetailsController); | ||
module(APPENGINE_SERVER_GROUP_DETAILS_CTRL, [APPENGINE_SERVER_GROUP_WRITER, SERVER_GROUP_WRITER]).controller( | ||
'appengineServerGroupDetailsCtrl', | ||
AppengineServerGroupDetailsController, | ||
); |
@@ -6,4 +6,4 @@ import { ApplicationNameValidator, IApplicationNameValidator, IValidationResult } from '@spinnaker/core'; | ||
public validate(name = ''): IValidationResult { | ||
const warnings: string[] = [], | ||
errors: string[] = []; | ||
const warnings: string[] = []; | ||
const errors: string[] = []; | ||
if (name.length) { | ||
@@ -10,0 +10,0 @@ this.validateSpecialCharacters(name, errors); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1029696
6165
1