Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save danielhamelberg/5be329c97a68b490f88830a763bc06e5 to your computer and use it in GitHub Desktop.

Select an option

Save danielhamelberg/5be329c97a68b490f88830a763bc06e5 to your computer and use it in GitHub Desktop.
Tampermonkey script to add UI helpers for Octopus Deploy
// ==UserScript==
// @name Octopus Helpers
// @namespace http://blog.spinthemoose.com/
// @version 0.2
// @description Adds some useful capabilities to the Octopus Deploy UI.
// @author David Alpert
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @match http://172.30.100.100/app*
// @grant none
// ==/UserScript==
function OctopusHelpers() {
if (window.jQuery == 'undefined') {
window.setTimeout(OctopusHelpers, 100);
} else {
var hash = location.hash.slice(1);
if (hash.endsWith('/releases/create')) {
var x = 'release-editor input[ng-model="release.Version"]';
waitForKeyElements(x,
function(){
$(x).after('<input id="octohelper-copy-release-version" type="button" value="Apply Release Version to Packages" style="margin-left:10px;">');
$('#octohelper-copy-release-version').click(function(ev) {
var releaseVersion = $(x).val();
var packageVersionInputs = $('release-editor input[ng-model="pack.SpecificVersion"]');
packageVersionInputs.val(releaseVersion);
packageVersionInputs.each(function(idx,el){
angular.element(el).triggerHandler('change');
});
});
},
true /* only once */
);
}
}
}
OctopusHelpers();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment