Commit 9aa8f544 authored by khawkins98's avatar khawkins98
Browse files

Add logout function

parent cd984853
......@@ -50,6 +50,20 @@ function analyticsAuthorize(clientid) {
container: 'embed-api-auth-container',
clientid: clientid
});
gapi.analytics.auth.on('signIn', function() {
$('#logout-container').show();
});
gapi.analytics.auth.on('signOut', function() {
$('#logout-container').hide();
});
}
// a simple logout function
// docs: https://developers.google.com/analytics/devguides/reporting/embed/v1/component-reference#auth
function analyticsLogout() {
gapi.analytics.auth.signOut();
}
......@@ -111,4 +125,4 @@ function setChartDefaults(){
Chart.defaults.global.animationEasing = 'easeInOutQuart';
Chart.defaults.global.responsive = true;
Chart.defaults.global.maintainAspectRatio = false;
}
\ No newline at end of file
}
......@@ -65,8 +65,8 @@ function bootstrapCustomEBIAnalytics(requestedOriginDate) {
// --------
$(document).ready(function() {
// when the GAPI is ready, run the process
gapi.analytics.ready(function() {
// when the GAPI is ready, run the process
var defaultDateNow = moment().format('YYYYMMDD');
bootstrapCustomEBIAnalytics(defaultDateNow);
enableUserDatePicking();
......
......@@ -78,6 +78,11 @@
<pre><div id="embed-api-auth-container"></div></pre>
<!-- <div id="view-selector-container"></div> -->
<div id="view-name"></div>
<div id="logout-container" style="display:none;">
<a href="#" class="button small" onclick="analyticsLogout(); return false;">
<i class="icon icon-functional" data-icon="U"></i> Logout
</a>
</div>
<div id="active-users-container"></div>
</div>
<div class="columns medium-2">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment