Merge branch 'feature/google-analytics' into rrt/dev

This commit is contained in:
Aaron Louie 2020-06-02 00:14:02 -04:00
commit 08a87b8917
9 changed files with 21 additions and 10 deletions

View File

@ -32,6 +32,6 @@ RUN echo "pushstate: enabled" > /etc/nginx/html/Staticfile
# then starts/reloads nginx. # then starts/reloads nginx.
ENTRYPOINT ["./entrypoint.sh", \ ENTRYPOINT ["./entrypoint.sh", \
"/etc/nginx/html/index.html,/etc/nginx/conf.d/default.conf", \ "/etc/nginx/html/index.html,/etc/nginx/conf.d/default.conf", \
"PRODUCTION,API_URL,IRB_URL,HOME_ROUTE,BASE_HREF,DEPLOY_URL,PORT0", \ "PRODUCTION,API_URL,IRB_URL,HOME_ROUTE,BASE_HREF,DEPLOY_URL,PORT0,GOOGLE_ANALYTICS_KEY", \
"/etc/nginx/html", \ "/etc/nginx/html", \
"true"] "true"]

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.231", "version": "0.0.235",
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.231.tgz", "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.235.tgz",
"integrity": "sha512-89kkRnTy3Ix9bawDXt0uddMtjGDj7VacARa78PEHR3CSYt/dWTsqAC7x4SJr3IdElzgvPDh9yZqxAUuciMHtLg==" "integrity": "sha512-1M646LRHpyyLoH+QKvtP40Tp+KMwYtlwIpyr5vllin20+zRAAzEj4FMuI/aBGnwpBVcNuLfhql4NMqvgfxIggQ=="
}, },
"sass": { "sass": {
"version": "1.23.3", "version": "1.23.3",

View File

@ -21,7 +21,7 @@
"e2e-wf:db-setup": "docker exec -it backend pipenv run flask load-example-data", "e2e-wf:db-setup": "docker exec -it backend pipenv run flask load-example-data",
"e2e-wf:pb-setup": "docker exec -it pb pipenv run flask db upgrade", "e2e-wf:pb-setup": "docker exec -it pb pipenv run flask db upgrade",
"e2e-wf": "npm run e2e-wf:stop && npm run e2e-wf:clean && npm run e2e-wf:build && npm run e2e-wf:start && npm run e2e-wf:db-upgrade && npm run e2e-wf:db-setup && npm run e2e-wf:pb-setup", "e2e-wf": "npm run e2e-wf:stop && npm run e2e-wf:clean && npm run e2e-wf:build && npm run e2e-wf:start && npm run e2e-wf:db-upgrade && npm run e2e-wf:db-setup && npm run e2e-wf:pb-setup",
"env": "chmod +x ./docker/substitute-env-variables.sh && ./docker/substitute-env-variables.sh src/index.html PRODUCTION,API_URL,IRB_URL,HOME_ROUTE,BASE_HREF,PORT0", "env": "chmod +x ./docker/substitute-env-variables.sh && ./docker/substitute-env-variables.sh src/index.html PRODUCTION,API_URL,IRB_URL,HOME_ROUTE,BASE_HREF,PORT0,GOOGLE_ANALYTICS_KEY",
"ci": "npm run lint && npm run test:coverage && sonar-scanner" "ci": "npm run lint && npm run test:coverage && sonar-scanner"
}, },
"private": true, "private": true,
@ -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.231", "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,5 +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';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
@ -9,7 +9,11 @@ import {ApiService} from 'sartography-workflow-lib';
export class AppComponent { export class AppComponent {
title = 'CR Connect Configuration'; title = 'CR Connect Configuration';
constructor(private apiService: ApiService) { constructor(
private apiService: ApiService,
private googleAnalyticsService: GoogleAnalyticsService
) {
this.googleAnalyticsService.init();
} }
get isSignedIn() { get isSignedIn() {

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,6 +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';
interface NavItem { interface NavItem {
path?: string; path?: string;
@ -25,6 +25,7 @@ export class NavbarComponent {
private router: Router, private router: Router,
private api: ApiService, private api: ApiService,
@Inject('APP_ENVIRONMENT') private environment: AppEnvironment, @Inject('APP_ENVIRONMENT') private environment: AppEnvironment,
private googleAnalyticsService: GoogleAnalyticsService
) { ) {
this._loadUser(); this._loadUser();
this.title = environment.title; this.title = environment.title;
@ -38,6 +39,7 @@ export class NavbarComponent {
if (isSignedIn()) { if (isSignedIn()) {
this.api.getUser().subscribe(u => { this.api.getUser().subscribe(u => {
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 : 'UA-168203235-5',
}; };

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">