Skip to content

Commit

Permalink
Merge pull request #5977 from deNBI/feat/nfdi_lifetime
Browse files Browse the repository at this point in the history
Feat/nfdi lifetime
  • Loading branch information
dweinholz authored Nov 30, 2023
2 parents da5395d + 808400e commit 81ff85d
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,15 @@ <h5 class="col-md-6 form-control-label">General Information</h5>
/>
<div class="input-group-append"><span class="input-group-text"> months </span></div>
</div>
<span class="help-block"
>How long would you like to run this project ({{ max_lifetime }} months is maximum)?</span
>
<span class="help-block">How long would you like to run this project?</span>
<div class="alert alert-primary">
The maximum possible initial lifetime to be requested is
<strong>{{ max_lifetime }} months.</strong> Under certain conditions, longer initial terms can also be
granted, for example in the case the project is an <strong>NFDI</strong> project. Please click the
corresponding options in the further course of the form and enter further information in the available
comment and description fields if necessary. Please consider: After initially approved, you are able
to extend your project lifetime by sending extension requests.
</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ export class ApplicationFormularComponent extends ApplicationBaseClassComponent
WIKI_PERSONAL_DATA: string = WIKI_PERSONAL_DATA;
GDPR_LINK: string = GDPR_LINK;
survey_link_visible: boolean = false;
max_lifetime: number = 6;

MAX_LIFETIME_DEFAULT: number = 6;
max_lifetime: number = this.MAX_LIFETIME_DEFAULT;

acknowledgeModalTitle: string = 'Acknowledge';
acknowledgeModalType: string = 'info';
Expand Down Expand Up @@ -418,6 +420,8 @@ export class ApplicationFormularComponent extends ApplicationBaseClassComponent
case 'nfdi': {
if (!checked) {
this.application.project_application_nfdi = '';
} else {
this.max_lifetime = 12;
}
break;
}
Expand Down
101 changes: 76 additions & 25 deletions src/app/applications/applications.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@
selectedCenter[application.project_application_id] !== undefined ? 'is-valid' : 'is-invalid'
"
*ngIf="
(application | hasstatusinlist : Application_States.SUBMITTED) ||
(application | hasstatusinlist : Application_States.CONFIRMATION_DECLINED) ||
((application | hasstatusinlist : Application_States.WAIT_FOR_CONFIRMATION) &&
(application | hasstatusinlist: Application_States.SUBMITTED) ||
(application | hasstatusinlist: Application_States.CONFIRMATION_DECLINED) ||
((application | hasstatusinlist: Application_States.WAIT_FOR_CONFIRMATION) &&
!application?.project_application_compute_center?.FacilityId)
"
[(ngModel)]="selectedCenter[application.project_application_id]"
Expand All @@ -134,7 +134,7 @@
</option>
</ng-container>
</select>
<span *ngIf="application | hasstatusinlist : Application_States.WAIT_FOR_CONFIRMATION">{{
<span *ngIf="application | hasstatusinlist: Application_States.WAIT_FOR_CONFIRMATION">{{
application?.project_application_compute_center?.Name
}}</span>
</td>
Expand All @@ -143,8 +143,8 @@
<div class="btn-group">
<button
*ngIf="
(application | hasstatusinlist : Application_States.CONFIRMATION_DECLINED) ||
((application | hasstatusinlist : Application_States.WAIT_FOR_CONFIRMATION) &&
(application | hasstatusinlist: Application_States.CONFIRMATION_DECLINED) ||
((application | hasstatusinlist: Application_States.WAIT_FOR_CONFIRMATION) &&
!application?.project_application_compute_center?.FacilityId)
"
style="margin: 2px"
Expand All @@ -165,8 +165,8 @@
</button>
<button
*ngIf="
(application | hasstatusinlist : Application_States.SUBMITTED) &&
!(application | hasstatusinlist : Application_States.APPROVED)
(application | hasstatusinlist: Application_States.SUBMITTED) &&
!(application | hasstatusinlist: Application_States.APPROVED)
"
style="margin: 2px"
(click)="showConfirmationModal(application, ConfirmationActions.DELETE_APPLICATION)"
Expand Down Expand Up @@ -199,7 +199,7 @@
</button>
<button
*ngIf="
(application | hasstatusinlist : Application_States.WAIT_FOR_CONFIRMATION) &&
(application | hasstatusinlist: Application_States.WAIT_FOR_CONFIRMATION) &&
application?.project_application_compute_center?.FacilityId
"
style="margin: 2px"
Expand All @@ -214,7 +214,7 @@
</button>
<button
*ngIf="
(application | hasstatusinlist : Application_States.SUBMITTED) &&
(application | hasstatusinlist: Application_States.SUBMITTED) &&
application?.project_application_openstack_project
"
style="margin: 2px"
Expand All @@ -231,7 +231,7 @@

<button
*ngIf="
(application | hasstatusinlist : Application_States.SUBMITTED) &&
(application | hasstatusinlist: Application_States.SUBMITTED) &&
!application?.project_application_openstack_project
"
style="margin: 2px"
Expand All @@ -250,7 +250,7 @@
</button>

<button
*ngIf="application | hasstatusinlist : Application_States.SUBMITTED"
*ngIf="application | hasstatusinlist: Application_States.SUBMITTED"
type="button"
class="btn btn-danger"
id="btn_decline_{{ application.project_application_shortname }}"
Expand All @@ -264,7 +264,7 @@
<button
*ngIf="
application.project_application_pi_approved &&
(application | hasstatusinlist : Application_States.SUBMITTED)
(application | hasstatusinlist: Application_States.SUBMITTED)
"
type="button"
id="btn_reset_pi_{{ application.project_application_shortname }}"
Expand Down Expand Up @@ -406,7 +406,7 @@
'modification_adjustment_' + application?.project_application_shortname
"
*ngIf="
(application | hasstatusinlist : Application_States.MODIFICATION_REQUESTED) &&
(application | hasstatusinlist: Application_States.MODIFICATION_REQUESTED) &&
application?.project_modification_request
"
style="margin: 2px"
Expand All @@ -421,7 +421,7 @@
<button
[id]="'modification_approval_' + application?.project_application_shortname"
*ngIf="
(application | hasstatusinlist : Application_States.MODIFICATION_REQUESTED) &&
(application | hasstatusinlist: Application_States.MODIFICATION_REQUESTED) &&
application?.project_application_openstack_project &&
application?.project_modification_request
"
Expand All @@ -438,7 +438,7 @@
<button
[id]="'modification_approval_' + application?.project_application_shortname"
*ngIf="
(application | hasstatusinlist : Application_States.MODIFICATION_REQUESTED) &&
(application | hasstatusinlist: Application_States.MODIFICATION_REQUESTED) &&
!application?.project_application_openstack_project &&
application?.project_modification_request
"
Expand All @@ -459,7 +459,7 @@
</button>
<button
*ngIf="
(application | hasstatusinlist : Application_States.MODIFICATION_REQUESTED) &&
(application | hasstatusinlist: Application_States.MODIFICATION_REQUESTED) &&
application?.project_modification_request
"
type="button"
Expand Down Expand Up @@ -592,7 +592,7 @@
[id]="'extension_approval_' + application?.project_application_shortname"
[attr.data-test-id]="'extension_approval_' + application?.project_application_shortname"
*ngIf="
(application | hasstatusinlist : Application_States.LIFETIME_EXTENSION_REQUESTED) &&
(application | hasstatusinlist: Application_States.LIFETIME_EXTENSION_REQUESTED) &&
application?.project_lifetime_request
"
style="margin: 2px"
Expand All @@ -607,7 +607,7 @@
[id]="'extension_adjustment_' + application?.project_application_shortname"
[attr.data-test-id]="'extension_adjustment_' + application?.project_application_shortname"
*ngIf="
(application | hasstatusinlist : Application_States.LIFETIME_EXTENSION_REQUESTED) &&
(application | hasstatusinlist: Application_States.LIFETIME_EXTENSION_REQUESTED) &&
application?.project_lifetime_request
"
style="margin: 2px"
Expand All @@ -620,7 +620,7 @@
</button>
<button
*ngIf="
(application | hasstatusinlist : Application_States.LIFETIME_EXTENSION_REQUESTED) &&
(application | hasstatusinlist: Application_States.LIFETIME_EXTENSION_REQUESTED) &&
application?.project_lifetime_request
"
type="button"
Expand Down Expand Up @@ -813,7 +813,7 @@
</button>
<button
[id]="'credit_extension_approval_' + application?.project_application_shortname"
*ngIf="application | hasstatusinlist : Application_States.CREDITS_EXTENSION_REQUESTED"
*ngIf="application | hasstatusinlist: Application_States.CREDITS_EXTENSION_REQUESTED"
style="margin: 2px"
(click)="showConfirmationModal(application, ConfirmationActions.APPROVE_CREDITS)"
type="button"
Expand All @@ -825,7 +825,7 @@

<button
[id]="'credit_extension_decline_' + application?.project_application_shortname"
*ngIf="application | hasstatusinlist : Application_States.CREDITS_EXTENSION_REQUESTED"
*ngIf="application | hasstatusinlist: Application_States.CREDITS_EXTENSION_REQUESTED"
(click)="showConfirmationModal(application, ConfirmationActions.DECLINE_CREDITS)"
type="button"
class="btn btn-danger"
Expand Down Expand Up @@ -1047,6 +1047,57 @@ <h4>Adjust application for {{ selectedApplication?.project_application_shortname
</div>
</div>

<div class="form-group row">
<label class="col-md-4 form-control-label" for="initially_requested_lifetime_counter"
><strong
>Lifetime
<i
data-balloon="Number of volumes allowed to create. The sum of the volumes size equals the value provided in the storage limit field."
data-balloon-pos="down"
data-balloon-length="large"
><i class="icon-question" style="cursor: pointer"></i></i></strong
></label>
<div class="col">
<div class="input-group">
<input
required
class="form-control"
name="initially_requested_lifetime_counter"
id="initially_requested_lifetime_counter"
placeholder="NA"
value="{{ selectedApplication?.project_application_lifetime }}"
type="number"
disabled
/>
</div>
<span class="help-block">Amount of requested lifetime months</span>
</div>

<div class="col">
<div class="input-group">
<input
required
class="form-control"
id="granted_lifetime_counter"
name="granted_lifetime_counter"
placeholder="e.g. 20"
type="number"
min="0"
max="24"
step="1"
[(ngModel)]="adjustedApplication.project_application_lifetime"
appMinAmount="0"
appInteger
[ngClass]="{
'is-invalid': resourceAdjustmentForm.controls.granted_lifetime_counter?.invalid,
'is-valid': resourceAdjustmentForm.controls.granted_lifetime_counter?.valid
}"
/>
</div>
<span class="help-block">Lifetime you want to grant</span>
</div>
</div>

<div class="form-group row">
<h6 class="col-md-8 form-control-label">
Resources*
Expand Down Expand Up @@ -1096,7 +1147,7 @@ <h6 class="col-md-8 form-control-label">
name="{{ fl.name }}_requested"
id="{{ fl.name }}_requested"
type="text"
value="{{ selectedApplication | flavorCounter : fl }}"
value="{{ selectedApplication | flavorCounter: fl }}"
placeholder="0"
disabled
/>
Expand All @@ -1116,7 +1167,7 @@ <h6 class="col-md-8 form-control-label">
step="1"
placeholder="e.g 1"
(ngModelChange)="onChangeFlavor(fl, $event)"
[ngModel]="adjustedApplication | flavorCounter : fl"
[ngModel]="adjustedApplication | flavorCounter: fl"
#name="ngModel"
appMinAmount="0"
appIntegerOrNull
Expand Down Expand Up @@ -1485,7 +1536,7 @@ <h4>Adjust lifetime extension for {{ selectedApplication?.project_application_sh
type="number"
min="1"
step="1"
max="6"
max="24"
[(ngModel)]="adjustedApplication?.project_lifetime_request.extra_lifetime"
appMinAmount="0"
appInteger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,18 @@ <h4>Extension request for {{ project?.project_application_shortname }}</h4>
<span class="input-group-text" style="padding: 0 !important"> months</span>
</div>
</div>
<span class="help-block">Number of months you want to extend the project (up to a maximum of 6 months).</span>
<span class="help-block"
>Number of months you want to extend the project. Consider a maximum of {{ max_lifetime }} months</span
>
</div>
</div>
<div class="row">
<div class="col">
<div class="alert alert-info">
Please consider: in certain cases the possible amount of months to extend the project can be higher than the
given maximum. This applies e.g for <strong>NFDI-projects</strong>. Please use the comment function to justify
the need for an extension beyond the maximum possible number of months.
</div>
</div>
</div>
<div class="form-group row" *ngIf="initial_number_of_edam_terms === 0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export class LifetimeRequestComponent implements OnInit, OnDestroy {
life_time_string: string;
end_date: Date;
new_end_date: Date | string;
max_lifetime: number = 6;
MAX_LIFETIME_DEFAULT: number = 6;
max_lifetime: number = this.MAX_LIFETIME_DEFAULT;
selected_ontology_terms: EdamOntologyTerm[] = [];
edam_ontology_terms: EdamOntologyTerm[];
ontology_search_keyword: string = 'term';
Expand All @@ -45,7 +46,11 @@ export class LifetimeRequestComponent implements OnInit, OnDestroy {
this.edam_ontology_terms = terms;
this.searchTermsInEdamTerms();
});

if (this.project.project_application_nfdi?.length > 0) {
this.max_lifetime = 12;
} else {
this.max_lifetime = this.MAX_LIFETIME_DEFAULT;
}
if (this.project.project_lifetime_request) {
this.temp_project_extension = new ApplicationLifetimeExtension(this.project.project_lifetime_request);
} else {
Expand Down

0 comments on commit 81ff85d

Please sign in to comment.