mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-18 20:47:51 +00:00
Removing raven dependencies
This commit is contained in:
parent
e76527840b
commit
62e866273b
@ -72,7 +72,6 @@
|
||||
"ngx-electron": "^2.1.1",
|
||||
"node-fetch": "^2.6.0",
|
||||
"notosans-fontface": "^1.1.0",
|
||||
"raven-js": "^3.27.2",
|
||||
"rxjs": "^6.5.3",
|
||||
"rxjs-compat": "^6.5.3",
|
||||
"save-html-as-image": "^1.2.0",
|
||||
|
@ -277,13 +277,11 @@ def build_command(arguments):
|
||||
]
|
||||
|
||||
excludes = [
|
||||
"raven.deprecation", # reported problem in raven package (6.4.0)
|
||||
"distutils", # issue on macOS
|
||||
"tkinter", # issue on Windows
|
||||
]
|
||||
|
||||
packages = [
|
||||
"raven",
|
||||
"psutil",
|
||||
"asyncio",
|
||||
"packaging", # needed for linux
|
||||
|
@ -1,4 +1,3 @@
|
||||
import * as Raven from 'raven-js';
|
||||
import { BrowserModule, Title } from '@angular/platform-browser';
|
||||
import { NgModule, ErrorHandler } from '@angular/core';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
@ -64,7 +63,6 @@ import { ProgressService } from './common/progress/progress.service';
|
||||
import { version } from './version';
|
||||
import { ToasterErrorHandler } from './common/error-handlers/toaster-error-handler';
|
||||
import { environment } from '../environments/environment';
|
||||
import { RavenState } from './common/error-handlers/raven-state-communicator';
|
||||
import { ServerDiscoveryComponent } from './components/servers/server-discovery/server-discovery.component';
|
||||
import { ServerDatabase } from './services/server.database';
|
||||
import { CreateSnapshotDialogComponent } from './components/snapshots/create-snapshot-dialog/create-snapshot-dialog.component';
|
||||
@ -281,15 +279,6 @@ import { ChangeHostnameActionComponent } from './components/project-map/context-
|
||||
import { ChangeHostnameDialogComponent } from './components/project-map/change-hostname-dialog/change-hostname-dialog.component';
|
||||
import { ApplianceInfoDialogComponent } from './components/project-map/new-template-dialog/appliance-info-dialog/appliance-info-dialog.component';
|
||||
|
||||
if (environment.production) {
|
||||
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
|
||||
shouldSendCallback: () => {
|
||||
return RavenState.shouldSend;
|
||||
},
|
||||
release: version
|
||||
}).install();
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
|
@ -1,40 +0,0 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { PersistenceService } from 'angular-persistence';
|
||||
|
||||
import { SettingsService } from '../../services/settings.service';
|
||||
import { RavenErrorHandler } from './raven-error-handler';
|
||||
import { environment } from '../../../environments/environment';
|
||||
|
||||
describe('RavenErrorHandler', () => {
|
||||
let handler: RavenErrorHandler;
|
||||
let settingsService: SettingsService;
|
||||
const inProductionOriginal = environment.production;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [SettingsService, PersistenceService, RavenErrorHandler]
|
||||
});
|
||||
|
||||
settingsService = TestBed.get(SettingsService);
|
||||
handler = TestBed.get(RavenErrorHandler);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
environment.production = inProductionOriginal;
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(handler).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should handle error', () => {
|
||||
settingsService.set('crash_reports', true);
|
||||
environment.production = true;
|
||||
expect(handler.shouldSend()).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should not handle when crash reports are disabled', () => {
|
||||
settingsService.set('crash_reports', false);
|
||||
expect(handler.shouldSend()).toBeFalsy();
|
||||
});
|
||||
});
|
@ -1,20 +0,0 @@
|
||||
import { ErrorHandler, Inject, Injector } from '@angular/core';
|
||||
|
||||
import { SettingsService } from '../../services/settings.service';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { RavenState } from './raven-state-communicator';
|
||||
|
||||
export class RavenErrorHandler implements ErrorHandler {
|
||||
constructor(@Inject(Injector) protected injector: Injector) {}
|
||||
|
||||
handleError(err: any): void {
|
||||
RavenState.shouldSend = this.shouldSend();
|
||||
|
||||
console.error(err.originalError || err);
|
||||
}
|
||||
|
||||
shouldSend() {
|
||||
const settingsService: SettingsService = this.injector.get(SettingsService);
|
||||
return environment.production && settingsService.get('crash_reports');
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
export class RavenStateCommunicator {
|
||||
public shouldSend = true;
|
||||
}
|
||||
|
||||
export var RavenState = new RavenStateCommunicator();
|
@ -2,10 +2,10 @@ import { TestBed } from '@angular/core/testing';
|
||||
import { ToasterService } from '../../services/toaster.service';
|
||||
import { MockedToasterService } from '../../services/toaster.service.spec';
|
||||
import { ToasterErrorHandler } from './toaster-error-handler';
|
||||
import { RavenErrorHandler } from './raven-error-handler';
|
||||
import { SettingsService } from '../../services/settings.service';
|
||||
import { MockedSettingsService } from '../../services/settings.service.spec';
|
||||
import { Injector } from '@angular/core';
|
||||
import { SentryErrorHandler } from './sentry-error-handler';
|
||||
|
||||
class MockedToasterErrorHandler extends ToasterErrorHandler {
|
||||
handleError(err: any): void {
|
||||
@ -23,7 +23,7 @@ describe('ToasterErrorHandler', () => {
|
||||
providers: [
|
||||
{ provide: ToasterService, useClass: MockedToasterService },
|
||||
{ provide: SettingsService, useClass: MockedSettingsService },
|
||||
RavenErrorHandler,
|
||||
SentryErrorHandler,
|
||||
ToasterErrorHandler
|
||||
]
|
||||
});
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { RavenErrorHandler } from './raven-error-handler';
|
||||
import { ToasterService } from '../../services/toaster.service';
|
||||
import { SentryErrorHandler } from './sentry-error-handler';
|
||||
|
||||
|
@ -7823,11 +7823,6 @@ range-parser@^1.2.0, range-parser@^1.2.1, range-parser@~1.2.1:
|
||||
resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031"
|
||||
integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==
|
||||
|
||||
raven-js@^3.27.2:
|
||||
version "3.27.2"
|
||||
resolved "https://registry.npmjs.org/raven-js/-/raven-js-3.27.2.tgz#6c33df952026cd73820aa999122b7b7737a66775"
|
||||
integrity sha512-mFWQcXnhRFEQe5HeFroPaEghlnqy7F5E2J3Fsab189ondqUzcjwSVi7el7F36cr6PvQYXoZ1P2F5CSF2/azeMQ==
|
||||
|
||||
raw-body@2.4.0:
|
||||
version "2.4.0"
|
||||
resolved "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz#a1ce6fb9c9bc356ca52e89256ab59059e13d0332"
|
||||
|
Loading…
Reference in New Issue
Block a user