Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
2b903ece
Commit
2b903ece
authored
May 14, 2018
by
Dennis Tang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename vuex actions as per best practices
parent
3acc649d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
27 deletions
+27
-27
app/assets/javascripts/projects/gke_cluster_dropdowns/components/gke_machine_type_dropdown.vue
...luster_dropdowns/components/gke_machine_type_dropdown.vue
+2
-2
app/assets/javascripts/projects/gke_cluster_dropdowns/components/gke_project_id_dropdown.vue
..._cluster_dropdowns/components/gke_project_id_dropdown.vue
+2
-2
app/assets/javascripts/projects/gke_cluster_dropdowns/components/gke_zone_dropdown.vue
...ts/gke_cluster_dropdowns/components/gke_zone_dropdown.vue
+2
-2
app/assets/javascripts/projects/gke_cluster_dropdowns/store/actions.js
...vascripts/projects/gke_cluster_dropdowns/store/actions.js
+15
-15
spec/javascripts/projects/gke_cluster_dropdowns/stores/actions_spec.js
...pts/projects/gke_cluster_dropdowns/stores/actions_spec.js
+6
-6
No files found.
app/assets/javascripts/projects/gke_cluster_dropdowns/components/gke_machine_type_dropdown.vue
View file @
2b903ece
...
...
@@ -47,7 +47,7 @@ export default {
selectedZone
()
{
this
.
isLoading
=
true
;
this
.
get
MachineTypes
()
this
.
fetch
MachineTypes
()
.
then
(
this
.
fetchSuccessHandler
)
.
catch
(
this
.
fetchFailureHandler
);
},
...
...
@@ -56,7 +56,7 @@ export default {
},
},
methods
:
{
...
mapActions
([
'
get
MachineTypes
'
]),
...
mapActions
([
'
fetch
MachineTypes
'
]),
...
mapActions
({
setItem
:
'
setMachineType
'
}),
enableSubmit
()
{
if
(
this
.
allDropdownsSelected
)
{
...
...
app/assets/javascripts/projects/gke_cluster_dropdowns/components/gke_project_id_dropdown.vue
View file @
2b903ece
...
...
@@ -76,12 +76,12 @@ export default {
created
()
{
this
.
isLoading
=
true
;
this
.
get
Projects
()
this
.
fetch
Projects
()
.
then
(
this
.
fetchSuccessHandler
)
.
catch
(
this
.
fetchFailureHandler
);
},
methods
:
{
...
mapActions
([
'
get
Projects
'
]),
...
mapActions
([
'
fetch
Projects
'
]),
...
mapActions
({
setItem
:
'
setProject
'
}),
fetchSuccessHandler
()
{
if
(
this
.
defaultValue
)
{
...
...
app/assets/javascripts/projects/gke_cluster_dropdowns/components/gke_zone_dropdown.vue
View file @
2b903ece
...
...
@@ -38,13 +38,13 @@ export default {
selectedProject
()
{
this
.
isLoading
=
true
;
this
.
get
Zones
()
this
.
fetch
Zones
()
.
then
(
this
.
fetchSuccessHandler
)
.
catch
(
this
.
fetchFailureHandler
);
},
},
methods
:
{
...
mapActions
([
'
get
Zones
'
]),
...
mapActions
([
'
fetch
Zones
'
]),
...
mapActions
({
setItem
:
'
setZone
'
}),
},
};
...
...
app/assets/javascripts/projects/gke_cluster_dropdowns/store/actions.js
View file @
2b903ece
/* global gapi */
import
*
as
types
from
'
./mutation_types
'
;
export
const
setProject
=
({
commit
},
selectedProject
)
=>
{
commit
(
types
.
SET_PROJECT
,
selectedProject
);
};
export
const
setZone
=
({
commit
},
selectedZone
)
=>
{
commit
(
types
.
SET_ZONE
,
selectedZone
);
};
export
const
setMachineType
=
({
commit
},
selectedMachineType
)
=>
{
commit
(
types
.
SET_MACHINE_TYPE
,
selectedMachineType
);
};
const
gapiRequest
=
({
service
,
params
,
commit
,
mutation
,
payloadKey
})
=>
new
Promise
((
resolve
,
reject
)
=>
{
const
request
=
service
.
list
(
params
);
...
...
@@ -31,7 +19,19 @@ const gapiRequest = ({ service, params, commit, mutation, payloadKey }) =>
);
});
export
const
getProjects
=
({
commit
})
=>
export
const
setProject
=
({
commit
},
selectedProject
)
=>
{
commit
(
types
.
SET_PROJECT
,
selectedProject
);
};
export
const
setZone
=
({
commit
},
selectedZone
)
=>
{
commit
(
types
.
SET_ZONE
,
selectedZone
);
};
export
const
setMachineType
=
({
commit
},
selectedMachineType
)
=>
{
commit
(
types
.
SET_MACHINE_TYPE
,
selectedMachineType
);
};
export
const
fetchProjects
=
({
commit
})
=>
gapiRequest
({
service
:
gapi
.
client
.
cloudresourcemanager
.
projects
,
params
:
{},
...
...
@@ -40,7 +40,7 @@ export const getProjects = ({ commit }) =>
payloadKey
:
'
projects
'
,
});
export
const
get
Zones
=
({
commit
,
state
})
=>
export
const
fetch
Zones
=
({
commit
,
state
})
=>
gapiRequest
({
service
:
gapi
.
client
.
compute
.
zones
,
params
:
{
...
...
@@ -51,7 +51,7 @@ export const getZones = ({ commit, state }) =>
payloadKey
:
'
items
'
,
});
export
const
get
MachineTypes
=
({
commit
,
state
})
=>
export
const
fetch
MachineTypes
=
({
commit
,
state
})
=>
gapiRequest
({
service
:
gapi
.
client
.
compute
.
machineTypes
,
params
:
{
...
...
spec/javascripts/projects/gke_cluster_dropdowns/stores/actions_spec.js
View file @
2b903ece
...
...
@@ -51,10 +51,10 @@ describe('GCP Cluster Dropdown Store Actions', () => {
describe
(
'
async fetch methods
'
,
()
=>
{
window
.
gapi
=
gapi
();
describe
(
'
get
Projects
'
,
()
=>
{
describe
(
'
fetch
Projects
'
,
()
=>
{
it
(
'
fetches projects from Google API
'
,
done
=>
{
store
.
dispatch
(
'
get
Projects
'
)
.
dispatch
(
'
fetch
Projects
'
)
.
then
(()
=>
{
expect
(
store
.
state
.
projects
[
0
].
projectId
).
toEqual
(
selectedProjectMock
.
projectId
);
expect
(
store
.
state
.
projects
[
0
].
name
).
toEqual
(
selectedProjectMock
.
name
);
...
...
@@ -65,10 +65,10 @@ describe('GCP Cluster Dropdown Store Actions', () => {
});
});
describe
(
'
get
Zones
'
,
()
=>
{
describe
(
'
fetch
Zones
'
,
()
=>
{
it
(
'
fetches zones from Google API
'
,
done
=>
{
store
.
dispatch
(
'
get
Zones
'
)
.
dispatch
(
'
fetch
Zones
'
)
.
then
(()
=>
{
expect
(
store
.
state
.
zones
[
0
].
name
).
toEqual
(
selectedZoneMock
);
...
...
@@ -78,10 +78,10 @@ describe('GCP Cluster Dropdown Store Actions', () => {
});
});
describe
(
'
get
MachineTypes
'
,
()
=>
{
describe
(
'
fetch
MachineTypes
'
,
()
=>
{
it
(
'
fetches machine types from Google API
'
,
done
=>
{
store
.
dispatch
(
'
get
MachineTypes
'
)
.
dispatch
(
'
fetch
MachineTypes
'
)
.
then
(()
=>
{
expect
(
store
.
state
.
machineTypes
[
0
].
name
).
toEqual
(
selectedMachineTypeMock
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment