Merge pull request #7294 from pureshine/replication-ui

Fix cannot search for replication tasks
This commit is contained in:
Wenkai Yin 2019-04-04 09:52:04 +08:00 committed by GitHub
commit 3ed8d87406
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 48 additions and 49 deletions

View File

@ -18,22 +18,22 @@
<button type="button" class="btn btn-sm btn-secondary" [disabled]="!selectedRow.length" (click)="deleteTargets(selectedRow)"><clr-icon shape="times" size="16"></clr-icon>&nbsp;{{'DESTINATION.DELETE' | translate}}</button> <button type="button" class="btn btn-sm btn-secondary" [disabled]="!selectedRow.length" (click)="deleteTargets(selectedRow)"><clr-icon shape="times" size="16"></clr-icon>&nbsp;{{'DESTINATION.DELETE' | translate}}</button>
</clr-dg-action-bar> </clr-dg-action-bar>
<clr-dg-column [clrDgField]="'name'" class="flex-min-width">{{'DESTINATION.NAME' | translate}}</clr-dg-column> <clr-dg-column [clrDgField]="'name'" class="flex-min-width">{{'DESTINATION.NAME' | translate}}</clr-dg-column>
<clr-dg-column [clrDgField]="'status'">{{'DESTINATION.STATUS' | translate}}</clr-dg-column> <clr-dg-column [clrDgField]="'status'" class="flex-min-width">{{'DESTINATION.STATUS' | translate}}</clr-dg-column>
<clr-dg-column [clrDgField]="'url'" class="flex-min-width">{{'DESTINATION.URL' | translate}}</clr-dg-column> <clr-dg-column [clrDgField]="'url'" class="flex-min-width">{{'DESTINATION.URL' | translate}}</clr-dg-column>
<clr-dg-column [clrDgField]="'type'" class="flex-min-width">{{'DESTINATION.PROVIDER' | translate}}</clr-dg-column> <clr-dg-column [clrDgField]="'type'">{{'DESTINATION.PROVIDER' | translate}}</clr-dg-column>
<clr-dg-column [clrDgField]="'insecure'">{{'CONFIG.VERIFY_REMOTE_CERT' | translate }}</clr-dg-column> <clr-dg-column [clrDgField]="'insecure'">{{'CONFIG.VERIFY_REMOTE_CERT' | translate }}</clr-dg-column>
<clr-dg-column [clrDgField]="'credential.type'">{{'DESTINATION.AUTHENTICATION' | translate }}</clr-dg-column> <clr-dg-column [clrDgField]="'credential.type'">{{'DESTINATION.AUTHENTICATION' | translate }}</clr-dg-column>
<clr-dg-column [clrDgSortBy]="creationTimeComparator">{{'DESTINATION.CREATION_TIME' | translate}}</clr-dg-column> <clr-dg-column [clrDgSortBy]="creationTimeComparator">{{'DESTINATION.CREATION_TIME' | translate}}</clr-dg-column>
<clr-dg-placeholder>{{'DESTINATION.PLACEHOLDER' | translate }}</clr-dg-placeholder> <clr-dg-placeholder>{{'DESTINATION.PLACEHOLDER' | translate }}</clr-dg-placeholder>
<clr-dg-row *clrDgItems="let t of targets" [clrDgItem]='t'> <clr-dg-row *clrDgItems="let t of targets" [clrDgItem]='t'>
<clr-dg-cell class="flex-min-width">{{t.name}}</clr-dg-cell> <clr-dg-cell class="flex-min-width">{{t.name}}</clr-dg-cell>
<clr-dg-cell [ngSwitch]="t.status"> <clr-dg-cell [ngSwitch]="t.status" class="flex-min-width">
<div *ngSwitchCase="'unhealthy'"><clr-icon shape="exclamation-circle" class="is-error text-alignment" size="22"></clr-icon> Unhealthy</div> <div *ngSwitchCase="'unhealthy'"><clr-icon shape="exclamation-circle" class="is-error text-alignment" size="22"></clr-icon> Unhealthy</div>
<div *ngSwitchCase="'healthy'"><clr-icon shape="success-standard" class="is-success text-alignment" size="18"></clr-icon> Healthy</div> <div *ngSwitchCase="'healthy'"><clr-icon shape="success-standard" class="is-success text-alignment" size="18"></clr-icon> Healthy</div>
<div *ngSwitchCase="'unknown' || ''"><clr-icon shape="exclamation-triangle" class="is-warning text-alignment" size="22"></clr-icon> Unknown</div> <div *ngSwitchCase="'unknown' || ''"><clr-icon shape="exclamation-triangle" class="is-warning text-alignment" size="22"></clr-icon> Unknown</div>
</clr-dg-cell> </clr-dg-cell>
<clr-dg-cell class="flex-min-width">{{t.url}}</clr-dg-cell> <clr-dg-cell class="flex-min-width">{{t.url}}</clr-dg-cell>
<clr-dg-cell class="flex-min-width">{{t.type}}</clr-dg-cell> <clr-dg-cell>{{t.type}}</clr-dg-cell>
<clr-dg-cell> <clr-dg-cell>
{{!t.insecure}} {{!t.insecure}}
</clr-dg-cell> </clr-dg-cell>

View File

@ -24,7 +24,7 @@
</div> </div>
<div class="status-failed" *ngIf="executions && executions['status'] === 'Failed'"> <div class="status-failed" *ngIf="executions && executions['status'] === 'Failed'">
<clr-icon size="18" shape="error-standard" class="color-red"></clr-icon> <clr-icon size="18" shape="error-standard" class="color-red"></clr-icon>
<span>{{'REPLICATION.FAILTURE'| translate}}</span> <span>{{'REPLICATION.FAILURE'| translate}}</span>
</div> </div>
</div> </div>
<div> <div>
@ -50,15 +50,15 @@
<section class="execution-detail-label"> <section class="execution-detail-label">
<section class="detail-row"> <section class="detail-row">
<span class="label label-purple detail-span">{{'REPLICATION.SUCCESS'| translate}}</span> <span class="label label-purple detail-span">{{'REPLICATION.SUCCESS'| translate}}</span>
<div class="execution-details">{{'1'}}</div> <div class="execution-details">{{successNum}}</div>
</section> </section>
<section class="detail-row"> <section class="detail-row">
<span class="label label-red detail-span">{{'REPLICATION.FAILTURE'| translate}}</span> <span class="label label-red detail-span">{{'REPLICATION.FAILURE'| translate}}</span>
<div class="execution-details">{{'2'}}</div> <div class="execution-details">{{failedNum}}</div>
</section> </section>
<section class="detail-row"> <section class="detail-row">
<span class="label label-light-blue detail-span">{{'REPLICATION.IN_PROGRESS'| translate}}</span> <span class="label label-light-blue detail-span">{{'REPLICATION.IN_PROGRESS'| translate}}</span>
<div class="execution-details">{{'3'}}</div> <div class="execution-details">{{progressNum}}</div>
</section> </section>
</section> </section>
</div> </div>
@ -70,26 +70,25 @@
<div class="row flex-items-xs-between flex-items-xs-bottom"> <div class="row flex-items-xs-between flex-items-xs-bottom">
<div class="action-select"> <div class="action-select">
<div class="select filterTag" [hidden]="!isOpenFilterTag"> <div class="select filterTag" [hidden]="!isOpenFilterTag">
<select> <select (change)="selectFilter($event)">
<option value="recourceType">{{'REPLICATION.RECOURCE_TYPE' |translate}}</option> <option value="resourceType">{{'REPLICATION.RESOURCE_TYPE' |translate}}</option>
<option value="recource">{{'REPLICATION.RECOURCE' | translate}}</option> <option value="resource">{{'REPLICATION.RESOURCE' | translate}}</option>
<option value="destination">{{'REPLICATION.DESTINATION' | translate}}</option> <option value="destination">{{'REPLICATION.DESTINATION' | translate}}</option>
<option value="status">{{'REPLICATION.STATUS' | translate}}</option> <option value="status">{{'REPLICATION.STATUS' | translate}}</option>
</select> </select>
</div> </div>
<hbr-filter [withDivider]="true" (openFlag)="openFilter($event)" <hbr-filter [withDivider]="true" (openFlag)="openFilter($event)"
filterPlaceholder='{{"REPLICATION.FILTER_PLACEHOLDER" | translate}}'></hbr-filter> filterPlaceholder='{{"REPLICATION.FILTER_PLACEHOLDER" | translate}}' (filterEvt)="doSearch($event)"></hbr-filter>
<span class="refresh-btn"> <span class="refresh-btn">
<clr-icon shape="refresh"></clr-icon> <clr-icon shape="refresh" (click)="refreshTasks()"></clr-icon>
<span class="spinner spinner-inline" hidden></span>
</span> </span>
</div> </div>
</div> </div>
<clr-datagrid [(clrDgSelected)]="selectedRow" [clrDgLoading]="loading"> <clr-datagrid [(clrDgSelected)]="selectedRow" [clrDgLoading]="loading">
<clr-dg-column>{{'REPLICATION.TASK_ID'| translate}}</clr-dg-column> <clr-dg-column>{{'REPLICATION.TASK_ID'| translate}}</clr-dg-column>
<clr-dg-column [clrDgField]="'resource_type'">{{'REPLICATION.RECOURCE_TYPE' <clr-dg-column [clrDgField]="'resource_type'">{{'REPLICATION.RESOURCE_TYPE'
| translate}}</clr-dg-column> | translate}}</clr-dg-column>
<clr-dg-column [clrDgField]="'src_resource'">{{'REPLICATION.RECOURCE' | <clr-dg-column [clrDgField]="'src_resource'">{{'REPLICATION.SOURCE' |
translate}}</clr-dg-column> translate}}</clr-dg-column>
<clr-dg-column [clrDgField]="'dst_resource'">{{'REPLICATION.DESTINATION' | <clr-dg-column [clrDgField]="'dst_resource'">{{'REPLICATION.DESTINATION' |
translate}}</clr-dg-column> translate}}</clr-dg-column>

