Skip to content

Commit 3e20b83

Browse files
committed
Merge branch 'jivl-realtime-update-adding-file' into 'master'
Add realtime pipeline status component for files Closes #42927 See merge request gitlab-org/gitlab-ce!17705
2 parents 49d5c09 + e2e0a4d commit 3e20b83

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-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: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,4 +509,29 @@ def visit_blob(path, anchor: nil, ref: 'master')
509509
end
510510
end
511511
end
512+
513+
context 'realtime pipelines' do
514+
before do
515+
Files::CreateService.new(
516+
project,
517+
project.creator,
518+
start_branch: 'feature',
519+
branch_name: 'feature',
520+
commit_message: "Add ruby file",
521+
file_path: 'files/ruby/test.rb',
522+
file_content: "# Awesome content"
523+
).execute
524+
525+
create(:ci_pipeline, status: 'running', project: project, ref: 'feature', sha: project.commit('feature').sha)
526+
visit_blob('files/ruby/test.rb', ref: 'feature')
527+
end
528+
529+
it 'should show the realtime pipeline status' do
530+
page.within('.commit-actions') do
531+
expect(page).to have_css('.ci-status-icon')
532+
expect(page).to have_css('.ci-status-icon-running')
533+
expect(page).to have_css('.js-ci-status-icon-running')
534+
end
535+
end
536+
end
512537
end

0 commit comments

Comments
 (0)