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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
f86f9450
Commit
f86f9450
authored
May 09, 2018
by
Dennis Tang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed „fetched“ prefix from mutation and state
parent
4f001a3a
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
50 additions
and
56 deletions
+50
-56
app/assets/javascripts/projects/gke_cluster_dropdowns/components/gke_machine_type_dropdown.vue
...luster_dropdowns/components/gke_machine_type_dropdown.vue
+1
-2
app/assets/javascripts/projects/gke_cluster_dropdowns/components/gke_project_id_dropdown.vue
..._cluster_dropdowns/components/gke_project_id_dropdown.vue
+1
-2
app/assets/javascripts/projects/gke_cluster_dropdowns/components/gke_zone_dropdown.vue
...ts/gke_cluster_dropdowns/components/gke_zone_dropdown.vue
+1
-2
app/assets/javascripts/projects/gke_cluster_dropdowns/stores/actions.js
...ascripts/projects/gke_cluster_dropdowns/stores/actions.js
+3
-3
app/assets/javascripts/projects/gke_cluster_dropdowns/stores/index.js
...avascripts/projects/gke_cluster_dropdowns/stores/index.js
+3
-3
app/assets/javascripts/projects/gke_cluster_dropdowns/stores/mutation_types.js
...s/projects/gke_cluster_dropdowns/stores/mutation_types.js
+3
-3
app/assets/javascripts/projects/gke_cluster_dropdowns/stores/mutations.js
...cripts/projects/gke_cluster_dropdowns/stores/mutations.js
+6
-6
spec/javascripts/projects/gke_cluster_dropdowns/components/gke_machine_type_dropdown_spec.js
...er_dropdowns/components/gke_machine_type_dropdown_spec.js
+3
-3
spec/javascripts/projects/gke_cluster_dropdowns/components/gke_project_id_dropdown_spec.js
...ster_dropdowns/components/gke_project_id_dropdown_spec.js
+2
-2
spec/javascripts/projects/gke_cluster_dropdowns/components/gke_zone_dropdown_spec.js
...ke_cluster_dropdowns/components/gke_zone_dropdown_spec.js
+2
-5
spec/javascripts/projects/gke_cluster_dropdowns/helpers.js
spec/javascripts/projects/gke_cluster_dropdowns/helpers.js
+3
-3
spec/javascripts/projects/gke_cluster_dropdowns/stores/actions_spec.js
...pts/projects/gke_cluster_dropdowns/stores/actions_spec.js
+4
-4
spec/javascripts/projects/gke_cluster_dropdowns/stores/mutations_spec.js
...s/projects/gke_cluster_dropdowns/stores/mutations_spec.js
+18
-18
No files found.
app/assets/javascripts/projects/gke_cluster_dropdowns/components/gke_machine_type_dropdown.vue
View file @
f86f9450
...
...
@@ -42,8 +42,7 @@ export default {
};
},
computed
:
{
...
mapState
([
'
selectedProject
'
,
'
selectedZone
'
,
'
selectedMachineType
'
]),
...
mapState
({
machineTypes
:
'
fetchedMachineTypes
'
}),
...
mapState
([
'
selectedProject
'
,
'
selectedZone
'
,
'
selectedMachineType
'
,
'
machineTypes
'
]),
...
mapGetters
([
'
hasProject
'
,
'
hasZone
'
,
'
hasMachineType
'
]),
isDisabled
()
{
return
!
this
.
selectedProject
||
!
this
.
selectedZone
;
...
...
app/assets/javascripts/projects/gke_cluster_dropdowns/components/gke_project_id_dropdown.vue
View file @
f86f9450
...
...
@@ -45,8 +45,7 @@ export default {
};
},
computed
:
{
...
mapState
([
'
selectedProject
'
]),
...
mapState
({
projects
:
'
fetchedProjects
'
}),
...
mapState
([
'
selectedProject
'
,
'
projects
'
]),
...
mapGetters
([
'
hasProject
'
]),
hasOneProject
()
{
return
this
.
projects
.
length
===
1
;
...
...
app/assets/javascripts/projects/gke_cluster_dropdowns/components/gke_zone_dropdown.vue
View file @
f86f9450
...
...
@@ -42,8 +42,7 @@ export default {
};
},
computed
:
{
...
mapState
([
'
selectedProject
'
,
'
selectedZone
'
]),
...
mapState
({
zones
:
'
fetchedZones
'
}),
...
mapState
([
'
selectedProject
'
,
'
selectedZone
'
,
'
zones
'
]),
...
mapGetters
([
'
hasProject
'
]),
isDisabled
()
{
return
!
this
.
hasProject
;
...
...
app/assets/javascripts/projects/gke_cluster_dropdowns/stores/actions.js
View file @
f86f9450
...
...
@@ -29,7 +29,7 @@ export const getProjects = ({ commit }) =>
return
request
.
then
(
resp
=>
{
commit
(
types
.
SET_
FETCHED_
PROJECTS
,
resp
.
result
.
projects
);
commit
(
types
.
SET_PROJECTS
,
resp
.
result
.
projects
);
resolve
();
},
...
...
@@ -60,7 +60,7 @@ export const getZones = ({ commit, state }) =>
return
request
.
then
(
resp
=>
{
commit
(
types
.
SET_
FETCHED_
ZONES
,
resp
.
result
.
items
);
commit
(
types
.
SET_ZONES
,
resp
.
result
.
items
);
resolve
();
},
...
...
@@ -90,7 +90,7 @@ export const getMachineTypes = ({ commit, state }) =>
return
request
.
then
(
resp
=>
{
commit
(
types
.
SET_
FETCHED_
MACHINE_TYPES
,
resp
.
result
.
items
);
commit
(
types
.
SET_MACHINE_TYPES
,
resp
.
result
.
items
);
resolve
();
},
...
...
app/assets/javascripts/projects/gke_cluster_dropdowns/stores/index.js
View file @
f86f9450
...
...
@@ -17,8 +17,8 @@ export default new Vuex.Store({
},
selectedZone
:
''
,
selectedMachineType
:
''
,
fetchedP
rojects
:
[],
fetchedZ
ones
:
[],
fetchedM
achineTypes
:
[],
p
rojects
:
[],
z
ones
:
[],
m
achineTypes
:
[],
},
});
app/assets/javascripts/projects/gke_cluster_dropdowns/stores/mutation_types.js
View file @
f86f9450
export
const
SET_PROJECT
=
'
SET_PROJECT
'
;
export
const
SET_ZONE
=
'
SET_ZONE
'
;
export
const
SET_MACHINE_TYPE
=
'
SET_MACHINE_TYPE
'
;
export
const
SET_
FETCHED_PROJECTS
=
'
SET_FETCHED
_PROJECTS
'
;
export
const
SET_
FETCHED_ZONES
=
'
SET_FETCHED
_ZONES
'
;
export
const
SET_
FETCHED_MACHINE_TYPES
=
'
SET_FETCHED
_MACHINE_TYPES
'
;
export
const
SET_
PROJECTS
=
'
SET
_PROJECTS
'
;
export
const
SET_
ZONES
=
'
SET
_ZONES
'
;
export
const
SET_
MACHINE_TYPES
=
'
SET
_MACHINE_TYPES
'
;
app/assets/javascripts/projects/gke_cluster_dropdowns/stores/mutations.js
View file @
f86f9450
...
...
@@ -10,13 +10,13 @@ export default {
[
types
.
SET_MACHINE_TYPE
](
state
,
selectedMachineType
)
{
Object
.
assign
(
state
,
{
selectedMachineType
});
},
[
types
.
SET_
FETCHED_PROJECTS
](
state
,
fetchedP
rojects
)
{
Object
.
assign
(
state
,
{
fetchedP
rojects
});
[
types
.
SET_
PROJECTS
](
state
,
p
rojects
)
{
Object
.
assign
(
state
,
{
p
rojects
});
},
[
types
.
SET_
FETCHED_ZONES
](
state
,
fetchedZ
ones
)
{
Object
.
assign
(
state
,
{
fetchedZ
ones
});
[
types
.
SET_
ZONES
](
state
,
z
ones
)
{
Object
.
assign
(
state
,
{
z
ones
});
},
[
types
.
SET_
FETCHED_MACHINE_TYPES
](
state
,
fetchedM
achineTypes
)
{
Object
.
assign
(
state
,
{
fetchedM
achineTypes
});
[
types
.
SET_
MACHINE_TYPES
](
state
,
m
achineTypes
)
{
Object
.
assign
(
state
,
{
m
achineTypes
});
},
};
spec/javascripts/projects/gke_cluster_dropdowns/components/gke_machine_type_dropdown_spec.js
View file @
f86f9450
...
...
@@ -3,8 +3,8 @@ import GkeMachineTypeDropdown from '~/projects/gke_cluster_dropdowns/components/
import
{
SET_PROJECT
,
SET_ZONE
,
SET_
FETCHED_
ZONES
,
SET_
FETCHED_
MACHINE_TYPES
,
SET_ZONES
,
SET_MACHINE_TYPES
,
}
from
'
~/projects/gke_cluster_dropdowns/stores/mutation_types
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
...
...
@@ -84,7 +84,7 @@ describe('GkeMachineTypeDropdown', () => {
describe
(
'
form input
'
,
()
=>
{
it
(
'
reflects new value when dropdown item is clicked
'
,
done
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
input
'
).
value
).
toBe
(
''
);
vm
.
$store
.
commit
(
SET_
FETCHED_
MACHINE_TYPES
,
gapiMachineTypesResponseMock
.
items
);
vm
.
$store
.
commit
(
SET_MACHINE_TYPES
,
gapiMachineTypesResponseMock
.
items
);
vm
.
$nextTick
(()
=>
{
vm
.
$el
.
querySelector
(
'
.dropdown-content button
'
).
click
();
...
...
spec/javascripts/projects/gke_cluster_dropdowns/components/gke_project_id_dropdown_spec.js
View file @
f86f9450
import
Vue
from
'
vue
'
;
import
GkeProjectIdDropdown
from
'
~/projects/gke_cluster_dropdowns/components/gke_project_id_dropdown.vue
'
;
import
{
SET_
FETCHED_
PROJECTS
}
from
'
~/projects/gke_cluster_dropdowns/stores/mutation_types
'
;
import
{
SET_PROJECTS
}
from
'
~/projects/gke_cluster_dropdowns/stores/mutation_types
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
resetStore
}
from
'
../helpers
'
;
...
...
@@ -64,7 +64,7 @@ describe('GkeProjectIdDropdown', () => {
it
(
'
returns empty toggle text
'
,
done
=>
{
vm
.
$nextTick
(()
=>
{
vm
.
$store
.
commit
(
SET_
FETCHED_
PROJECTS
,
[]);
vm
.
$store
.
commit
(
SET_PROJECTS
,
[]);
vm
.
setProject
(
emptyProjectMock
);
vm
.
$nextTick
(()
=>
{
...
...
spec/javascripts/projects/gke_cluster_dropdowns/components/gke_zone_dropdown_spec.js
View file @
f86f9450
import
Vue
from
'
vue
'
;
import
GkeZoneDropdown
from
'
~/projects/gke_cluster_dropdowns/components/gke_zone_dropdown.vue
'
;
import
{
SET_PROJECT
,
SET_FETCHED_ZONES
,
}
from
'
~/projects/gke_cluster_dropdowns/stores/mutation_types
'
;
import
{
SET_PROJECT
,
SET_ZONES
}
from
'
~/projects/gke_cluster_dropdowns/stores/mutation_types
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
resetStore
}
from
'
../helpers
'
;
...
...
@@ -67,7 +64,7 @@ describe('GkeZoneDropdown', () => {
describe
(
'
selectItem
'
,
()
=>
{
it
(
'
reflects new value when dropdown item is clicked
'
,
done
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
input
'
).
value
).
toBe
(
''
);
vm
.
$store
.
commit
(
SET_
FETCHED_
ZONES
,
gapiZonesResponseMock
.
items
);
vm
.
$store
.
commit
(
SET_ZONES
,
gapiZonesResponseMock
.
items
);
vm
.
$nextTick
(()
=>
{
vm
.
$el
.
querySelector
(
'
.dropdown-content button
'
).
click
();
...
...
spec/javascripts/projects/gke_cluster_dropdowns/helpers.js
View file @
f86f9450
...
...
@@ -13,9 +13,9 @@ export const resetStore = store => {
},
selectedZone
:
''
,
selectedMachineType
:
''
,
fetchedP
rojects
:
[],
fetchedZ
ones
:
[],
fetchedM
achineTypes
:
[],
p
rojects
:
[],
z
ones
:
[],
m
achineTypes
:
[],
});
};
...
...
spec/javascripts/projects/gke_cluster_dropdowns/stores/actions_spec.js
View file @
f86f9450
...
...
@@ -56,8 +56,8 @@ describe('GCP Cluster Dropdown Store Actions', () => {
store
.
dispatch
(
'
getProjects
'
)
.
then
(()
=>
{
expect
(
store
.
state
.
fetchedP
rojects
[
0
].
projectId
).
toEqual
(
selectedProjectMock
.
projectId
);
expect
(
store
.
state
.
fetchedP
rojects
[
0
].
name
).
toEqual
(
selectedProjectMock
.
name
);
expect
(
store
.
state
.
p
rojects
[
0
].
projectId
).
toEqual
(
selectedProjectMock
.
projectId
);
expect
(
store
.
state
.
p
rojects
[
0
].
name
).
toEqual
(
selectedProjectMock
.
name
);
done
();
})
...
...
@@ -70,7 +70,7 @@ describe('GCP Cluster Dropdown Store Actions', () => {
store
.
dispatch
(
'
getZones
'
)
.
then
(()
=>
{
expect
(
store
.
state
.
fetchedZ
ones
[
0
].
name
).
toEqual
(
selectedZoneMock
);
expect
(
store
.
state
.
z
ones
[
0
].
name
).
toEqual
(
selectedZoneMock
);
done
();
})
...
...
@@ -83,7 +83,7 @@ describe('GCP Cluster Dropdown Store Actions', () => {
store
.
dispatch
(
'
getMachineTypes
'
)
.
then
(()
=>
{
expect
(
store
.
state
.
fetchedM
achineTypes
[
0
].
name
).
toEqual
(
selectedMachineTypeMock
);
expect
(
store
.
state
.
m
achineTypes
[
0
].
name
).
toEqual
(
selectedMachineTypeMock
);
done
();
})
...
...
spec/javascripts/projects/gke_cluster_dropdowns/stores/mutations_spec.js
View file @
f86f9450
...
...
@@ -52,45 +52,45 @@ describe('GCP Cluster Dropdown Store Mutations', () => {
});
});
describe
(
'
SET_
FETCHED_
PROJECTS
'
,
()
=>
{
it
(
'
should set Google API Projects response as
fetchedP
rojects
'
,
()
=>
{
describe
(
'
SET_PROJECTS
'
,
()
=>
{
it
(
'
should set Google API Projects response as
p
rojects
'
,
()
=>
{
const
state
=
{
fetchedP
rojects
:
[],
p
rojects
:
[],
};
expect
(
state
.
fetchedP
rojects
.
length
).
toEqual
(
0
);
expect
(
state
.
p
rojects
.
length
).
toEqual
(
0
);
mutations
.
SET_
FETCHED_
PROJECTS
(
state
,
gapiProjectsResponseMock
.
projects
);
mutations
.
SET_PROJECTS
(
state
,
gapiProjectsResponseMock
.
projects
);
expect
(
state
.
fetchedP
rojects
.
length
).
toEqual
(
gapiProjectsResponseMock
.
projects
.
length
);
expect
(
state
.
p
rojects
.
length
).
toEqual
(
gapiProjectsResponseMock
.
projects
.
length
);
});
});
describe
(
'
SET_
FETCHED_
ZONES
'
,
()
=>
{
it
(
'
should set Google API Zones response as
fetchedZ
ones
'
,
()
=>
{
describe
(
'
SET_ZONES
'
,
()
=>
{
it
(
'
should set Google API Zones response as
z
ones
'
,
()
=>
{
const
state
=
{
fetchedZ
ones
:
[],
z
ones
:
[],
};
expect
(
state
.
fetchedZ
ones
.
length
).
toEqual
(
0
);
expect
(
state
.
z
ones
.
length
).
toEqual
(
0
);
mutations
.
SET_
FETCHED_
ZONES
(
state
,
gapiZonesResponseMock
.
items
);
mutations
.
SET_ZONES
(
state
,
gapiZonesResponseMock
.
items
);
expect
(
state
.
fetchedZ
ones
.
length
).
toEqual
(
gapiZonesResponseMock
.
items
.
length
);
expect
(
state
.
z
ones
.
length
).
toEqual
(
gapiZonesResponseMock
.
items
.
length
);
});
});
describe
(
'
SET_
FETCHED_
MACHINE_TYPES
'
,
()
=>
{
it
(
'
should set Google API Machine Types response as
fetchedM
achineTypes
'
,
()
=>
{
describe
(
'
SET_MACHINE_TYPES
'
,
()
=>
{
it
(
'
should set Google API Machine Types response as
m
achineTypes
'
,
()
=>
{
const
state
=
{
fetchedM
achineTypes
:
[],
m
achineTypes
:
[],
};
expect
(
state
.
fetchedM
achineTypes
.
length
).
toEqual
(
0
);
expect
(
state
.
m
achineTypes
.
length
).
toEqual
(
0
);
mutations
.
SET_
FETCHED_
MACHINE_TYPES
(
state
,
gapiMachineTypesResponseMock
.
items
);
mutations
.
SET_MACHINE_TYPES
(
state
,
gapiMachineTypesResponseMock
.
items
);
expect
(
state
.
fetchedM
achineTypes
.
length
).
toEqual
(
gapiMachineTypesResponseMock
.
items
.
length
);
expect
(
state
.
m
achineTypes
.
length
).
toEqual
(
gapiMachineTypesResponseMock
.
items
.
length
);
});
});
});
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