Skip to content

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
dweinholz committed Jan 10, 2025
2 parents e1bc69e + 52ec958 commit b01a8c3
Show file tree
Hide file tree
Showing 22 changed files with 469 additions and 327 deletions.
73 changes: 52 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.899.0",
"version": "4.900.0",
"description": "de.NBI Cloud Portal",
"scripts": {
"ng": "ng serve",
Expand Down Expand Up @@ -109,7 +109,7 @@
"less-loader": "12.2.0",
"lint-staged": "15.2.10",
"ngx-spec": "2.1.6",
"npm-run-all2": "6.2.6",
"npm-run-all2": "7.0.1",
"prettier": "3.3.3",
"raw-loader": "4.0.2",
"sass-loader": "16.0.2",
Expand Down
13 changes: 13 additions & 0 deletions src/app/api-connector/applications.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,4 +336,17 @@ export class ApplicationsService {
withCredentials: true
})
}

checkForTakenShortname(shortname: string,exclude_project_id?:string|number): Observable<any> {

let params:any={ shortname: shortname }
if (exclude_project_id){
params={ shortname: shortname ,exclude_project_id:exclude_project_id}
}
return this.http.get(`${ApiSettings.getApiBaseURL()}project_applications/shortname/`, {
params: params,
withCredentials: true
});

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ <h5 class="col-md-6 form-control-label">General Information</h5>
<font color="red">Umlauts and special characters are prohibited in the shortname.</font>
</strong>
</div>
<div *ngIf="shortNameTaken">
<strong>
<font color="red"
>Warning: This shortname is already in use. A unique suffix will be automatically appended upon
submission.</font
>
</strong>
</div>
<input
required
type="text"
Expand All @@ -153,7 +161,9 @@ <h5 class="col-md-6 form-control-label">General Information</h5>
#shortname
(keyup)="checkShortname(shortname.value)"
class="form-control"
maxlength="15"
min="5"
[maxlength]="shortNameMaxLength"
(ngModelChange)="setDefaulShortnameLength()"
[(ngModel)]="application.project_application_shortname"
minlength="5"
placeholder="e.g. ThalianaBench"
Expand Down Expand Up @@ -490,7 +500,7 @@ <h5 class="col-md-12 form-control-label">Resources</h5>
/>
<div class="input-group-append"><span class="input-group-text"> GB </span></div>
</div>
<span class="help-block">How much total extra storage do you need for your VMs?</span>
<span class="help-block">How much total storage do you need for your VMs in form of Volumes?</span>
</div>
</div>
<div class="form-group row" *ngIf="openstack_project">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ import { UserService } from '../../api-connector/user.service'
import { Userinfo } from '../../userinfo/userinfo.model'
import { User } from '../application.model/user.model'
import { NotificationModalComponent } from '../../shared/modal/notification-modal'
import { Subject, Subscription } from 'rxjs';

Check failure on line 36 in src/app/applications/application-formular/application-formular.component.ts

View workflow job for this annotation

GitHub Actions / tslinting-check

'Subscription' is defined but never used
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
import { thresholdScott } from 'd3'

Check failure on line 38 in src/app/applications/application-formular/application-formular.component.ts

View workflow job for this annotation

GitHub Actions / tslinting-check

'thresholdScott' is defined but never used

/**
* Application formular component.
Expand All @@ -51,6 +54,8 @@ export class ApplicationFormularComponent extends ApplicationBaseClassComponent
@Input() application: Application
@Input() is_validation: boolean = false
@Input() hash: string
DEFAULT_SHORTNAME_MAX_LENGTH:number=15
shortNameMaxLength:number=15

userinfo: Userinfo
valid_pi_affiliations
Expand Down Expand Up @@ -87,6 +92,9 @@ export class ApplicationFormularComponent extends ApplicationBaseClassComponent
WIKI_BACKUP_LINK: string = WIKI_BACKUP_LINK
GDPR_LINK: string = GDPR_LINK
survey_link_visible: boolean = false
private nameCheckPipe = new Subject<string>();
shortnameChecking: boolean = false;
shortNameTaken: boolean = false;

MAX_LIFETIME_DEFAULT: number = 6
max_lifetime: number = this.MAX_LIFETIME_DEFAULT
Expand Down Expand Up @@ -119,6 +127,7 @@ export class ApplicationFormularComponent extends ApplicationBaseClassComponent
this.getListOfFlavors()
this.getListOfTypes()
this.is_vo_admin = is_vo
this.nameCheckPipe.pipe(debounceTime(600), distinctUntilChanged()).subscribe(value => {this.checkIfNameIsTaken(value)});

if (this.openstack_project) {
this.simple_vm_min_vm = true
Expand All @@ -138,6 +147,21 @@ export class ApplicationFormularComponent extends ApplicationBaseClassComponent
}
}

setDefaulShortnameLength():void{
this.shortNameMaxLength=this.DEFAULT_SHORTNAME_MAX_LENGTH
}

checkIfNameIsTaken(shortname: string): void {
this.shortnameChecking = true;

this.applicationsService.checkForTakenShortname(shortname,this.application?.project_application_id).subscribe((result: boolean): void => {
let nameExists: boolean = result['exists'];
this.shortnameChecking = false;
this.shortNameTaken = nameExists;
});

}

checkValidityComment(): boolean {
if (this.extraResourceCommentRequired) {
if (this.application.project_application_comment?.length < 50) {
Expand Down Expand Up @@ -173,6 +197,10 @@ export class ApplicationFormularComponent extends ApplicationBaseClassComponent
if (this.application && !this.initiated_validation && this.is_validation) {
this.openstack_project = this.application.project_application_openstack_project

if(this.application.project_application_shortname.length > 15){
this.shortNameMaxLength=this.application.project_application_shortname.length
}

this.simple_vm_project = !this.openstack_project
this.application.project_application_pi = new User()

Expand Down Expand Up @@ -238,6 +266,11 @@ export class ApplicationFormularComponent extends ApplicationBaseClassComponent
*/
public checkShortname(shortname: string): void {
this.invalid_shortname = !/^[a-zA-Z0-9\s]*$/.test(shortname)
if (!this.invalid_shortname) {
this.shortnameChecking = true;
this.nameCheckPipe.next(shortname);
}

}

public checkLongname(longname: string): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h4>Adjust application for {{ application?.project_application_shortname }}</h4>
[ngStyle]="{
'background-color': adjustedApplication.project_application_openstack_project
? '#FF0000'
: '#00adef'
: '#00adef',
}"
></span>
</label>
Expand Down Expand Up @@ -78,7 +78,7 @@ <h4>Adjust application for {{ application?.project_application_shortname }}</h4>
appInteger
[ngClass]="{
'is-invalid': resourceAdjustmentForm.controls.granted_lifetime_counter?.invalid,
'is-valid': resourceAdjustmentForm.controls.granted_lifetime_counter?.valid
'is-valid': resourceAdjustmentForm.controls.granted_lifetime_counter?.valid,
}"
/>
</div>
Expand Down Expand Up @@ -109,7 +109,7 @@ <h6 class="col-md-8 form-control-label">
style="font-size: 25px"
[ngClass]="{
'icon-arrow-up': groupval.isOpen,
'icon-arrow-down': !groupval.isOpen
'icon-arrow-down': !groupval.isOpen,
}"
></i>
</div>
Expand Down Expand Up @@ -163,7 +163,7 @@ <h6 class="col-md-8 form-control-label">
appIntegerOrNull
[ngClass]="{
'is-invalid': name?.invalid,
'is-valid': name?.valid
'is-valid': name?.valid,
}"
/>
<div class="input-group-append"><span class="input-group-text"> VMs</span></div>
Expand Down Expand Up @@ -217,7 +217,7 @@ <h6 class="col-md-8 form-control-label">
appInteger
[ngClass]="{
'is-invalid': resourceAdjustmentForm.controls.granted_volume_counter?.invalid,
'is-valid': resourceAdjustmentForm.controls.grated_volume_counter?.valid
'is-valid': resourceAdjustmentForm.controls.grated_volume_counter?.valid,
}"
/>
</div>
Expand Down Expand Up @@ -247,7 +247,7 @@ <h6 class="col-md-8 form-control-label">
/>
<div class="input-group-append"><span class="input-group-text"> GB </span></div>
</div>
<span class="help-block">Requested extra storage</span>
<span class="help-block">Requested volume storage</span>
</div>
<div class="col">
<div class="input-group">
Expand All @@ -264,13 +264,13 @@ <h6 class="col-md-8 form-control-label">
appInteger
[ngClass]="{
'is-invalid': resourceAdjustmentForm.controls.granted_volume_limit?.invalid,
'is-valid': resourceAdjustmentForm.controls.granted_volume_limit?.valid
'is-valid': resourceAdjustmentForm.controls.granted_volume_limit?.valid,
}"
[disabled]="resourceAdjustmentForm.controls.granted_volume_counter?.value === 0"
/>
<div class="input-group-append"><span class="input-group-text"> GB </span></div>
</div>
<span class="help-block">Amount of extra storage you want to grant</span>
<span class="help-block">Amount of volume storage you want to grant</span>
</div>
</div>

Expand Down Expand Up @@ -316,7 +316,7 @@ <h6 class="col-md-8 form-control-label">
required
[ngClass]="{
'is-invalid': resourceAdjustmentForm.controls.granted_object_storage?.invalid,
'is-valid': resourceAdjustmentForm.controls.granted_object_storage?.valid
'is-valid': resourceAdjustmentForm.controls.granted_object_storage?.valid,
}"
/>
<div class="input-group-append"><span class="input-group-text"> GB </span></div>
Expand Down
Loading

0 comments on commit b01a8c3

Please sign in to comment.