Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated TsLint Linting [refs/heads/deps/major-angularmaterial-monorepo] #6299

Open
wants to merge 2 commits into
base: deps/major-angularmaterial-monorepo
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.900.0",
"version": "4.901.0",
"description": "de.NBI Cloud Portal",
"scripts": {
"ng": "ng serve",
Expand All @@ -20,7 +20,7 @@
"dependencies": {
"@angular-eslint/eslint-plugin": "^18.3.0",
"@angular/animations": "18.2.8",
"@angular/cdk": "18.2.9",
"@angular/cdk": "19.1.0",
"@angular/common": "18.2.8",
"@angular/compiler": "18.2.8",
"@angular/core": "18.2.8",
Expand Down
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 @@ -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
@@ -1,23 +1,22 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing'

import { GeneratePublicKeyModalComponent } from './generate-public-key-modal.component';
import { GeneratePublicKeyModalComponent } from './generate-public-key-modal.component'

describe('GeneratePublicKeyModalComponent', () => {
let component: GeneratePublicKeyModalComponent;
let fixture: ComponentFixture<GeneratePublicKeyModalComponent>;
let component: GeneratePublicKeyModalComponent
let fixture: ComponentFixture<GeneratePublicKeyModalComponent>

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [GeneratePublicKeyModalComponent]
})
.compileComponents();
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [GeneratePublicKeyModalComponent]
}).compileComponents()

fixture = TestBed.createComponent(GeneratePublicKeyModalComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
fixture = TestBed.createComponent(GeneratePublicKeyModalComponent)
component = fixture.componentInstance
fixture.detectChanges()
})

it('should create', () => {
expect(component).toBeTruthy();
});
});
it('should create', () => {
expect(component).toBeTruthy()
})
})
Original file line number Diff line number Diff line change
@@ -1,48 +1,43 @@
import { Component, EventEmitter, Injectable } from '@angular/core';
import { KeyService } from 'app/api-connector/key.service';
import { AbstractBaseModalComponent } from 'app/shared/modal/abstract-base-modal/abstract-base-modal.component';
import { BsModalService } from 'ngx-bootstrap/modal';
import { Component, EventEmitter, Injectable } from '@angular/core'
import { KeyService } from 'app/api-connector/key.service'
import { AbstractBaseModalComponent } from 'app/shared/modal/abstract-base-modal/abstract-base-modal.component'
import { BsModalService } from 'ngx-bootstrap/modal'
import { saveAs } from 'file-saver'

@Injectable({ providedIn: 'root' })
@Component({
selector: 'app-generate-public-key-modal',
templateUrl: './generate-public-key-modal.component.html',
styleUrl: './generate-public-key-modal.component.scss'
selector: 'app-generate-public-key-modal',
templateUrl: './generate-public-key-modal.component.html',
styleUrl: './generate-public-key-modal.component.scss'
})
export class GeneratePublicKeyModalComponent extends AbstractBaseModalComponent {
userlogin:string;
acknowledgement_given:boolean=false
userlogin: string
acknowledgement_given: boolean = false

constructor(
constructor(
protected modalService: BsModalService,
private keyService:KeyService
) {
super(modalService)

}
showGeneratePublicKeyModal(
userlogin:string

): EventEmitter<void> {
const initialState = {
userlogin
}

return this.showBaseModal(GeneratePublicKeyModalComponent, initialState)
private keyService: KeyService
) {
super(modalService)
}
showGeneratePublicKeyModal(userlogin: string): EventEmitter<void> {
const initialState = {
userlogin
}

downloadPem(data: string): void {
const blob: Blob = new Blob([data], { type: 'pem' })
const url: string = window.URL.createObjectURL(blob)
saveAs(url, `${this.userlogin}_ecdsa`)
}


generateKey(): void {
this.keyService.generateKey().subscribe((res: any): void => {
this.event.emit()
this.downloadPem(res['private_key'])
})
}
return this.showBaseModal(GeneratePublicKeyModalComponent, initialState)
}

downloadPem(data: string): void {
const blob: Blob = new Blob([data], { type: 'pem' })
const url: string = window.URL.createObjectURL(blob)
saveAs(url, `${this.userlogin}_ecdsa`)
}

generateKey(): void {
this.keyService.generateKey().subscribe((res: any): void => {
this.event.emit()
this.downloadPem(res['private_key'])
})
}
}
26 changes: 10 additions & 16 deletions src/app/shared/shared_modules/public-key/public-key.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export class PublicKeyComponent extends AbstractBaseClass implements OnInit {
constructor(
private keyService: KeyService,
private clipboardService: ClipboardService,
private generatePublicKeyModal:GeneratePublicKeyModalComponent,
private setPublicKeyModalComponent:SetPublicKeyModalComponent
private generatePublicKeyModal: GeneratePublicKeyModalComponent,
private setPublicKeyModalComponent: SetPublicKeyModalComponent
) {
super()
}
Expand All @@ -45,28 +45,24 @@ export class PublicKeyComponent extends AbstractBaseClass implements OnInit {
}
}

showSetPublicKeyModal():void{
this.setPublicKeyModalComponent.showSetPublicKeyModal(this.userinfo.PublicKey).subscribe(() =>{
console.log("event submitted")
showSetPublicKeyModal(): void {
this.setPublicKeyModalComponent.showSetPublicKeyModal(this.userinfo.PublicKey).subscribe(() => {
console.log('event submitted')
this.getUserPublicKey()
})

}

showGeneratePublicKeyModal():void{
this.generatePublicKeyModal.showGeneratePublicKeyModal(this.userinfo.UserLogin).subscribe(() =>{
console.log("event submitted")
showGeneratePublicKeyModal(): void {
this.generatePublicKeyModal.showGeneratePublicKeyModal(this.userinfo.UserLogin).subscribe(() => {
console.log('event submitted')
this.getUserPublicKey()
})
}

unsetAcknowledgment():void{
this.acknowledgement_given=false;
unsetAcknowledgment(): void {
this.acknowledgement_given = false
}




isKeyBlocked(): void {
this.keyService.isBlocked(this.userinfo.PublicKey.trim()).subscribe((res: BlacklistedResponse) => {
this.blocked_key = res.blacklisted
Expand All @@ -80,8 +76,6 @@ export class PublicKeyComponent extends AbstractBaseClass implements OnInit {
})
}



copyToClipboard(text: string): void {
if (this.clipboardService.isSupported) {
this.clipboardService.copy(text)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing'

import { SetPublicKeyModalComponent } from './set-public-key-modal.component';
import { SetPublicKeyModalComponent } from './set-public-key-modal.component'

describe('SetPublicKeyModalComponent', () => {
let component: SetPublicKeyModalComponent;
let fixture: ComponentFixture<SetPublicKeyModalComponent>;
let component: SetPublicKeyModalComponent
let fixture: ComponentFixture<SetPublicKeyModalComponent>

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [SetPublicKeyModalComponent]
})
.compileComponents();
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [SetPublicKeyModalComponent]
}).compileComponents()

fixture = TestBed.createComponent(SetPublicKeyModalComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
fixture = TestBed.createComponent(SetPublicKeyModalComponent)
component = fixture.componentInstance
fixture.detectChanges()
})

it('should create', () => {
expect(component).toBeTruthy();
});
});
it('should create', () => {
expect(component).toBeTruthy()
})
})
Loading