Skip to content

Commit

Permalink
Add basic link and button tracking to the most common links.
Browse files Browse the repository at this point in the history
  • Loading branch information
newswangerd committed Aug 2, 2018
1 parent 41f663a commit 3a65c94
Show file tree
Hide file tree
Showing 21 changed files with 76 additions and 48 deletions.
5 changes: 3 additions & 2 deletions galaxyui/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
[pinnableMenus]="true"
[showBadges]="true"
[showIcons]="true"
[updateActiveItemsOnClick]="false">
[updateActiveItemsOnClick]="false"
(onItemClickEvent)='onItemClickEvent($event)'>
<div>
<ul class="nav navbar-nav navbar-right navbar-iconic">
<li class="dropdown" dropdown>
Expand All @@ -27,7 +28,7 @@
</ul>
</li>
<li class="navbar-iconic">
<a class="nav-item-iconic nav-link" [routerLink]="['/login']" [queryParams]="{error: false}" *ngIf="!authenticated"><span class="fa fa-sign-in"></span> &nbsp;Login</a>
<a appLogEvent class="nav-item-iconic nav-link" [routerLink]="['/login']" [queryParams]="{error: false}" *ngIf="!authenticated"><span class="fa fa-sign-in"></span> &nbsp;Login</a>
</li>
<li class="dropdown" dropdown *ngIf="authenticated">
<a class="dropdown-toggle nav-item-iconic"
Expand Down
12 changes: 4 additions & 8 deletions galaxyui/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { NotificationService } from 'patternfly-ng/notification/notification-se

import { AuthService } from './auth/auth.service';
import { ApiRootService } from './resources/api-root/api-root.service';
import { EventLoggerService } from './resources/logger/event-logger.service';

