ssh-keys.component.html 1.86 KB
Newer Older
1 2 3 4 5 6
<div class="mat-typography">
	<h3>Key Management</h3>
	<div style="margin-bottom: 25px;">
		<div *ngIf="userService.user.ssh_keys.length > 0; then key_list else upload_note"></div>
	</div>
	<div *ngIf="upload; then uploading else not_uploading"></div>
7 8 9
</div>
<ng-template #key_list>
	<mat-table [dataSource]="userService.sshKeyData">
10 11 12 13 14 15
		<ng-container matColumnDef="name">
			<mat-header-cell *matHeaderCellDef>Name</mat-header-cell>
			<mat-cell *matCellDef="let element">{{ element.name}}</mat-cell>
		</ng-container>
		<ng-container matColumnDef="key">
			<mat-header-cell *matHeaderCellDef>Key</mat-header-cell>
16
			<mat-cell style="font-size: 11px;" *matCellDef="let element">{{ element.key }}</mat-cell>
17 18 19 20
		</ng-container>
		<ng-container matColumnDef="action">
			<mat-header-cell *matHeaderCellDef>Action</mat-header-cell>
			<mat-cell *matCellDef="let element">
21
				<button mat-icon-button matTooltip="Delete key" (click)="deleteKey(element)">
22 23
					<mat-icon>delete_forever</mat-icon>
				</button>
Lukas Burgey's avatar
Lukas Burgey committed
24
			</mat-cell>
25
		</ng-container>
Lukas Burgey's avatar
Lukas Burgey committed
26
		<mat-header-row *matHeaderRowDef="columns"></mat-header-row>
27
		<mat-row *matRowDef="let row; columns: columns;"></mat-row>
Lukas Burgey's avatar
Lukas Burgey committed
28
	</mat-table>
29 30 31
</ng-template>
<ng-template #upload_note>
	<p>
32
	You have no uploaded keys. Please upload an SSH public key.
Lukas Burgey's avatar
Lukas Burgey committed
33
	</p>
34 35
</ng-template>
<ng-template #uploading>
Lukas Burgey's avatar
Lukas Burgey committed
36
	<button mat-icon-button (click)="upload = true"><mat-icon>add</mat-icon></button>
37 38
</ng-template>
<ng-template #not_uploading>
Lukas Burgey's avatar
Lukas Burgey committed
39 40 41 42 43 44 45 46 47
	<form (ngSubmit)="uploadKey()" #sshKeyForm="ngForm">
		<mat-form-field>
			<input matInput placeholder="Name" required [(ngModel)]="newKeyName" name="name">
		</mat-form-field>
		<mat-form-field>
			<textarea matInput placeholder="Key" required [(ngModel)]="newKeyKey" name="key"></textarea>
		</mat-form-field>
		<button mat-raised-button color="primary" type="submit" [disabled]="!sshKeyForm.form.valid">Submit</button>
	</form>
48
</ng-template>