Skip to content

Commit

Permalink
Merge pull request #6307 from deNBI/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dweinholz authored Jan 23, 2025
2 parents c0f0e89 + 6f9b8b1 commit bd669dd
Show file tree
Hide file tree
Showing 20 changed files with 506 additions and 425 deletions.
13 changes: 6 additions & 7 deletions src/app/api-connector/applications.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,16 +337,15 @@ export class ApplicationsService {
})
}

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}
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 @@ -51,7 +51,7 @@ export class ResourceDetailComponent extends ApplicationBaseClassComponent imple
this.flavorDiffs.push({
name: flavor.name,
current: flavor.counter,
diff: 0,
diff: 0 - flavor.counter,
new: 0
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ 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 } from 'rxjs';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
import { Subject } from 'rxjs'
import { debounceTime, distinctUntilChanged } from 'rxjs/operators'

/**
* Application formular component.
Expand All @@ -53,8 +53,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
DEFAULT_SHORTNAME_MAX_LENGTH: number = 15
shortNameMaxLength: number = 15

userinfo: Userinfo
valid_pi_affiliations
Expand Down Expand Up @@ -91,9 +91,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;
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 @@ -126,7 +126,9 @@ 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)});
this.nameCheckPipe.pipe(debounceTime(600), distinctUntilChanged()).subscribe(value => {
this.checkIfNameIsTaken(value)
})

if (this.openstack_project) {
this.simple_vm_min_vm = true
Expand All @@ -146,19 +148,20 @@ export class ApplicationFormularComponent extends ApplicationBaseClassComponent
}
}

setDefaulShortnameLength():void{
this.shortNameMaxLength=this.DEFAULT_SHORTNAME_MAX_LENGTH
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;
});

this.shortnameChecking = true

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

checkValidityComment(): boolean {
Expand Down Expand Up @@ -196,8 +199,8 @@ 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
if (this.application.project_application_shortname.length > 15) {
this.shortNameMaxLength = this.application.project_application_shortname.length
}

this.simple_vm_project = !this.openstack_project
Expand Down Expand Up @@ -266,10 +269,9 @@ 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);
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 @@ -36,7 +36,6 @@ export class ApplicationListComponent implements OnInit, OnChanges {
}

setDataTestId(): void {
console.log('set data test id')
switch (this.tabState) {
case ApplicationTabStates.SUBMITTED: {
this.dataTestId = 'submitted_applications_container'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class ApplicationVoActionsComponent extends AbstractBaseClass implements

this.bsModalRef = this.modalService.show(ModificationRequestComponent, {
initialState,
class: 'modal-lg'
class: 'modal-xl'
})
this.subscribeToBsModalRef()
// this.subscribeForExtensionResult(this.ExtensionRequestType.MODIFICATION);
Expand Down
Loading

0 comments on commit bd669dd

Please sign in to comment.