Skip to content
Snippets Groups Projects
Commit 9d1ab1e9 authored by Filipa Lacerda's avatar Filipa Lacerda
Browse files

Add error state to commits and merge requests pipelines table

parent 01660209
No related branches found
No related tags found
1 merge request!9978Pipelines empty state
Loading
@@ -5,6 +5,7 @@ import PipelinesTableComponent from '../../vue_shared/components/pipelines_table
Loading
@@ -5,6 +5,7 @@ import PipelinesTableComponent from '../../vue_shared/components/pipelines_table
import PipelinesService from '../../vue_pipelines_index/services/pipelines_service'; import PipelinesService from '../../vue_pipelines_index/services/pipelines_service';
import PipelineStore from '../../vue_pipelines_index/stores/pipelines_store'; import PipelineStore from '../../vue_pipelines_index/stores/pipelines_store';
import eventHub from '../../vue_pipelines_index/event_hub'; import eventHub from '../../vue_pipelines_index/event_hub';
import ErrorState from '../../vue_pipelines_index/components/error_state';
import '../../lib/utils/common_utils'; import '../../lib/utils/common_utils';
import '../../vue_shared/vue_resource_interceptor'; import '../../vue_shared/vue_resource_interceptor';
   
Loading
@@ -22,6 +23,7 @@ import '../../vue_shared/vue_resource_interceptor';
Loading
@@ -22,6 +23,7 @@ import '../../vue_shared/vue_resource_interceptor';
export default Vue.component('pipelines-table', { export default Vue.component('pipelines-table', {
components: { components: {
'pipelines-table-component': PipelinesTableComponent, 'pipelines-table-component': PipelinesTableComponent,
'error-state': ErrorState,
}, },
   
/** /**
Loading
@@ -39,9 +41,16 @@ export default Vue.component('pipelines-table', {
Loading
@@ -39,9 +41,16 @@ export default Vue.component('pipelines-table', {
store, store,
state: store.state, state: store.state,
isLoading: false, isLoading: false,
hasError: false,
}; };
}, },
   
computed: {
shouldRenderErrorState() {
return this.hasError && !this.pageRequest;
},
},
/** /**
* When the component is about to be mounted, tell the service to fetch the data * When the component is about to be mounted, tell the service to fetch the data
* *
Loading
@@ -80,6 +89,7 @@ export default Vue.component('pipelines-table', {
Loading
@@ -80,6 +89,7 @@ export default Vue.component('pipelines-table', {
this.isLoading = false; this.isLoading = false;
}) })
.catch(() => { .catch(() => {
this.hasError = true;
this.isLoading = false; this.isLoading = false;
new Flash('An error occurred while fetching the pipelines, please reload the page again.'); new Flash('An error occurred while fetching the pipelines, please reload the page again.');
}); });
Loading
@@ -92,12 +102,7 @@ export default Vue.component('pipelines-table', {
Loading
@@ -92,12 +102,7 @@ export default Vue.component('pipelines-table', {
<i class="fa fa-spinner fa-spin"></i> <i class="fa fa-spinner fa-spin"></i>
</div> </div>
   
<div class="blank-state blank-state-no-icon" <error-state v-if="shouldRenderErrorState" />
v-if="!isLoading && state.pipelines.length === 0">
<h2 class="blank-state-title js-blank-state-title">
No pipelines to show
</h2>
</div>
   
<div class="table-holder pipelines" <div class="table-holder pipelines"
v-if="!isLoading && state.pipelines.length > 0"> v-if="!isLoading && state.pipelines.length > 0">
Loading
Loading
Loading
@@ -163,6 +163,7 @@ export default {
Loading
@@ -163,6 +163,7 @@ export default {
this.pageRequest = false; this.pageRequest = false;
}) })
.catch(() => { .catch(() => {
this.hasError = true;
this.pageRequest = false; this.pageRequest = false;
new Flash('An error occurred while fetching the pipelines, please reload the page again.'); new Flash('An error occurred while fetching the pipelines, please reload the page again.');
}); });
Loading
@@ -196,7 +197,7 @@ export default {
Loading
@@ -196,7 +197,7 @@ export default {
<i class="fa fa-spinner fa-spin" aria-hidden="true"></i> <i class="fa fa-spinner fa-spin" aria-hidden="true"></i>
</div> </div>
   
<empty-state v-if="shouldRenderEmptyState" /> <empty-state v-if="shouldRenderEmptyState" :helpPagePath="helpPagePath" />
   
<error-state v-if="shouldRenderErrorState" /> <error-state v-if="shouldRenderErrorState" />
   
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment