Files
awx/awx/ui/static/js/ng-console.js
Jared Tabor d7e2614760 Copyright JS files and removing unlicensed files
Adding the Copyright and All Rights Reserved to the JS files, as well as removing pwdmeter and 3dDonut chart (in lieu of d3.js donut chart)

adding the legend and getting pie chart to donut

adding data labels to donut chart

working legend and tooltip

job detail donut

Ansible Copyright added to beginning of all JS files

removing pwdmeter and d3donut

fixing merge conflicts
2015-05-29 12:08:22 -04:00

53 lines
1.6 KiB
JavaScript

/*************************************************
* Copyright (c) 2015 Ansible, Inc.
*
* All Rights Reserved
*************************************************/
// THIS FILE ONLY INCLUDED IN DEBUG BUILDS
//
// To use:
//
// Open a console in Chrome DevTools and load this
// script with:
//
// require('tower/ng-console');
//
// Then go to the Elements tab and drill down to any
// element within the angular app. Go back to the console
// and you can access the scope for the selected element
// using the variable $scope.
//
var ngAppElem = angular.element(document.querySelector('[ng-app]') || document);
window.injector = ngAppElem.injector();
window.inject = window.injector.invoke;
window.$rootScope = ngAppElem.scope();
// getService('auth') will create a variable `auth` assigned to the service `auth`.
//
window.getService = function getService(serviceName) {
window.inject([serviceName, function (s) {window[serviceName] = s;}]);
};
Object.defineProperty(window, '$scope', {
get: function () {
var elem = angular.element(window.__commandLineAPI.$0);
return elem.isolateScope() || elem.scope();
},
});
/**
* USAGE
*
* First copy the script and paste it in Chrome DevTools in Sources -> left pane -> Snippets.
* Then, after loading an Angular page, right click on the snippet and choose "run".
* Afterwards, you have the following available in the console:
*
* 1) $rootScope
* 2) inject(function ($q, $compile) { ...use $q and $compile here... });
* 3) click on an element in DevTools; now $scope in the console points at the element scope (isolate if one exists).
*
* Enjoy!
*/