Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the new Sentry library #4966

Merged
merged 1 commit into from
Jun 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions contribs/gmf/apps/desktop/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import gmfControllersAbstractDesktopController, {AbstractDesktopController}
import appBase from '../appmodule.js';
import EPSG2056 from '@geoblocks/proj/src/EPSG_2056.js';
import EPSG21781 from '@geoblocks/proj/src/EPSG_21781.js';
import Raven from 'raven-js/src/raven.js';
import RavenPluginsAngular from 'raven-js/plugins/angular.js';

if (!window.requestAnimationFrame) {
alert('Your browser is not supported, please update it or use another one. You will be redirected.\n\n'
Expand Down Expand Up @@ -102,14 +100,6 @@ class Controller extends AbstractDesktopController {
gettextCatalog.getString('Add a theme');
gettextCatalog.getString('Add a sub theme');
gettextCatalog.getString('Add a layer');

if ($injector.has('sentryUrl')) {
const options = $injector.has('sentryOptions') ? $injector.get('sentryOptions') : undefined;
const raven = new Raven();
raven.config($injector.get('sentryUrl'), options)
.addPlugin(RavenPluginsAngular)
.install();
}
}
}

Expand Down
10 changes: 0 additions & 10 deletions contribs/gmf/apps/desktop_alt/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import EPSG2056 from '@geoblocks/proj/src/EPSG_2056.js';
import EPSG21781 from '@geoblocks/proj/src/EPSG_21781.js';
import ngeoStatemanagerWfsPermalink from 'ngeo/statemanager/WfsPermalink.js';
import {Circle, Fill, Stroke, Style} from 'ol/style.js';
import Raven from 'raven-js/src/raven.js';
import RavenPluginsAngular from 'raven-js/plugins/angular.js';

if (!window.requestAnimationFrame) {
alert('Your browser is not supported, please update it or use another one. You will be redirected.\n\n'
Expand Down Expand Up @@ -147,14 +145,6 @@ class Controller extends AbstractDesktopController {
* @type {string}
*/
this.bgOpacityOptions = 'orthophoto';

if ($injector.has('sentryUrl')) {
const options = $injector.has('sentryOptions') ? $injector.get('sentryOptions') : undefined;
const raven = new Raven();
raven.config($injector.get('sentryUrl'), options)
.addPlugin(RavenPluginsAngular)
.install();
}
}

/**
Expand Down
10 changes: 0 additions & 10 deletions contribs/gmf/apps/iframe_api/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import gmfControllersAbstractAPIController, {AbstractAPIController}
import appBase from '../appmodule.js';
import EPSG2056 from '@geoblocks/proj/src/EPSG_2056.js';
import EPSG21781 from '@geoblocks/proj/src/EPSG_21781.js';
import Raven from 'raven-js/src/raven.js';
import RavenPluginsAngular from 'raven-js/plugins/angular.js';

if (!window.requestAnimationFrame) {
alert('Your browser is not supported, please update it or use another one. You will be redirected.\n\n'
Expand Down Expand Up @@ -46,14 +44,6 @@ class Controller extends AbstractAPIController {

this.EPSG2056 = EPSG2056;
this.EPSG21781 = EPSG21781;

if ($injector.has('sentryUrl')) {
const options = $injector.has('sentryOptions') ? $injector.get('sentryOptions') : undefined;
const raven = new Raven();
raven.config($injector.get('sentryUrl'), options)
.addPlugin(RavenPluginsAngular)
.install();
}
}
}

Expand Down
10 changes: 0 additions & 10 deletions contribs/gmf/apps/mobile/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import gmfControllersAbstractMobileController, {AbstractMobileController}
import appBase from '../appmodule.js';
import EPSG2056 from '@geoblocks/proj/src/EPSG_2056.js';
import EPSG21781 from '@geoblocks/proj/src/EPSG_21781.js';
import Raven from 'raven-js/src/raven.js';
import RavenPluginsAngular from 'raven-js/plugins/angular.js';

if (!window.requestAnimationFrame) {
alert('Your browser is not supported, please update it or use another one. You will be redirected.\n\n'
Expand Down Expand Up @@ -60,14 +58,6 @@ class Controller extends AbstractMobileController {
* @type {string[]}
*/
this.searchCoordinatesProjections = [EPSG21781, EPSG2056, 'EPSG:4326'];

if ($injector.has('sentryUrl')) {
const options = $injector.has('sentryOptions') ? $injector.get('sentryOptions') : undefined;
const raven = new Raven();
raven.config($injector.get('sentryUrl'), options)
.addPlugin(RavenPluginsAngular)
.install();
}
}
}

Expand Down
10 changes: 0 additions & 10 deletions contribs/gmf/apps/mobile_alt/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import gmfControllersAbstractMobileController, {AbstractMobileController}
import appBase from '../appmodule.js';
import EPSG2056 from '@geoblocks/proj/src/EPSG_2056.js';
import EPSG21781 from '@geoblocks/proj/src/EPSG_21781.js';
import Raven from 'raven-js/src/raven.js';
import RavenPluginsAngular from 'raven-js/plugins/angular.js';

if (!window.requestAnimationFrame) {
alert('Your browser is not supported, please update it or use another one. You will be redirected.\n\n'
Expand Down Expand Up @@ -66,14 +64,6 @@ class Controller extends AbstractMobileController {
* @type {string[]}
*/
this.searchCoordinatesProjections = [EPSG21781, EPSG2056, 'EPSG:4326'];

if ($injector.has('sentryUrl')) {
const options = $injector.has('sentryOptions') ? $injector.get('sentryOptions') : undefined;
const raven = new Raven();
raven.config($injector.get('sentryUrl'), options)
.addPlugin(RavenPluginsAngular)
.install();
}
}
}

Expand Down
10 changes: 0 additions & 10 deletions contribs/gmf/apps/oeedit/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import EPSG21781 from '@geoblocks/proj/src/EPSG_21781.js';
import olCollection from 'ol/Collection.js';
import olLayerVector from 'ol/layer/Vector.js';
import olSourceVector from 'ol/source/Vector.js';
import Raven from 'raven-js/src/raven.js';
import RavenPluginsAngular from 'raven-js/plugins/angular.js';

if (!window.requestAnimationFrame) {
alert('Your browser is not supported, please update it or use another one. You will be redirected.\n\n'
Expand Down Expand Up @@ -201,14 +199,6 @@ class Controller extends AbstractDesktopController {
gettextCatalog.getString('Add a theme');
gettextCatalog.getString('Add a sub theme');
gettextCatalog.getString('Add a layer');

if ($injector.has('sentryUrl')) {
const options = $injector.has('sentryOptions') ? $injector.get('sentryOptions') : undefined;
const raven = new Raven();
raven.config($injector.get('sentryUrl'), options)
.addPlugin(RavenPluginsAngular)
.install();
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions contribs/gmf/src/authentication/Service.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import angular from 'angular';
import ngeoCustomEvent from 'ngeo/CustomEvent.js';
import olEventsEventTarget from 'ol/events/Target.js';
// @ts-ignore
import * as Sentry from '@sentry/browser';


/**
Expand Down Expand Up @@ -249,6 +251,10 @@ export class AuthenticationService extends olEventsEventTarget {
* @private
*/
setUser_(respData, emitEvent) {
Sentry.setUser({
username: respData.username
});

for (const key in this.user_) {
// @ts-ignore: unsupported syntax
this.user_[key] = null;
Expand Down
12 changes: 12 additions & 0 deletions contribs/gmf/src/controllers/AbstractAppController.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import olStyleStroke from 'ol/style/Stroke.js';
import olStyleStyle from 'ol/style/Style.js';
import {ThemeEventType} from 'gmf/theme/Manager.js';
import {getBrowserLanguage} from 'ngeo/utils.js';
// @ts-ignore
import * as Sentry from '@sentry/browser';


/**
Expand Down Expand Up @@ -665,6 +667,16 @@ export function AbstractAppController(config, map, $scope, $injector) {
* @type {?string}
*/
this.displaywindowWidth = '50vw';

if ($injector.has('sentryOptions')) {
const options = $injector.get('sentryOptions');
const tags = options.tags || [];
delete options.tags;
Sentry.init(options);
for (const tag in tags) {
Sentry.setTag(tag, tags[tag]);
}
}
}


Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
"@camptocamp/cesium": "^1.56.1",
"@fortawesome/fontawesome-free": "^5.8.2",
"@geoblocks/proj": "^0.4.0",
"@sentry/browser": "^5.4.2",
"@sentry/types": "^5.4.2",
"@types/angular": "^1.6.54",
"@types/angular-animate": "^1.5.10",
"@types/angular-dynamic-locale": "^0.1.34",
Expand Down Expand Up @@ -115,7 +117,6 @@
"phantomjs-prebuilt": "^2.1.16",
"popper.js": "^1.15.0",
"proj4": "^2.5.0",
"raven-js": "^3.27.1",
"simple-html-tokenizer": "^0.1.1",
"sinon": "^7.3.2",
"svg-inline-loader": "^0.8.0",
Expand Down