diff --git a/app/.vs/app/v16/.suo b/app/.vs/app/v16/.suo index 5fb7e89..e4322b1 100644 Binary files a/app/.vs/app/v16/.suo and b/app/.vs/app/v16/.suo differ diff --git a/app/.vs/slnx.sqlite b/app/.vs/slnx.sqlite index a4cc5cd..36f668c 100644 Binary files a/app/.vs/slnx.sqlite and b/app/.vs/slnx.sqlite differ diff --git a/app/src/app/account/account.component.html b/app/src/app/account/account.component.html index 83ab178..9545658 100644 --- a/app/src/app/account/account.component.html +++ b/app/src/app/account/account.component.html @@ -29,7 +29,7 @@
  • Container Name Service: + [ngClass]="userInfo.triton_cns_enabled ? 'border-success text-success' : 'danger-success text-danger'"> {{ userInfo.triton_cns_enabled ? 'enabled' : 'disabled' }}
  • @@ -48,13 +48,18 @@
      -
    1. - {{ userKey.name }}: {{ userKey.fingerprint }} +
    2. + {{ userKey.name }}: {{ userKey.fingerprint }} + +
    + - \ No newline at end of file diff --git a/app/src/app/account/account.component.ts b/app/src/app/account/account.component.ts index a2e5133..0cc16dc 100644 --- a/app/src/app/account/account.component.ts +++ b/app/src/app/account/account.component.ts @@ -11,6 +11,7 @@ import { ToastrService } from 'ngx-toastr'; import { SshKeyEditorComponent } from './ssh-key-editor/ssh-key-editor.component'; import { Title } from "@angular/platform-browser"; import { TranslateService } from '@ngx-translate/core'; +import { ConfirmationDialogComponent } from '../components/confirmation-dialog/confirmation-dialog.component'; @Component({ selector: 'app-account', @@ -72,6 +73,42 @@ export class AccountComponent implements OnInit, OnDestroy const modalRef = this.modalService.show(SshKeyEditorComponent, modalConfig); } + // ---------------------------------------------------------------------------------------------------------------- + deleteSshKey(keyName: string) + { + const modalConfig = { + ignoreBackdropClick: true, + keyboard: false, + animated: true, + initialState: { + prompt: `Are you sure you wish to permanently delete the "${keyName}" key?`, + confirmButtonText: 'Yes, delete it', + declineButtonText: 'No, keep it', + confirmByDefault: false + } + }; + + const modalRef = this.modalService.show(ConfirmationDialogComponent, modalConfig); + + modalRef.content.confirm.pipe(first()).subscribe(() => + { + this.accountService.deleteKey(keyName) + .subscribe(() => + { + const index = this.userKeys.findIndex(x => x.name === keyName); + if (index >= 0) + { + this.userKeys.splice(index, 1); + this.toastr.info(`The "${keyName}" key has been deleted`); + } + }, err => + { + const errorDetails = err.error?.message ? `(${err.error.message})` : ''; + this.toastr.error(`Failed to remove the "${keyName}" key ${errorDetails}`); + }); + }); + } + // ---------------------------------------------------------------------------------------------------------------- ngOnInit() { diff --git a/app/src/app/file-manager/file-manager.component.html b/app/src/app/file-manager/file-manager.component.html deleted file mode 100644 index 7731c9a..0000000 --- a/app/src/app/file-manager/file-manager.component.html +++ /dev/null @@ -1 +0,0 @@ -

    file-manager works!

    diff --git a/app/src/app/file-manager/file-manager.component.scss b/app/src/app/file-manager/file-manager.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/app/src/app/file-manager/file-manager.component.spec.ts b/app/src/app/file-manager/file-manager.component.spec.ts deleted file mode 100644 index 9e94da7..0000000 --- a/app/src/app/file-manager/file-manager.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { FileManagerComponent } from './file-manager.component'; - -describe('FileManagerComponent', () => { - let component: FileManagerComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ FileManagerComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(FileManagerComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/app/src/app/file-manager/file-manager.component.ts b/app/src/app/file-manager/file-manager.component.ts deleted file mode 100644 index a28fb79..0000000 --- a/app/src/app/file-manager/file-manager.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-file-manager', - templateUrl: './file-manager.component.html', - styleUrls: ['./file-manager.component.scss'] -}) -export class FileManagerComponent implements OnInit { - - constructor() { } - - ngOnInit(): void { - } - -} diff --git a/app/src/app/file-manager/file-manager.module.ts b/app/src/app/file-manager/file-manager.module.ts deleted file mode 100644 index d6eb458..0000000 --- a/app/src/app/file-manager/file-manager.module.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { NgModule } from '@angular/core'; - -import { SharedModule } from '../shared.module'; -import { RouterModule } from '@angular/router'; - -import { TranslateModule, TranslateService, LangChangeEvent } from '@ngx-translate/core'; -import { TranslateLoader } from '@ngx-translate/core'; -import { WebpackTranslateLoader } from '../helpers/webpack-translate-loader.service'; -import { TranslateCompiler } from '@ngx-translate/core'; -import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler'; - -import { FileManagerComponent } from './file-manager.component'; - -@NgModule({ - declarations: [FileManagerComponent], - imports: [ - SharedModule, - RouterModule.forChild([ - { - path: '', - component: FileManagerComponent - } - ]), - TranslateModule.forChild({ - loader: { - provide: TranslateLoader, - //useClass: WebpackTranslateLoader - useFactory: () => new WebpackTranslateLoader('file-manager') - }, - compiler: { - provide: TranslateCompiler, - useFactory: () => new TranslateMessageFormatCompiler() - }, - isolate: true - }) - ] -}) -export class FileManagerModule -{ - constructor(private readonly translate: TranslateService) - { - translate.use(translate.store.currentLang); - - translate.store.onLangChange.subscribe((event: LangChangeEvent) => translate.use(event.lang)); - } -} diff --git a/app/src/assets/i18n/account/en.json b/app/src/assets/i18n/account/en.json index a4fd338..04f5fa2 100644 --- a/app/src/assets/i18n/account/en.json +++ b/app/src/assets/i18n/account/en.json @@ -5,6 +5,7 @@ "myProfile": "My profile", "updateProfile": "Update profile", "myKeys": "My keys", - "addKey": "Add key" + "addKey": "Add key", + "removeKey": "Delete this key" } }