Commit 6f7aa68c authored by Yogi_Wang's avatar Yogi_Wang
Browse files

[fix][unauthorized] Support show relogin when unauthorized in popup modal


1.support show relogin when unauthorized  in popup modali
2.change change member role error handle
3.change helm chart service error handle
Signed-off-by: default avatarYogi_Wang <yawang@vmware.com>
parent 6db856c3
...@@ -17,6 +17,7 @@ import { clone } from '../../../lib/utils/utils'; ...@@ -17,6 +17,7 @@ import { clone } from '../../../lib/utils/utils';
import { ConfirmationDialogComponent } from '../../shared/confirmation-dialog/confirmation-dialog.component'; import { ConfirmationDialogComponent } from '../../shared/confirmation-dialog/confirmation-dialog.component';
import { ConfirmationDialogService } from '../../shared/confirmation-dialog/confirmation-dialog.service'; import { ConfirmationDialogService } from '../../shared/confirmation-dialog/confirmation-dialog.service';
import { ConfirmationMessage } from '../../shared/confirmation-dialog/confirmation-message'; import { ConfirmationMessage } from '../../shared/confirmation-dialog/confirmation-message';
import { ErrorHandler } from '../../../lib/utils/error-handler';
describe('AccountSettingsModalComponent', () => { describe('AccountSettingsModalComponent', () => {
let component: AccountSettingsModalComponent; let component: AccountSettingsModalComponent;
...@@ -78,6 +79,7 @@ describe('AccountSettingsModalComponent', () => { ...@@ -78,6 +79,7 @@ describe('AccountSettingsModalComponent', () => {
providers: [ providers: [
ChangeDetectorRef, ChangeDetectorRef,
TranslateService, TranslateService,
ErrorHandler,
{ provide: SessionService, useValue: fakeSessionService }, { provide: SessionService, useValue: fakeSessionService },
{ provide: MessageHandlerService, useValue: fakeMessageHandlerService }, { provide: MessageHandlerService, useValue: fakeMessageHandlerService },
{ provide: SearchTriggerService, useValue: fakeSearchTriggerService }, { provide: SearchTriggerService, useValue: fakeSearchTriggerService },
......
...@@ -8,6 +8,7 @@ import { PasswordSettingService } from '../password-setting.service'; ...@@ -8,6 +8,7 @@ import { PasswordSettingService } from '../password-setting.service';
import { InlineAlertComponent } from '../../../shared/inline-alert/inline-alert.component'; import { InlineAlertComponent } from '../../../shared/inline-alert/inline-alert.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { ErrorHandler } from '../../../../lib/utils/error-handler';
describe('ForgotPasswordComponent', () => { describe('ForgotPasswordComponent', () => {
let component: ForgotPasswordComponent; let component: ForgotPasswordComponent;
...@@ -28,6 +29,7 @@ describe('ForgotPasswordComponent', () => { ...@@ -28,6 +29,7 @@ describe('ForgotPasswordComponent', () => {
schemas: [CUSTOM_ELEMENTS_SCHEMA], schemas: [CUSTOM_ELEMENTS_SCHEMA],
providers: [ providers: [
TranslateService, TranslateService,
ErrorHandler,
{ provide: PasswordSettingService, useValue: fakePasswordSettingService } { provide: PasswordSettingService, useValue: fakePasswordSettingService }
] ]
}).compileComponents(); }).compileComponents();
......
...@@ -10,6 +10,7 @@ import { FormsModule } from '@angular/forms'; ...@@ -10,6 +10,7 @@ import { FormsModule } from '@angular/forms';
import { InlineAlertComponent } from '../../shared/inline-alert/inline-alert.component'; import { InlineAlertComponent } from '../../shared/inline-alert/inline-alert.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { ErrorHandler } from '../../../lib/utils/error-handler';
describe('PasswordSettingComponent', () => { describe('PasswordSettingComponent', () => {
let component: PasswordSettingComponent; let component: PasswordSettingComponent;
...@@ -37,7 +38,8 @@ describe('PasswordSettingComponent', () => { ...@@ -37,7 +38,8 @@ describe('PasswordSettingComponent', () => {
TranslateService, TranslateService,
{ provide: PasswordSettingService, useValue: fakePasswordSettingService }, { provide: PasswordSettingService, useValue: fakePasswordSettingService },
{ provide: SessionService, useValue: fakeSessionService }, { provide: SessionService, useValue: fakeSessionService },
{ provide: MessageHandlerService, useValue: fakeMessageHandlerService } { provide: MessageHandlerService, useValue: fakeMessageHandlerService },
ErrorHandler
], ],
schemas: [CUSTOM_ELEMENTS_SCHEMA], schemas: [CUSTOM_ELEMENTS_SCHEMA],
}).compileComponents(); }).compileComponents();
......
...@@ -9,6 +9,7 @@ import { MessageHandlerService } from '../../../shared/message-handler/message-h ...@@ -9,6 +9,7 @@ import { MessageHandlerService } from '../../../shared/message-handler/message-h
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ClarityModule } from '@clr/angular'; import { ClarityModule } from '@clr/angular';
import { InlineAlertComponent } from '../../../shared/inline-alert/inline-alert.component'; import { InlineAlertComponent } from '../../../shared/inline-alert/inline-alert.component';
import { ErrorHandler } from '../../../../lib/utils/error-handler';
describe('ResetPasswordComponent', () => { describe('ResetPasswordComponent', () => {
let component: ResetPasswordComponent; let component: ResetPasswordComponent;
...@@ -30,6 +31,7 @@ describe('ResetPasswordComponent', () => { ...@@ -30,6 +31,7 @@ describe('ResetPasswordComponent', () => {
TranslateService, TranslateService,
{ provide: PasswordSettingService, useValue: fakePasswordSettingService }, { provide: PasswordSettingService, useValue: fakePasswordSettingService },
{ provide: MessageHandlerService, useValue: fakeMessageHandlerService }, { provide: MessageHandlerService, useValue: fakeMessageHandlerService },
ErrorHandler
], ],
schemas: [CUSTOM_ELEMENTS_SCHEMA] schemas: [CUSTOM_ELEMENTS_SCHEMA]
}).compileComponents(); }).compileComponents();
......
...@@ -10,6 +10,7 @@ import { FormsModule } from '@angular/forms'; ...@@ -10,6 +10,7 @@ import { FormsModule } from '@angular/forms';
import { InlineAlertComponent } from '../../shared/inline-alert/inline-alert.component'; import { InlineAlertComponent } from '../../shared/inline-alert/inline-alert.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { ErrorHandler } from '../../../lib/utils/error-handler';
describe('SignUpComponent', () => { describe('SignUpComponent', () => {
let component: SignUpComponent; let component: SignUpComponent;
...@@ -47,7 +48,8 @@ describe('SignUpComponent', () => { ...@@ -47,7 +48,8 @@ describe('SignUpComponent', () => {
providers: [ providers: [
TranslateService, TranslateService,
{ provide: SessionService, useValue: fakeSessionService }, { provide: SessionService, useValue: fakeSessionService },
{ provide: UserService, useValue: fakeUserService } { provide: UserService, useValue: fakeUserService },
ErrorHandler
], ],
schemas: [CUSTOM_ELEMENTS_SCHEMA] schemas: [CUSTOM_ELEMENTS_SCHEMA]
}).compileComponents(); }).compileComponents();
......
...@@ -20,6 +20,7 @@ import { PasswordSettingService } from '../../account/password-setting/password- ...@@ -20,6 +20,7 @@ import { PasswordSettingService } from '../../account/password-setting/password-
import { SkinableConfig } from '../../services/skinable-config.service'; import { SkinableConfig } from '../../services/skinable-config.service';
import { InlineAlertComponent } from '../../shared/inline-alert/inline-alert.component'; import { InlineAlertComponent } from '../../shared/inline-alert/inline-alert.component';
import { AppConfigService } from "../../services/app-config.service"; import { AppConfigService } from "../../services/app-config.service";
import { ErrorHandler } from '../../../lib/utils/error-handler';
describe('HarborShellComponent', () => { describe('HarborShellComponent', () => {
let component: HarborShellComponent; let component: HarborShellComponent;
...@@ -86,6 +87,7 @@ describe('HarborShellComponent', () => { ...@@ -86,6 +87,7 @@ describe('HarborShellComponent', () => {
{ provide: AccountSettingsModalService, useValue: mockAccountSettingsModalService }, { provide: AccountSettingsModalService, useValue: mockAccountSettingsModalService },
{ provide: PasswordSettingService, useValue: mockPasswordSettingService }, { provide: PasswordSettingService, useValue: mockPasswordSettingService },
{ provide: SkinableConfig, useValue: mockSkinableConfig }, { provide: SkinableConfig, useValue: mockSkinableConfig },
ErrorHandler
], ],
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA] schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA]
}).compileComponents(); }).compileComponents();
......
<div [class.alert-app-level]="!isAppLevel" [hidden]="!globalMessageOpened"> <div [class.alert-app-level]="!isAppLevel" [hidden]="!globalMessageOpened">
<clr-alert [clrAlertType]="globalMessage.type" [clrAlertAppLevel]="isAppLevel" [(clrAlertClosed)]="!globalMessageOpened" (clrAlertClosedChange)="onClose()"> <clr-alert [clrAlertType]="globalMessage.type" [clrAlertClosable]="!needAuth" [clrAlertAppLevel]="isAppLevel" [(clrAlertClosed)]="!globalMessageOpened" (clrAlertClosedChange)="onClose()">
<div class="alert-item"> <div class="alert-item">
<span class="alert-text">{{message}}</span> <span class="alert-text">{{message}}</span>
<div class="alert-actions alert-style" *ngIf="needAuth"> <div class="alert-actions alert-style" *ngIf="needAuth">
......
...@@ -5,5 +5,5 @@ ...@@ -5,5 +5,5 @@
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: 10000; z-index: 1000;
} }
\ No newline at end of file
...@@ -126,7 +126,7 @@ export class MessageComponent implements OnInit, OnDestroy { ...@@ -126,7 +126,7 @@ export class MessageComponent implements OnInit, OnDestroy {
} }
signIn(): void { signIn(): void {
this.router.navigateByUrl(CommonRoutes.EMBEDDED_SIGN_IN); this.router.navigate([ CommonRoutes.EMBEDDED_SIGN_IN ], {queryParams: {redirect_url: this.router.url}});
} }
onClose() { onClose() {
......
...@@ -10,6 +10,7 @@ import { ProjectService } from "../../../lib/services"; ...@@ -10,6 +10,7 @@ import { ProjectService } from "../../../lib/services";
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { delay } from 'rxjs/operators'; import { delay } from 'rxjs/operators';
import { ErrorHandler } from '../../../lib/utils/error-handler';
describe('CreateProjectComponent', () => { describe('CreateProjectComponent', () => {
let component: CreateProjectComponent; let component: CreateProjectComponent;
...@@ -47,6 +48,7 @@ describe('CreateProjectComponent', () => { ...@@ -47,6 +48,7 @@ describe('CreateProjectComponent', () => {
TranslateService, TranslateService,
{provide: ProjectService, useValue: mockProjectService}, {provide: ProjectService, useValue: mockProjectService},
{provide: MessageHandlerService, useValue: mockMessageHandlerService}, {provide: MessageHandlerService, useValue: mockMessageHandlerService},
ErrorHandler
] ]
}).compileComponents(); }).compileComponents();
})); }));
......
...@@ -105,7 +105,7 @@ export class HelmChartDefaultService extends HelmChartService { ...@@ -105,7 +105,7 @@ export class HelmChartDefaultService extends HelmChartService {
private handleErrorObservable(error: HttpErrorResponse) { private handleErrorObservable(error: HttpErrorResponse) {
return observableThrowError(error.error || error); return observableThrowError(error);
} }
public getHelmCharts( public getHelmCharts(
......
...@@ -12,6 +12,7 @@ import { UserService } from '../../../user/user.service'; ...@@ -12,6 +12,7 @@ import { UserService } from '../../../user/user.service';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { MessageHandlerService } from '../../../shared/message-handler/message-handler.service'; import { MessageHandlerService } from '../../../shared/message-handler/message-handler.service';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { ErrorHandler } from '../../../../lib/utils/error-handler';
describe('AddMemberComponent', () => { describe('AddMemberComponent', () => {
let component: AddMemberComponent; let component: AddMemberComponent;
...@@ -54,6 +55,7 @@ describe('AddMemberComponent', () => { ...@@ -54,6 +55,7 @@ describe('AddMemberComponent', () => {
{ provide: MemberService, useValue: mockMemberService }, { provide: MemberService, useValue: mockMemberService },
{ provide: UserService, useValue: mockUserService }, { provide: UserService, useValue: mockUserService },
{ provide: MessageHandlerService, useValue: mockMessageHandlerService }, { provide: MessageHandlerService, useValue: mockMessageHandlerService },
ErrorHandler,
{ {
provide: ActivatedRoute, useValue: { provide: ActivatedRoute, useValue: {
RouterparamMap: of({ get: (key) => 'value' }), RouterparamMap: of({ get: (key) => 'value' }),
......
...@@ -37,8 +37,7 @@ import {User} from "../../../user/user"; ...@@ -37,8 +37,7 @@ import {User} from "../../../user/user";
import {Project} from "../../project"; import {Project} from "../../project";
import { Member } from '../member'; import { Member } from '../member';
import { MemberService } from '../member.service'; import { MemberService } from '../member.service';
import { HttpResponseBase } from '@angular/common/http'; import { ErrorHandler } from '../../../../lib/utils/error-handler';
import { errorHandler } from "../../../../lib/utils/shared/shared.utils";
@Component({ @Component({
...@@ -80,6 +79,7 @@ export class AddMemberComponent implements AfterViewChecked, OnInit, OnDestroy { ...@@ -80,6 +79,7 @@ export class AddMemberComponent implements AfterViewChecked, OnInit, OnDestroy {
constructor(private memberService: MemberService, constructor(private memberService: MemberService,
private userService: UserService, private userService: UserService,
private errorHandle: ErrorHandler,
private messageHandlerService: MessageHandlerService, private messageHandlerService: MessageHandlerService,
private translateService: TranslateService, private translateService: TranslateService,
private route: ActivatedRoute, private route: ActivatedRoute,
...@@ -158,22 +158,10 @@ export class AddMemberComponent implements AfterViewChecked, OnInit, OnDestroy { ...@@ -158,22 +158,10 @@ export class AddMemberComponent implements AfterViewChecked, OnInit, OnDestroy {
() => { () => {
this.messageHandlerService.showSuccess('MEMBER.ADDED_SUCCESS'); this.messageHandlerService.showSuccess('MEMBER.ADDED_SUCCESS');
this.added.emit(true); this.added.emit(true);
// this.addMemberOpened = false;
}, },
error => { error => {
if (error instanceof HttpResponseBase) { this.errorHandle.error(error);
if (this.messageHandlerService.isAppLevel(error)) {
this.messageHandlerService.handleError(error);
// this.addMemberOpened = false;
} else {
let errorMessageKey: string = errorHandler(error);
this.translateService
.get(errorMessageKey)
.subscribe(errorMessage => this.messageHandlerService.handleError(errorMessage));
}
}
}); });
// this.addMemberOpened = false;
} }
selectedName(username: string) { selectedName(username: string) {
......
...@@ -202,7 +202,7 @@ export class MemberComponent implements OnInit, OnDestroy { ...@@ -202,7 +202,7 @@ export class MemberComponent implements OnInit, OnDestroy {
.changeMemberRole(projectId, member.id, roleId) .changeMemberRole(projectId, member.id, roleId)
.pipe(map(() => this.batchChangeRoleInfos[member.id] = 'done') .pipe(map(() => this.batchChangeRoleInfos[member.id] = 'done')
, catchError(error => { , catchError(error => {
this.messageHandlerService.handleError(error + ": " + member.entity_name); this.messageHandlerService.handleError(error);
return observableThrowError(error); return observableThrowError(error);
})); }));
}; };
......
...@@ -9,6 +9,8 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; ...@@ -9,6 +9,8 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
import { NoopAnimationsModule } from "@angular/platform-browser/animations"; import { NoopAnimationsModule } from "@angular/platform-browser/animations";
import { InlineAlertComponent } from "../../../../shared/inline-alert/inline-alert.component"; import { InlineAlertComponent } from "../../../../shared/inline-alert/inline-alert.component";
import { ImmutableRetentionRule } from "../../tag-retention/retention"; import { ImmutableRetentionRule } from "../../tag-retention/retention";
import { ErrorHandler } from '../../../../../lib/utils/error-handler';
describe('AddRuleComponent', () => { describe('AddRuleComponent', () => {
let component: AddRuleComponent; let component: AddRuleComponent;
let fixture: ComponentFixture<AddRuleComponent>; let fixture: ComponentFixture<AddRuleComponent>;
...@@ -36,7 +38,9 @@ describe('AddRuleComponent', () => { ...@@ -36,7 +38,9 @@ describe('AddRuleComponent', () => {
] ]
} }
}; };
const mockErrorHandler = {
handleErrorPopupUnauthorized: () => {}
}
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [AddRuleComponent, InlineAlertComponent], declarations: [AddRuleComponent, InlineAlertComponent],
...@@ -51,7 +55,11 @@ describe('AddRuleComponent', () => { ...@@ -51,7 +55,11 @@ describe('AddRuleComponent', () => {
TranslateModule.forRoot() TranslateModule.forRoot()
], ],
providers: [ providers: [
ImmutableTagService ImmutableTagService,
ErrorHandler,
{
provide: ErrorHandler, useValue: mockErrorHandler
}
] ]
}) })
.compileComponents(); .compileComponents();
......
...@@ -11,10 +11,12 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; ...@@ -11,10 +11,12 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
import { TagRetentionService } from "../tag-retention.service"; import { TagRetentionService } from "../tag-retention.service";
import { InlineAlertComponent } from "../../../../shared/inline-alert/inline-alert.component"; import { InlineAlertComponent } from "../../../../shared/inline-alert/inline-alert.component";
import { delay } from 'rxjs/operators'; import { delay } from 'rxjs/operators';
import { ErrorHandler } from '../../../../../lib/utils/error-handler';
describe('AddRuleComponent', () => { describe('AddRuleComponent', () => {
let component: AddRuleComponent; let component: AddRuleComponent;
let fixture: ComponentFixture<AddRuleComponent>; let fixture: ComponentFixture<AddRuleComponent>;
const mockTagRetentionService = { }; const mockTagRetentionService = { };
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
schemas: [ schemas: [
...@@ -32,6 +34,7 @@ describe('AddRuleComponent', () => { ...@@ -32,6 +34,7 @@ describe('AddRuleComponent', () => {
declarations: [AddRuleComponent, InlineAlertComponent], declarations: [AddRuleComponent, InlineAlertComponent],
providers: [ providers: [
TranslateService, TranslateService,
ErrorHandler,
{ provide: TagRetentionService, useValue: mockTagRetentionService }, { provide: TagRetentionService, useValue: mockTagRetentionService },
] ]
}) })
......
...@@ -11,6 +11,7 @@ import { MessageHandlerService } from "../../../shared/message-handler/message-h ...@@ -11,6 +11,7 @@ import { MessageHandlerService } from "../../../shared/message-handler/message-h
import { of } from 'rxjs'; import { of } from 'rxjs';
import { Webhook } from "../webhook"; import { Webhook } from "../webhook";
import { InlineAlertComponent } from "../../../shared/inline-alert/inline-alert.component"; import { InlineAlertComponent } from "../../../shared/inline-alert/inline-alert.component";
import { ErrorHandler } from '../../../../lib/utils/error-handler';
describe('AddWebhookFormComponent', () => { describe('AddWebhookFormComponent', () => {
let component: AddWebhookFormComponent; let component: AddWebhookFormComponent;
...@@ -91,6 +92,7 @@ describe('AddWebhookFormComponent', () => { ...@@ -91,6 +92,7 @@ describe('AddWebhookFormComponent', () => {
TranslateService, TranslateService,
{ provide: WebhookService, useValue: mockWebhookService }, { provide: WebhookService, useValue: mockWebhookService },
{ provide: MessageHandlerService, useValue: mockMessageHandlerService }, { provide: MessageHandlerService, useValue: mockMessageHandlerService },
ErrorHandler
] ]
......
...@@ -18,6 +18,8 @@ import { InlineAlertComponent } from "../../shared/inline-alert/inline-alert.com ...@@ -18,6 +18,8 @@ import { InlineAlertComponent } from "../../shared/inline-alert/inline-alert.com
import { AddWebhookComponent } from "./add-webhook/add-webhook.component"; import { AddWebhookComponent } from "./add-webhook/add-webhook.component";
import { ConfirmationDialogComponent } from "../../../lib/components/confirmation-dialog"; import { ConfirmationDialogComponent } from "../../../lib/components/confirmation-dialog";
import { UserPermissionService } from '../../../lib/services'; import { UserPermissionService } from '../../../lib/services';
import { ErrorHandler } from '../../../lib/utils/error-handler';
describe('WebhookComponent', () => { describe('WebhookComponent', () => {
let component: WebhookComponent; let component: WebhookComponent;
let fixture: ComponentFixture<WebhookComponent>; let fixture: ComponentFixture<WebhookComponent>;
...@@ -121,6 +123,7 @@ describe('WebhookComponent', () => { ...@@ -121,6 +123,7 @@ describe('WebhookComponent', () => {
], ],
providers: [ providers: [
TranslateService, TranslateService,
ErrorHandler,
{ provide: WebhookService, useValue: mockWebhookService }, { provide: WebhookService, useValue: mockWebhookService },
{ provide: MessageHandlerService, useValue: mockMessageHandlerService }, { provide: MessageHandlerService, useValue: mockMessageHandlerService },
{ provide: ActivatedRoute, useValue: mockActivatedRoute }, { provide: ActivatedRoute, useValue: mockActivatedRoute },
......
...@@ -8,6 +8,9 @@ import { FormsModule } from '@angular/forms'; ...@@ -8,6 +8,9 @@ import { FormsModule } from '@angular/forms';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { HttpClientTestingModule } from '@angular/common/http/testing'; import { HttpClientTestingModule } from '@angular/common/http/testing';
import { MessageHandlerService } from '../message-handler/message-handler.service';
import { ErrorHandler } from '../../../lib/utils/error-handler';
describe('InlineAlertComponent', () => { describe('InlineAlertComponent', () => {
let component: InlineAlertComponent; let component: InlineAlertComponent;
let fixture: ComponentFixture<InlineAlertComponent>; let fixture: ComponentFixture<InlineAlertComponent>;
...@@ -28,7 +31,8 @@ describe('InlineAlertComponent', () => { ...@@ -28,7 +31,8 @@ describe('InlineAlertComponent', () => {
], ],
declarations: [InlineAlertComponent], declarations: [InlineAlertComponent],
providers: [ providers: [
TranslateService TranslateService,
ErrorHandler
] ]
}) })
.compileComponents(); .compileComponents();
......
...@@ -15,6 +15,8 @@ import { Component, Output, EventEmitter } from '@angular/core'; ...@@ -15,6 +15,8 @@ import { Component, Output, EventEmitter } from '@angular/core';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { Subscription } from "rxjs"; import { Subscription } from "rxjs";
import { errorHandler } from "../../../lib/utils/shared/shared.utils"; import { errorHandler } from "../../../lib/utils/shared/shared.utils";
import { MessageHandlerService } from '../message-handler/message-handler.service';
import { ErrorHandler } from '../../../lib/utils/error-handler';
@Component({ @Component({
selector: 'inline-alert', selector: 'inline-alert',
...@@ -35,7 +37,9 @@ export class InlineAlertComponent { ...@@ -35,7 +37,9 @@ export class InlineAlertComponent {
@Output() confirmEvt = new EventEmitter<boolean>(); @Output() confirmEvt = new EventEmitter<boolean>();
@Output() closeEvt = new EventEmitter<boolean>(); @Output() closeEvt = new EventEmitter<boolean>();
constructor(private translate: TranslateService) { } constructor(private translate: TranslateService,
private errHandler: ErrorHandler,
) { }
public get errorMessage(): string { public get errorMessage(): string {
return this.displayedText; return this.displayedText;
...@@ -47,7 +51,7 @@ export class InlineAlertComponent { ...@@ -47,7 +51,7 @@ export class InlineAlertComponent {
if (this.displayedText) { if (this.displayedText) {
this.translate.get(this.displayedText).subscribe((res: string) => this.displayedText = res); this.translate.get(this.displayedText).subscribe((res: string) => this.displayedText = res);
} }
this.errHandler.handleErrorPopupUnauthorized(error);
this.inlineAlertType = 'danger'; this.inlineAlertType = 'danger';
this.showCancelAction = false; this.showCancelAction = false;
this.inlineAlertClosable = true; this.inlineAlertClosable = true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment