mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 19:30:39 -03:30
Merge pull request #7125 from jaredevantabor/pendo
updating pendo version, and moving apiKey out of repo
This commit is contained in:
commit
a423084d55
@ -1,3 +1,4 @@
|
||||
{
|
||||
"BRAND_NAME": "AWX"
|
||||
"BRAND_NAME": "AWX",
|
||||
"PENDO_API_KEY": ""
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ function BaseStringService (namespace) {
|
||||
* default.strings.json and fall back to defaults defined inline.
|
||||
*/
|
||||
this.BRAND_NAME = defaults.BRAND_NAME || 'AWX';
|
||||
this.PENDO_API_KEY = defaults.PENDO_API_KEY || '';
|
||||
|
||||
/*
|
||||
* Globally relevant strings should be defined here to avoid duplication of content across the
|
||||
|
||||
@ -67,7 +67,6 @@ import users from './users/main';
|
||||
import projects from './projects/main';
|
||||
import RestServices from './rest/main';
|
||||
import access from './access/main';
|
||||
import './login/authenticationServices/pendo/ng-pendo';
|
||||
import footer from './footer/main';
|
||||
import scheduler from './scheduler/main';
|
||||
import instanceGroups from './instance-groups/main';
|
||||
@ -94,7 +93,6 @@ var tower = angular.module('Tower', [
|
||||
'I18N',
|
||||
uiRouter,
|
||||
'ui.router.state.events',
|
||||
'pendolytics',
|
||||
'lrInfiniteScroll',
|
||||
|
||||
about.name,
|
||||
@ -150,9 +148,6 @@ var tower = angular.module('Tower', [
|
||||
.config(['$logProvider', function($logProvider) {
|
||||
$logProvider.debugEnabled($ENV['ng-debug'] || false);
|
||||
}])
|
||||
.config(['$pendolyticsProvider', function($pendolyticsProvider) {
|
||||
$pendolyticsProvider.doNotAutoStart();
|
||||
}])
|
||||
.config(['ngToastProvider', function(ngToastProvider) {
|
||||
ngToastProvider.configure({
|
||||
animation: 'slide',
|
||||
|
||||
@ -6,15 +6,16 @@
|
||||
|
||||
|
||||
export default
|
||||
[ '$rootScope', '$pendolytics', 'Rest', 'GetBasePath', 'ProcessErrors', '$q',
|
||||
'ConfigService', '$log',
|
||||
function ($rootScope, $pendolytics, Rest, GetBasePath, ProcessErrors, $q,
|
||||
ConfigService, $log) {
|
||||
[ '$rootScope', 'Rest', 'GetBasePath', 'ProcessErrors', '$q',
|
||||
'ConfigService', '$log', 'AppStrings',
|
||||
function ($rootScope, Rest, GetBasePath, ProcessErrors, $q,
|
||||
ConfigService, $log, AppStrings) {
|
||||
return {
|
||||
setPendoOptions: function (config) {
|
||||
var tower_version = config.version.split('-')[0],
|
||||
trial = (config.trial) ? config.trial : false,
|
||||
options = {
|
||||
apiKey: AppStrings.get('PENDO_API_KEY'),
|
||||
visitor: {
|
||||
id: null,
|
||||
role: null,
|
||||
@ -93,6 +94,16 @@ export default
|
||||
return deferred.promise;
|
||||
},
|
||||
|
||||
bootstrap: function(){
|
||||
/* jshint ignore:start */
|
||||
(function(p,e,n,d,o){var v,w,x,y,z;o=p[d]=p[d]||{};o._q=[];
|
||||
v=['initialize','identify','updateOptions','pageLoad'];for(w=0,x=v.length;w<x;++w)(function(m){
|
||||
o[m]=o[m]||function(){o._q[m===v[0]?'unshift':'push']([m].concat([].slice.call(arguments,0)));};})(v[w]);
|
||||
y=e.createElement(n);y.async=!0;y.src=`https://cdn.pendo.io/agent/static/${AppStrings.get('PENDO_API_KEY')}/pendo.js`;
|
||||
z=e.getElementsByTagName(n)[0];z.parentNode.insertBefore(y,z);})(window,document,'script','pendo');
|
||||
/* jshint ignore:end */
|
||||
},
|
||||
|
||||
issuePendoIdentity: function () {
|
||||
var options,
|
||||
c = ConfigService.get(),
|
||||
@ -102,12 +113,14 @@ export default
|
||||
config.version = c.version;
|
||||
config.ansible_version = c.ansible_version;
|
||||
if(config.analytics_status === 'detailed' || config.analytics_status === 'anonymous'){
|
||||
$pendolytics.bootstrap();
|
||||
this.bootstrap();
|
||||
options = this.setPendoOptions(config);
|
||||
this.setRole(options).then(function(options){
|
||||
$log.debug('Pendo status is '+ config.analytics_status + '. Object below:');
|
||||
$log.debug(options);
|
||||
$pendolytics.identify(options);
|
||||
/* jshint ignore:start */
|
||||
pendo.initialize(options);
|
||||
/* jshint ignore:end */
|
||||
}, function(reason){
|
||||
// reject function for setRole
|
||||
$log.debug(reason);
|
||||
|
||||
@ -1,131 +0,0 @@
|
||||
/* jshint ignore:start */
|
||||
|
||||
/*
|
||||
* pendo.io Angular Module
|
||||
*
|
||||
* (c) 2013 pendo.io
|
||||
*/
|
||||
|
||||
|
||||
|
||||
(function(angular) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var ap = {};
|
||||
ap.waitForPendo = function(delay, registerFn) {
|
||||
var waitFn = function() { ap.waitForPendo( delay, registerFn); };
|
||||
|
||||
if (ap.disabled) {
|
||||
ap.afterReenable = waitFn;
|
||||
return;
|
||||
}
|
||||
|
||||
if(window.hasOwnProperty('pendo') && window.pendo.initialize) {
|
||||
registerFn(pendo);
|
||||
} else {
|
||||
setTimeout(waitFn, delay);
|
||||
}
|
||||
};
|
||||
|
||||
angular.module('pendolytics', [])
|
||||
.provider('$pendolytics', function() {
|
||||
|
||||
var eventCache = [];
|
||||
var service = {};
|
||||
|
||||
var serviceImpl = {
|
||||
pageLoad: function() {
|
||||
eventCache.push( {method: 'pageLoad', args: [] });
|
||||
},
|
||||
identify: function( newName, accountId, props ) {
|
||||
var saveMe = { method: 'identify', args: [ newName, accountId, props ] };
|
||||
eventCache.push(saveMe);
|
||||
},
|
||||
updateOptions: function( obj ) {
|
||||
eventCache.push({ method: 'updateOptions', args: [obj]});
|
||||
},
|
||||
|
||||
/*
|
||||
* This will allow for initalizing the Agent asynchronously
|
||||
* with an API key that is set after the agent has been set.
|
||||
*/
|
||||
initialize: function(options) {
|
||||
eventCache.unshift({
|
||||
method: 'initialize',
|
||||
args: [options]
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
service.pageLoad = function() {
|
||||
serviceImpl.pageLoad();
|
||||
};
|
||||
|
||||
service.load = function() {
|
||||
pendo.log("PENDO LOADED!!!");
|
||||
|
||||
serviceImpl = pendo;
|
||||
|
||||
// Flush the cache
|
||||
angular.forEach(eventCache, function(item) {
|
||||
pendo[item.method].apply(pendo, item.args);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
service.identify = function(newName, accountId, props){
|
||||
serviceImpl.identify(newName, accountId, props);
|
||||
};
|
||||
|
||||
service.updateOptions = function(json_obj) {
|
||||
serviceImpl.updateOptions(json_obj);
|
||||
};
|
||||
|
||||
service.initialize = function(options){
|
||||
serviceImpl.initialize(options);
|
||||
};
|
||||
|
||||
service.enable = function(){
|
||||
if (ap.disabled) {
|
||||
ap.disabled = false;
|
||||
ap.afterReenable();
|
||||
}
|
||||
};
|
||||
|
||||
service.disable = function(){
|
||||
ap.disabled = true;
|
||||
};
|
||||
|
||||
service.bootstrap = function() {
|
||||
if (!service.bootstrapped) {
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.async = true;
|
||||
script.src = ('https:' === document.location.protocol ? 'https://' : 'http://' ) + 'd3accju1t3mngt.cloudfront.net/js/pa.min.js';
|
||||
var firstScript = document.getElementsByTagName('script')[0];
|
||||
firstScript.parentNode.insertBefore(script, firstScript);
|
||||
service.bootstrapped = true;
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
$get: function(){ return service; },
|
||||
doNotAutoStart: function() {
|
||||
service.doNotAutoStart = true;
|
||||
}
|
||||
};
|
||||
|
||||
}).run(['$rootScope', '$pendolytics', function($rootScope, $pendolytics) {
|
||||
if (!$pendolytics.doNotAutoStart) {
|
||||
$pendolytics.bootstrap();
|
||||
}
|
||||
ap.waitForPendo( 500, function( p ) {
|
||||
$pendolytics.load();
|
||||
$rootScope.$on('$locationChangeSuccess', function() {
|
||||
$pendolytics.pageLoad();
|
||||
});
|
||||
});
|
||||
}]);
|
||||
|
||||
})(angular);
|
||||
@ -24,13 +24,6 @@
|
||||
</script>
|
||||
<script src="{{ STATIC_URL }}tower.vendor.js?v={{version}}"></script>
|
||||
<script src="{{ STATIC_URL }}tower.js?v={{version}}"></script>
|
||||
<script>
|
||||
window.pendo_options = {
|
||||
|
||||
// This is required to be able to load data client side
|
||||
usePendoAgentAPI: true
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body data-user-agent="{{userAgent}}">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user