@spinnaker/google 0.2.4 → 0.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@spinnaker/google",
3
3
  "license": "Apache-2.0",
4
- "version": "0.2.4",
4
+ "version": "0.2.11",
5
5
  "module": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
7
10
  "scripts": {
8
11
  "clean": "shx rm -rf dist",
9
12
  "prepublishOnly": "npm run build",
@@ -13,7 +16,7 @@
13
16
  "lib": "npm run build"
14
17
  },
15
18
  "dependencies": {
16
- "@spinnaker/core": "^0.23.0",
19
+ "@spinnaker/core": "^0.27.0",
17
20
  "@uirouter/angularjs": "1.0.26",
18
21
  "angular": "1.6.10",
19
22
  "angular-ui-bootstrap": "2.5.0",
@@ -26,8 +29,8 @@
26
29
  "ui-select": "0.19.8"
27
30
  },
28
31
  "devDependencies": {
29
- "@spinnaker/eslint-plugin": "^3.0.1",
30
- "@spinnaker/scripts": "^0.3.0",
32
+ "@spinnaker/eslint-plugin": "^3.0.2",
33
+ "@spinnaker/scripts": "^0.3.1",
31
34
  "@types/angular": "1.6.26",
32
35
  "@types/angular-mocks": "1.5.10",
33
36
  "@types/angular-ui-bootstrap": "0.13.41",
@@ -37,5 +40,5 @@
37
40
  "shx": "0.3.3",
38
41
  "typescript": "4.3.5"
39
42
  },
40
- "gitHead": "21bd84315ab519ae2c72adb6605b237b728352a0"
43
+ "gitHead": "217b75396c5ec25d9b2019a849593b0b8d52e916"
41
44
  }
@@ -16,91 +16,93 @@ module(GOOGLE_AUTOSCALINGPOLICY_COMPONENTS_METRICSETTINGS_METRICSETTINGS_COMPONE
16
16
  },
17
17
  templateUrl: require('./metricSettings.component.html'),