View File

@ -16,7 +16,7 @@ export class ReplicationTasksComponent implements OnInit {
selectedRow: []; selectedRow: [];
loading = false; loading = false;
searchTask: string; searchTask: string;
defaultFilter = "recourceType"; defaultFilter = "resourceType";
tasks: ReplicationTasks[] = []; tasks: ReplicationTasks[] = [];
tasksCopy: ReplicationTasks[] = []; tasksCopy: ReplicationTasks[] = [];
stopOnGoing: boolean; stopOnGoing: boolean;
@ -66,12 +66,24 @@ export class ReplicationTasksComponent implements OnInit {
: null; : null;
} }
public get successNum(): string {
return this.executions && this.executions['succeed'];
}
public get failedNum(): string {
return this.executions && this.executions['failed'];
}
public get progressNum(): string {
return this.executions && this.executions['in_progress'];
}
stopJob() { stopJob() {
this.stopOnGoing = true; this.stopOnGoing = true;
this.replicationService.stopJobs(this.executionId) this.replicationService.stopJobs(this.executionId)
.subscribe(response => { .subscribe(response => {
this.stopOnGoing = false; this.stopOnGoing = false;
// this.getExecutions(); this.getExecutionDetail();
this.translate.get("REPLICATION.STOP_SUCCESS", { param: this.executionId }).subscribe((res: string) => { this.translate.get("REPLICATION.STOP_SUCCESS", { param: this.executionId }).subscribe((res: string) => {
this.errorHandler.info(res); this.errorHandler.info(res);
}); });
@ -90,11 +102,11 @@ export class ReplicationTasksComponent implements OnInit {
this.replicationService.getReplicationTasks(this.executionId) this.replicationService.getReplicationTasks(this.executionId)
.pipe(finalize(() => (this.loading = false))) .pipe(finalize(() => (this.loading = false)))
.subscribe(tasks => { .subscribe(tasks => {
if (this.defaultFilter === 'recourceType') { if (this.defaultFilter === 'resourceType') {
this.tasks = tasks.filter(x => this.tasks = tasks.filter(x =>
x.resource_type.includes(this.searchTask) x.resource_type.includes(this.searchTask)
); );
} else if (this.defaultFilter === 'recource') { } else if (this.defaultFilter === 'resource') {
this.tasks = tasks.filter(x => this.tasks = tasks.filter(x =>
x.src_resource.includes(this.searchTask) x.src_resource.includes(this.searchTask)
); );

View File

@ -25,12 +25,7 @@
<div class="row flex-items-xs-between jobsRow"> <div class="row flex-items-xs-between jobsRow">
<h5 class="flex-items-xs-bottom option-left-down">{{'REPLICATION.REPLICATION_EXECUTIONS' | translate}}</h5> <h5 class="flex-items-xs-bottom option-left-down">{{'REPLICATION.REPLICATION_EXECUTIONS' | translate}}</h5>
<div class="flex-items-xs-bottom option-right-down"> <div class="flex-items-xs-bottom option-right-down">
<button class="btn btn-link" (click)="toggleSearchJobOptionalName(currentJobSearchOption)">{{toggleJobSearchOption[currentJobSearchOption] | translate}}</button> <button class="btn btn-link" (click)="toggleSearchJobOptionalName(currentJobSearchOption)">{{"REPLICATION.ADVANCED" | translate}}</button>
<hbr-filter [withDivider]="true" filterPlaceholder='{{"REPLICATION.FILTER_EXECUTIONS_PLACEHOLDER" | translate}}' (filterEvt)="doSearchJobs($event)"
[currentValue]="search.repoName"></hbr-filter>
<span class="refresh-btn" (click)="refreshJobs()">
<clr-icon shape="refresh"></clr-icon>
</span>
</div> </div>
</div> </div>
<div class="row flex-items-xs-right row-right" [hidden]="currentJobSearchOption === 0"> <div class="row flex-items-xs-right row-right" [hidden]="currentJobSearchOption === 0">

View File

@ -74,11 +74,6 @@ const jobStatus: { [key: string]: any } = [
{ key: "canceled", description: "REPLICATION.CANCELED" } { key: "canceled", description: "REPLICATION.CANCELED" }
]; ];
const optionalSearch: {} = {
0: "REPLICATION.ADVANCED",
1: "REPLICATION.SIMPLE"
};
export class SearchOption { export class SearchOption {
ruleId: number | string; ruleId: number | string;
ruleName: string = ""; ruleName: string = "";
@ -130,8 +125,6 @@ export class ReplicationComponent implements OnInit, OnDestroy {
hiddenJobList = true; hiddenJobList = true;
jobs: ReplicationJobItem[]; jobs: ReplicationJobItem[];
toggleJobSearchOption = optionalSearch;
currentJobSearchOption: number; currentJobSearchOption: number;
@ViewChild(ListReplicationRuleComponent) @ViewChild(ListReplicationRuleComponent)

View File

@ -337,14 +337,14 @@
"STOP_SUCCESS": "Stop Execution {{param}} Successful", "STOP_SUCCESS": "Stop Execution {{param}} Successful",
"STOP_SUMMARY": "Do you want to stop the executions {{param}}?", "STOP_SUMMARY": "Do you want to stop the executions {{param}}?",
"TASK_ID":"Task ID", "TASK_ID":"Task ID",
"RECOURCE_TYPE": "Recource Type", "RESOURCE_TYPE": "Resource Type",
"RECOURCE": "Recource", "SOURCE": "Source",
"DESTINATION": "Destination", "DESTINATION": "Destination",
"POLICY": "Policy", "POLICY": "Policy",
"DURATION": "Duration", "DURATION": "Duration",
"SUCCESS_RATE": "Success Rate", "SUCCESS_RATE": "Success Rate",
"SUCCESS": "SUCCESS", "SUCCESS": "SUCCESS",
"FAILTURE": "FAILTURE", "FAILURE": "FAILURE",
"IN_PROGRESS": "IN PROGRESS", "IN_PROGRESS": "IN PROGRESS",
"REPLICATION_RULE": "Replication Rule", "REPLICATION_RULE": "Replication Rule",
"NEW_REPLICATION_RULE": "New Replication Rule", "NEW_REPLICATION_RULE": "New Replication Rule",

View File

@ -336,14 +336,14 @@
"STOP_SUCCESS": "Stop Execution {{param}} Successful", "STOP_SUCCESS": "Stop Execution {{param}} Successful",
"STOP_SUMMARY": "De que desea detener las ejecuciones {{param}}?", "STOP_SUMMARY": "De que desea detener las ejecuciones {{param}}?",
"TASK_ID":"Task ID", "TASK_ID":"Task ID",
"RECOURCE_TYPE": "Recource Type", "RESOURCE_TYPE": "Resource Type",
"RECOURCE": "Recource", "SOURCE": "Source",
"DESTINATION": "Destination", "DESTINATION": "Destination",
"POLICY": "Policy", "POLICY": "Policy",
"DURATION": "Duration", "DURATION": "Duration",
"SUCCESS_RATE": "Success Rate", "SUCCESS_RATE": "Success Rate",
"SUCCESS": "SUCCESS", "SUCCESS": "SUCCESS",
"FAILTURE": "FAILTURE", "FAILURE": "FAILURE",
"IN_PROGRESS": "IN PROGRESS", "IN_PROGRESS": "IN PROGRESS",
"STOP_EXECUTIONS": "Stop Execution", "STOP_EXECUTIONS": "Stop Execution",
"ID":"ID", "ID":"ID",

View File

@ -321,14 +321,14 @@
"STOP_SUCCESS": "Stop Execution {{param}} Successful", "STOP_SUCCESS": "Stop Execution {{param}} Successful",
"STOP_SUMMARY": "Voulez-vous arrêter les exécutions {{param}}?", "STOP_SUMMARY": "Voulez-vous arrêter les exécutions {{param}}?",
"TASK_ID":"Task ID", "TASK_ID":"Task ID",
"RECOURCE_TYPE": "Recource Type", "RESOURCE_TYPE": "Resource Type",
"RECOURCE": "Recource", "SOURCE": "Source",
"DESTINATION": "Destination", "DESTINATION": "Destination",
"POLICY": "Policy", "POLICY": "Policy",
"DURATION": "Duration", "DURATION": "Duration",
"SUCCESS_RATE": "Success Rate", "SUCCESS_RATE": "Success Rate",
"SUCCESS": "SUCCESS", "SUCCESS": "SUCCESS",
"FAILTURE": "FAILTURE", "FAILURE": "FAILURE",
"IN_PROGRESS": "IN PROGRESS", "IN_PROGRESS": "IN PROGRESS",
"STOP_EXECUTIONS": "Stop Execution", "STOP_EXECUTIONS": "Stop Execution",
"ID":"ID", "ID":"ID",

View File

@ -335,14 +335,14 @@
"STOP_SUCCESS": "Stop Execution {{param}} Successful", "STOP_SUCCESS": "Stop Execution {{param}} Successful",
"STOP_SUMMARY": "Você quer parar as execuções? {{param}}?", "STOP_SUMMARY": "Você quer parar as execuções? {{param}}?",
"TASK_ID":"Task ID", "TASK_ID":"Task ID",
"RECOURCE_TYPE": "Recource Type", "RESOURCE_TYPE": "Resource Type",
"RECOURCE": "Recource", "SOURCE": "Source",
"DESTINATION": "Destination", "DESTINATION": "Destination",
"POLICY": "Policy", "POLICY": "Policy",
"DURATION": "Duration", "DURATION": "Duration",
"SUCCESS_RATE": "Success Rate", "SUCCESS_RATE": "Success Rate",
"SUCCESS": "SUCCESS", "SUCCESS": "SUCCESS",
"FAILTURE": "FAILTURE", "FAILURE": "FAILURE",
"IN_PROGRESS": "IN PROGRESS", "IN_PROGRESS": "IN PROGRESS",
"STOP_EXECUTIONS": "Stop Execution", "STOP_EXECUTIONS": "Stop Execution",
"ID":"ID", "ID":"ID",

View File

@ -336,14 +336,14 @@
"STOP_SUCCESS": "停止任务 {{param}} 成功", "STOP_SUCCESS": "停止任务 {{param}} 成功",
"STOP_SUMMARY": "确认停止任务{{param}}?", "STOP_SUMMARY": "确认停止任务{{param}}?",
"TASK_ID":"任务ID", "TASK_ID":"任务ID",
"RECOURCE_TYPE": "源类型", "RESOURCE_TYPE": "源类型",
"RECOURCE": "源", "SOURCE": "源",
"DESTINATION": "目标", "DESTINATION": "目标",
"POLICY": "政策", "POLICY": "政策",
"DURATION": "到期时间", "DURATION": "到期时间",
"SUCCESS_RATE": "成功百分比", "SUCCESS_RATE": "成功百分比",
"SUCCESS": "成功", "SUCCESS": "成功",
"FAILTURE": "失败", "FAILURE": "失败",
"IN_PROGRESS": "进行中", "IN_PROGRESS": "进行中",
"STOP_EXECUTIONS": "停止任务", "STOP_EXECUTIONS": "停止任务",
"ID":"ID", "ID":"ID",