Commit 75ad40f6 authored by Enrique Alcantara's avatar Enrique Alcantara

Set instance types in initial state

Instead of fetching instance types, retrieve them
from a data attribute.
parent 3baa517c
......@@ -24,7 +24,6 @@ const {
} = createNamespacedHelpers('securityGroups');
const {
mapState: mapInstanceTypesState,
mapActions: mapInstanceTypesActions,
} = createNamespacedHelpers('instanceTypes');
export default {
......@@ -265,7 +264,6 @@ export default {
mounted() {
this.fetchRegions();
this.fetchRoles();
this.fetchInstanceTypes();
},
methods: {
...mapActions([
......
......@@ -23,7 +23,6 @@ export default el => {
createClusterPath,
signOutPath,
externalLinkIcon,
getInstanceTypesPath,
} = el.dataset;
return new Vue({
......@@ -38,9 +37,6 @@ export default el => {
createClusterPath,
signOutPath,
},
apiPaths: {
getInstanceTypesPath,
},
awsCredentials: {
accessKeyId,
secretAccessKey,
......
......@@ -3,11 +3,11 @@ import actions from './actions';
import mutations from './mutations';
import state from './state';
const createStore = fetchFn => ({
const createStore = ({ fetchFn, initialState }) => ({
actions: actions(fetchFn),
getters,
mutations,
state: state(),
state: Object.assign(state(), initialState || {}),
});
export default createStore;
......@@ -48,7 +48,7 @@ const createStore = ({ initialState }) =>
},
instanceTypes: {
namespaced: true,
...clusterDropdownStore({ initialState: initialState.instanceTypes }),
...clusterDropdownStore({ initialState: { items: initialState.instanceTypes } }),
},
},
});
......
......@@ -27,7 +27,6 @@ describe('EksClusterConfigurationForm', () => {
let subnetsActions;
let keyPairsActions;
let securityGroupsActions;
let instanceTypesActions;
let vm;
beforeEach(() => {
......@@ -66,9 +65,6 @@ describe('EksClusterConfigurationForm', () => {
securityGroupsActions = {
fetchItems: jest.fn(),
};
instanceTypesActions = {
fetchItems: jest.fn(),
};
rolesState = {
...clusterDropdownStoreState(),
};
......@@ -127,7 +123,6 @@ describe('EksClusterConfigurationForm', () => {
instanceTypes: {
namespaced: true,
state: instanceTypesState,
actions: instanceTypesActions,
},
},
});
......@@ -187,10 +182,6 @@ describe('EksClusterConfigurationForm', () => {
it('fetches available roles', () => {
expect(rolesActions.fetchItems).toHaveBeenCalled();
});
it('fetches available instance types', () => {
expect(instanceTypesActions.fetchItems).toHaveBeenCalled();
});
});
it('dispatches signOut action when sign out button is clicked', () => {
......
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