Commit ea43f586 authored by Filipa Lacerda's avatar 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,7 +94,8 @@ ...@@ -94,7 +94,8 @@
#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
= render 'projects/commit/pipelines_list', endpoint: pipelines_namespace_project_merge_request_path(@project.namespace, @project, @merge_request) - if @pipelines.any?
= 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,31 +36,27 @@ ...@@ -36,31 +36,27 @@
= 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? .pipeline-svgs{ "data" => {"commit_icon_svg" => custom_icon("icon_commit"),
%div "icon_status_canceled" => custom_icon("icon_status_canceled"),
.nothing-here-block No pipelines to show "icon_status_running" => custom_icon("icon_status_running"),
- else "icon_status_skipped" => custom_icon("icon_status_skipped"),
.pipeline-svgs{ "data" => {"commit_icon_svg" => custom_icon("icon_commit"), "icon_status_created" => custom_icon("icon_status_created"),
"icon_status_canceled" => custom_icon("icon_status_canceled"), "icon_status_pending" => custom_icon("icon_status_pending"),
"icon_status_running" => custom_icon("icon_status_running"), "icon_status_success" => custom_icon("icon_status_success"),
"icon_status_skipped" => custom_icon("icon_status_skipped"), "icon_status_failed" => custom_icon("icon_status_failed"),
"icon_status_created" => custom_icon("icon_status_created"), "icon_status_warning" => custom_icon("icon_status_warning"),
"icon_status_pending" => custom_icon("icon_status_pending"), "stage_icon_status_canceled" => custom_icon("icon_status_canceled_borderless"),
"icon_status_success" => custom_icon("icon_status_success"), "stage_icon_status_running" => custom_icon("icon_status_running_borderless"),
"icon_status_failed" => custom_icon("icon_status_failed"), "stage_icon_status_skipped" => custom_icon("icon_status_skipped_borderless"),
"icon_status_warning" => custom_icon("icon_status_warning"), "stage_icon_status_created" => custom_icon("icon_status_created_borderless"),
"stage_icon_status_canceled" => custom_icon("icon_status_canceled_borderless"), "stage_icon_status_pending" => custom_icon("icon_status_pending_borderless"),
"stage_icon_status_running" => custom_icon("icon_status_running_borderless"), "stage_icon_status_success" => custom_icon("icon_status_success_borderless"),
"stage_icon_status_skipped" => custom_icon("icon_status_skipped_borderless"), "stage_icon_status_failed" => custom_icon("icon_status_failed_borderless"),
"stage_icon_status_created" => custom_icon("icon_status_created_borderless"), "stage_icon_status_warning" => custom_icon("icon_status_warning_borderless"),
"stage_icon_status_pending" => custom_icon("icon_status_pending_borderless"), "icon_play" => custom_icon("icon_play"),
"stage_icon_status_success" => custom_icon("icon_status_success_borderless"), "icon_timer" => custom_icon("icon_timer"),
"stage_icon_status_failed" => custom_icon("icon_status_failed_borderless"), "icon_status_manual" => custom_icon("icon_status_manual"),
"stage_icon_status_warning" => custom_icon("icon_status_warning_borderless"), } }
"icon_play" => custom_icon("icon_play"),
"icon_timer" => custom_icon("icon_timer"),
"icon_status_manual" => custom_icon("icon_status_manual"),
} }
.vue-pipelines-index .vue-pipelines-index
......
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