mirror of
https://github.com/goharbor/harbor
synced 2024-09-20 19:07:40 +00:00
Fix redirection issue for registries (#14270)
Signed-off-by: sshijun <sshijun@vmware.com>
This commit is contained in:
parent
dfe360040b
commit
617ebb4045
|
@ -4,7 +4,7 @@ import {
|
||||||
Subscription,
|
Subscription,
|
||||||
Observable,
|
Observable,
|
||||||
forkJoin,
|
forkJoin,
|
||||||
throwError as observableThrowError
|
throwError as observableThrowError, of
|
||||||
} from 'rxjs';
|
} from 'rxjs';
|
||||||
import { DistributionSetupModalComponent } from '../distribution-setup-modal/distribution-setup-modal.component';
|
import { DistributionSetupModalComponent } from '../distribution-setup-modal/distribution-setup-modal.component';
|
||||||
import { OperationService } from '../../../../shared/components/operation/operation.service';
|
import { OperationService } from '../../../../shared/components/operation/operation.service';
|
||||||
|
@ -25,6 +25,7 @@ import { ConfirmationDialogService } from "../../../global-confirmation-dialog/c
|
||||||
import { ConfirmationButtons, ConfirmationState, ConfirmationTargets } from "../../../../shared/entities/shared.const";
|
import { ConfirmationButtons, ConfirmationState, ConfirmationTargets } from "../../../../shared/entities/shared.const";
|
||||||
import { errorHandler } from "../../../../shared/units/shared.utils";
|
import { errorHandler } from "../../../../shared/units/shared.utils";
|
||||||
import { ConfirmationMessage } from "../../../global-confirmation-dialog/confirmation-message";
|
import { ConfirmationMessage } from "../../../global-confirmation-dialog/confirmation-message";
|
||||||
|
import { HttpErrorResponse } from "@angular/common/http";
|
||||||
|
|
||||||
interface MultiOperateData {
|
interface MultiOperateData {
|
||||||
operation: string;
|
operation: string;
|
||||||
|
@ -203,7 +204,6 @@ export class DistributionInstancesComponent implements OnInit, OnDestroy {
|
||||||
this.translate.get(message).subscribe(errMsg => {
|
this.translate.get(message).subscribe(errMsg => {
|
||||||
this.msgHandler.error(msg + ': ' + errMsg);
|
this.msgHandler.error(msg + ': ' + errMsg);
|
||||||
});
|
});
|
||||||
this.msgHandler.handleErrorPopupUnauthorized(error);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -277,11 +277,37 @@ export class DistributionInstancesComponent implements OnInit, OnDestroy {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
forkJoin(...observableLists).subscribe(item => {
|
forkJoin(...observableLists).subscribe(resArr => {
|
||||||
|
if (data.operation === 'delete') {
|
||||||
|
let error;
|
||||||
|
let errorCount: number = 0;
|
||||||
|
if (resArr && resArr.length) {
|
||||||
|
resArr.forEach(item => {// only record the last error
|
||||||
|
if (item instanceof HttpErrorResponse) {
|
||||||
|
error = errorHandler(item);
|
||||||
|
errorCount += 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (errorCount === 0) {// All successful
|
||||||
|
this.translate.get('DISTRIBUTION.DELETED_SUCCESS').subscribe(msg => {
|
||||||
|
this.msgHandler.info(msg);
|
||||||
|
});
|
||||||
this.selectedRow = [];
|
this.selectedRow = [];
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
} else if (resArr && resArr.length === errorCount && error) {// All failed
|
||||||
|
this.msgHandler.handleError(error);
|
||||||
|
} else if (error) { // Partly failed
|
||||||
|
this.msgHandler.handleError(error);
|
||||||
|
this.selectedRow = [];
|
||||||
|
this.refresh();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.selectedRow = [];
|
||||||
|
this.refresh();
|
||||||
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
this.msgHandler.handleErrorPopupUnauthorized(error);
|
this.msgHandler.error(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -297,18 +323,16 @@ export class DistributionInstancesComponent implements OnInit, OnDestroy {
|
||||||
map(() => {
|
map(() => {
|
||||||
this.translate.get('DISTRIBUTION.DELETED_SUCCESS').subscribe(msg => {
|
this.translate.get('DISTRIBUTION.DELETED_SUCCESS').subscribe(msg => {
|
||||||
operateChanges(operMessage, OperationState.success);
|
operateChanges(operMessage, OperationState.success);
|
||||||
this.msgHandler.info(msg);
|
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
catchError(error => {
|
catchError(error => {
|
||||||
const message = errorHandler(error);
|
const message = errorHandler(error);
|
||||||
this.translate.get('DISTRIBUTION.DELETED_FAILED').subscribe(msg => {
|
this.translate.get('DISTRIBUTION.DELETED_FAILED').subscribe(msg => {
|
||||||
operateChanges(operMessage, OperationState.failure, msg);
|
|
||||||
this.translate.get(message).subscribe(errMsg => {
|
this.translate.get(message).subscribe(errMsg => {
|
||||||
this.msgHandler.error(msg + ': ' + errMsg);
|
operateChanges(operMessage, OperationState.failure, msg + ': ' + errMsg);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return observableThrowError(error);
|
return of(error);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ export class TotalReplicationPageComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
goRegistry(): void {
|
goRegistry(): void {
|
||||||
this.router.navigate(['../registries'], { relativeTo: this.activeRoute });
|
this.router.navigate(['harbor', 'registries']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public get isSystemAdmin(): boolean {
|
public get isSystemAdmin(): boolean {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user