diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /app/assets/javascripts/monitoring/stores/actions.js | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'app/assets/javascripts/monitoring/stores/actions.js')
-rw-r--r-- | app/assets/javascripts/monitoring/stores/actions.js | 71 |
1 files changed, 48 insertions, 23 deletions
diff --git a/app/assets/javascripts/monitoring/stores/actions.js b/app/assets/javascripts/monitoring/stores/actions.js index a0b4fd0b608..215b4b7b2d7 100644 --- a/app/assets/javascripts/monitoring/stores/actions.js +++ b/app/assets/javascripts/monitoring/stores/actions.js @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/browser'; -import { deprecatedCreateFlash as createFlash } from '~/flash'; +import createFlash from '~/flash'; import axios from '~/lib/utils/axios_utils'; import { convertToFixedRange } from '~/lib/utils/datetime_range'; import { convertObjectPropsToCamelCase } from '../../lib/utils/common_utils'; @@ -134,15 +134,17 @@ export const fetchDashboard = ({ state, commit, dispatch, getters }) => { if (state.showErrorBanner) { if (error.response.data && error.response.data.message) { const { message } = error.response.data; - createFlash( - sprintf( + createFlash({ + message: sprintf( s__('Metrics|There was an error while retrieving metrics. %{message}'), { message }, false, ), - ); + }); } else { - createFlash(s__('Metrics|There was an error while retrieving metrics')); + createFlash({ + message: s__('Metrics|There was an error while retrieving metrics'), + }); } } }); @@ -174,7 +176,10 @@ export const fetchDashboardData = ({ state, dispatch, getters }) => { dispatch('fetchDeploymentsData'); if (!state.timeRange) { - createFlash(s__(`Metrics|Invalid time range, please verify.`), 'warning'); + createFlash({ + message: s__(`Metrics|Invalid time range, please verify.`), + type: 'warning', + }); return Promise.reject(); } @@ -202,7 +207,10 @@ export const fetchDashboardData = ({ state, dispatch, getters }) => { }); }) .catch(() => { - createFlash(s__(`Metrics|There was an error while retrieving metrics`), 'warning'); + createFlash({ + message: s__(`Metrics|There was an error while retrieving metrics`), + type: 'warning', + }); }); }; @@ -254,7 +262,9 @@ export const fetchDeploymentsData = ({ state, dispatch }) => { .then((resp) => resp.data) .then((response) => { if (!response || !response.deployments) { - createFlash(s__('Metrics|Unexpected deployment data response from prometheus endpoint')); + createFlash({ + message: s__('Metrics|Unexpected deployment data response from prometheus endpoint'), + }); } dispatch('receiveDeploymentsDataSuccess', response.deployments); @@ -262,7 +272,9 @@ export const fetchDeploymentsData = ({ state, dispatch }) => { .catch((error) => { Sentry.captureException(error); dispatch('receiveDeploymentsDataFailure'); - createFlash(s__('Metrics|There was an error getting deployment information.')); + createFlash({ + message: s__('Metrics|There was an error getting deployment information.'), + }); }); }; export const receiveDeploymentsDataSuccess = ({ commit }, data) => { @@ -290,9 +302,11 @@ export const fetchEnvironmentsData = ({ state, dispatch }) => { ) .then((environments) => { if (!environments) { - createFlash( - s__('Metrics|There was an error fetching the environments data, please try again'), - ); + createFlash({ + message: s__( + 'Metrics|There was an error fetching the environments data, please try again', + ), + }); } dispatch('receiveEnvironmentsDataSuccess', environments); @@ -300,7 +314,9 @@ export const fetchEnvironmentsData = ({ state, dispatch }) => { .catch((err) => { Sentry.captureException(err); dispatch('receiveEnvironmentsDataFailure'); - createFlash(s__('Metrics|There was an error getting environments information.')); + createFlash({ + message: s__('Metrics|There was an error getting environments information.'), + }); }); }; export const requestEnvironmentsData = ({ commit }) => { @@ -332,7 +348,9 @@ export const fetchAnnotations = ({ state, dispatch, getters }) => { .then(parseAnnotationsResponse) .then((annotations) => { if (!annotations) { - createFlash(s__('Metrics|There was an error fetching annotations. Please try again.')); + createFlash({ + message: s__('Metrics|There was an error fetching annotations. Please try again.'), + }); } dispatch('receiveAnnotationsSuccess', annotations); @@ -340,7 +358,9 @@ export const fetchAnnotations = ({ state, dispatch, getters }) => { .catch((err) => { Sentry.captureException(err); dispatch('receiveAnnotationsFailure'); - createFlash(s__('Metrics|There was an error getting annotations information.')); + createFlash({ + message: s__('Metrics|There was an error getting annotations information.'), + }); }); }; @@ -377,9 +397,11 @@ export const fetchDashboardValidationWarnings = ({ state, dispatch, getters }) = .catch((err) => { Sentry.captureException(err); dispatch('receiveDashboardValidationWarningsFailure'); - createFlash( - s__('Metrics|There was an error getting dashboard validation warnings information.'), - ); + createFlash({ + message: s__( + 'Metrics|There was an error getting dashboard validation warnings information.', + ), + }); }); }; @@ -480,11 +502,14 @@ export const fetchVariableMetricLabelValues = ({ state, commit }, { defaultQuery commit(types.UPDATE_VARIABLE_METRIC_LABEL_VALUES, { variable, label, data }); }) .catch(() => { - createFlash( - sprintf(s__('Metrics|There was an error getting options for variable "%{name}".'), { - name: variable.name, - }), - ); + createFlash({ + message: sprintf( + s__('Metrics|There was an error getting options for variable "%{name}".'), + { + name: variable.name, + }, + ), + }); }); optionsRequests.push(optionsRequest); } |