Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/clusters_list/store')
-rw-r--r--app/assets/javascripts/clusters_list/store/actions.js30
-rw-r--r--app/assets/javascripts/clusters_list/store/mutation_types.js3
-rw-r--r--app/assets/javascripts/clusters_list/store/mutations.js7
-rw-r--r--app/assets/javascripts/clusters_list/store/state.js4
4 files changed, 29 insertions, 15 deletions
diff --git a/app/assets/javascripts/clusters_list/store/actions.js b/app/assets/javascripts/clusters_list/store/actions.js
index 5245c307c8c..dddcfb3d975 100644
--- a/app/assets/javascripts/clusters_list/store/actions.js
+++ b/app/assets/javascripts/clusters_list/store/actions.js
@@ -16,9 +16,18 @@ const allNodesPresent = (clusters, retryCount) => {
return retryCount > MAX_REQUESTS || clusters.every(cluster => cluster.nodes != null);
};
-export const fetchClusters = ({ state, commit }) => {
+export const reportSentryError = (_store, { error, tag }) => {
+ Sentry.withScope(scope => {
+ scope.setTag('javascript_clusters_list', tag);
+ Sentry.captureException(error);
+ });
+};
+
+export const fetchClusters = ({ state, commit, dispatch }) => {
let retryCount = 0;
+ commit(types.SET_LOADING_NODES, true);
+
const poll = new Poll({
resource: {
fetchClusters: paginatedEndPoint => axios.get(paginatedEndPoint),
@@ -34,31 +43,30 @@ export const fetchClusters = ({ state, commit }) => {
const paginationInformation = parseIntPagination(normalizedHeaders);
commit(types.SET_CLUSTERS_DATA, { data, paginationInformation });
- commit(types.SET_LOADING_STATE, false);
+ commit(types.SET_LOADING_CLUSTERS, false);
if (allNodesPresent(data.clusters, retryCount)) {
poll.stop();
+ commit(types.SET_LOADING_NODES, false);
}
}
} catch (error) {
poll.stop();
- Sentry.withScope(scope => {
- scope.setTag('javascript_clusters_list', 'fetchClustersSuccessCallback');
- Sentry.captureException(error);
- });
+ commit(types.SET_LOADING_CLUSTERS, false);
+ commit(types.SET_LOADING_NODES, false);
+
+ dispatch('reportSentryError', { error, tag: 'fetchClustersSuccessCallback' });
}
},
errorCallback: response => {
poll.stop();
- commit(types.SET_LOADING_STATE, false);
+ commit(types.SET_LOADING_CLUSTERS, false);
+ commit(types.SET_LOADING_NODES, false);
flash(__('Clusters|An error occurred while loading clusters'));
- Sentry.withScope(scope => {
- scope.setTag('javascript_clusters_list', 'fetchClustersErrorCallback');
- Sentry.captureException(response);
- });
+ dispatch('reportSentryError', { error: response, tag: 'fetchClustersErrorCallback' });
},
});
diff --git a/app/assets/javascripts/clusters_list/store/mutation_types.js b/app/assets/javascripts/clusters_list/store/mutation_types.js
index a5275f28c13..beb4388c93e 100644
--- a/app/assets/javascripts/clusters_list/store/mutation_types.js
+++ b/app/assets/javascripts/clusters_list/store/mutation_types.js
@@ -1,3 +1,4 @@
export const SET_CLUSTERS_DATA = 'SET_CLUSTERS_DATA';
-export const SET_LOADING_STATE = 'SET_LOADING_STATE';
+export const SET_LOADING_CLUSTERS = 'SET_LOADING_CLUSTERS';
+export const SET_LOADING_NODES = 'SET_LOADING_NODES';
export const SET_PAGE = 'SET_PAGE';
diff --git a/app/assets/javascripts/clusters_list/store/mutations.js b/app/assets/javascripts/clusters_list/store/mutations.js
index 2a9df9f38f0..5b462928518 100644
--- a/app/assets/javascripts/clusters_list/store/mutations.js
+++ b/app/assets/javascripts/clusters_list/store/mutations.js
@@ -1,8 +1,11 @@
import * as types from './mutation_types';
export default {
- [types.SET_LOADING_STATE](state, value) {
- state.loading = value;
+ [types.SET_LOADING_CLUSTERS](state, value) {
+ state.loadingClusters = value;
+ },
+ [types.SET_LOADING_NODES](state, value) {
+ state.loadingNodes = value;
},
[types.SET_CLUSTERS_DATA](state, { data, paginationInformation }) {
Object.assign(state, {
diff --git a/app/assets/javascripts/clusters_list/store/state.js b/app/assets/javascripts/clusters_list/store/state.js
index 0023b43ed92..51fafd49479 100644
--- a/app/assets/javascripts/clusters_list/store/state.js
+++ b/app/assets/javascripts/clusters_list/store/state.js
@@ -1,9 +1,11 @@
export default (initialState = {}) => ({
+ ancestorHelperPath: initialState.ancestorHelpPath,
endpoint: initialState.endpoint,
hasAncestorClusters: false,
- loading: true,
clusters: [],
clustersPerPage: 0,
+ loadingClusters: true,
+ loadingNodes: true,
page: 1,
providers: {
aws: { path: initialState.imgTagsAwsPath, text: initialState.imgTagsAwsText },