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
bd3e95ea
Commit
bd3e95ea
authored
Apr 11, 2018
by
Filipa Lacerda
Committed by
Clement Ho
Apr 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace vue resource with axios for pipeline details page
parent
b2f57a56
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
33 deletions
+27
-33
app/assets/javascripts/pipelines/pipeline_details_mediator.js
...assets/javascripts/pipelines/pipeline_details_mediator.js
+2
-4
app/assets/javascripts/pipelines/services/pipeline_service.js
...assets/javascripts/pipelines/services/pipeline_service.js
+5
-8
changelogs/unreleased/fl-pipelines-details-axios.yml
changelogs/unreleased/fl-pipelines-details-axios.yml
+5
-0
spec/javascripts/pipelines/pipeline_details_mediator_spec.js
spec/javascripts/pipelines/pipeline_details_mediator_spec.js
+15
-21
No files found.
app/assets/javascripts/pipelines/pipeline_details_mediator.js
View file @
bd3e95ea
...
@@ -40,10 +40,8 @@ export default class pipelinesMediator {
...
@@ -40,10 +40,8 @@ export default class pipelinesMediator {
}
}
successCallback
(
response
)
{
successCallback
(
response
)
{
return
response
.
json
().
then
((
data
)
=>
{
this
.
state
.
isLoading
=
false
;
this
.
state
.
isLoading
=
false
;
this
.
store
.
storePipeline
(
data
);
this
.
store
.
storePipeline
(
response
.
data
);
});
}
}
errorCallback
()
{
errorCallback
()
{
...
...
app/assets/javascripts/pipelines/services/pipeline_service.js
View file @
bd3e95ea
import
Vue
from
'
vue
'
;
import
axios
from
'
../../lib/utils/axios_utils
'
;
import
VueResource
from
'
vue-resource
'
;
Vue
.
use
(
VueResource
);
export
default
class
PipelineService
{
export
default
class
PipelineService
{
constructor
(
endpoint
)
{
constructor
(
endpoint
)
{
this
.
pipeline
=
Vue
.
resource
(
endpoint
)
;
this
.
pipeline
=
endpoint
;
}
}
getPipeline
()
{
getPipeline
()
{
return
this
.
pipeline
.
get
(
);
return
axios
.
get
(
this
.
pipeline
);
}
}
// eslint-disable-next-line
// eslint-disable-next-line
class-methods-use-this
postAction
(
endpoint
)
{
postAction
(
endpoint
)
{
return
Vue
.
http
.
post
(
`
${
endpoint
}
.json`
);
return
axios
.
post
(
`
${
endpoint
}
.json`
);
}
}
}
}
changelogs/unreleased/fl-pipelines-details-axios.yml
0 → 100644
View file @
bd3e95ea
---
title
:
Replace vue resource with axios for pipelines details page
merge_request
:
author
:
type
:
other
spec/javascripts/pipelines/pipeline_details_mediator_spec.js
View file @
bd3e95ea
import
_
from
'
underscore
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
Vue
from
'
vue
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
PipelineMediator
from
'
~/pipelines/pipeline_details_mediator
'
;
import
PipelineMediator
from
'
~/pipelines/pipeline_details_mediator
'
;
describe
(
'
PipelineMdediator
'
,
()
=>
{
describe
(
'
PipelineMdediator
'
,
()
=>
{
let
mediator
;
let
mediator
;
let
mock
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
mediator
=
new
PipelineMediator
({
endpoint
:
'
foo
'
});
mock
=
new
MockAdapter
(
axios
);
mediator
=
new
PipelineMediator
({
endpoint
:
'
foo.json
'
});
});
afterEach
(()
=>
{
mock
.
restore
();
});
});
it
(
'
should set defaults
'
,
()
=>
{
it
(
'
should set defaults
'
,
()
=>
{
expect
(
mediator
.
options
).
toEqual
({
endpoint
:
'
foo
'
});
expect
(
mediator
.
options
).
toEqual
({
endpoint
:
'
foo
.json
'
});
expect
(
mediator
.
state
.
isLoading
).
toEqual
(
false
);
expect
(
mediator
.
state
.
isLoading
).
toEqual
(
false
);
expect
(
mediator
.
store
).
toBeDefined
();
expect
(
mediator
.
store
).
toBeDefined
();
expect
(
mediator
.
service
).
toBeDefined
();
expect
(
mediator
.
service
).
toBeDefined
();
});
});
describe
(
'
request and store data
'
,
()
=>
{
describe
(
'
request and store data
'
,
()
=>
{
const
interceptor
=
(
request
,
next
)
=>
{
it
(
'
should store received data
'
,
done
=>
{
next
(
request
.
respondWith
(
JSON
.
stringify
({
foo
:
'
bar
'
}),
{
mock
.
onGet
(
'
foo.json
'
).
reply
(
200
,
{
id
:
'
121123
'
});
status
:
200
,
}));
};
beforeEach
(()
=>
{
Vue
.
http
.
interceptors
.
push
(
interceptor
);
});
afterEach
(()
=>
{
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptor
,
interceptor
);
});
it
(
'
should store received data
'
,
(
done
)
=>
{
mediator
.
fetchPipeline
();
mediator
.
fetchPipeline
();
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
mediator
.
store
.
state
.
pipeline
).
toEqual
({
foo
:
'
bar
'
});
expect
(
mediator
.
store
.
state
.
pipeline
).
toEqual
({
id
:
'
121123
'
});
done
();
done
();
});
}
,
0
);
});
});
});
});
});
});
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