Skip to content

Commit

Permalink
Merge branch 'dev' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
vktrrdk committed Feb 1, 2023
2 parents c22e242 + 3368bd6 commit 97809c1
Show file tree
Hide file tree
Showing 9 changed files with 11,753 additions and 11,681 deletions.
23,344 changes: 11,672 additions & 11,672 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@denbi/cloud-portal-webapp",
"version": "4.588.0",
"version": "4.590.0",
"description": "de.NBI Cloud Portal",
"scripts": {
"ng": "ng serve",
Expand Down Expand Up @@ -110,7 +110,7 @@
"eslint": "^8.28.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-jsdoc": "39.6.8",
"eslint-plugin-jsdoc": "39.6.10",
"eslint-plugin-no-null": "latest",
"eslint-plugin-prefer-arrow": "1.2.3",
"exports-loader": "4.0.0",
Expand Down
6 changes: 5 additions & 1 deletion src/app/api-connector/vo.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ export class VoService {
facility: string,
type: string,
adminsOnly: boolean,
expiredTemplate: boolean,
removalDate: Date,
reply?: string,
): Observable<any> {
const params: HttpParams = new HttpParams()
Expand All @@ -135,6 +137,8 @@ export class VoService {
.set('admins_only', adminsOnly)
.set('reply', reply)
.set('facility', facility)
.set('expired_template', expiredTemplate)
.set('removal_date', removalDate.toUTCString())
.set('type', type);

return this.http.post<IResponseTemplate>(`${ApiSettings.getApiBaseURL()}voManagers/current/voMail/`, params, {
Expand All @@ -145,7 +149,7 @@ export class VoService {
/**
* Get members of a project with emails.
*
* @param groupid id of the the group
* @param groupid id of the group
* @returns
*/
getVoGroupRichMembers(groupid: number | string): Observable<ProjectMember[]> {
Expand Down
3 changes: 3 additions & 0 deletions src/app/pipe-module/pipe-module.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { NoCoresPipe, NoRamPipe, NoVMsPipe } from './pipes/ressources';
import { HasUnavailableFlavorsPipe } from './pipes/has-unavailable-flavors.pipe';
import { ValidTimeFramePipe } from './pipes/validTimeFrame.pipe';
import { PublicKeyPipe } from './pipes/publicKey.pipe';
import { IsFutureTimePipe } from './pipes/futureTime.pipe';

/**
* Pipemodule
Expand All @@ -30,6 +31,7 @@ import { PublicKeyPipe } from './pipes/publicKey.pipe';
NoCoresPipe,
NoRamPipe,
ValidTimeFramePipe,
IsFutureTimePipe,
PublicKeyPipe,
],
exports: [
Expand All @@ -46,6 +48,7 @@ import { PublicKeyPipe } from './pipes/publicKey.pipe';
NoCoresPipe,
NoRamPipe,
ValidTimeFramePipe,
IsFutureTimePipe,
PublicKeyPipe,
],
imports: [CommonModule],
Expand Down
18 changes: 18 additions & 0 deletions src/app/pipe-module/pipes/futureTime.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Pipe, PipeTransform } from '@angular/core';

/**
* Pipe to check if the date picked is in the future.
*/
@Pipe({
name: 'isFutureTime',
pure: false,
})
export class IsFutureTimePipe implements PipeTransform {
transform(date: Date): boolean {
if (date === null) {
return false;
}

return new Date().getTime() <= date.getTime();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ <h4>Extension request for {{ project?.project_application_shortname }}</h4>
<div class="input-group">
<input
class="form-control"
(change)="calculateNewEndDate(); calculateCreditsLifetime()"
(ngModelChange)="calculateNewEndDate(); calculateCreditsLifetime()"
id="temp_project_extension_application_renewal_lifetime"
data-test-id="project_extension_months_input"
name="temp_project_extension_application_renewal_lifetime"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export class LifetimeRequestComponent implements OnInit, OnDestroy {
end_date: Date;
new_end_date: Date;
max_lifetime: number = 6;

selected_ontology_terms: EdamOntologyTerm[] = [];
edam_ontology_terms: EdamOntologyTerm[];
ontology_search_keyword: string = 'term';
Expand Down Expand Up @@ -143,6 +142,7 @@ export class LifetimeRequestComponent implements OnInit, OnDestroy {

calculateNewEndDate() {
this.new_end_date = new Date(this.end_date);
console.log(this.new_end_date);
this.new_end_date.setMonth(this.end_date.getMonth() + this.temp_project_extension.extra_lifetime);
}
}
20 changes: 19 additions & 1 deletion src/app/vo_manager/VoOverviewComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ export class VoOverviewComponent extends AbstractBaseClass implements OnInit {
public emailVerify: string;
public emailType: number;
public emailAdminsOnly: boolean = false;
public expiredTemplated: boolean = false;

public removalDate: Date = new Date();
public selectedProject: Application;
computecenters: ComputecenterComponent[] = [];

Expand Down Expand Up @@ -116,7 +119,6 @@ export class VoOverviewComponent extends AbstractBaseClass implements OnInit {
if (reply) {
reply = reply.trim();
}
console.log(this.emailAdminsOnly);
switch (this.emailType) {
case 0: {
this.sendMailToVo(
Expand All @@ -125,6 +127,8 @@ export class VoOverviewComponent extends AbstractBaseClass implements OnInit {
this.selectedFacility.toString(),
this.selectedProjectType,
this.emailAdminsOnly,
this.expiredTemplated,
this.removalDate,
reply,
);
break;
Expand Down Expand Up @@ -171,6 +175,8 @@ export class VoOverviewComponent extends AbstractBaseClass implements OnInit {
facility: string,
type: string,
adminsOnly: boolean,
expiredTemplate: boolean,
removalDate: Date,
reply?: string,
): void {
this.voService
Expand All @@ -180,6 +186,8 @@ export class VoOverviewComponent extends AbstractBaseClass implements OnInit {
facility,
type,
adminsOnly,
expiredTemplate,
removalDate,
encodeURIComponent(reply),
)
.subscribe((result: IResponseTemplate): void => {
Expand All @@ -193,6 +201,13 @@ export class VoOverviewComponent extends AbstractBaseClass implements OnInit {
});
}

dayChanged(date: { year: number; month: number; day: number }): void {
this.removalDate.setDate(date.day);
this.removalDate.setMonth(date.month - 1);
this.removalDate.setFullYear(date.year);
console.log(this.removalDate);
}

setEmailType(type: number): void {
this.emailType = type;
switch (this.emailType) {
Expand Down Expand Up @@ -254,6 +269,9 @@ export class VoOverviewComponent extends AbstractBaseClass implements OnInit {
default:
this.emailVerify = 'Are you sure you want to send this?';
}
if (this.selectedProjectType !== 'EXP') {
this.expiredTemplated = false;
}
}

getVoProjects(): void {
Expand Down
35 changes: 32 additions & 3 deletions src/app/vo_manager/voOverview.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,34 @@ <h4 class="modal-title">{{ emailHeader }}</h4>
</div>
</div>
</div>
<div class="form-group row" *ngIf="emailType === 0 && selectedProjectType === 'EXP'">
<div class="col-md-auto">
<div class="form-check">
<input
class="form-check-input"
type="checkbox"
[ngModelOptions]="{ standalone: true }"
[(ngModel)]="expiredTemplated"
(ngModelChange)="this.adjustVerifyText()"
id="expiredTemplateCheckbox"
/>
<label class="form-check-label" for="adminOnlyCheckbox">
Send templated mail for expired projects
</label>
</div>
</div>
</div>
<div *ngIf="expiredTemplated && selectedProjectType === 'EXP'" class="form-group row">
<label class="col-md-12 control-label"><strong>Set a removal date</strong></label>
<div class="mb-3 mx-auto">
<app-datepicker (dayChange)="dayChanged($event)"></app-datepicker>
</div>
<div class="alert alert-danger" *ngIf="!(removalDate | isFutureTime)">
Please select a removal date that is in the future.
</div>
</div>
<div
*ngIf="!(expiredTemplated && selectedProjectType === 'EXP')"
class="form-group row"
[ngClass]="{
'has-danger': emailSub.invalid && (emailSub.dirty || emailSub.touched),
Expand All @@ -612,7 +639,7 @@ <h4 class="modal-title">{{ emailHeader }}</h4>
</div>
</div>

<div class="form-group row">
<div class="form-group row" *ngIf="!(expiredTemplated && selectedProjectType === 'EXP')">
<label class="col-md-12 control-label"><strong>Reply to (optional)</strong></label>
<div class="col-md-12">
<input
Expand All @@ -632,7 +659,7 @@ <h4 class="modal-title">{{ emailHeader }}</h4>
</div>
</div>
<!-- Textarea -->
<div class="form-group row">
<div class="form-group row" *ngIf="!(expiredTemplated && selectedProjectType === 'EXP')">
<label class="col-md-12 control-label"><strong>Email text*</strong></label>
<div class="col-md-12">
<textarea
Expand All @@ -656,7 +683,9 @@ <h4 class="modal-title">{{ emailHeader }}</h4>
<div class="modal-footer">
<button
type="button"
[disabled]="f.invalid"
[disabled]="
f.invalid || (this.expiredTemplated && this.selectedProjectType === 'EXP' && !(removalDate | isFutureTime))
"
class="btn btn-primary"
(click)="emailModal.hide(); verifyModal.show()"
>
Expand Down

0 comments on commit 97809c1

Please sign in to comment.