Injects GA key via environment variable. Fixes GA service imports.

This commit is contained in:
Aaron Louie 2020-06-01 23:49:21 -04:00
parent cb5b76c92f
commit cb09d4d460
8 changed files with 13 additions and 10 deletions

6
package-lock.json generated
View File

@ -12299,9 +12299,9 @@
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
}, },
"sartography-workflow-lib": { "sartography-workflow-lib": {
"version": "0.0.234", "version": "0.0.235",
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.234.tgz", "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.235.tgz",
"integrity": "sha512-v0IznXGlVaznpIE5jLVNqNWeIr4I22oU2E1yyayAc4eCYC5P8+KnvJYKdW/sUBfH9jKRKUlseMK3jSX7Tt/IPw==" "integrity": "sha512-1M646LRHpyyLoH+QKvtP40Tp+KMwYtlwIpyr5vllin20+zRAAzEj4FMuI/aBGnwpBVcNuLfhql4NMqvgfxIggQ=="
}, },
"sass": { "sass": {
"version": "1.23.3", "version": "1.23.3",

View File

@ -54,7 +54,7 @@
"ngx-file-drop": "^8.0.8", "ngx-file-drop": "^8.0.8",
"ngx-markdown": "^9.0.0", "ngx-markdown": "^9.0.0",
"rxjs": "~6.5.4", "rxjs": "~6.5.4",
"sartography-workflow-lib": "0.0.234", "sartography-workflow-lib": "0.0.235",
"tslib": "^1.11.1", "tslib": "^1.11.1",
"uuid": "^7.0.2", "uuid": "^7.0.2",
"zone.js": "^0.10.3" "zone.js": "^0.10.3"

View File

@ -15,6 +15,7 @@ export class ThisEnvironment implements AppEnvironment {
api = environment.api; api = environment.api;
irbUrl = environment.irbUrl; irbUrl = environment.irbUrl;
title = environment.title; title = environment.title;
googleAnalyticsKey = environment.googleAnalyticsKey;
} }
const routes: Routes = [ const routes: Routes = [

View File

@ -1,6 +1,5 @@
import {Component} from '@angular/core'; import {Component} from '@angular/core';
import {ApiService} from 'sartography-workflow-lib'; import {ApiService, GoogleAnalyticsService} from 'sartography-workflow-lib';
import {GoogleAnalyticsService} from 'sartography-workflow-lib/lib/services/google-analytics.service';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',

View File

@ -59,6 +59,7 @@ export class ThisEnvironment implements AppEnvironment {
api = environment.api; api = environment.api;
irbUrl = environment.irbUrl; irbUrl = environment.irbUrl;
title = environment.title; title = environment.title;
googleAnalyticsKey = environment.googleAnalyticsKey;
} }
/** /**

View File

@ -1,7 +1,6 @@
import {Component, Inject, OnInit} from '@angular/core'; import {Component, Inject} from '@angular/core';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {ApiService, AppEnvironment, isSignedIn, User, UserParams} from 'sartography-workflow-lib'; import {ApiService, AppEnvironment, GoogleAnalyticsService, isSignedIn, User} from 'sartography-workflow-lib';
import {GoogleAnalyticsService} from 'sartography-workflow-lib/lib/services/google-analytics.service';
interface NavItem { interface NavItem {
path?: string; path?: string;
@ -39,8 +38,8 @@ export class NavbarComponent {
private _loadUser() { private _loadUser() {
if (isSignedIn()) { if (isSignedIn()) {
this.api.getUser().subscribe(u => { this.api.getUser().subscribe(u => {
this.googleAnalyticsService.setUser(u.uid);
this.user = u; this.user = u;
this.googleAnalyticsService.setUser(this.user.uid);
this._loadNavLinks(); this._loadNavLinks();
}, error => { }, error => {
localStorage.removeItem('token'); localStorage.removeItem('token');

View File

@ -10,4 +10,5 @@ export const environment: AppEnvironment = {
api: _has(ENV, 'api', '$API_URL') ? ENV.api : 'http://localhost:5000/v1.0', api: _has(ENV, 'api', '$API_URL') ? ENV.api : 'http://localhost:5000/v1.0',
irbUrl: _has(ENV, 'irbUrl', '$IRB_URL') ? ENV.irbUrl : 'http://localhost:5001', irbUrl: _has(ENV, 'irbUrl', '$IRB_URL') ? ENV.irbUrl : 'http://localhost:5001',
title: _has(ENV, 'title', '$TITLE') ? ENV.title : 'Research Ramp-Up Toolkit Configurator', title: _has(ENV, 'title', '$TITLE') ? ENV.title : 'Research Ramp-Up Toolkit Configurator',
googleAnalyticsKey: _has(ENV, 'googleAnalyticsKey', '$GOOGLE_ANALYTICS_KEY') ? ENV.title : 'AIzaSyD-m_e_Ilm7CHA9gY9nqp56vp2drz4VTy4',
}; };

View File

@ -11,9 +11,11 @@
api: '$API_URL', api: '$API_URL',
irbUrl: '$IRB_URL', irbUrl: '$IRB_URL',
baseHref: '$BASE_HREF', baseHref: '$BASE_HREF',
googleAnalyticsKey: '$GOOGLE_ANALYTICS_KEY',
}; };
</script> </script>
<meta content="width=device-width, initial-scale=1" name="viewport"> <meta content="width=device-width, initial-scale=1" name="viewport">
<meta name="google-site-verification" content="KBn1RBc_UR6VF025kfjl_fRlIoLufSHL5JIkwE_xrOc" />
<link href="favicon.ico" rel="icon" type="image/x-icon"> <link href="favicon.ico" rel="icon" type="image/x-icon">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://use.typekit.net/kwp6dli.css"> <link rel="stylesheet" href="https://use.typekit.net/kwp6dli.css">