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 {
...
@@ -42,8 +42,7 @@ export default {
};
};
},
},
computed
:
{
computed
:
{
...
mapState
([
'
selectedProject
'
,
'
selectedZone
'
,
'
selectedMachineType
'
]),
...
mapState
([
'
selectedProject
'
,
'
selectedZone
'
,
'
selectedMachineType
'
,
'
machineTypes
'
]),
...
mapState
({
machineTypes
:
'
fetchedMachineTypes
'
}),
...
mapGetters
([
'
hasProject
'
,
'
hasZone
'
,
'
hasMachineType
'
]),
...
mapGetters
([
'
hasProject
'
,
'
hasZone
'
,
'
hasMachineType
'
]),
isDisabled
()
{
isDisabled
()
{
return
!
this
.
selectedProject
||
!
this
.
selectedZone
;
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 {
...
@@ -45,8 +45,7 @@ export default {
};
};
},
},
computed
:
{
computed
:
{
...
mapState
([
'
selectedProject
'
]),
...
mapState
([
'
selectedProject
'
,
'
projects
'
]),
...
mapState
({
projects
:
'
fetchedProjects
'
}),
...
mapGetters
([
'
hasProject
'
]),
...
mapGetters
([
'
hasProject
'
]),
hasOneProject
()
{
hasOneProject
()
{
return
this
.
projects
.
length
===
1
;
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 {
...
@@ -42,8 +42,7 @@ export default {
};
};
},
},
computed
:
{
computed
:
{
...
mapState
([
'
selectedProject
'
,
'
selectedZone
'
]),
...
mapState
([
'
selectedProject
'
,
'
selectedZone
'
,
'
zones
'
]),
...
mapState
({
zones
:
'
fetchedZones
'
}),
...
mapGetters
([
'
hasProject
'
]),
...
mapGetters
([
'
hasProject
'
]),
isDisabled
()
{
isDisabled
()
{
return
!
this
.
hasProject
;
return
!
this
.
hasProject
;
...
...
app/assets/javascripts/projects/gke_cluster_dropdowns/stores/actions.js
View file @
f86f9450
...
@@ -29,7 +29,7 @@ export const getProjects = ({ commit }) =>
...
@@ -29,7 +29,7 @@ export const getProjects = ({ commit }) =>
return
request
.
then
(
return
request
.
then
(
resp
=>
{
resp
=>
{
commit
(
types
.
SET_
FETCHED_
PROJECTS
,
resp
.
result
.
projects
);
commit
(
types
.
SET_PROJECTS
,
resp
.
result
.
projects
);
resolve
();
resolve
();
},
},
...
@@ -60,7 +60,7 @@ export const getZones = ({ commit, state }) =>
...
@@ -60,7 +60,7 @@ export const getZones = ({ commit, state }) =>
return
request
.
then
(
return
request
.
then
(
resp
=>
{
resp
=>
{
commit
(
types
.
SET_
FETCHED_
ZONES
,
resp
.
result
.
items
);
commit
(
types
.
SET_ZONES
,
resp
.
result
.
items
);
resolve
();
resolve
();
},
},
...
@@ -90,7 +90,7 @@ export const getMachineTypes = ({ commit, state }) =>
...
@@ -90,7 +90,7 @@ export const getMachineTypes = ({ commit, state }) =>
return
request
.
then
(
return
request
.
then
(
resp
=>
{
resp
=>
{
commit
(
types
.
SET_
FETCHED_
MACHINE_TYPES
,
resp
.
result
.
items
);
commit
(
types
.
SET_MACHINE_TYPES
,
resp
.
result
.
items
);
resolve
();
resolve
();
},
},
...
...
app/assets/javascripts/projects/gke_cluster_dropdowns/stores/index.js
View file @
f86f9450
...
@@ -17,8 +17,8 @@ export default new Vuex.Store({
...
@@ -17,8 +17,8 @@ export default new Vuex.Store({
},
},
selectedZone
:
''
,
selectedZone
:
''
,
selectedMachineType
:
''
,
selectedMachineType
:
''
,
fetchedP
rojects
:
[],
p
rojects
:
[],
fetchedZ
ones
:
[],
z
ones
:
[],
fetchedM
achineTypes
:
[],
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_PROJECT
=
'
SET_PROJECT
'
;
export
const
SET_ZONE
=
'
SET_ZONE
'
;
export
const
SET_ZONE
=
'
SET_ZONE
'
;
export
const
SET_MACHINE_TYPE
=
'
SET_MACHINE_TYPE
'
;
export
const
SET_MACHINE_TYPE
=
'
SET_MACHINE_TYPE
'
;
export
const
SET_
FETCHED_PROJECTS
=
'
SET_FETCHED
_PROJECTS
'
;
export
const
SET_
PROJECTS
=
'
SET
_PROJECTS
'
;
export
const
SET_
FETCHED_ZONES
=
'
SET_FETCHED
_ZONES
'
;
export
const
SET_
ZONES
=
'
SET
_ZONES
'
;
export
const
SET_
FETCHED_MACHINE_TYPES
=
'
SET_FETCHED
_MACHINE_TYPES
'
;
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 {
...
@@ -10,13 +10,13 @@ export default {
[
types
.
SET_MACHINE_TYPE
](
state
,
selectedMachineType
)
{
[
types
.
SET_MACHINE_TYPE
](
state
,
selectedMachineType
)
{
Object
.
assign
(
state
,
{
selectedMachineType
});
Object
.
assign
(
state
,
{
selectedMachineType
});
},
},
[
types
.
SET_
FETCHED_PROJECTS
](
state
,
fetchedP
rojects
)
{
[
types
.
SET_
PROJECTS
](
state
,
p
rojects
)
{
Object
.
assign
(
state
,
{
fetchedP
rojects
});
Object
.
assign
(
state
,
{
p
rojects
});
},
},
[
types
.
SET_
FETCHED_ZONES
](
state
,
fetchedZ
ones
)
{
[
types
.
SET_
ZONES
](
state
,
z
ones
)
{
Object
.
assign
(
state
,
{
fetchedZ
ones
});
Object
.
assign
(
state
,
{
z
ones
});
},
},
[
types
.
SET_
FETCHED_MACHINE_TYPES
](
state
,
fetchedM
achineTypes
)
{
[
types
.
SET_
MACHINE_TYPES
](
state
,
m
achineTypes
)
{
Object
.
assign
(
state
,
{
fetchedM
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/
...
@@ -3,8 +3,8 @@ import GkeMachineTypeDropdown from '~/projects/gke_cluster_dropdowns/components/
import
{
import
{
SET_PROJECT
,
SET_PROJECT
,
SET_ZONE
,
SET_ZONE
,
SET_
FETCHED_
ZONES
,
SET_ZONES
,
SET_
FETCHED_
MACHINE_TYPES
,
SET_MACHINE_TYPES
,
}
from
'
~/projects/gke_cluster_dropdowns/stores/mutation_types
'
;
}
from
'
~/projects/gke_cluster_dropdowns/stores/mutation_types
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
...
@@ -84,7 +84,7 @@ describe('GkeMachineTypeDropdown', () => {
...
@@ -84,7 +84,7 @@ describe('GkeMachineTypeDropdown', () => {
describe
(
'
form input
'
,
()
=>
{
describe
(
'
form input
'
,
()
=>
{
it
(
'
reflects new value when dropdown item is clicked
'
,
done
=>
{
it
(
'
reflects new value when dropdown item is clicked
'
,
done
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
input
'
).
value
).
toBe
(
''
);
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
.
$nextTick
(()
=>
{
vm
.
$el
.
querySelector
(
'
.dropdown-content button
'
).
click
();
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
Vue
from
'
vue
'
;
import
GkeProjectIdDropdown
from
'
~/projects/gke_cluster_dropdowns/components/gke_project_id_dropdown.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
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
resetStore
}
from
'
../helpers
'
;
import
{
resetStore
}
from
'
../helpers
'
;
...
@@ -64,7 +64,7 @@ describe('GkeProjectIdDropdown', () => {
...
@@ -64,7 +64,7 @@ describe('GkeProjectIdDropdown', () => {
it
(
'
returns empty toggle text
'
,
done
=>
{
it
(
'
returns empty toggle text
'
,
done
=>
{
vm
.
$nextTick
(()
=>
{
vm
.
$nextTick
(()
=>
{
vm
.
$store
.
commit
(
SET_
FETCHED_
PROJECTS
,
[]);
vm
.
$store
.
commit
(
SET_PROJECTS
,
[]);
vm
.
setProject
(
emptyProjectMock
);
vm
.
setProject
(
emptyProjectMock
);
vm
.
$nextTick
(()
=>
{
vm
.
$nextTick
(()
=>
{
...
...
spec/javascripts/projects/gke_cluster_dropdowns/components/gke_zone_dropdown_spec.js
View file @
f86f9450
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
GkeZoneDropdown
from
'
~/projects/gke_cluster_dropdowns/components/gke_zone_dropdown.vue
'
;
import
GkeZoneDropdown
from
'
~/projects/gke_cluster_dropdowns/components/gke_zone_dropdown.vue
'
;
import
{
import
{
SET_PROJECT
,
SET_ZONES
}
from
'
~/projects/gke_cluster_dropdowns/stores/mutation_types
'
;
SET_PROJECT
,
SET_FETCHED_ZONES
,
}
from
'
~/projects/gke_cluster_dropdowns/stores/mutation_types
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
resetStore
}
from
'
../helpers
'
;
import
{
resetStore
}
from
'
../helpers
'
;
...
@@ -67,7 +64,7 @@ describe('GkeZoneDropdown', () => {
...
@@ -67,7 +64,7 @@ describe('GkeZoneDropdown', () => {
describe
(
'
selectItem
'
,
()
=>
{
describe
(
'
selectItem
'
,
()
=>
{
it
(
'
reflects new value when dropdown item is clicked
'
,
done
=>
{
it
(
'
reflects new value when dropdown item is clicked
'
,
done
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
input
'
).
value
).
toBe
(
''
);
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
.
$nextTick
(()
=>
{
vm
.
$el
.
querySelector
(
'
.dropdown-content button
'
).
click
();
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 => {
...
@@ -13,9 +13,9 @@ export const resetStore = store => {
},
},
selectedZone
:
''
,
selectedZone
:
''
,
selectedMachineType
:
''
,
selectedMachineType
:
''
,
fetchedP
rojects
:
[],
p
rojects
:
[],
fetchedZ
ones
:
[],
z
ones
:
[],
fetchedM
achineTypes
:
[],
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', () => {
...
@@ -56,8 +56,8 @@ describe('GCP Cluster Dropdown Store Actions', () => {
store
store
.
dispatch
(
'
getProjects
'
)
.
dispatch
(
'
getProjects
'
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
store
.
state
.
fetchedP
rojects
[
0
].
projectId
).
toEqual
(
selectedProjectMock
.
projectId
);
expect
(
store
.
state
.
p
rojects
[
0
].
projectId
).
toEqual
(
selectedProjectMock
.
projectId
);
expect
(
store
.
state
.
fetchedP
rojects
[
0
].
name
).
toEqual
(
selectedProjectMock
.
name
);
expect
(
store
.
state
.
p
rojects
[
0
].
name
).
toEqual
(
selectedProjectMock
.
name
);
done
();
done
();
})
})
...
@@ -70,7 +70,7 @@ describe('GCP Cluster Dropdown Store Actions', () => {
...
@@ -70,7 +70,7 @@ describe('GCP Cluster Dropdown Store Actions', () => {
store
store
.
dispatch
(
'
getZones
'
)
.
dispatch
(
'
getZones
'
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
store
.
state
.
fetchedZ
ones
[
0
].
name
).
toEqual
(
selectedZoneMock
);
expect
(
store
.
state
.
z
ones
[
0
].
name
).
toEqual
(
selectedZoneMock
);
done
();
done
();
})
})
...
@@ -83,7 +83,7 @@ describe('GCP Cluster Dropdown Store Actions', () => {
...
@@ -83,7 +83,7 @@ describe('GCP Cluster Dropdown Store Actions', () => {
store
store
.
dispatch
(
'
getMachineTypes
'
)
.
dispatch
(
'
getMachineTypes
'
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
store
.
state
.
fetchedM
achineTypes
[
0
].
name
).
toEqual
(
selectedMachineTypeMock
);
expect
(
store
.
state
.
m
achineTypes
[
0
].
name
).
toEqual
(
selectedMachineTypeMock
);
done
();
done
();
})
})
...
...
spec/javascripts/projects/gke_cluster_dropdowns/stores/mutations_spec.js
View file @
f86f9450
...
@@ -52,45 +52,45 @@ describe('GCP Cluster Dropdown Store Mutations', () => {
...
@@ -52,45 +52,45 @@ describe('GCP Cluster Dropdown Store Mutations', () => {
});
});
});
});
describe
(
'
SET_
FETCHED_
PROJECTS
'
,
()
=>
{
describe
(
'
SET_PROJECTS
'
,
()
=>
{
it
(
'
should set Google API Projects response as
fetchedP
rojects
'
,
()
=>
{
it
(
'
should set Google API Projects response as
p
rojects
'
,
()
=>
{
const
state
=
{
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
'
,
()
=>
{
describe
(
'
SET_ZONES
'
,
()
=>
{
it
(
'
should set Google API Zones response as
fetchedZ
ones
'
,
()
=>
{
it
(
'
should set Google API Zones response as
z
ones
'
,
()
=>
{
const
state
=
{
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
'
,
()
=>
{
describe
(
'
SET_MACHINE_TYPES
'
,
()
=>
{
it
(
'
should set Google API Machine Types response as
fetchedM
achineTypes
'
,
()
=>
{
it
(
'
should set Google API Machine Types response as
m
achineTypes
'
,
()
=>
{
const
state
=
{
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