18
18
  controller: function () {
19
- const multipleAllowedFor = {
20
- cpuUtilization: false,
21
- loadBalancingUtilization: false,
22
- customMetricUtilizations: true,
23
- };
24
-
25
- const metricTypes = Object.keys(multipleAllowedFor);
26
-
27
- this.targetTypesToDisplayMap = {
28
- GAUGE: 'Gauge',
29
- DELTA_PER_SECOND: 'Delta / second',
30
- DELTA_PER_MINUTE: 'Delta / minute',
31
- };
32
-
33
- this.metricScopeTypesToDisplayMap = {
34
- TIME_SERIES_PER_INSTANCE: 'Time series per instance',
35
- SINGLE_TIME_SERIES_PER_GROUP: 'Single time series per group',
36
- };
37
-
38
- this.scalingpolicyTypesToDisplayMap = {
39
- UTILIZATION_TARGET: 'Utilization target',
40
- SINGLE_INSTANCE_ASSIGNMENT: 'singleInstanceAssignment',
41
- };
42
-
43
- this.addMetric = (metricType) => {
44
- if (multipleAllowedFor[metricType]) {
45
- this.policy[metricType] = this.policy[metricType] || [];
46
- this.policy[metricType].push({});
47
- } else if (emptyOrUndefined(this.policy[metricType])) {
48
- this.policy[metricType] = { utilizationTarget: null };
19
+ this.$onInit = () => {
20
+ const multipleAllowedFor = {
21
+ cpuUtilization: false,
22
+ loadBalancingUtilization: false,
23
+ customMetricUtilizations: true,
24
+ };
25
+
26
+ const metricTypes = Object.keys(multipleAllowedFor);
27
+
28
+ this.targetTypesToDisplayMap = {
29
+ GAUGE: 'Gauge',
30
+ DELTA_PER_SECOND: 'Delta / second',
31
+ DELTA_PER_MINUTE: 'Delta / minute',
32
+ };
33
+
34
+ this.metricScopeTypesToDisplayMap = {
35
+ TIME_SERIES_PER_INSTANCE: 'Time series per instance',
36
+ SINGLE_TIME_SERIES_PER_GROUP: 'Single time series per group',
37
+ };
38
+
39
+ this.scalingpolicyTypesToDisplayMap = {
40
+ UTILIZATION_TARGET: 'Utilization target',
41
+ SINGLE_INSTANCE_ASSIGNMENT: 'singleInstanceAssignment',
42
+ };
43
+
44
+ this.addMetric = (metricType) => {
45
+ if (multipleAllowedFor[metricType]) {
46
+ this.policy[metricType] = this.policy[metricType] || [];
47
+ this.policy[metricType].push({});
48
+ } else if (emptyOrUndefined(this.policy[metricType])) {
49
+ this.policy[metricType] = { utilizationTarget: null };
50
+ }
51
+ };
52
+
53
+ this.deleteMetric = (metricType, index) => {
54
+ if (multipleAllowedFor[metricType]) {
55
+ this.policy[metricType].splice(index, 1);
56
+ } else {
57
+ // sending an empty object to the API deletes the policy.
58
+ this.policy[metricType] = {};
59
+ }
60
+ };
61
+
62
+ this.showMetric = (metricType) => {
63
+ const metric = this.policy[metricType];
64
+ // should not show policy form if the policy is undefined or an empty object.
65
+ return !emptyOrUndefined(metric);
66
+ };
67
+
68
+ this.isSingleTimeSeriesPerGroup = (scopeType, index) => {
69
+ if (this.policy.customMetricUtilizations[index].metricExportScope === scopeType) return true;
70
+ };
71
+
72
+ this.isScalingPolicySingleInstanceAssignment = (policyType, index) => {
73
+ if (this.policy.customMetricUtilizations[index].scalingpolicy === policyType) return true;
74
+ };
75
+
76
+ this.showNoMetricsWarning = () => {
77
+ return _.every(
78
+ metricTypes.map((type) => {
79
+ return _.some([
80
+ multipleAllowedFor[type] && !_.get(this.policy, [type, 'length']),
81
+ emptyOrUndefined(this.policy[type]),
82
+ ]);
83
+ }),
84
+ );
85
+ };
86
+
87
+ this.setUtilizationTargetFromDisplay = (metricType, value) => {
88
+ this.policy[metricType].utilizationTarget = value / 100;
89
+ };
90
+
91
+ this.initializeTargetDisplay = (metricType) => {
92
+ this[`${metricType}TargetDisplay`] = safeDecimalToPercent(this.policy[metricType].utilizationTarget);
93
+ };
94
+
95
+ function safeDecimalToPercent(value) {
96
+ if (value === 0) {
97
+ return 0;
98
+ }
99
+ return value ? Math.round(value * 100) : undefined;
49
100
  }
50
- };
51
101
 
52
- this.deleteMetric = (metricType, index) => {
53
- if (multipleAllowedFor[metricType]) {
54
- this.policy[metricType].splice(index, 1);
55
- } else {
56
- // sending an empty object to the API deletes the policy.
57
- this.policy[metricType] = {};
102
+ function emptyOrUndefined(value) {
103
+ return _.isEqual(value, {}) || _.isUndefined(value);
58
104
  }
59
105
  };
60
-
61
- this.showMetric = (metricType) => {
62
- const metric = this.policy[metricType];
63
- // should not show policy form if the policy is undefined or an empty object.
64
- return !emptyOrUndefined(metric);
65
- };
66
-
67
- this.isSingleTimeSeriesPerGroup = (scopeType, index) => {
68
- if (this.policy.customMetricUtilizations[index].metricExportScope === scopeType) return true;
69
- };
70
-
71
- this.isScalingPolicySingleInstanceAssignment = (policyType, index) => {
72
- if (this.policy.customMetricUtilizations[index].scalingpolicy === policyType) return true;
73
- };
74
-
75
- this.showNoMetricsWarning = () => {
76
- return _.every(
77
- metricTypes.map((type) => {
78
- return _.some([
79
- multipleAllowedFor[type] && !_.get(this.policy, [type, 'length']),
80
- emptyOrUndefined(this.policy[type]),
81
- ]);
82
- }),
83
- );
84
- };
85
-
86
- this.setUtilizationTargetFromDisplay = (metricType, value) => {
87
- this.policy[metricType].utilizationTarget = value / 100;
88
- };
89
-
90
- this.initializeTargetDisplay = (metricType) => {
91
- this[`${metricType}TargetDisplay`] = safeDecimalToPercent(this.policy[metricType].utilizationTarget);
92
- };
93
-
94
- function safeDecimalToPercent(value) {
95
- if (value === 0) {
96
- return 0;
97
- }
98
- return value ? Math.round(value * 100) : undefined;
99
- }
100
-
101
- function emptyOrUndefined(value) {
102
- return _.isEqual(value, {}) || _.isUndefined(value);
103
- }
104
106
  },
105
107
  },
106
108
  );
@@ -16,44 +16,46 @@ module(GOOGLE_AUTOSCALINGPOLICY_COMPONENTS_SCALINGSCHEDULES_SCALINGSCHEDULES_COM
16
16
  },
17
17
  templateUrl: require('./scalingSchedules.component.html'),
18
18
  controller: function () {
19
- const multipleAllowedFor = {
20
- scalingSchedules: true,
21
- };
22
-
23
- this.timezones = timezones;
24
-
25
- this.addSchedule = (scheduleType) => {
26
- if (multipleAllowedFor[scheduleType]) {
27
- this.policy[scheduleType] = this.policy[scheduleType] || [];
28
- this.policy[scheduleType].push({});
29
- } else if (emptyOrUndefined(this.policy[scheduleType])) {
30
- this.policy[scheduleType] = {};
31
- }
32
- };
33
-
34
- this.deleteSchedule = (scheduleType, index) => {
35
- if (multipleAllowedFor[scheduleType]) {
36
- this.policy[scheduleType].splice(index, 1);
37
- } else {
38
- // sending an empty object to the API deletes the policy.
39
- this.policy[scheduleType] = {};
19
+ this.$onInit = () => {
20
+ const multipleAllowedFor = {
21
+ scalingSchedules: true,
22
+ };
23
+
24
+ this.timezones = timezones;
25
+
26
+ this.addSchedule = (scheduleType) => {
27
+ if (multipleAllowedFor[scheduleType]) {
28
+ this.policy[scheduleType] = this.policy[scheduleType] || [];
29
+ this.policy[scheduleType].push({});
30
+ } else if (emptyOrUndefined(this.policy[scheduleType])) {
31
+ this.policy[scheduleType] = {};
32
+ }
33
+ };
34
+
35
+ this.deleteSchedule = (scheduleType, index) => {
36
+ if (multipleAllowedFor[scheduleType]) {
37
+ this.policy[scheduleType].splice(index, 1);
38
+ } else {
39
+ // sending an empty object to the API deletes the policy.
40
+ this.policy[scheduleType] = {};
41
+ }
42
+ };
43
+
44
+ this.selectTimezone = (timezone, index) => {
45
+ const { scalingSchedules } = this.policy;
46
+ const schedule = scalingSchedules[index];
47
+ scalingSchedules[index] = { ...schedule, timezone };
48
+
49
+ this.updatePolicy({
50
+ ...this.policy,
51
+ scalingSchedules: [...scalingSchedules],
52
+ });
53
+ };
54
+
55
+ function emptyOrUndefined(value) {
56
+ return _.isEqual(value, {}) || _.isUndefined(value);
40
57
  }
41
58
  };
42
-
43
- this.selectTimezone = (timezone, index) => {
44
- const { scalingSchedules } = this.policy;
45
- const schedule = scalingSchedules[index];
46
- scalingSchedules[index] = { ...schedule, timezone };
47
-
48
- this.updatePolicy({
49
- ...this.policy,
50
- scalingSchedules: [...scalingSchedules],
51
- });
52
- };
53
-
54
- function emptyOrUndefined(value) {
55
- return _.isEqual(value, {}) || _.isUndefined(value);
56
- }
57
59
  },
58
60
  },
59
61
  );
@@ -18,60 +18,62 @@ module(GOOGLE_LOADBALANCER_CONFIGURE_HTTP_BACKENDSERVICE_BACKENDSERVICE_COMPONEN
18
18
  },
19
19
  templateUrl: require('./backendService.component.html'),
20
20
  controller: function () {
21
- this.backingData = this.command.backingData;
22
- this.loadBalancer = this.command.loadBalancer;
23
- const servicesByName = this.backingData.backendServicesKeyedByName;
21
+ this.$onInit = () => {
22
+ this.backingData = this.command.backingData;
23
+ this.loadBalancer = this.command.loadBalancer;
24
+ const servicesByName = this.backingData.backendServicesKeyedByName;
24
25
 
25
- this.onBackendServiceSelect = (selectedBackendService) => {
26
- assign(selectedBackendService);
27
- this.command.onHealthCheckSelected(selectedBackendService.healthCheck, this.command);
28
- };
26
+ this.onBackendServiceSelect = (selectedBackendService) => {
27
+ assign(selectedBackendService);
28
+ this.command.onHealthCheckSelected(selectedBackendService.healthCheck, this.command);
29
+ };
29
30
 
30
- this.toggleEditExisting = () => {
31
- this.editExisting = !this.editExisting;
32
- if (!this.editExisting) {
33
- const template = new BackendServiceTemplate();
34
- assign(template);
35
- } else {
36
- delete this.backendService.name;
37
- }
38
- };
31
+ this.toggleEditExisting = () => {
32
+ this.editExisting = !this.editExisting;
33
+ if (!this.editExisting) {
34
+ const template = new BackendServiceTemplate();
35
+ assign(template);
36
+ } else {
37
+ delete this.backendService.name;
38
+ }
39
+ };
39
40
 
40
- this.getAllHealthChecks = () => {
41
- const allHealthChecks = this.loadBalancer.healthChecks.concat(this.backingData.healthChecks);
42
- return _.chain(allHealthChecks)
43
- .filter((hc) => hc.account === this.loadBalancer.credentials || !hc.account)
44
- .map((hc) => hc.name)
45
- .uniq()
46
- .value();
47
- };
41
+ this.getAllHealthChecks = () => {
42
+ const allHealthChecks = this.loadBalancer.healthChecks.concat(this.backingData.healthChecks);
43
+ return _.chain(allHealthChecks)
44
+ .filter((hc) => hc.account === this.loadBalancer.credentials || !hc.account)
45
+ .map((hc) => hc.name)
46
+ .uniq()
47
+ .value();
48
+ };
48
49
 
49
- this.getSessionAffinitySuggestions = () => {
50
- if (this.loadBalancer.loadBalancerType === 'HTTP') {
51
- return ['None', 'Client IP', 'Generated Cookie'];
52
- } else {
53
- return ['None', 'Client IP', 'Generated Cookie', 'Header Field', 'HTTP Cookie'];
54
- }
55
- };
50
+ this.getSessionAffinitySuggestions = () => {
51
+ if (this.loadBalancer.loadBalancerType === 'HTTP') {
52
+ return ['None', 'Client IP', 'Generated Cookie'];
53
+ } else {
54
+ return ['None', 'Client IP', 'Generated Cookie', 'Header Field', 'HTTP Cookie'];
55
+ }
56
+ };
56
57
 
57
- this.getAllServiceNames = () => {
58
- return this.command.backingData.backendServices
59
- .filter((service) => service.account === this.loadBalancer.credentials)
60
- .map((service) => service.name);
61
- };
58
+ this.getAllServiceNames = () => {
59
+ return this.command.backingData.backendServices
60
+ .filter((service) => service.account === this.loadBalancer.credentials)
61
+ .map((service) => service.name);
62
+ };
62
63
 
63
- this.maxCookieTtl = 60 * 60 * 24; // One day.
64
+ this.maxCookieTtl = 60 * 60 * 24; // One day.
64
65
 
65
- const getBackendServiceName = () => {
66
- return _.get(this, 'backendService.name');
67
- };
66
+ const getBackendServiceName = () => {
67
+ return _.get(this, 'backendService.name');
68
+ };
68
69
 
69
- if (servicesByName[getBackendServiceName()]) {
70
- this.editExisting = true;
71
- }
70
+ if (servicesByName[getBackendServiceName()]) {
71
+ this.editExisting = true;
72
+ }
72
73
 
73
- const assign = (toAssign) => {
74
- this.loadBalancer.backendServices[this.index] = this.backendService = toAssign;
74
+ const assign = (toAssign) => {
75
+ this.loadBalancer.backendServices[this.index] = this.backendService = toAssign;
76
+ };
75
77
  };
76
78
  },
77
79
  },
@@ -15,30 +15,32 @@ module(GOOGLE_LOADBALANCER_CONFIGURE_HTTP_BASICSETTINGS_BASICSETTINGS_COMPONENT,
15
15
  },
16
16
  templateUrl: require('./basicSettings.component.html'),
17
17
  controller: function () {
18
- const c = this.command;
19
- this.loadBalancer = c.loadBalancer;
20
- this.accounts = c.backingData.accounts;
21
- const loadBalancerMap = c.backingData.loadBalancerMap;
18
+ this.$onInit = () => {
19
+ const c = this.command;
20
+ this.loadBalancer = c.loadBalancer;
21
+ this.accounts = c.backingData.accounts;
22
+ const loadBalancerMap = c.backingData.loadBalancerMap;
22
23
 
23
- this.getName = (loadBalancer, applicationName) => {
24
- const loadBalancerName = [applicationName, loadBalancer.stack || '', loadBalancer.detail || ''].join('-');
25
- return _.trimEnd(loadBalancerName, '-');
26
- };
24
+ this.getName = (loadBalancer, applicationName) => {
25
+ const loadBalancerName = [applicationName, loadBalancer.stack || '', loadBalancer.detail || ''].join('-');
26
+ return _.trimEnd(loadBalancerName, '-');
27
+ };
27
28
 
28
- this.updateName = (lb, appName) => {
29
- lb.urlMapName = this.getName(lb, appName);
30
- };
29
+ this.updateName = (lb, appName) => {
30
+ lb.urlMapName = this.getName(lb, appName);
31
+ };
31
32
 
32
- this.accountChanged = (account) => {
33
- this.existingLoadBalancerNames = _.get(loadBalancerMap, [account, 'urlMapNames']) || [];
34
- c.onAccountChange(c);
35
- };
33
+ this.accountChanged = (account) => {
34
+ this.existingLoadBalancerNames = _.get(loadBalancerMap, [account, 'urlMapNames']) || [];
35
+ c.onAccountChange(c);
36
+ };
36
37
 
37
- if (!this.loadBalancer.name) {
38
- this.updateName(this.loadBalancer, this.application.name);
39
- }
38
+ if (!this.loadBalancer.name) {
39
+ this.updateName(this.loadBalancer, this.application.name);
40
+ }
40
41
 
41
- this.existingLoadBalancerNames = _.get(loadBalancerMap, [this.loadBalancer.credentials, 'urlMapNames']) || [];
42
+ this.existingLoadBalancerNames = _.get(loadBalancerMap, [this.loadBalancer.credentials, 'urlMapNames']) || [];
43
+ };
42
44
  },
43
45
  },
44
46
  );
@@ -19,49 +19,51 @@ module(GOOGLE_LOADBALANCER_CONFIGURE_HTTP_HEALTHCHECK_HEALTHCHECK_COMPONENT, [])
19
19
  },
20
20
  templateUrl: require('./healthCheck.component.html'),
21
21
  controller: function () {
22
- this.max = Number.MAX_SAFE_INTEGER;
23
- this.backingData = this.command.backingData;
24
- this.loadBalancer = this.command.loadBalancer;
25
- const healthChecksByName = this.backingData.healthChecksKeyedByName;
22
+ this.$onInit = () => {
23
+ this.max = Number.MAX_SAFE_INTEGER;
24
+ this.backingData = this.command.backingData;
25
+ this.loadBalancer = this.command.loadBalancer;
26
+ const healthChecksByName = this.backingData.healthChecksKeyedByName;
26
27
 
27
- this.onHealthCheckSelect = (selectedHealthCheck) => {
28
- assign(selectedHealthCheck);
29
- };
28
+ this.onHealthCheckSelect = (selectedHealthCheck) => {
29
+ assign(selectedHealthCheck);
30
+ };
30
31
 
31
- this.getAllHealthCheckNames = () => {
32
- return this.command.backingData.healthChecks
33
- .filter((hc) => hc.account === this.loadBalancer.credentials)
34
- .map((hc) => hc.name);
35
- };
32
+ this.getAllHealthCheckNames = () => {
33
+ return this.command.backingData.healthChecks
34
+ .filter((hc) => hc.account === this.loadBalancer.credentials)
35
+ .map((hc) => hc.name);
36
+ };
36
37
 
37
- this.toggleEditExisting = () => {
38
- this.editExisting = !this.editExisting;
39
- if (!this.editExisting) {
40
- assign(new HealthCheckTemplate());
41
- } else {
42
- delete this.healthCheck.name;
43
- }
44
- };
38
+ this.toggleEditExisting = () => {
39
+ this.editExisting = !this.editExisting;
40
+ if (!this.editExisting) {
41
+ assign(new HealthCheckTemplate());
42
+ } else {
43
+ delete this.healthCheck.name;
44
+ }
45
+ };
45
46
 
46
- const assign = (toAssign) => {
47
- this.loadBalancer.healthChecks[this.index] = this.healthCheck = toAssign;
48
- };
47
+ const assign = (toAssign) => {
48
+ this.loadBalancer.healthChecks[this.index] = this.healthCheck = toAssign;
49
+ };
49
50
 
50
- const getHealthCheckName = () => {
51
- return _.get(this, 'healthCheck.name');
52
- };
51
+ const getHealthCheckName = () => {
52
+ return _.get(this, 'healthCheck.name');
53
+ };
53
54
 
54
- this.onProtocolChange = () => {
55
- if (this.healthCheck.healthCheckType !== this.healthCheckType) {
56
- assign(Object.assign({}, new HealthCheckTemplate(), { healthCheckType: this.healthCheckType }));
57
- }
58
- };
55
+ this.onProtocolChange = () => {
56
+ if (this.healthCheck.healthCheckType !== this.healthCheckType) {
57
+ assign(Object.assign({}, new HealthCheckTemplate(), { healthCheckType: this.healthCheckType }));
58
+ }
59
+ };
59
60
 
60
- if (healthChecksByName[getHealthCheckName()]) {
61
- this.editExisting = true;
62
- }
61
+ if (healthChecksByName[getHealthCheckName()]) {
62
+ this.editExisting = true;
63
+ }
63
64
 
64
- this.healthCheckType = this.healthCheck.healthCheckType;
65
+ this.healthCheckType = this.healthCheck.healthCheckType;
66
+ };
65
67
  },
66
68
  },
67
69
  );
@@ -19,15 +19,17 @@ module(GOOGLE_LOADBALANCER_CONFIGURE_HTTP_HOSTRULE_HOSTRULE_COMPONENT, [
19
19
  },
20
20
  templateUrl: require('./hostRule.component.html'),
21
21
  controller: function () {
22
- this.loadBalancer = this.command.loadBalancer;
23
- const pathRules = this.hostRule.pathMatcher.pathRules;
22
+ this.$onInit = () => {
23
+ this.loadBalancer = this.command.loadBalancer;
24
+ const pathRules = this.hostRule.pathMatcher.pathRules;
24
25
 
25
- this.addPathRule = () => {
26
- pathRules.push(new PathRuleTemplate());
27
- };
26
+ this.addPathRule = () => {
27
+ pathRules.push(new PathRuleTemplate());
28
+ };
28
29
 
29
- this.deletePathRule = (index) => {
30
- pathRules.splice(index, 1);
30
+ this.deletePathRule = (index) => {
31
+ pathRules.splice(index, 1);
32
+ };
31
33
  };
32
34
  },
33
35
  });