feat(aio): remove google feedback

This commit is contained in:
Ward Bell 2017-03-31 01:11:07 -07:00 committed by Pete Bacon Darwin
parent 65bb2373ae
commit 4c21114087
6 changed files with 2 additions and 82 deletions

View File

@ -436,10 +436,6 @@
"url": "https://github.com/angular/angular/issues", "url": "https://github.com/angular/angular/issues",
"title": "Report Issues", "title": "Report Issues",
"tooltip": "Post issues and suggestions on github." "tooltip": "Post issues and suggestions on github."
},
{
"title": "Site Feedback",
"tooltip": "Submit feedback on this page."
} }
] ]
}, },
@ -462,7 +458,7 @@
"tooltip": "Twitter" "tooltip": "Twitter"
}, },
{ {
"url": "hhttps://github.com/angular/angular", "url": "https://github.com/angular/angular",
"title": "GitHub", "title": "GitHub",
"tooltip": "GitHub" "tooltip": "GitHub"
}, },

View File

@ -24,7 +24,6 @@ import { ApiService } from 'app/embedded/api/api.service';
import { DocViewerComponent } from 'app/layout/doc-viewer/doc-viewer.component'; import { DocViewerComponent } from 'app/layout/doc-viewer/doc-viewer.component';
import { EmbeddedModule } from 'app/embedded/embedded.module'; import { EmbeddedModule } from 'app/embedded/embedded.module';
import { GaService } from 'app/shared/ga.service'; import { GaService } from 'app/shared/ga.service';
import { GoogleFeedbackService } from 'app/shared/google-feedback.service';
import { Logger } from 'app/shared/logger.service'; import { Logger } from 'app/shared/logger.service';
import { LocationService } from 'app/shared/location.service'; import { LocationService } from 'app/shared/location.service';
import { NavigationService } from 'app/navigation/navigation.service'; import { NavigationService } from 'app/navigation/navigation.service';
@ -65,7 +64,6 @@ import { AutoScrollService } from 'app/shared/auto-scroll.service';
providers: [ providers: [
ApiService, ApiService,
GaService, GaService,
GoogleFeedbackService,
Logger, Logger,
Location, Location,
{ provide: LocationStrategy, useClass: PathLocationStrategy }, { provide: LocationStrategy, useClass: PathLocationStrategy },

View File

@ -4,11 +4,8 @@
<h3>{{node.title}}</h3> <h3>{{node.title}}</h3>
<ul> <ul>
<li *ngFor="let item of node.children"> <li *ngFor="let item of node.children">
<a *ngIf="item.url" class="link" [href]="item.url" <a class="link" [href]="item.url"
[title]="item.tooltip || item.title">{{ item.title }}</a> [title]="item.tooltip || item.title">{{ item.title }}</a>
<a *ngIf="!item.url" class="action" (click)="action(item)"
[title]="item.tooltip || item.title"
[attr.aria-label]="item.tooltip || item.title">{{ item.title}}</a>
</li> </li>
</ul> </ul>
</div> </div>

View File

@ -1,6 +1,5 @@
import { Component, Input } from '@angular/core'; import { Component, Input } from '@angular/core';
import { GoogleFeedbackService } from 'app/shared/google-feedback.service';
import { NavigationNode, VersionInfo } from 'app/navigation/navigation.service'; import { NavigationNode, VersionInfo } from 'app/navigation/navigation.service';
@Component({ @Component({
@ -10,12 +9,4 @@ import { NavigationNode, VersionInfo } from 'app/navigation/navigation.service';
export class FooterComponent { export class FooterComponent {
@Input() nodes: NavigationNode[]; @Input() nodes: NavigationNode[];
@Input() versionInfo: VersionInfo; @Input() versionInfo: VersionInfo;
constructor(private feedback: GoogleFeedbackService) { }
action(node: NavigationNode) {
// There is only one action at this time, site feedback
// so don't bother to analyze the node; just do the action.
this.feedback.openFeedback();
}
} }

View File

@ -1,59 +0,0 @@
import { Injectable } from '@angular/core';
import { Logger } from 'app/shared/logger.service';
interface UserFeedback {
api: { startFeedback: (config: any) => void };
}
@Injectable()
/**
* Google Feedback Service - opens a Google Feedback facility.
* Presupposes that tiny Google Feedback has been loaded from
* //www.gstatic.com/feedback/api.js with a script on the host web page.
*/
export class GoogleFeedbackService {
// ms to wait before acquiring window.userfeedback after library loads
// empirically determined to allow time for e2e test setup
static initializeDelay = 1000;
private userFeedback: UserFeedback;
constructor(private logger: Logger) {
// fallback userFeedback
this.userFeedback = {
api: { startFeedback: () => {
logger.error('Google Feedback service is not available.');
}
}
};
}
openFeedback() {
this.initializeGoogleFeedback().then(ufb => {
const configuration = {
'productId': '410509', // Google's Angular Docs key?
'authuser': '1',
'bucket': 'angulario'
};
ufb.api.startFeedback(configuration);
});
};
private initializeGoogleFeedback() {
let ufb = window['userfeedback'];
if (ufb) {
return Promise.resolve<UserFeedback>(this.userFeedback = ufb);
} else {
// Give script more time to async load.
// Useful in e2e tests.
return new Promise<UserFeedback>(resolve => {
setTimeout(() => {
ufb = window['userfeedback'];
if (ufb) { this.userFeedback = ufb; }
resolve(this.userFeedback);
}, GoogleFeedbackService.initializeDelay);
});
}
}
}

View File

@ -31,9 +31,6 @@
</script> </script>
<script async src='https://www.google-analytics.com/analytics.js'></script> <script async src='https://www.google-analytics.com/analytics.js'></script>
<!-- End Google Analytics --> <!-- End Google Analytics -->
<!-- Google Feedback -->
<script async src="//www.gstatic.com/feedback/api.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<aio-shell>Loading...</aio-shell> <aio-shell>Loading...</aio-shell>