Modify replication rule list not seleted first

This commit is contained in:
pfh 2018-04-20 18:58:37 +08:00
parent 842ff695b9
commit e92ef72902
4 changed files with 9 additions and 10 deletions

View File

@ -135,14 +135,9 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges {
.getReplicationRules(this.projectId, ruleName)) .getReplicationRules(this.projectId, ruleName))
.then(rules => { .then(rules => {
this.rules = rules || []; this.rules = rules || [];
if (this.rules && this.rules.length > 0) { // job list hidden
this.selectedId = this.rules[0].id || ''; this.hideJobs.emit();
this.selectOne.emit(this.rules[0]);
} else {
this.hideJobs.emit();
}
this.changedRules = this.rules; this.changedRules = this.rules;
this.selectedRow = this.changedRules[0];
this.loading = false; this.loading = false;
} }
).catch(error => { ).catch(error => {

View File

@ -13,7 +13,7 @@ export const REPLICATION_TEMPLATE: string = `
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<hbr-list-replication-rule #listReplicationRule [projectId]="projectId" [isSystemAdmin]="isSystemAdmin" (replicateManual)=replicateManualRule($event) (selectOne)="selectOneRule($event)" (hideJobs)="hideJobs()" (openNewRule)="openModal()" (editOne)="openEditRule($event)" (reload)="reloadRules($event)" [loading]="loading" [withReplicationJob]="withReplicationJob" (redirect)="customRedirect($event)"></hbr-list-replication-rule> <hbr-list-replication-rule #listReplicationRule [projectId]="projectId" [isSystemAdmin]="isSystemAdmin" (replicateManual)=replicateManualRule($event) (selectOne)="selectOneRule($event)" (hideJobs)="hideJobs()" (openNewRule)="openModal()" (editOne)="openEditRule($event)" (reload)="reloadRules($event)" [loading]="loading" [withReplicationJob]="withReplicationJob" (redirect)="customRedirect($event)"></hbr-list-replication-rule>
</div> </div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding-left:0px;"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding-left:0px;" [hidden]='hiddenJobList'>
<div *ngIf="withReplicationJob" class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <div *ngIf="withReplicationJob" class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="row flex-items-xs-between" style="height:60px;"> <div class="row flex-items-xs-between" style="height:60px;">
<h5 class="flex-items-xs-bottom option-left-down" style="margin-left: 14px;">{{'REPLICATION.REPLICATION_JOBS' | translate}}</h5> <h5 class="flex-items-xs-bottom option-left-down" style="margin-left: 14px;">{{'REPLICATION.REPLICATION_JOBS' | translate}}</h5>

View File

@ -109,6 +109,8 @@ export class ReplicationComponent implements OnInit, OnDestroy {
rules: ReplicationRule[]; rules: ReplicationRule[];
loading: boolean; loading: boolean;
isStopOnGoing: boolean; isStopOnGoing: boolean;
hiddenJobList = true;
jobs: ReplicationJobItem[]; jobs: ReplicationJobItem[];
batchDelectionInfos: BatchInfo[] = []; batchDelectionInfos: BatchInfo[] = [];
@ -267,6 +269,7 @@ export class ReplicationComponent implements OnInit, OnDestroy {
selectOneRule(rule: ReplicationRule) { selectOneRule(rule: ReplicationRule) {
if (rule && rule.id) { if (rule && rule.id) {
this.hiddenJobList = false;
this.search.ruleId = rule.id || ''; this.search.ruleId = rule.id || '';
this.search.repoName = ''; this.search.repoName = '';
this.search.status = ''; this.search.status = '';
@ -361,6 +364,7 @@ export class ReplicationComponent implements OnInit, OnDestroy {
hideJobs() { hideJobs() {
this.search.ruleId = 0; this.search.ruleId = 0;
this.jobs = []; this.jobs = [];
this.hiddenJobList = true;
} }
stopJobs() { stopJobs() {

View File

@ -30,7 +30,7 @@
"clarity-icons": "0.10.24", "clarity-icons": "0.10.24",
"clarity-ui": "0.10.24", "clarity-ui": "0.10.24",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"harbor-ui": "0.7.3", "harbor-ui": "0.7.4",
"intl": "^1.2.5", "intl": "^1.2.5",
"mutationobserver-shim": "^0.3.2", "mutationobserver-shim": "^0.3.2",
"ngx-cookie": "^1.0.0", "ngx-cookie": "^1.0.0",