Fix bugs infinity copy of reponame and auth

1. everytime click deploy or add additional info will add a prefix before reponame
2. add constrait on button on cardview
This commit is contained in:
Deng, Qian 2018-04-26 20:56:31 +08:00
parent fa8bbe821a
commit 18c8686d57
4 changed files with 14 additions and 10 deletions

View File

@ -69,9 +69,9 @@ export const CREATE_EDIT_RULE_TEMPLATE: string = `
</div>
</div>
<label *ngIf="noEndpointInfo.length != 0" class="colorRed alertLabel">{{noEndpointInfo | translate}}</label>
<span class="alertLabel goLink" *ngIf="noEndpointInfo.length != 0" (click)="goRegistry()">{{'SIDE_NAV.SYSTEM_MGMT.REGISTRY' | translate}}</span>
<span class="alertLabel goLink" *ngIf="noEndpointInfo.length != 0" (click)="goRegistry()">{{'REPLICATION.ENDPOINTS' | translate}}</span>
</div>
<!--Trigger-->
<div class="form-group form-group-override">
<label class="form-group-label-override">{{'REPLICATION.TRIGGER_MODE' | translate}}</label>

View File

@ -73,16 +73,16 @@ export const REPOSITORY_GRIDVIEW_TEMPLATE = `
</div>
<div class="card-footer">
<clr-dropdown [clrCloseMenuOnItemClick]="false">
<button *ngIf="withAdmiral" type="button" class="btn btn-link" (click)="provisionItemEvent($event, item)">{{'REPOSITORY.DEPLOY' | translate}}</button>
<button type="button" class="btn btn-link" (click)="$event.stopPropagation()" clrDropdownTrigger>
<button *ngIf="withAdmiral" type="button" class="btn btn-link" (click)="provisionItemEvent($event, item)" [disabled]="!hasProjectAdminRole">{{'REPOSITORY.DEPLOY' | translate}}</button>
<button type="button" class="btn btn-link" (click)="$event.stopPropagation()" [disabled]="!hasProjectAdminRole" clrDropdownTrigger>
{{'REPOSITORY.ACTION' | translate}}
<clr-icon shape="caret down"></clr-icon>
</button>
<clr-dropdown-menu clrPosition="top-left" *clrIfOpen>
<button *ngIf="withAdmiral" type="button" class="btn btn-link" clrDropdownItem (click)="itemAddInfoEvent($event, item)">
<button *ngIf="withAdmiral" type="button" class="btn btn-link" clrDropdownItem (click)="itemAddInfoEvent($event, item)" [disabled]="!hasProjectAdminRole">
{{'REPOSITORY.ADDITIONAL_INFO' | translate}}
</button>
<button type="button" class="btn btn-link" clrDropdownItem (click)="deleteItemEvent($event, item)">
<button type="button" class="btn btn-link" clrDropdownItem (click)="deleteItemEvent($event, item)" [disabled]="!hasProjectAdminRole">
{{'REPOSITORY.DELETE' | translate}}
</button>
</clr-dropdown-menu>

View File

@ -9,7 +9,7 @@ import { REPOSITORY_GRIDVIEW_TEMPLATE } from './repository-gridview.component.ht
import { REPOSITORY_GRIDVIEW_STYLE } from './repository-gridview.component.css';
import { Repository, SystemInfo, SystemInfoService, RepositoryService, RequestQueryParams, RepositoryItem, TagService } from '../service/index';
import { ErrorHandler } from '../error-handler/error-handler';
import { toPromise, CustomComparator , DEFAULT_PAGE_SIZE, calculatePage, doFiltering, doSorting} from '../utils';
import { toPromise, CustomComparator , DEFAULT_PAGE_SIZE, calculatePage, doFiltering, doSorting, clone} from '../utils';
import { ConfirmationState, ConfirmationTargets, ConfirmationButtons } from '../shared/shared.const';
import { ConfirmationDialogComponent } from '../confirmation-dialog/confirmation-dialog.component';
import { ConfirmationMessage } from '../confirmation-dialog/confirmation-message';
@ -266,12 +266,16 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
provisionItemEvent(evt: any, repo: RepositoryItem): void {
evt.stopPropagation();
this.repoProvisionEvent.emit(repo);
let repoCopy = clone(repo)
repoCopy.name = this.registryUrl + ':443/' + repoCopy.name;
this.repoProvisionEvent.emit(repoCopy);
}
itemAddInfoEvent(evt: any, repo: RepositoryItem): void {
evt.stopPropagation();
this.addInfoEvent.emit(repo);
let repoCopy = clone(repo)
repoCopy.name = this.registryUrl + ':443/' + repoCopy.name;
this.addInfoEvent.emit(repoCopy);
}
deleteItemEvent(evt: any, item: RepositoryItem): void {

View File

@ -285,6 +285,6 @@ export function isEmptyObject(obj: any): boolean {
* @returns {*}
*/
export function clone(srcObj: any): any {
if (!srcObj) return null;
if (!srcObj) { return null };
return JSON.parse(JSON.stringify(srcObj));
}