import {
BodyCommand,
Expand All @@ -59,6 +60,7 @@ export class AppComponent implements OnInit {
private modalService: BsModalService,
private notificationService: NotificationService,
private pfBodyService: PFBodyService,
private eventLoggerService: EventLoggerService,
) {
this.router.events.subscribe(event => {
if (event instanceof NavigationEnd || event instanceof NavigationStart) {
Expand Down Expand Up @@ -213,13 +215,7 @@ export class AppComponent implements OnInit {
this.removeNavButtons();
}

onItemClicked($event: NavigationItemConfig): void {
console.log('item clicked');
console.log($event);
}

onNavigation($event: NavigationItemConfig): void {
console.log('navigation started');
console.log($event);
onItemClickEvent($event: any): void {
this.eventLoggerService.logLink($event.title, $event.url);
}
}
2 changes: 1 addition & 1 deletion galaxyui/src/app/authors/authors.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<div class="list-pf-content-wrapper">
<div class="list-pf-main-content">
<div class="list-pf-title">
<a [routerLink]="['/', item.name]" class="title-link"
<a appLogEvent [routerLink]="['/', item.name]" class="title-link"
tooltip="View author profile and content">{{item.name}}</a>
</div>
<div class="list-pf-description text-overflow-pf">{{item.description }}</div>
Expand Down
10 changes: 5 additions & 5 deletions galaxyui/src/app/authors/detail/author-detail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
<p *ngIf="namespace.company">{{ namespace.company }}</p>
<p *ngIf="namespace.location"><i class="fa fa-map-marker"></i> {{ namespace.location }}</p>
<p *ngIf="namespace.email">
<a [href]="'mailto:'+ namespace.email" tooltip="Send an email">
<a [appLogEvent]="namespace.email" [href]="'mailto:'+ namespace.email" tooltip="Send an email">
<i class="fa fa-envelope"></i> {{ namespace.email }}
</a>
</p>
<p *ngIf="namespace.html_url">
<a [href]="namespace.html_url"
<a [appLogEvent]="namespace.html_url" [href]="namespace.html_url"
target="_blank"
tooltip="View site in new browser window or tab">
<i class="fa fa-link"></i> {{ namespace.html_url }}
Expand All @@ -47,7 +47,7 @@
</div>
<div class="col-sm-3">
<div class="namespace namespace-header-right" *ngIf="namespace.html_url">
<a target="_blank" href="{{ namespace.html_url }}" class="btn btn-default primary-action"><span class="fa fa-github"></span> View on GitHub</a>
<a appLogEvent="View On GitHub" target="_blank" href="{{ namespace.html_url }}" class="btn btn-default primary-action"><span class="fa fa-github"></span> View on GitHub</a>
</div>
</div>
</div>
Expand Down Expand Up @@ -79,7 +79,7 @@
<div class="list-pf-content-wrapper">
<div class="list-pf-main-content">
<div class="list-pf-title">
<a [routerLink]="['/', item.summary_fields['namespace']['name'], item.name]"
<a appLogEvent [routerLink]="['/', item.summary_fields['namespace']['name'], item.name]"
class="repo-name" tooltip="View content details">{{ item.name }}</a>
</div>
<div class="list-pf-description">{{ item.description }}</div>
Expand Down Expand Up @@ -111,7 +111,7 @@

<div *ngIf="item.travis_build_url">
<div class="travis">
<a href="{{ item.travis_build_url }}" target="_blank" tooltip="View Travis build output. Opens in new tab or window.">
<a appLogEvent="travis" href="{{ item.travis_build_url }}" target="_blank" tooltip="View Travis build output. Opens in new tab or window.">
&nbsp; <img src="{{ item.travis_status_url }}"
class="travis-status-img" title="Travis Build Status" />
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { Router } from '@angular/router';

import { ActionConfig } from 'patternfly-ng/action/action-config';

import { Repository } from '../../../resources/repositories/repository';
import { EventLoggerService } from '../../../resources/logger/event-logger.service';
import { Repository } from '../../../resources/repositories/repository';

@Component({
selector: 'author-detail-actions',
Expand All @@ -18,7 +19,8 @@ import { Repository } from '../../../resources/repositories/repository';
export class DetailActionsComponent implements OnInit {

constructor(
private router: Router
private router: Router,
private eventLoggerService: EventLoggerService,
) {}

_repository: Repository;
Expand All @@ -45,7 +47,7 @@ export class DetailActionsComponent implements OnInit {
title: 'View SCM Repository',
tooltip: 'Opens the SCM repository in new browser window or tab'
}, {
disabled: (this._repository.issue_tracker_url) ? true : false,
disabled: (!this.repository.issue_tracker_url) ? true : false,
id: 'issueLog',
title: 'Visit the Issue Log',
tooltip: 'Opens the Issue Log in new browser window or tab'
Expand All @@ -56,13 +58,17 @@ export class DetailActionsComponent implements OnInit {
handleAction($event) {
switch ($event.id) {
case 'more':
const url = `/${ this.repository.summary_fields['namespace']['name'] }/${ this.repository.name }`;
this.eventLoggerService.logLink('View Content', url);
this.router.navigate(['/', this.repository.summary_fields['namespace']['name'],
this.repository.name]);
break;
case 'scmView':
this.eventLoggerService.logLink('View SCM Repository', this.repository.external_url);
window.open(this.repository.external_url, '_blank');
break;
case 'issueLog':
this.eventLoggerService.logLink('Visit the Issue Log', this.repository.issue_tracker_url);
window.open(this.repository.issue_tracker_url, '_blank');
break;
}
Expand Down
2 changes: 1 addition & 1 deletion galaxyui/src/app/home/carousel/carousel.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<i class="fa fa-star fa-2x"></i>
</span>
<span class="header-text">Featured Partners</span>
<a [routerLink]="['/','search']">View All Partners</a>
<a appLogEvent [routerLink]="['/','search']">View All Partners</a>
</div>
</ng-template>
<div class="partner-carousel">
Expand Down
7 changes: 5 additions & 2 deletions galaxyui/src/app/home/carousel/carousel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
Router
} from '@angular/router';

import { Namespace } from '../../resources/namespaces/namespace';
import { EventLoggerService } from '../../resources/logger/event-logger.service';
import { Namespace } from '../../resources/namespaces/namespace';

@Component({
selector: 'carousel-component',
Expand Down Expand Up @@ -39,7 +40,8 @@ export class CarouselComponent implements OnInit {
_vendors: Namespace[] = [];

constructor(
private router: Router
private router: Router,
private eventLoggerService: EventLoggerService,
) { }

ngOnInit() { }
Expand All @@ -57,6 +59,7 @@ export class CarouselComponent implements OnInit {
'vendor': 'true',
'namespaces': vendor.name
};
this.eventLoggerService.logLink(vendor.name, '/search');
this.router.navigate(['/', 'search'], { queryParams: params });
}
}
8 changes: 7 additions & 1 deletion galaxyui/src/app/home/popular/popular.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class Category {
iconClass: string;
}

import { EventLoggerService } from '../../resources/logger/event-logger.service';

@Component({
selector: 'popular-component',
templateUrl: './popular.component.html',
Expand All @@ -26,7 +28,8 @@ export class PopularComponent implements OnInit {
categories: Category[] = [];

constructor(
private router: Router
private router: Router,
private eventLoggerService: EventLoggerService,
) {}

ngOnInit() {
Expand Down Expand Up @@ -81,6 +84,9 @@ export class PopularComponent implements OnInit {
} else {
params['tags'] = category.name.toLowerCase();
}

this.eventLoggerService.logLink(category.name, '/search');

this.router.navigate(['/', 'search'], {queryParams: params});
}

Expand Down
2 changes: 1 addition & 1 deletion galaxyui/src/app/login/login.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[config]="config">
<div class="custom-blank-slate-card">
<div class="custom-blank-slate-icon">
<a [routerLink]="" (click)="login()"><i class="fa fa-github"></i></a>
<a appLogEvent="GitHub Login" [routerLink]="" (click)="login()"><i class="fa fa-github"></i></a>
</div>
<h3>{{ connectingMsg || msgText }}</h3>
</div>
Expand Down
5 changes: 4 additions & 1 deletion galaxyui/src/app/login/login.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ import {
CardModule
} from 'patternfly-ng/card/basic-card/card.module';

import { SharedModule } from '../shared/shared.module';

@NgModule({
declarations: [
LoginComponent
],
imports: [
CardModule,
LoginRoutingModule
LoginRoutingModule,
SharedModule
],
providers: []
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import {
import { Action } from 'patternfly-ng/action/action';
import { ActionConfig } from 'patternfly-ng/action/action-config';

import { AuthService } from '../../../auth/auth.service';
import { Namespace } from '../../../resources/namespaces/namespace';
import { AuthService } from '../../../auth/auth.service';
import { EventLoggerService } from '../../../resources/logger/event-logger.service';
import { Namespace } from '../../../resources/namespaces/namespace';

@Component({
encapsulation: ViewEncapsulation.None,
Expand All @@ -40,7 +41,8 @@ export class NamespaceActionComponent implements OnInit {
actionConfig: ActionConfig;

constructor(
private authService: AuthService
private authService: AuthService,
private eventLoggerService: EventLoggerService,
) {}

ngOnInit(): void {
Expand Down Expand Up @@ -97,6 +99,8 @@ export class NamespaceActionComponent implements OnInit {
id: $event.id,
item: this.namespace
};

this.eventLoggerService.logButton($event.title);
this.handleAction.emit(event);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
import { Action } from 'patternfly-ng/action/action';
import { ActionConfig } from 'patternfly-ng/action/action-config';

import { Repository } from '../../../../../resources/repositories/repository';
import { EventLoggerService } from '../../../../../resources/logger/event-logger.service';
import { Repository } from '../../../../../resources/repositories/repository';

@Component({
encapsulation: ViewEncapsulation.None,
Expand All @@ -39,6 +40,7 @@ export class NamespaceRepositoryActionComponent implements OnInit {
actionConfig: ActionConfig;

constructor(
private eventLoggerService: EventLoggerService,
) {}

ngOnInit(): void {
Expand Down Expand Up @@ -71,6 +73,8 @@ export class NamespaceRepositoryActionComponent implements OnInit {
id: $event.id,
item: this.repository
};

this.eventLoggerService.logButton($event.title);
this.handleAction.emit(event);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,26 @@
<div class="list-pf-content-wrapper">
<div class="list-pf-main-content">
<div class="list-pf-title">
<a [routerLink]="item.detail_url">{{ item.name }}</a></div>
<a appLogEvent [routerLink]="item.detail_url">{{ item.name }}</a></div>
<div class="list-pf-description text-overflow-pf">{{ item.description | slice:0:60 }}</div>
</div>
<div class="list-pf-additional-content">
<div *ngIf="item['latest_import'] && (item['latest_import']['state'] === 'PENDING' || item['latest_import']['state'] === 'RUNNING')">
<a [routerLink]="['/my-imports']" [queryParams]="{namespace: namespace.name, repository_name: item.name}" class="running"
<a appLogEvent="{{ item.name }}: import status" [routerLink]="['/my-imports']" [queryParams]="{namespace: namespace.name, repository_name: item.name}" class="running"
tooltip="View import log">
<i class="fa fa-spin fa-spinner"></i>
<span class="text">{{ item['latest_import']['state'][0] + item['latest_import']['state'].substring(1, item['latest_import']['state'].length).toLowerCase() }}
{{ item['latest_import']['as_of_dt'] }}</span>
</a>
</div>
<div *ngIf="item['latest_import'] && item['latest_import']['state'] === 'SUCCESS'">
<a [routerLink]="['/my-imports']" [queryParams]="{namespace: namespace.name, repository_name: item.name}" class="succeeded"
<a appLogEvent="{{ item.name }}: import status" [routerLink]="['/my-imports']" [queryParams]="{namespace: namespace.name, repository_name: item.name}" class="succeeded"
tooltip="View import log">
<i class="fa fa-circle"></i> <span class="text">Succeeded {{ item['latest_import']['as_of_dt'] }}</span>
</a>
</div>
<div *ngIf="item['latest_import'] && item['latest_import']['state'] === 'FAILED'">
<a [routerLink]="['/my-imports']" [queryParams]="{namespace: namespace.name, repository_name: item.name}" class="failed"
<a appLogEvent="{{ item.name }}: import status" [routerLink]="['/my-imports']" [queryParams]="{namespace: namespace.name, repository_name: item.name}" class="failed"
tooltip="View import log">
<i class="fa fa-circle"></i> <span class="text">Failed {{ item['latest_import']['as_of_dt'] }}</span>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
(onSortChange)="sortChanged($event)"
(onViewSelect)="viewSelected($event)">
<ng-template #toolbarActionTemplate>
<a class="btn btn-primary primary-action"
<a appAddRoute="Add Namespace" class="btn btn-primary primary-action"
type="button"
routerLink="/my-content/namespaces/new" *ngIf="me.staff">
<span class="fa fa-plus"></span> Add
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</div>

<div class="import-btn-container" *ngIf="canImport">
<button class="btn btn-default btn-sm"
<button appLogEvent="Re Import" class="btn btn-default btn-sm"
type="button"
(click)="startImport()"
tooltip="Restart import"
Expand Down
13 changes: 7 additions & 6 deletions galaxyui/src/app/search/popular/popular.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ import {

import { ListConfig } from 'patternfly-ng/list/basic-list/list-config';

import { Tag } from '../../resources/tags/tag';

import { Platform } from '../../resources/platforms/platform';

import { CloudPlatform } from '../../resources/cloud-platforms/cloud-platform';
import { CloudPlatform } from '../../resources/cloud-platforms/cloud-platform';
import { EventLoggerService} from '../../resources/logger/event-logger.service';
import { Platform } from '../../resources/platforms/platform';
import { Tag } from '../../resources/tags/tag';

class PopularData {
tags: Tag[];
Expand Down Expand Up @@ -45,7 +44,8 @@ export class PopularComponent implements OnInit {
items: any;

constructor(
private route: ActivatedRoute
private route: ActivatedRoute,
private eventLoggerService: EventLoggerService,
) {}

handleClick($event) {
Expand All @@ -54,6 +54,7 @@ export class PopularComponent implements OnInit {
e.itemType = this.popularType;
e.item = $event.item;
this.click.emit(e);
this.eventLoggerService.logButton(this.popularTitle + ': ' + $event.item.name);
}

ngOnInit() {
Expand Down
Loading

0 comments on commit 3a65c94

Please sign in to comment.