forked from spinnaker/deck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resume.controller.ts
73 lines (61 loc) · 1.98 KB
/
resume.controller.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { copy, IController, module } from 'angular'
import { IModalServiceInstance } from 'angular-ui-bootstrap';
import {
Application,
MANIFEST_WRITER,
ManifestWriter,
TASK_MONITOR_BUILDER,
TaskMonitor,
TaskMonitorBuilder
} from '@spinnaker/core';
import { IManifestCoordinates } from '../IManifestCoordinates';
interface IResumeRolloutCommand {
name: string;
location: string;
account: string;
reason: string;
}
class KubernetesManifestResumeRolloutController implements IController {
public taskMonitor: TaskMonitor;
public command: IResumeRolloutCommand;
public verification = {
verified: false
};
constructor(coordinates: IManifestCoordinates,
taskMonitorBuilder: TaskMonitorBuilder,
private $uibModalInstance: IModalServiceInstance,
private manifestWriter: ManifestWriter,
private application: Application) {
'ngInject';
this.taskMonitor = taskMonitorBuilder.buildTaskMonitor({
title: `Resume rollout of ${coordinates.name} in ${coordinates.namespace}`,
application: application,
modalInstance: $uibModalInstance,
});
this.command = {
name: coordinates.name,
location: coordinates.namespace,
account: coordinates.account,
reason: null,
};
}
public isValid(): boolean {
return this.verification.verified;
}
public cancel(): void {
this.$uibModalInstance.dismiss();
};
public resumeRollout(): void {
this.taskMonitor.submit(() => {
const payload = copy(this.command) as any;
payload.cloudProvider = 'kubernetes';
return this.manifestWriter.resumeRolloutManifest(payload, this.application);
});
}
}
export const KUBERNETES_MANIFEST_RESUME_ROLLOUT_CTRL = 'spinnaker.kubernetes.v2.manifest.resumeRollout.controller';
module(KUBERNETES_MANIFEST_RESUME_ROLLOUT_CTRL, [
TASK_MONITOR_BUILDER,
MANIFEST_WRITER,
])
.controller('kubernetesV2ManifestResumeRolloutCtrl', KubernetesManifestResumeRolloutController);