-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
703ad31
commit bb1b429
Showing
7 changed files
with
128 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 16 additions & 17 deletions
33
..._modules/public-key/generate-public-key-modal/generate-public-key-modal.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
}) | ||
}) |
69 changes: 32 additions & 37 deletions
69
...hared_modules/public-key/generate-public-key-modal/generate-public-key-modal.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 16 additions & 17 deletions
33
...red/shared_modules/public-key/set-public-key-modal/set-public-key-modal.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
}) | ||
}) |
Oops, something went wrong.