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
e8c58d62
Commit
e8c58d62
authored
Sep 04, 2019
by
Lee Tickett
Committed by
Paul Slaughter
Sep 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove vue resource from group service
Addresses
https://gitlab.com/gitlab-org/gitlab-ce/issues/66750
parent
df6f1dd9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
27 deletions
+26
-27
app/assets/javascripts/groups/components/app.vue
app/assets/javascripts/groups/components/app.vue
+2
-5
app/assets/javascripts/groups/service/groups_service.js
app/assets/javascripts/groups/service/groups_service.js
+10
-11
changelogs/unreleased/remove-vue-resource-from-group-service.yml
...ogs/unreleased/remove-vue-resource-from-group-service.yml
+5
-0
spec/javascripts/groups/components/app_spec.js
spec/javascripts/groups/components/app_spec.js
+2
-1
spec/javascripts/groups/service/groups_service_spec.js
spec/javascripts/groups/service/groups_service_spec.js
+7
-10
No files found.
app/assets/javascripts/groups/components/app.vue
View file @
e8c58d62
...
@@ -95,10 +95,8 @@ export default {
...
@@ -95,10 +95,8 @@ export default {
if
(
updatePagination
)
{
if
(
updatePagination
)
{
this
.
updatePagination
(
res
.
headers
);
this
.
updatePagination
(
res
.
headers
);
}
}
return
res
.
data
;
return
res
;
})
})
.
then
(
res
=>
res
.
json
())
.
catch
(()
=>
{
.
catch
(()
=>
{
this
.
isLoading
=
false
;
this
.
isLoading
=
false
;
$
.
scrollTo
(
0
);
$
.
scrollTo
(
0
);
...
@@ -190,11 +188,10 @@ export default {
...
@@ -190,11 +188,10 @@ export default {
this
.
targetGroup
.
isBeingRemoved
=
true
;
this
.
targetGroup
.
isBeingRemoved
=
true
;
this
.
service
this
.
service
.
leaveGroup
(
this
.
targetGroup
.
leavePath
)
.
leaveGroup
(
this
.
targetGroup
.
leavePath
)
.
then
(
res
=>
res
.
json
())
.
then
(
res
=>
{
.
then
(
res
=>
{
$
.
scrollTo
(
0
);
$
.
scrollTo
(
0
);
this
.
store
.
removeGroup
(
this
.
targetGroup
,
this
.
targetParentGroup
);
this
.
store
.
removeGroup
(
this
.
targetGroup
,
this
.
targetParentGroup
);
Flash
(
res
.
notice
,
'
notice
'
);
Flash
(
res
.
data
.
notice
,
'
notice
'
);
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
let
message
=
COMMON_STR
.
FAILURE
;
let
message
=
COMMON_STR
.
FAILURE
;
...
...
app/assets/javascripts/groups/service/groups_service.js
View file @
e8c58d62
import
Vue
from
'
vue
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
'
../../vue_shared/vue_resource_interceptor
'
;
export
default
class
GroupsService
{
export
default
class
GroupsService
{
constructor
(
endpoint
)
{
constructor
(
endpoint
)
{
this
.
groups
=
Vue
.
resource
(
endpoint
)
;
this
.
endpoint
=
endpoint
;
}
}
getGroups
(
parentId
,
page
,
filterGroups
,
sort
,
archived
)
{
getGroups
(
parentId
,
page
,
filterGroups
,
sort
,
archived
)
{
const
data
=
{};
const
params
=
{};
if
(
parentId
)
{
if
(
parentId
)
{
data
.
parent_id
=
parentId
;
params
.
parent_id
=
parentId
;
}
else
{
}
else
{
// Do not send the following param for sub groups
// Do not send the following param for sub groups
if
(
page
)
{
if
(
page
)
{
data
.
page
=
page
;
params
.
page
=
page
;
}
}
if
(
filterGroups
)
{
if
(
filterGroups
)
{
data
.
filter
=
filterGroups
;
params
.
filter
=
filterGroups
;
}
}
if
(
sort
)
{
if
(
sort
)
{
data
.
sort
=
sort
;
params
.
sort
=
sort
;
}
}
if
(
archived
)
{
if
(
archived
)
{
data
.
archived
=
archived
;
params
.
archived
=
archived
;
}
}
}
}
return
this
.
groups
.
get
(
data
);
return
axios
.
get
(
this
.
endpoint
,
{
params
}
);
}
}
// eslint-disable-next-line class-methods-use-this
// eslint-disable-next-line class-methods-use-this
leaveGroup
(
endpoint
)
{
leaveGroup
(
endpoint
)
{
return
Vue
.
http
.
delete
(
endpoint
);
return
axios
.
delete
(
endpoint
);
}
}
}
}
changelogs/unreleased/remove-vue-resource-from-group-service.yml
0 → 100644
View file @
e8c58d62
---
title
:
Remove vue resource from group service
merge_request
:
author
:
Lee Tickett
type
:
other
spec/javascripts/groups/components/app_spec.js
View file @
e8c58d62
import
'
~/flash
'
;
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
...
@@ -333,7 +334,7 @@ describe('AppComponent', () => {
...
@@ -333,7 +334,7 @@ describe('AppComponent', () => {
it
(
'
hides modal confirmation leave group and remove group item from tree
'
,
done
=>
{
it
(
'
hides modal confirmation leave group and remove group item from tree
'
,
done
=>
{
const
notice
=
`You left the "
${
childGroupItem
.
fullName
}
" group.`
;
const
notice
=
`You left the "
${
childGroupItem
.
fullName
}
" group.`
;
spyOn
(
vm
.
service
,
'
leaveGroup
'
).
and
.
returnValue
(
returnServicePromise
({
notice
}));
spyOn
(
vm
.
service
,
'
leaveGroup
'
).
and
.
returnValue
(
Promise
.
resolve
({
data
:
{
notice
}
}));
spyOn
(
vm
.
store
,
'
removeGroup
'
).
and
.
callThrough
();
spyOn
(
vm
.
store
,
'
removeGroup
'
).
and
.
callThrough
();
spyOn
(
window
,
'
Flash
'
);
spyOn
(
window
,
'
Flash
'
);
spyOn
(
$
,
'
scrollTo
'
);
spyOn
(
$
,
'
scrollTo
'
);
...
...
spec/javascripts/groups/service/groups_service_spec.js
View file @
e8c58d62
import
Vue
from
'
vue
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
VueResource
from
'
vue-resource
'
;
import
GroupsService
from
'
~/groups/service/groups_service
'
;
import
GroupsService
from
'
~/groups/service/groups_service
'
;
import
{
mockEndpoint
,
mockParentGroupItem
}
from
'
../mock_data
'
;
import
{
mockEndpoint
,
mockParentGroupItem
}
from
'
../mock_data
'
;
Vue
.
use
(
VueResource
);
describe
(
'
GroupsService
'
,
()
=>
{
describe
(
'
GroupsService
'
,
()
=>
{
let
service
;
let
service
;
...
@@ -15,8 +12,8 @@ describe('GroupsService', () => {
...
@@ -15,8 +12,8 @@ describe('GroupsService', () => {
describe
(
'
getGroups
'
,
()
=>
{
describe
(
'
getGroups
'
,
()
=>
{
it
(
'
should return promise for `GET` request on provided endpoint
'
,
()
=>
{
it
(
'
should return promise for `GET` request on provided endpoint
'
,
()
=>
{
spyOn
(
service
.
group
s
,
'
get
'
).
and
.
stub
();
spyOn
(
axio
s
,
'
get
'
).
and
.
stub
();
const
queryP
arams
=
{
const
p
arams
=
{
page
:
2
,
page
:
2
,
filter
:
'
git
'
,
filter
:
'
git
'
,
sort
:
'
created_asc
'
,
sort
:
'
created_asc
'
,
...
@@ -25,21 +22,21 @@ describe('GroupsService', () => {
...
@@ -25,21 +22,21 @@ describe('GroupsService', () => {
service
.
getGroups
(
55
,
2
,
'
git
'
,
'
created_asc
'
,
true
);
service
.
getGroups
(
55
,
2
,
'
git
'
,
'
created_asc
'
,
true
);
expect
(
service
.
groups
.
get
).
toHaveBeenCalledWith
({
parent_id
:
55
});
expect
(
axios
.
get
).
toHaveBeenCalledWith
(
mockEndpoint
,
{
params
:
{
parent_id
:
55
}
});
service
.
getGroups
(
null
,
2
,
'
git
'
,
'
created_asc
'
,
true
);
service
.
getGroups
(
null
,
2
,
'
git
'
,
'
created_asc
'
,
true
);
expect
(
service
.
groups
.
get
).
toHaveBeenCalledWith
(
queryParams
);
expect
(
axios
.
get
).
toHaveBeenCalledWith
(
mockEndpoint
,
{
params
}
);
});
});
});
});
describe
(
'
leaveGroup
'
,
()
=>
{
describe
(
'
leaveGroup
'
,
()
=>
{
it
(
'
should return promise for `DELETE` request on provided endpoint
'
,
()
=>
{
it
(
'
should return promise for `DELETE` request on provided endpoint
'
,
()
=>
{
spyOn
(
Vue
.
http
,
'
delete
'
).
and
.
stub
();
spyOn
(
axios
,
'
delete
'
).
and
.
stub
();
service
.
leaveGroup
(
mockParentGroupItem
.
leavePath
);
service
.
leaveGroup
(
mockParentGroupItem
.
leavePath
);
expect
(
Vue
.
http
.
delete
).
toHaveBeenCalledWith
(
mockParentGroupItem
.
leavePath
);
expect
(
axios
.
delete
).
toHaveBeenCalledWith
(
mockParentGroupItem
.
leavePath
);
});
});
});
});
});
});
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