Skip to content

Commit 52c79bc

Browse files
author
Jose Ivan Vargas
committed
Add realtime pipeline status component for files
1 parent a3b85d1 commit 52c79bc

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
1+
import Vue from 'vue';
2+
import commitPipelineStatus from '~/projects/tree/components/commit_pipeline_status_component.vue';
13
import BlobViewer from '~/blob/viewer/index';
24
import initBlob from '~/pages/projects/init_blob';
35

46
document.addEventListener('DOMContentLoaded', () => {
57
new BlobViewer(); // eslint-disable-line no-new
68
initBlob();
9+
10+
const CommitPipelineStatusEl = document.querySelector('.js-commit-pipeline-status');
11+
const statusLink = document.querySelector('.commit-actions .ci-status-link');
12+
if (statusLink) {
13+
statusLink.remove();
14+
// eslint-disable-next-line no-new
15+
new Vue({
16+
el: CommitPipelineStatusEl,
17+
components: {
18+
commitPipelineStatus,
19+
},
20+
render(createElement) {
21+
return createElement('commit-pipeline-status', {
22+
props: {
23+
endpoint: CommitPipelineStatusEl.dataset.endpoint,
24+
},
25+
});
26+
},
27+
});
28+
}
729
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Add realtime pipeline status for adding/viewing files
3+
merge_request: 17705
4+
author:
5+
type: other

spec/features/projects/blobs/blob_show_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,4 +509,20 @@ def visit_blob(path, anchor: nil, ref: 'master')
509509
end
510510
end
511511
end
512+
513+
context 'realtime pipelines' do
514+
let(:user) { create(:user) }
515+
let(:pipeline) { create(:ci_pipeline, project: project, ref: 'feature', sha: project.commit.id, user: user, status: :success) }
516+
517+
before do
518+
project.add_master(user)
519+
sign_in(user)
520+
visit_blob('files/ruby/popen.rb', ref: 'feature')
521+
end
522+
523+
it 'should show the realtime pipeline status' do
524+
wait_for_requests
525+
expect(find('.js-commit-pipeline-status')).not_to be nil
526+
end
527+
end
512528
end

0 commit comments

Comments
 (0)