BigW Consortium Gitlab

Commit ea43f586 by Filipa Lacerda

Only load pipelines vue component when there are pipelines.

Move Empty state to vue component
parent 035cb734
...@@ -40,20 +40,26 @@ ...@@ -40,20 +40,26 @@
}, },
template: ` template: `
<div> <div>
<div class="pipelines realtime-loading" v-if='pipelines.length < 1'> <div class="pipelines realtime-loading" v-if='pageRequest'>
<i class="fa fa-spinner fa-spin"></i> <i class="fa fa-spinner fa-spin"></i>
</div> </div>
<div class="table-holder" v-if='pipelines.length'>
<div class="blank-state blank-state-no-icon"
v-if="!pageRequest && pipelines.length === 0">
<h2 class="blank-state-title js-blank-state-title">
No pipelines to show
</h2>
</div>
<div class="table-holder" v-if='!pageRequest && pipelines.length'>
<pipelines-table-component <pipelines-table-component
:pipelines='pipelines' :pipelines='pipelines'
:svgs='svgs'> :svgs='svgs'>
</pipelines-table-component> </pipelines-table-component>
</div> </div>
<div class="pipelines realtime-loading" v-if='pageRequest'>
<i class="fa fa-spinner fa-spin"></i>
</div>
<gl-pagination <gl-pagination
v-if='pageInfo.total > pageInfo.perPage' v-if='!pageRequest && pipelines.length && pageInfo.total > pageInfo.perPage'
:pagenum='pagenum' :pagenum='pagenum'
:change='change' :change='change'
:count='count.all' :count='count.all'
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
gl.PipelineStore = class { gl.PipelineStore = class {
fetchDataLoop(Vue, pageNum, url, apiScope) { fetchDataLoop(Vue, pageNum, url, apiScope) {
this.pageRequest = true;
const updatePipelineNums = (count) => { const updatePipelineNums = (count) => {
const { all } = count; const { all } = count;
const running = count.running_or_pending; const running = count.running_or_pending;
...@@ -41,7 +42,7 @@ ...@@ -41,7 +42,7 @@
this.pageRequest = false; this.pageRequest = false;
}, () => { }, () => {
this.pageRequest = false; this.pageRequest = false;
return new Flash('Something went wrong on our end.'); return new Flash('An error occurred while fetching the pipelines, please reload the page again.');
}); });
goFetch(); goFetch();
......
...@@ -94,6 +94,7 @@ ...@@ -94,6 +94,7 @@
#commits.commits.tab-pane #commits.commits.tab-pane
-# This tab is always loaded via AJAX -# This tab is always loaded via AJAX
#pipelines.pipelines.tab-pane #pipelines.pipelines.tab-pane
- if @pipelines.any?
= render 'projects/commit/pipelines_list', endpoint: pipelines_namespace_project_merge_request_path(@project.namespace, @project, @merge_request) = render 'projects/commit/pipelines_list', endpoint: pipelines_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)
#diffs.diffs.tab-pane #diffs.diffs.tab-pane
-# This tab is always loaded via AJAX -# This tab is always loaded via AJAX
......
...@@ -36,10 +36,6 @@ ...@@ -36,10 +36,6 @@
= link_to ci_lint_path, class: 'btn btn-default' do = link_to ci_lint_path, class: 'btn btn-default' do
%span CI Lint %span CI Lint
.content-list.pipelines{ data: { url: namespace_project_pipelines_path(@project.namespace, @project, format: :json) } } .content-list.pipelines{ data: { url: namespace_project_pipelines_path(@project.namespace, @project, format: :json) } }
- if @pipelines.blank?
%div
.nothing-here-block No pipelines to show
- else
.pipeline-svgs{ "data" => {"commit_icon_svg" => custom_icon("icon_commit"), .pipeline-svgs{ "data" => {"commit_icon_svg" => custom_icon("icon_commit"),
"icon_status_canceled" => custom_icon("icon_status_canceled"), "icon_status_canceled" => custom_icon("icon_status_canceled"),
"icon_status_running" => custom_icon("icon_status_running"), "icon_status_running" => custom_icon("icon_status_running"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment