summaryrefslogtreecommitdiff
path: root/app/assets
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-01-21 10:41:13 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2017-01-21 10:41:13 +0000
commit382761472b15fd01c9312f885ebe14e62c8426aa (patch)
tree9a05950e1a0b9a5dfee5e9e8810444b43ddfcb71 /app/assets
parent21c225cdaab77d531e4eff10c778406de3f549f3 (diff)
parent5f84368cba3e5c517b20fc6956a742bcd10569f8 (diff)
downloadgitlab-ce-382761472b15fd01c9312f885ebe14e62c8426aa.tar.gz
Merge branch 'fix/revert-removing-build-tab-again' into '8-16-stable'
Revert removing builds tab on '8-16-stable' See merge request !8661
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/dispatcher.js.es64
-rw-r--r--app/assets/javascripts/merge_request_tabs.js.es629
-rw-r--r--app/assets/javascripts/merge_request_widget.js.es63
3 files changed, 32 insertions, 4 deletions
diff --git a/app/assets/javascripts/dispatcher.js.es6 b/app/assets/javascripts/dispatcher.js.es6
index 99a34651639..e0255d64a65 100644
--- a/app/assets/javascripts/dispatcher.js.es6
+++ b/app/assets/javascripts/dispatcher.js.es6
@@ -152,6 +152,7 @@
new MergedButtons();
break;
case 'projects:merge_requests:commits':
+ case 'projects:merge_requests:builds':
new MergedButtons();
break;
case "projects:merge_requests:diffs":
@@ -176,6 +177,9 @@
container: '.js-pipeline-table',
});
break;
+ case 'projects:commit:builds':
+ new gl.Pipelines();
+ break;
case 'projects:commits:show':
case 'projects:activity':
shortcut_handler = new ShortcutsNavigation();
diff --git a/app/assets/javascripts/merge_request_tabs.js.es6 b/app/assets/javascripts/merge_request_tabs.js.es6
index 4c8c28af755..8a925591600 100644
--- a/app/assets/javascripts/merge_request_tabs.js.es6
+++ b/app/assets/javascripts/merge_request_tabs.js.es6
@@ -59,13 +59,16 @@
class MergeRequestTabs {
- constructor({ action, setUrl, stubLocation } = {}) {
+ constructor({ action, setUrl, buildsLoaded, stubLocation } = {}) {
this.diffsLoaded = false;
+ this.buildsLoaded = false;
this.pipelinesLoaded = false;
this.commitsLoaded = false;
this.fixedLayoutPref = null;
this.setUrl = setUrl !== undefined ? setUrl : true;
+ this.buildsLoaded = buildsLoaded || false;
+
this.setCurrentAction = this.setCurrentAction.bind(this);
this.tabShown = this.tabShown.bind(this);
this.showTab = this.showTab.bind(this);
@@ -116,6 +119,10 @@
$.scrollTo('.merge-request-details .merge-request-tabs', {
offset: -navBarHeight,
});
+ } else if (action === 'builds') {
+ this.loadBuilds($target.attr('href'));
+ this.expandView();
+ this.resetViewContainer();
} else if (action === 'pipelines') {
this.loadPipelines($target.attr('href'));
this.expandView();
@@ -173,8 +180,8 @@
setCurrentAction(action) {
this.currentAction = action === 'show' ? 'notes' : action;
- // Remove a trailing '/commits' '/diffs' '/pipelines' '/new' '/new/diffs'
- let newState = location.pathname.replace(/\/(commits|diffs|pipelines|new|new\/diffs)(\.html)?\/?$/, '');
+ // Remove a trailing '/commits' '/diffs' '/builds' '/pipelines' '/new' '/new/diffs'
+ let newState = location.pathname.replace(/\/(commits|diffs|builds|pipelines|new|new\/diffs)(\.html)?\/?$/, '');
// Append the new action if we're on a tab other than 'notes'
if (this.currentAction !== 'notes') {
@@ -243,6 +250,22 @@
});
}
+ loadBuilds(source) {
+ if (this.buildsLoaded) {
+ return;
+ }
+ this.ajaxGet({
+ url: `${source}.json`,
+ success: (data) => {
+ document.querySelector('div#builds').innerHTML = data.html;
+ gl.utils.localTimeAgo($('.js-timeago', 'div#builds'));
+ this.buildsLoaded = true;
+ new gl.Pipelines();
+ this.scrollToElement('#builds');
+ },
+ });
+ }
+
loadPipelines(source) {
if (this.pipelinesLoaded) {
return;
diff --git a/app/assets/javascripts/merge_request_widget.js.es6 b/app/assets/javascripts/merge_request_widget.js.es6
index 0305aeb07d9..e47047c4cca 100644
--- a/app/assets/javascripts/merge_request_widget.js.es6
+++ b/app/assets/javascripts/merge_request_widget.js.es6
@@ -74,7 +74,7 @@
MergeRequestWidget.prototype.addEventListeners = function() {
var allowedPages;
- allowedPages = ['show', 'commits', 'pipelines', 'changes'];
+ allowedPages = ['show', 'commits', 'builds', 'pipelines', 'changes'];
$(document).on('page:change.merge_request', (function(_this) {
return function() {
var page;
@@ -173,6 +173,7 @@
message = message.replace('{{title}}', data.title);
notify(title, message, _this.opts.gitlab_icon, function() {
this.close();
+ return Turbolinks.visit(_this.opts.builds_path);
});
}
}