-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5658 from deNBI/feat/stop_vm_message
feat(VirtualMachine):added stopped vm info
- Loading branch information
Showing
9 changed files
with
1,222 additions
and
1,222 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
233 changes: 113 additions & 120 deletions
233
src/app/shared/modal/email/project-email-modal/project-email-modal.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,127 +1,120 @@ | ||
<div class="modal-header"> | ||
<h4 class="modal-title" data-test-id="confirmation_modal_title">Sent Mail to specific projects</h4> | ||
<button type="button" class="close" style="cursor: pointer" (click)="bsModalRef.hide()" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
<h4 class="modal-title" data-test-id="confirmation_modal_title">Sent Mail to specific projects</h4> | ||
<button type="button" class="close" style="cursor: pointer" (click)="bsModalRef.hide()" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<div> | ||
Send Mail to: | ||
<ul> | ||
<li *ngFor="let pr of selectedProjects">{{pr.project_application_shortname}}</li> | ||
</ul> | ||
</div> | ||
<form class="form-horizontal" id="email_form" #f="ngForm"> | ||
|
||
|
||
<div class="form-group row"> | ||
<div class="col-md-auto"> | ||
<div class="form-check"> | ||
<input | ||
class="form-check-input" | ||
type="checkbox" | ||
[(ngModel)]="emailAdminsOnly" | ||
id="adminOnlyCheckbox" | ||
/> | ||
<label class="form-check-label" for="adminOnlyCheckbox"> Group administrators only </label> | ||
</div> | ||
</div> | ||
</div> | ||
<div | ||
|
||
class="form-group row" | ||
[ngClass]="{ | ||
'has-danger': emailSub.invalid && (emailSub.dirty || emailSub.touched), | ||
'has-success': emailSub.valid && (emailSub.dirty || emailSub.touched) | ||
}" | ||
> | ||
<label class="col-md-12 control-label"><strong>Email subject*</strong></label> | ||
<div class="col-md-12"> | ||
<input | ||
required | ||
id="emailSubject" | ||
name="emailSub" | ||
placeholder="Subject" | ||
class="form-control" | ||
type="text" | ||
[(ngModel)]="emailSubject" | ||
minlength="1" | ||
#emailSub="ngModel" | ||
[ngClass]="{ | ||
'is-invalid': emailSub.invalid && (emailSub.dirty || emailSub.touched), | ||
'is-valid': emailSub.valid && (emailSub.dirty || emailSub.touched) | ||
}" | ||
/> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group row"> | ||
<label class="col-md-12 control-label"><strong>Reply to (optional)</strong></label> | ||
<div class="col-md-12"> | ||
<input | ||
id="reply_to" | ||
name="emailReply" | ||
placeholder="" | ||
class="form-control" | ||
type="text" | ||
[(ngModel)]="emailReply" | ||
#emailRep="ngModel" | ||
pattern="([ ]*)(?!(^[.-].*|[^@]*[.-]@|.*\.{2,}.*)|^.{254}.)([a-zA-Z0-9!#$%&'*+\/=?^_`{|}~.-]+@)(?!-.*|.*-\.)([a-zA-Z0-9-]{1,63}\.)+[a-zA-Z]{2,15}([ ]*)" | ||
[ngClass]="{ | ||
'is-invalid': emailRep.invalid && (emailRep.dirty || emailRep.touched), | ||
'is-valid': emailRep.valid && (emailRep.dirty || emailRep.touched) | ||
}" | ||
/> | ||
</div> | ||
</div> | ||
<!-- Textarea --> | ||
<div class="form-group row"> | ||
<label class="col-md-12 control-label"><strong>Email text*</strong></label> | ||
<div class="col-md-12"> | ||
<textarea | ||
minlength="1" | ||
required | ||
class="form-control" | ||
id="emailText" | ||
name="emailText" | ||
[(ngModel)]="emailText" | ||
type="text" | ||
#emailT="ngModel" | ||
[ngClass]="{ | ||
'is-invalid': emailT.invalid && (emailT.dirty || emailT.touched), | ||
'is-valid': emailT.valid && (emailT.dirty || emailT.touched) | ||
}" | ||
></textarea> | ||
</div> | ||
</div> | ||
</form> | ||
<div class="templates-container"> | ||
<p>The following keys can be used as variables:</p> | ||
<div class="templates-list"> | ||
<span *ngFor="let template of templates">{{ '{' + template + '}' }}, </span> | ||
</div> | ||
</div> | ||
|
||
|
||
<div> | ||
Send Mail to: | ||
<ul> | ||
<li *ngFor="let pr of selectedProjects">{{ pr.project_application_shortname }}</li> | ||
</ul> | ||
</div> | ||
<form class="form-horizontal" id="email_form" #f="ngForm"> | ||
<div class="form-group row"> | ||
<div class="col-md-auto"> | ||
<div class="form-check"> | ||
<input | ||
class="form-check-input" | ||
type="checkbox" | ||
[(ngModel)]="emailAdminsOnly" | ||
name="emailAdminsOnly" | ||
id="adminOnlyCheckbox" | ||
/> | ||
<label class="form-check-label" for="adminOnlyCheckbox"> Group administrators only </label> | ||
</div> | ||
</div> | ||
</div> | ||
<div | ||
class="form-group row" | ||
[ngClass]="{ | ||
'has-danger': emailSub.invalid && (emailSub.dirty || emailSub.touched), | ||
'has-success': emailSub.valid && (emailSub.dirty || emailSub.touched) | ||
}" | ||
> | ||
<label class="col-md-12 control-label"><strong>Email subject*</strong></label> | ||
<div class="col-md-12"> | ||
<input | ||
required | ||
id="emailSubject" | ||
name="emailSubject" | ||
placeholder="Subject" | ||
class="form-control" | ||
type="text" | ||
[(ngModel)]="emailSubject" | ||
minlength="1" | ||
#emailSub="ngModel" | ||
[ngClass]="{ | ||
'is-invalid': emailSub.invalid && (emailSub.dirty || emailSub.touched), | ||
'is-valid': emailSub.valid && (emailSub.dirty || emailSub.touched) | ||
}" | ||
/> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group row"> | ||
<label class="col-md-12 control-label"><strong>Reply to (optional)</strong></label> | ||
<div class="col-md-12"> | ||
<input | ||
id="reply_to" | ||
name="emailReply" | ||
placeholder="" | ||
class="form-control" | ||
type="text" | ||
[(ngModel)]="emailReply" | ||
#emailRep="ngModel" | ||
pattern="([ ]*)(?!(^[.-].*|[^@]*[.-]@|.*\.{2,}.*)|^.{254}.)([a-zA-Z0-9!#$%&'*+\/=?^_`{|}~.-]+@)(?!-.*|.*-\.)([a-zA-Z0-9-]{1,63}\.)+[a-zA-Z]{2,15}([ ]*)" | ||
[ngClass]="{ | ||
'is-invalid': emailRep.invalid && (emailRep.dirty || emailRep.touched), | ||
'is-valid': emailRep.valid && (emailRep.dirty || emailRep.touched) | ||
}" | ||
/> | ||
</div> | ||
</div> | ||
<!-- Textarea --> | ||
<div class="form-group row"> | ||
<label class="col-md-12 control-label"><strong>Email text*</strong></label> | ||
<div class="col-md-12"> | ||
<textarea | ||
minlength="1" | ||
required | ||
class="form-control" | ||
id="emailText" | ||
name="emailText" | ||
[(ngModel)]="emailText" | ||
type="text" | ||
#emailT="ngModel" | ||
[ngClass]="{ | ||
'is-invalid': emailT.invalid && (emailT.dirty || emailT.touched), | ||
'is-valid': emailT.valid && (emailT.dirty || emailT.touched) | ||
}" | ||
></textarea> | ||
</div> | ||
</div> | ||
</form> | ||
<div class="templates-container"> | ||
<p>The following keys can be used as variables:</p> | ||
<div class="templates-list"> | ||
<span *ngFor="let template of templates">{{ '{' + template + '}' }}, </span> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button | ||
class="btn btn-secondary col-md-4" | ||
type="reset" | ||
data-test-id="close_confirmation_modal_btn" | ||
(click)=" bsModalRef.hide()" | ||
> | ||
Abort & Close | ||
</button> | ||
<button | ||
class="btn btn-success col-md-4" | ||
[disabled]=" | ||
f.invalid | ||
" | ||
data-test-id="confirm_confirmation_modal_btn" | ||
(click)="sentProjectsMail(); bsModalRef.hide()" | ||
> | ||
Sent Mail | ||
</button> | ||
<button | ||
class="btn btn-secondary col-md-4" | ||
type="reset" | ||
data-test-id="close_confirmation_modal_btn" | ||
(click)="bsModalRef.hide()" | ||
> | ||
Abort & Close | ||
</button> | ||
<button | ||
class="btn btn-success col-md-4" | ||
[disabled]="f.invalid" | ||
data-test-id="confirm_confirmation_modal_btn" | ||
(click)="sentProjectsMail(); bsModalRef.hide()" | ||
> | ||
Sent Mail | ||
</button> | ||
</div> |
103 changes: 53 additions & 50 deletions
103
src/app/shared/modal/email/project-email-modal/project-email-modal.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,57 @@ | ||
import {Component, EventEmitter, Input, OnInit} from '@angular/core'; | ||
import {Application} from '../../../../applications/application.model/application.model'; | ||
import {BsModalRef} from 'ngx-bootstrap/modal'; | ||
import {VoService} from '../../../../api-connector/vo.service'; | ||
import {IResponseTemplate} from '../../../../api-connector/response-template'; | ||
import { | ||
Component, EventEmitter, Input, OnDestroy, OnInit, | ||
} from '@angular/core'; | ||
import { BsModalRef } from 'ngx-bootstrap/modal'; | ||
import { Application } from '../../../../applications/application.model/application.model'; | ||
import { VoService } from '../../../../api-connector/vo.service'; | ||
import { IResponseTemplate } from '../../../../api-connector/response-template'; | ||
|
||
@Component({ | ||
selector: 'app-project-email-modal', | ||
templateUrl: './project-email-modal.component.html', | ||
styleUrls: ['./projext-email-modal.component.scss'], | ||
|
||
selector: 'app-project-email-modal', | ||
templateUrl: './project-email-modal.component.html', | ||
styleUrls: ['./projext-email-modal.component.scss'], | ||
}) | ||
export class ProjectEmailModalComponent implements OnInit { | ||
|
||
//currently only for vo | ||
@Input() selectedProjects: Application[]; | ||
emailAdminsOnly: boolean; | ||
emailSubject: string; | ||
emailReply: string; | ||
emailText: string; | ||
templates: string[]; | ||
|
||
public mailSuccesfullySent: EventEmitter<boolean> = new EventEmitter(); | ||
|
||
constructor(public bsModalRef: BsModalRef, private voService: VoService) { | ||
// eslint-disable-next-line no-empty-function | ||
} | ||
|
||
ngOnInit() { | ||
this.getMailTemplates() | ||
} | ||
|
||
getMailTemplates(): void { | ||
this.voService.getMailTemplates().subscribe((res: string[]) => { | ||
this.templates = res | ||
}) | ||
} | ||
|
||
sentProjectsMail(): void { | ||
const project_ids = this.selectedProjects.map((pr: Application) => { | ||
return pr.project_application_perun_id; | ||
}); | ||
|
||
this.voService.sendMailToProjects(project_ids, this.emailSubject, this.emailText, this.emailAdminsOnly, this.emailReply).subscribe((res: IResponseTemplate) => { | ||
this.mailSuccesfullySent.emit(res.value as boolean) | ||
}, () => { | ||
this.mailSuccesfullySent.emit(false) | ||
}) | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.bsModalRef.hide(); | ||
} | ||
export class ProjectEmailModalComponent implements OnDestroy, OnInit { | ||
// currently only for vo | ||
@Input() selectedProjects: Application[]; | ||
emailAdminsOnly: boolean; | ||
emailSubject: string; | ||
emailReply: string; | ||
emailText: string; | ||
templates: string[]; | ||
|
||
public event: EventEmitter<boolean> = new EventEmitter(); | ||
|
||
constructor(public bsModalRef: BsModalRef, private voService: VoService) { | ||
// eslint-disable-next-line no-empty-function | ||
} | ||
|
||
ngOnInit() { | ||
this.getMailTemplates(); | ||
} | ||
|
||
getMailTemplates(): void { | ||
this.voService.getMailTemplates().subscribe((res: string[]) => { | ||
this.templates = res; | ||
}); | ||
} | ||
|
||
sentProjectsMail(): void { | ||
const project_ids = this.selectedProjects.map((pr: Application) => pr.project_application_perun_id); | ||
|
||
this.voService | ||
.sendMailToProjects(project_ids, this.emailSubject, this.emailText, this.emailAdminsOnly, this.emailReply) | ||
.subscribe( | ||
(res: IResponseTemplate) => { | ||
this.event.emit(res.value as boolean); | ||
}, | ||
() => { | ||
this.event.emit(false); | ||
}, | ||
); | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.bsModalRef.hide(); | ||
} | ||
} |
Oops, something went wrong.