Last active
August 29, 2015 13:57
-
-
Save dalegaspi/9890873 to your computer and use it in GitHub Desktop.
TamperMonkey/GreaseMonkey script to extend apigee dashboard by adding a dropdown list of custom attribute names of your choice.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Apigee Add Developer User Script | |
// @namespace http://ap.org/ | |
// @version 0.9 | |
// @description This allows easier adding of custom properties | |
// @match https://enterprise.apigee.com/platform/* | |
// @copyright 2014+, dlegaspi@ap.org | |
// @require http://code.jquery.com/jquery-latest.js | |
// ==/UserScript== | |
$(document).ready(function() { | |
// the dashboard uses AngularJS but we're using jQuery | |
// upon loading completion, the page makes an async | |
// call to get its data...but instead of intercepting | |
// and or injecting the code on callback completion | |
// we're just doing this the "lazy" way and just check | |
// if the XML nodes of interest already exist | |
setInterval(function() { | |
var t = $( "input[ng-model='options.editableAttributeName']" ) | |
if (!t.next().is('datalist')){ | |
t.after('\ | |
<datalist id="APattrs"> \ | |
<option value="Basic Auth Username">Basic Auth Username</option> \ | |
<option value="Basic Auth Password">Basic Auth Password</option> \ | |
<option value="Company">Company</option> \ | |
<option value="MDM ID">MDM ID</option> \ | |
<option value="Org ID">Org ID</option> \ | |
<option value="Throttle">Throttle</option> \ | |
<option value="Quota">Quota</option> \ | |
</datalist>'); | |
t.attr('list', 'APattrs') | |
} | |
}, 500) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment