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>
</clr-dg-action-bar>
<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]="'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]="'credential.type'">{{'DESTINATION.AUTHENTICATION' | 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-row *clrDgItems="let t of targets" [clrDgItem]='t'>
<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="'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>
</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>
{{!t.insecure}}
</clr-dg-cell>

View File

@ -24,7 +24,7 @@
</div>
<div class="status-failed" *ngIf="executions && executions['status'] === 'Failed'">
<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>
@ -50,15 +50,15 @@
<section class="execution-detail-label">
<section class="detail-row">
<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 class="detail-row">
<span class="label label-red detail-span">{{'REPLICATION.FAILTURE'| translate}}</span>
<div class="execution-details">{{'2'}}</div>
<span class="label label-red detail-span">{{'REPLICATION.FAILURE'| translate}}</span>
<div class="execution-details">{{failedNum}}</div>
</section>
<section class="detail-row">
<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>
</div>
@ -70,26 +70,25 @@
<div class="row flex-items-xs-between flex-items-xs-bottom">
<div class="action-select">
<div class="select filterTag" [hidden]="!isOpenFilterTag">
<select>
<option value="recourceType">{{'REPLICATION.RECOURCE_TYPE' |translate}}</option>
<option value="recource">{{'REPLICATION.RECOURCE' | translate}}</option>
<select (change)="selectFilter($event)">
<option value="resourceType">{{'REPLICATION.RESOURCE_TYPE' |translate}}</option>
<option value="resource">{{'REPLICATION.RESOURCE' | translate}}</option>
<option value="destination">{{'REPLICATION.DESTINATION' | translate}}</option>
<option value="status">{{'REPLICATION.STATUS' | translate}}</option>
</select>
</div>
<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">
<clr-icon shape="refresh"></clr-icon>
<span class="spinner spinner-inline" hidden></span>
<clr-icon shape="refresh" (click)="refreshTasks()"></clr-icon>
</span>
</div>
</div>
<clr-datagrid [(clrDgSelected)]="selectedRow" [clrDgLoading]="loading">
<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>
<clr-dg-column [clrDgField]="'src_resource'">{{'REPLICATION.RECOURCE' |
<clr-dg-column [clrDgField]="'src_resource'">{{'REPLICATION.SOURCE' |
translate}}</clr-dg-column>
<clr-dg-column [clrDgField]="'dst_resource'">{{'REPLICATION.DESTINATION' |
translate}}</clr-dg-column>

View File

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

View File

@ -25,12 +25,7 @@
<div class="row flex-items-xs-between jobsRow">
<h5 class="flex-items-xs-bottom option-left-down">{{'REPLICATION.REPLICATION_EXECUTIONS' | translate}}</h5>
<div class="flex-items-xs-bottom option-right-down">
<button class="btn btn-link" (click)="toggleSearchJobOptionalName(currentJobSearchOption)">{{toggleJobSearchOption[currentJobSearchOption] | 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>
<button class="btn btn-link" (click)="toggleSearchJobOptionalName(currentJobSearchOption)">{{"REPLICATION.ADVANCED" | translate}}</button>
</div>
</div>
<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" }
];
const optionalSearch: {} = {
0: "REPLICATION.ADVANCED",
1: "REPLICATION.SIMPLE"
};
export class SearchOption {
ruleId: number | string;
ruleName: string = "";
@ -130,8 +125,6 @@ export class ReplicationComponent implements OnInit, OnDestroy {
hiddenJobList = true;
jobs: ReplicationJobItem[];
toggleJobSearchOption = optionalSearch;
currentJobSearchOption: number;
@ViewChild(ListReplicationRuleComponent)

View File

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

View File

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

View File

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

View File

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

View File

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