diff options
Diffstat (limited to 'app/assets/javascripts/serverless/store')
4 files changed, 13 insertions, 11 deletions
diff --git a/app/assets/javascripts/serverless/store/actions.js b/app/assets/javascripts/serverless/store/actions.js index a0a9fdf7ace..b9d57138efa 100644 --- a/app/assets/javascripts/serverless/store/actions.js +++ b/app/assets/javascripts/serverless/store/actions.js @@ -2,7 +2,7 @@ import * as types from './mutation_types'; import axios from '~/lib/utils/axios_utils'; import statusCodes from '~/lib/utils/http_status'; import { backOff } from '~/lib/utils/common_utils'; -import createFlash from '~/flash'; +import { deprecatedCreateFlash as createFlash } from '~/flash'; import { __ } from '~/locale'; import { MAX_REQUESTS, CHECKING_INSTALLED, TIMEOUT } from '../constants'; @@ -123,6 +123,3 @@ export const fetchMetrics = ({ dispatch }, { metricsPath, hasPrometheus }) => { createFlash(error); }); }; - -// prevent babel-plugin-rewire from generating an invalid default during karma tests -export default () => {}; diff --git a/app/assets/javascripts/serverless/store/getters.js b/app/assets/javascripts/serverless/store/getters.js index 071f663d9d2..c9b1d22799a 100644 --- a/app/assets/javascripts/serverless/store/getters.js +++ b/app/assets/javascripts/serverless/store/getters.js @@ -5,6 +5,3 @@ export const hasPrometheusMissingData = state => state.hasPrometheus && !state.h // Convert the function list into a k/v grouping based on the environment scope export const getFunctions = state => translate(state.functions); - -// prevent babel-plugin-rewire from generating an invalid default during karma tests -export default () => {}; diff --git a/app/assets/javascripts/serverless/store/index.js b/app/assets/javascripts/serverless/store/index.js index 5f72060633e..6f32d85201e 100644 --- a/app/assets/javascripts/serverless/store/index.js +++ b/app/assets/javascripts/serverless/store/index.js @@ -7,12 +7,12 @@ import createState from './state'; Vue.use(Vuex); -export const createStore = () => +export const createStore = (entryPointData = {}) => new Vuex.Store({ actions, getters, mutations, - state: createState(), + state: createState(entryPointData), }); -export default createStore(); +export default createStore; diff --git a/app/assets/javascripts/serverless/store/state.js b/app/assets/javascripts/serverless/store/state.js index fdd29299749..353bfcf3fed 100644 --- a/app/assets/javascripts/serverless/store/state.js +++ b/app/assets/javascripts/serverless/store/state.js @@ -1,14 +1,22 @@ -export default () => ({ +export default ( + initialState = { clustersPath: null, helpPath: null, emptyImagePath: null, statusPath: null }, +) => ({ + clustersPath: initialState.clustersPath, error: null, + helpPath: initialState.helpPath, installed: 'checking', isLoading: true, // functions functions: [], hasFunctionData: true, + statusPath: initialState.statusPath, // function_details hasPrometheus: true, hasPrometheusData: false, graphData: {}, + + // empty_state + emptyImagePath: initialState.emptyImagePath, }); |