-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(ui): refact keys, variables and run sidebar (#6221)
* refactor(ui): refact keys, variables and run sidebar * fix(ui): unit test + remove translate
- Loading branch information
Showing
13 changed files
with
154 additions
and
219 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,46 @@ | ||
<div class="KeyForm"> | ||
<div class="ui form"> | ||
<div class="ui info message" *ngIf="newKey.type === 'ssh'"> | ||
{{ 'keys_ssh_key_help' | translate }} <a href="#" [routerLink]="['/docs', 'docs', 'components', 'worker', 'key', 'install']">Worker Install Key</a> | ||
</div> | ||
<div class="ui info message" *ngIf="newKey.type === 'pgp'"> | ||
{{ 'keys_pgp_key_help' | translate }} <a href="#" [routerLink]="['/docs', 'docs', 'components', 'worker', 'key', 'install']">Worker Install Key</a> | ||
</div> | ||
<div class="fields"> | ||
<div class="seven wide field"> | ||
<label>{{ 'keys_name' | translate}}</label> | ||
<div class="ui labeled input"> | ||
<div class="ui label">{{prefix}}</div> | ||
<input type="text" name="name" [(ngModel)]="newKey.name"> | ||
</div> | ||
</div> | ||
<div class="seven wide field"> | ||
<label>{{ 'keys_type' | translate }}</label> | ||
<ng-container *ngIf="keyTypes"> | ||
<sui-select class="selection" | ||
name="type" | ||
[(ngModel)]="newKey.type" | ||
[options]="keyTypes" | ||
[isSearchable]="true" | ||
#selectKeyType> | ||
<sui-select-option *ngFor="let t of selectKeyType.filteredOptions" [value]="t"> | ||
</sui-select-option> | ||
</sui-select> | ||
</ng-container> | ||
</div> | ||
<div class="two wide right aligned field"> | ||
<button class="ui green button" type="button" [class.loading]="loading" [disabled]="loading || newKey.name === ''" (click)="addKey()">{{ 'btn_add' | translate }}</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<form nz-form> | ||
<nz-alert nzType="info" *ngIf="newKey.type === 'ssh'" [nzMessage]="sshHelp"></nz-alert> | ||
<ng-template #sshHelp> | ||
{{ 'keys_ssh_key_help' | translate }} <a href="#" | ||
[routerLink]="['/docs', 'docs', 'components', 'worker', 'key', 'install']">Worker | ||
Install Key</a> | ||
</ng-template> | ||
<nz-alert nzType="info" *ngIf="newKey.type === 'pgp'" [nzMessage]="pgpHelp"></nz-alert> | ||
<ng-template #pgpHelp> | ||
{{ 'keys_pgp_key_help' | translate }} <a href="#" | ||
[routerLink]="['/docs', 'docs', 'components', 'worker', 'key', 'install']">Worker | ||
Install Key</a> | ||
</ng-template> | ||
<nz-row> | ||
<nz-col [nzSpan]="8"> | ||
<nz-form-item> | ||
<nz-form-label>Key name</nz-form-label> | ||
<nz-form-control> | ||
<nz-input-group nzAddOnBefore="{{prefix}}"> | ||
<input type="text" nz-input [(ngModel)]="newKey.name" name="keyname"/> | ||
</nz-input-group> | ||
</nz-form-control> | ||
</nz-form-item> | ||
</nz-col> | ||
<nz-col [nzSpan]="7" [nzOffset]="1"> | ||
<nz-form-item> | ||
<nz-form-label>Key type</nz-form-label> | ||
<nz-form-control> | ||
<nz-select nzShowSearch [(ngModel)]="newKey.type" name="type"> | ||
<nz-option *ngFor="let t of keyTypes" [nzValue]="t" [nzLabel]="t"></nz-option> | ||
</nz-select> | ||
</nz-form-control> | ||
</nz-form-item> | ||
</nz-col> | ||
<nz-col [nzSpan]="2" [nzOffset]="1"> | ||
<nz-form-item> | ||
<nz-form-control> | ||
<button nz-button nzType="primary" [nzLoading]="loading" [disabled]="loading || newKey.name === ''" | ||
(click)="addKey()">Add | ||
</button> | ||
</nz-form-control> | ||
</nz-form-item> | ||
</nz-col> | ||
</nz-row> | ||
</form> | ||
|
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,9 +1,3 @@ | ||
.KeyForm { | ||
.fields { | ||
.field { | ||
button { | ||
margin-top: 23px; | ||
} | ||
} | ||
} | ||
} | ||
nz-row { | ||
margin-top: 20px; | ||
} |
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,44 +1,36 @@ | ||
<div class="keys" *ngIf="keys"> | ||
<table class="ui fixed celled table" *ngIf="getDataForCurrentPage().length > 0"> | ||
<thead> | ||
<tr> | ||
<th class="two wide">{{ 'keys_name' | translate }}</th> | ||
<th class="two wide">{{ 'keys_type' | translate }}</th> | ||
<th class="ten wide">{{ 'keys_public' | translate }}</th> | ||
<th class="two wide" *ngIf="edit"></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr *ngFor="let k of getDataForCurrentPage()"> | ||
<td> | ||
{{ k.name }} | ||
</td> | ||
<td> | ||
{{ k.type }} | ||
</td> | ||
<td> | ||
<pre>{{ k.public }}</pre> | ||
</td> | ||
<td *ngIf="edit"> | ||
<app-delete-button [loading]="loading" (event)="deleteKey(k)"></app-delete-button> | ||
</td> | ||
</tr> | ||
</tbody> | ||
<tfoot *ngIf="getNbOfPages() > 1"> | ||
<tr> | ||
<th colspan="4"> | ||
<div class="ui right floated pagination menu"> | ||
<a class="icon item" (click)="downPage()"> | ||
<i class="left chevron icon"></i> | ||
</a> | ||
<a class="item" *ngFor="let page of getNbOfPages() | ngForNumber" (click)="goTopage(page)" | ||
[class.active]="currentPage === page">{{page}}</a> | ||
<a class="icon item" (click)="upPage()"> | ||
<i class="right chevron icon"></i> | ||
</a> | ||
</div> | ||
</th> | ||
</tr> | ||
</tfoot> | ||
</table> | ||
</div> | ||
<nz-table [nzData]="keys" [nzNoResult]="nokeys" #keylist> | ||
<thead> | ||
<tr> | ||
<th nzWidth="50px">Key name</th> | ||
<th nzWidth="50px">Key type</th> | ||
<th nzWidth="400px">Public key</th> | ||
<th nzWidth="25px" *ngIf="edit"></th> | ||
</tr> | ||
</thead> | ||
<tbody *ngFor="let k of keylist.data"> | ||
<tr> | ||
<td> | ||
{{ k.name }} | ||
</td> | ||
<td> | ||
{{ k.type }} | ||
</td> | ||
<td nzBreakWord> | ||
<ng-container *ngIf="k.type === 'ssh'"> | ||
<input nz-input readonly [ngModel]="k.public"> | ||
</ng-container> | ||
<ng-container *ngIf="k.type === 'pgp'"> | ||
<textarea nz-input [ngModel]="k.public" readonly rows="29"></textarea> | ||
</ng-container> | ||
|
||
</td> | ||
<td *ngIf="edit"> | ||
<button nz-button nzDanger nzType="primary" [nzLoading]="loading" nz-popconfirm nzPopconfirmTitle="Are you sure you want to delete this key ?" | ||
(nzOnConfirm)="deleteKey(k)">Delete</button> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</nz-table> | ||
<ng-template #nokeys> | ||
<nz-alert nzType="info" nzMessage="There is no key"></nz-alert> | ||
</ng-template> |
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,5 +1,3 @@ | ||
@import '../../../../common'; | ||
|
||
pre { | ||
white-space: pre; | ||
word-break: break-all; | ||
|
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
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
Oops, something went wrong.