Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always opens console tab when job name is clicked #3742

Merged
merged 1 commit into from
Aug 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 5 additions & 55 deletions server/webapp/WEB-INF/rails.new/app/assets/javascripts/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,7 @@ var SubTabs = Class.create({
window[init_method_name]();
}
}
this.storeCurrentTabNameInCookie(this.tab_name);
TabsManager.prototype.updateLinkToThisPage(this.tab_name);
},
storeCurrentTabNameInCookie: function(tabName){
var type = this.container.tab_type;
var id = this.container.tab_id;

if(type && id) {
var expire_in_30_mins = new Date();
expire_in_30_mins.setTime(expire_in_30_mins.getTime() + 30 * 60 * 1000);

var cookie_key = 't-' + type + '-' + id;
var path = '/';

setCookie(cookie_key, this.tab_name, expire_in_30_mins, path);
}
}
});
var TabsManager = Class.create({
Expand Down Expand Up @@ -140,25 +125,13 @@ var TabsManager = Class.create({
return tabName;
} else {
tabName = this.getCurrentTabFromUrl();

if(tabName){
return tabName;
} else {
tabName = this.getCurrentTabFromCookie();

if(tabName){
return tabName;
} else {
tabName = this.getCurrentTabFromBuildOrStageStatus();
if(tabName){
return tabName;
} else {
if (this.defaultTabName) {
return this.defaultTabName;
}
return null;
}
}
}else {
if (this.defaultTabName) {
return this.defaultTabName;
}
return null;
}
}
},
Expand All @@ -174,29 +147,6 @@ var TabsManager = Class.create({

return null; // return undefined if no name in the tail of URL
},
getCurrentTabFromCookie: function() {
var cookie_key = 't-' + this.type + '-' + this.unique_id;
if(cookie_key != 't--' && cookie_key != 't-undefined-undefined'){
return getCookie(cookie_key);
} else {
return null;
}
},
getCurrentTabFromBuildOrStageStatus: function() {
var job = jQuery(".job_details_content");

if (job.data("result")) {
if (job.data("result") === 'passed') {
return 'artifacts';
}

if (job.data("result") === 'failed' || job.data("result") === 'failing') {
return 'failures';
}
}

return null;
},
initializeCurrentTab: function(tab) {
var current_tab_content_id = this.getCurrentTab(tab);
if (current_tab_content_id) {
Expand Down