Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

Commit

Permalink
Fix open blue ocean fotter button based on changes to how the link is…
Browse files Browse the repository at this point in the history
… generated in JENKINS-41638-v2
  • Loading branch information
tfennelly committed Feb 14, 2017
1 parent 5c4aecf commit 57a77a5
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/main/js/custom_commands/addOpenBlueOceanLinkToFooter.js
Expand Up @@ -32,13 +32,29 @@ Cmd.prototype.command = function () {
function doTweaks($jquery) {
$jquery(function() {
var contextUrlDiv = $jquery('#blueocean-context-url');
if (contextUrlDiv.length !== 0) {

if (contextUrlDiv.length === 1) {
var tryBlueOceanUrl;
var blueUrl = contextUrlDiv.attr('data-context-url');
var classicUrl = contextUrlDiv.attr('data-classic-url');

if (classicUrl) {
var indexOfContext = window.location.href.indexOf(classicUrl);
if (indexOfContext !== -1) {
tryBlueOceanUrl = window.location.href.substring(0, indexOfContext) + blueUrl;
}
}
if (!tryBlueOceanUrl) {
tryBlueOceanUrl = `./blue`;
}

var footer = $jquery('#footer');
var link = $jquery('<a>Open Blue Ocean</a>');
link.attr('id', 'open-blueocean-in-context');
link.attr('href', contextUrlDiv.attr('data-context-url'));
link.attr('href', tryBlueOceanUrl);
footer.append(link);
}

// Make the emission of the "complete" event (below) a bit
// more deterministic.
$jquery('body').addClass('open-blueocean-link-added');
Expand Down

0 comments on commit 57a77a5

Please sign in to comment.