This commit is contained in:
Manuel Romero
2020-07-28 20:44:37 +02:00
parent 0c79d43ba1
commit ecb6ad4d86
8 changed files with 17 additions and 14 deletions

View File

@@ -9,5 +9,5 @@
<link rel="stylesheet" href="styles.dfcdff1865ec2a7f43bf.css"></head>
<body>
<app-root></app-root>
<script src="runtime.e227d1a0e31cbccbf8ec.js" defer></script><script src="polyfills-es5.f1f388528ea207060cbf.js" nomodule defer></script><script src="polyfills.335424f161535f57733f.js" defer></script><script src="scripts.5520a99f673924c17e00.js" defer></script><script src="main.7684ac1ea9e30154a708.js" defer></script></body>
<script src="runtime.e227d1a0e31cbccbf8ec.js" defer></script><script src="polyfills-es5.f1f388528ea207060cbf.js" nomodule defer></script><script src="polyfills.335424f161535f57733f.js" defer></script><script src="scripts.5520a99f673924c17e00.js" defer></script><script src="main.f4f66d53ec443942c755.js" defer></script></body>
</html>

File diff suppressed because one or more lines are too long

View File

@@ -44,8 +44,8 @@ async function deallocate(provision, isSendEmailAfter ) {
let timeRunning = db.utils.getNewTimeRunning(provision);
await db.provision.update(provision._id.toString(), {"statusVms": "Stopped", "timeRunning": timeRunning, "stoppedFrom": new Date(), "pendingNextAction": undefined});
if ( isSendEmailAfter && provision._scenario) {
await sendEmail.sendVMsStopped(provision, provision._scenario);
if ( isSendEmailAfter && provision._scenarioDoc ) {
await sendEmail.sendVMsStopped(provision, provision._scenarioDoc);
}
console.log("All VMs DEALLOCATED for resource group: "+rgName);
@@ -57,7 +57,7 @@ async function start(provision){
console.log("Starting VMs for resource group: "+rgName);
//Re-enable Divvy according to what's in database
if (provision.schedule){
if ( provision.schedule) {
console.log("Re-enabling Divvy Tags according to database");
var tagsEdit = {
"24x7": provision.schedule.is24x7? " " : false,

View File

@@ -352,6 +352,9 @@ router.post('/:userId/provisions/:id/deallocatevms', passport.ensureAuthenticate
return res.status(404).json({"msg": "Not found provision with id "+req.params.id});
}
azurecli.deallocate(provision);
if ( req.body.isStartupTimeEnable !== undefined ) {
await db.schedule.update(provision.schedule._id, { "isStartupTimeEnable": req.body.isStartupTimeEnable });
}
return res.json({"statusVms": "Stopping"});
} catch (error) {

View File

@@ -12,7 +12,7 @@ export class ModalConfirmComponent implements OnInit, OnDestroy {
info;
provision;
action: Subject<any> = new Subject();
atStopKeepSchedule = true;
isStartupTimeEnable = true;
constructor( public modalRef: MDBModalRef ) {}
@@ -23,7 +23,7 @@ export class ModalConfirmComponent implements OnInit, OnDestroy {
}
checkOnchange($event) {
this.atStopKeepSchedule = $event.checked;
this.isStartupTimeEnable = $event.checked;
}
ngOnDestroy() {
@@ -31,7 +31,7 @@ export class ModalConfirmComponent implements OnInit, OnDestroy {
}
confirm() : void {
this.action.next({"atStopKeepSchedule": this.atStopKeepSchedule});
this.action.next({"isStartupTimeEnable": this.isStartupTimeEnable});
this.modalRef.hide();
}

View File

@@ -114,7 +114,7 @@ export class ProvisionsComponent implements OnInit {
var sub = modalRef.content.action.subscribe( (result: any) => {
console.log("Confirm result", result);
sub.unsubscribe();
this._provisionsService.stopVms(provision._id.toString(), this._userId).subscribe( res => {
this._provisionsService.stopVms(provision._id.toString(), this._userId, result).subscribe( res => {
provision.statusVms = res.statusVms;
provision.timeRunning = res.timeRunning;
provision.runningFrom = res.runningFrom;

View File

@@ -109,8 +109,8 @@ export class ProvisionsService {
return this.httpClient.get(`${environment.apiVersionPath}/destroyprovisions/${id}/logs`, {responseType: 'text'});
}
stopVms(id, userId): Observable<any> {
return this.httpClient.post(`${environment.apiVersionPath}/users/${userId}/provisions/${id}/deallocatevms`, null).pipe(map((p:any)=>{
stopVms(id, userId, patch): Observable<any> {
return this.httpClient.post(`${environment.apiVersionPath}/users/${userId}/provisions/${id}/deallocatevms`, patch).pipe(map((p:any)=>{
this.timeRunning(p);
return p;
}));

View File

@@ -214,12 +214,12 @@ export class TableProvisionsAdminComponent implements OnInit, OnDestroy, AfterVi
var sub = modalRef.content.action.subscribe( (result: any) => {
sub.unsubscribe();
this._stopVms(provision);
this._stopVms(provision, result);
});
}
private _stopVms(provision): void {
var sub = this._provisionsService.stopVms(provision._id.toString(), provision.user._id).subscribe( res => {
private _stopVms(provision, patch): void {
var sub = this._provisionsService.stopVms(provision._id.toString(), provision.user._id, patch).subscribe( res => {
provision.startVms = res.startVms;
sub.unsubscribe();
this._alertService.showAlert({