Merge pull request #12508 from jwangyangls/unified-processing-session-expired

[fix][ui] Operation unified processing session expired
This commit is contained in:
jwangyangls 2020-07-20 17:21:54 +08:00 committed by GitHub
commit 25e0f161ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 64 additions and 36 deletions

View File

@ -186,6 +186,7 @@ export class DistributionInstancesComponent implements OnInit, OnDestroy {
this.translate.get(message).subscribe(errMsg => {
this.msgHandler.error(msg + ': ' + errMsg);
});
this.msgHandler.handleErrorPopupUnauthorized(error);
});
}
);
@ -262,6 +263,8 @@ export class DistributionInstancesComponent implements OnInit, OnDestroy {
forkJoin(...observableLists).subscribe(item => {
this.selectedRow = [];
this.refresh();
}, error => {
this.msgHandler.handleErrorPopupUnauthorized(error);
});
}
}
@ -288,7 +291,7 @@ export class DistributionInstancesComponent implements OnInit, OnDestroy {
this.msgHandler.error(msg + ': ' + errMsg);
});
});
return observableThrowError(message);
return observableThrowError(error);
})
);
}

View File

@ -139,6 +139,7 @@ export class DistributionSetupModalComponent implements OnInit {
this.saveBtnState = ClrLoadingState.ERROR;
});
});
this.msgHandler.handleErrorPopupUnauthorized(err);
}
);
} else {
@ -172,6 +173,7 @@ export class DistributionSetupModalComponent implements OnInit {
this.saveBtnState = ClrLoadingState.ERROR;
});
});
this.msgHandler.handleErrorPopupUnauthorized(err);
}
);
}

View File

@ -143,7 +143,7 @@ export class GroupComponent implements OnInit, OnDestroy {
this.translateService.get(message).subscribe(res =>
operateChanges(operMessage, OperationState.failure, res)
);
return observableThrowError(message);
return observableThrowError(error);
}));
});

View File

@ -166,15 +166,15 @@ export class ChartVersionComponent implements OnInit {
return this.helmChartService
.deleteChartVersion(this.projectName, this.chartName, version.version)
.pipe(map(
() => operateChanges(operateMsg, OperationState.success),
() => operateChanges(operateMsg, OperationState.success)),
catchError( error => {
const message = errorHandlerFn(error);
this.translateService.get(message).subscribe(res =>
operateChanges(operateMsg, OperationState.failure, res)
);
return observableThrowError(message);
return observableThrowError(error);
}
)));
));
}
deleteVersions(versions: HelmChartVersion[]) {
@ -191,6 +191,8 @@ export class ChartVersionComponent implements OnInit {
if (totalCount === successCount) {
this.backEvt.emit();
}
}, error => {
this.errorHandler.error(error);
});
}

View File

@ -204,15 +204,15 @@ export class HelmChartComponent implements OnInit {
return this.helmChartService.deleteHelmChart(this.projectName, chartName)
.pipe(map(
() => operateChanges(operateMsg, OperationState.success),
() => operateChanges(operateMsg, OperationState.success)),
catchError( error => {
const message = errorHandlerFn(error);
this.translateService.get(message).subscribe(res =>
operateChanges(operateMsg, OperationState.failure, res)
);
return observableThrowError(message);
return observableThrowError(error);
}
)));
));
}
deleteCharts(charts: HelmChartItem[]) {
@ -220,12 +220,14 @@ export class HelmChartComponent implements OnInit {
let chartsDelete$ = charts.map(chart => this.deleteChart(chart.name));
forkJoin(chartsDelete$)
.pipe(
catchError(err => observableThrowError(err)),
finalize(() => {
this.refresh();
this.selectedRows = [];
}))
.subscribe(() => { });
.subscribe(() => { }
, error => {
this.errorHandler.error(error);
});
}
downloadLatestVersion(evt?: Event, item?: HelmChartItem) {

View File

@ -217,9 +217,7 @@ export class ListProjectComponent implements OnDestroy {
this.statisticHandler.refresh();
}
}, error => {
this.translate.get("BATCH.DELETED_FAILURE").subscribe(res => {
this.msgHandler.handleError(res);
});
this.msgHandler.handleError(error);
});
}
}
@ -242,7 +240,7 @@ export class ListProjectComponent implements OnDestroy {
this.translateService.get(message).subscribe(res =>
operateChanges(operMessage, OperationState.failure, res)
);
return observableThrowError(message);
return observableThrowError(error);
}));
}

View File

@ -1,4 +1,4 @@
import {of as observableOf, forkJoin} from "rxjs";
import {of as observableOf, forkJoin, throwError} from "rxjs";
import {mergeMap, catchError} from 'rxjs/operators';
import { ChangeDetectorRef, ChangeDetectionStrategy, ViewChild } from "@angular/core";
import { Component, OnInit, Input, Output, EventEmitter } from "@angular/core";
@ -139,9 +139,9 @@ export class AddGroupComponent implements OnInit {
this.translateService.get(message).subscribe(res =>
operateChanges(operMessage, OperationState.failure, res)
);
return observableThrowError(message);
return observableThrowError(error);
}),
catchError(error => observableOf(error.status)), );
catchError(error => observableThrowError(error)), );
});
forkJoin(GroupAdders$)
.subscribe(results => {
@ -150,6 +150,8 @@ export class AddGroupComponent implements OnInit {
} else {
this.added.emit(true);
}
}, error => {
this.msgHandler.handleError(error);
});
this.opened = false;
}

View File

@ -278,7 +278,7 @@ export class MemberComponent implements OnInit, OnDestroy {
this.translate.get(message).subscribe(res =>
operateChanges(operMessage, OperationState.failure, res)
);
return observableThrowError(message);
return observableThrowError(error);
}));
};
@ -289,6 +289,8 @@ export class MemberComponent implements OnInit, OnDestroy {
this.selectedRow = [];
this.batchOps = 'idle';
this.retrieve(this.projectId, "");
}, error => {
this.errorHandler.error(error);
});
}
getMemberPermissionRule(projectId: number): void {

View File

@ -748,10 +748,10 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
} else if (deleteErrorList.length === deleteResult.length) {
// all is error
this.loading = false;
this.errorHandlerService.error(deleteResult[deleteResult.length - 1].error);
this.errorHandlerService.error(deleteResult[deleteResult.length - 1]);
} else {
// some artifact delete success but it has error delete things
this.errorHandlerService.error(deleteErrorList[deleteErrorList.length - 1].error);
this.errorHandlerService.error(deleteErrorList[deleteErrorList.length - 1]);
// if delete one success refresh list
let st: ClrDatagridStateInterface = { page: {from: 0, to: this.pageSize - 1, size: this.pageSize} };
this.clrLoad(st);

View File

@ -242,10 +242,10 @@ export class ArtifactTagComponent implements OnInit, OnDestroy {
} else if (deleteErrorList.length === deleteResult.length) {
// all is error
this.loading = false;
this.errorHandlerService.error(deleteResult[deleteResult.length - 1].error);
this.errorHandlerService.error(deleteResult[deleteResult.length - 1]);
} else {
// some artifact delete success but it has error delete things
this.errorHandlerService.error(deleteErrorList[deleteErrorList.length - 1].error);
this.errorHandlerService.error(deleteErrorList[deleteErrorList.length - 1]);
// if delete one success refresh list
this.currentPage = 1;
let st: ClrDatagridStateInterface = { page: {from: 0, to: this.pageSize - 1, size: this.pageSize} };

View File

@ -242,7 +242,7 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit, OnDestroy
this.translateService.get(message).subscribe(res =>
operateChanges(operMessage, OperationState.failure, res)
);
return observableThrowError(message);
return observableThrowError(error);
}));
}

View File

@ -136,13 +136,15 @@ export class RobotAccountComponent implements OnInit, OnDestroy {
let robotsDelete$ = robots.map(robot => this.delOperate(robot));
forkJoin(robotsDelete$)
.pipe(
catchError(err => observableThrowError(err)),
finalize(() => {
this.retrieve();
this.selectedRow = [];
})
)
.subscribe(() => { });
.subscribe(() => { }
, error => {
this.errorHandler.error(error);
});
}
delOperate(robot: Robot) {
@ -164,7 +166,7 @@ export class RobotAccountComponent implements OnInit, OnDestroy {
this.translate.get(errorMsg).subscribe(res =>
operateChanges(operMessage, OperationState.failure, res)
);
return observableThrowError(errorMsg);
return observableThrowError(error);
}
)
));

View File

@ -259,6 +259,8 @@ export class UserComponent implements OnInit, OnDestroy {
this.selectedRow = [];
this.currentTerm = '';
this.refresh();
}, error => {
this.msgHandler.handleError(error);
});
}
}
@ -287,7 +289,7 @@ export class UserComponent implements OnInit, OnDestroy {
this.translate.get(message).subscribe(res =>
operateChanges(operMessage, OperationState.failure, res)
);
return observableThrowError(message);
return observableThrowError(error);
}));
}

View File

@ -54,7 +54,7 @@ export class UserService {
}
// Handle the related exceptions
handleError(error: any): Observable<any> {
return observableThrowError(error.error || error);
return observableThrowError(error);
}
// Get the user list

View File

@ -184,10 +184,15 @@ export class EndpointComponent implements OnInit, OnDestroy {
targetLists.forEach(target => {
observableLists.push(this.delOperate(target));
});
forkJoin(...observableLists).subscribe((item) => {
forkJoin(...observableLists)
.pipe(finalize(() => {
this.selectedRow = [];
this.reload(true);
this.forceRefreshView(2000);
}))
.subscribe((item) => {
}, error => {
this.errorHandler.error(error);
});
}
}
@ -215,7 +220,7 @@ export class EndpointComponent implements OnInit, OnDestroy {
this.translateService.get(message).subscribe(res =>
operateChanges(operMessage, OperationState.failure, res)
);
return observableThrowError(message);
return observableThrowError(error);
}
));
}

View File

@ -141,6 +141,8 @@ export class LabelComponent implements OnInit {
forkJoin(...observableLists).subscribe((item) => {
this.selectedRow = [];
this.retrieve(this.scope);
}, error => {
this.errorHandler.error(error);
});
}
}
@ -168,7 +170,7 @@ export class LabelComponent implements OnInit {
this.translateService.get(message).subscribe(res =>
operateChanges(operMessage, OperationState.failure, res)
);
return observableThrowError(message);
return observableThrowError(error);
}));
}

View File

@ -203,6 +203,8 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges {
this.reload.emit(true);
let hnd = setInterval(() => this.ref.markForCheck(), 200);
setTimeout(() => clearInterval(hnd), 2000);
}, error => {
this.errorHandler.error(error);
});
}
}
@ -227,7 +229,7 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges {
this.translateService.get(message).subscribe(res =>
operateChanges(operMessage, OperationState.failure, res)
);
return observableThrowError(message);
return observableThrowError(error);
}));
}
}

View File

@ -329,6 +329,8 @@ export class ReplicationComponent implements OnInit, OnDestroy {
if (rule) {
forkJoin(this.replicationOperate(rule)).subscribe(item => {
this.selectOneRule(rule);
}, error => {
this.errorHandler.error(error);
});
}
}
@ -356,7 +358,7 @@ export class ReplicationComponent implements OnInit, OnDestroy {
this.translateService.get(message).subscribe(res =>
operateChanges(operMessage, OperationState.failure, res)
);
return observableThrowError(message);
return observableThrowError(error);
})
);
}
@ -423,14 +425,16 @@ export class ReplicationComponent implements OnInit, OnDestroy {
let ExecutionsStop$ = targets.map(target => this.StopOperate(target));
forkJoin(ExecutionsStop$)
.pipe(
catchError(err => observableThrowError(err)),
finalize(() => {
this.refreshJobs();
this.isStopOnGoing = false;
this.selectedRow = [];
})
)
.subscribe(() => { });
.subscribe(() => { }
, error => {
this.errorHandler.error(error);
});
}
}
@ -457,7 +461,7 @@ export class ReplicationComponent implements OnInit, OnDestroy {
this.translateService.get(message).subscribe(res =>
operateChanges(operMessage, OperationState.failure, res)
);
return observableThrowError(message);
return observableThrowError(error);
})
);
}