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
a96b9ebf
Commit
a96b9ebf
authored
May 06, 2019
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removes fetchStage actions and mutations
Updates tests
parent
cc4a0d9a
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
145 additions
and
327 deletions
+145
-327
app/assets/javascripts/jobs/components/job_app.vue
app/assets/javascripts/jobs/components/job_app.vue
+5
-2
app/assets/javascripts/jobs/components/sidebar.vue
app/assets/javascripts/jobs/components/sidebar.vue
+1
-2
app/assets/javascripts/jobs/store/actions.js
app/assets/javascripts/jobs/store/actions.js
+0
-17
app/assets/javascripts/jobs/store/mutation_types.js
app/assets/javascripts/jobs/store/mutation_types.js
+0
-4
app/assets/javascripts/jobs/store/mutations.js
app/assets/javascripts/jobs/store/mutations.js
+2
-12
app/assets/javascripts/jobs/store/state.js
app/assets/javascripts/jobs/store/state.js
+0
-1
spec/frontend/jobs/store/mutations_spec.js
spec/frontend/jobs/store/mutations_spec.js
+1
-37
spec/javascripts/jobs/components/sidebar_spec.js
spec/javascripts/jobs/components/sidebar_spec.js
+1
-13
spec/javascripts/jobs/mock_data.js
spec/javascripts/jobs/mock_data.js
+135
-134
spec/javascripts/jobs/store/actions_spec.js
spec/javascripts/jobs/store/actions_spec.js
+0
-105
No files found.
app/assets/javascripts/jobs/components/job_app.vue
View file @
a96b9ebf
...
@@ -86,6 +86,7 @@ export default {
...
@@ -86,6 +86,7 @@ export default {
'
isScrollTopDisabled
'
,
'
isScrollTopDisabled
'
,
'
isScrolledToBottomBeforeReceivingTrace
'
,
'
isScrolledToBottomBeforeReceivingTrace
'
,
'
hasError
'
,
'
hasError
'
,
'
selectedStage
'
,
]),
]),
...
mapGetters
([
...
mapGetters
([
'
headerTime
'
,
'
headerTime
'
,
...
@@ -121,7 +122,9 @@ export default {
...
@@ -121,7 +122,9 @@ export default {
// fetch the stages for the dropdown on the sidebar
// fetch the stages for the dropdown on the sidebar
job
(
newVal
,
oldVal
)
{
job
(
newVal
,
oldVal
)
{
if
(
_
.
isEmpty
(
oldVal
)
&&
!
_
.
isEmpty
(
newVal
.
pipeline
))
{
if
(
_
.
isEmpty
(
oldVal
)
&&
!
_
.
isEmpty
(
newVal
.
pipeline
))
{
this
.
fetchStages
();
this
.
fetchJobsForStage
(
this
.
job
.
pipeline
.
details
.
stages
.
find
(
stage
=>
stage
&&
stage
.
name
===
this
.
selectedStage
),
);
}
}
if
(
newVal
.
archived
)
{
if
(
newVal
.
archived
)
{
...
@@ -160,7 +163,7 @@ export default {
...
@@ -160,7 +163,7 @@ export default {
'
setJobEndpoint
'
,
'
setJobEndpoint
'
,
'
setTraceOptions
'
,
'
setTraceOptions
'
,
'
fetchJob
'
,
'
fetchJob
'
,
'
fetch
Stages
'
,
'
fetch
JobsForStage
'
,
'
hideSidebar
'
,
'
hideSidebar
'
,
'
showSidebar
'
,
'
showSidebar
'
,
'
toggleSidebar
'
,
'
toggleSidebar
'
,
...
...
app/assets/javascripts/jobs/components/sidebar.vue
View file @
a96b9ebf
...
@@ -34,7 +34,7 @@ export default {
...
@@ -34,7 +34,7 @@ export default {
},
},
},
},
computed
:
{
computed
:
{
...
mapState
([
'
job
'
,
'
stages
'
,
'
jobs
'
,
'
selectedStage
'
,
'
isLoadingStages
'
]),
...
mapState
([
'
job
'
,
'
stages
'
,
'
jobs
'
,
'
selectedStage
'
]),
coverage
()
{
coverage
()
{
return
`
${
this
.
job
.
coverage
}
%`
;
return
`
${
this
.
job
.
coverage
}
%`
;
},
},
...
@@ -208,7 +208,6 @@ export default {
...
@@ -208,7 +208,6 @@ export default {
/>
/>
<stages-dropdown
<stages-dropdown
v-if=
"!isLoadingStages"
:stages=
"stages"
:stages=
"stages"
:pipeline=
"job.pipeline"
:pipeline=
"job.pipeline"
:selected-stage=
"selectedStage"
:selected-stage=
"selectedStage"
...
...
app/assets/javascripts/jobs/store/actions.js
View file @
a96b9ebf
...
@@ -178,23 +178,6 @@ export const receiveTraceError = ({ commit }) => {
...
@@ -178,23 +178,6 @@ export const receiveTraceError = ({ commit }) => {
flash
(
__
(
'
An error occurred while fetching the job log.
'
));
flash
(
__
(
'
An error occurred while fetching the job log.
'
));
};
};
/**
* Stages dropdown on sidebar
*/
export
const
requestStages
=
({
commit
})
=>
commit
(
types
.
REQUEST_STAGES
);
export
const
fetchStages
=
({
state
,
dispatch
})
=>
{
dispatch
(
'
requestStages
'
);
dispatch
(
'
receiveStagesSuccess
'
,
state
.
job
.
pipeline
.
details
.
stages
);
const
selectedStage
=
state
.
job
.
pipeline
.
details
.
stages
.
find
(
stage
=>
stage
.
name
===
state
.
selectedStage
);
dispatch
(
'
fetchJobsForStage
'
,
selectedStage
);
};
export
const
receiveStagesSuccess
=
({
commit
},
data
)
=>
commit
(
types
.
RECEIVE_STAGES_SUCCESS
,
data
);
export
const
receiveStagesError
=
({
commit
})
=>
{
commit
(
types
.
RECEIVE_STAGES_ERROR
);
flash
(
__
(
'
An error occurred while fetching stages.
'
));
};
/**
/**
* Jobs list on sidebar - depend on stages dropdown
* Jobs list on sidebar - depend on stages dropdown
*/
*/
...
...
app/assets/javascripts/jobs/store/mutation_types.js
View file @
a96b9ebf
...
@@ -24,10 +24,6 @@ export const STOP_POLLING_TRACE = 'STOP_POLLING_TRACE';
...
@@ -24,10 +24,6 @@ export const STOP_POLLING_TRACE = 'STOP_POLLING_TRACE';
export
const
RECEIVE_TRACE_SUCCESS
=
'
RECEIVE_TRACE_SUCCESS
'
;
export
const
RECEIVE_TRACE_SUCCESS
=
'
RECEIVE_TRACE_SUCCESS
'
;
export
const
RECEIVE_TRACE_ERROR
=
'
RECEIVE_TRACE_ERROR
'
;
export
const
RECEIVE_TRACE_ERROR
=
'
RECEIVE_TRACE_ERROR
'
;
export
const
REQUEST_STAGES
=
'
REQUEST_STAGES
'
;
export
const
RECEIVE_STAGES_SUCCESS
=
'
RECEIVE_STAGES_SUCCESS
'
;
export
const
RECEIVE_STAGES_ERROR
=
'
RECEIVE_STAGES_ERROR
'
;
export
const
SET_SELECTED_STAGE
=
'
SET_SELECTED_STAGE
'
;
export
const
SET_SELECTED_STAGE
=
'
SET_SELECTED_STAGE
'
;
export
const
REQUEST_JOBS_FOR_STAGE
=
'
REQUEST_JOBS_FOR_STAGE
'
;
export
const
REQUEST_JOBS_FOR_STAGE
=
'
REQUEST_JOBS_FOR_STAGE
'
;
export
const
RECEIVE_JOBS_FOR_STAGE_SUCCESS
=
'
RECEIVE_JOBS_FOR_STAGE_SUCCESS
'
;
export
const
RECEIVE_JOBS_FOR_STAGE_SUCCESS
=
'
RECEIVE_JOBS_FOR_STAGE_SUCCESS
'
;
...
...
app/assets/javascripts/jobs/store/mutations.js
View file @
a96b9ebf
...
@@ -65,6 +65,8 @@ export default {
...
@@ -65,6 +65,8 @@ export default {
state
.
isLoading
=
false
;
state
.
isLoading
=
false
;
state
.
job
=
job
;
state
.
job
=
job
;
state
.
stages
=
job
.
pipeline
.
details
.
stages
||
[];
/**
/**
* We only update it on the first request
* We only update it on the first request
* The dropdown can be changed by the user
* The dropdown can be changed by the user
...
@@ -101,18 +103,6 @@ export default {
...
@@ -101,18 +103,6 @@ export default {
state
.
isScrolledToBottomBeforeReceivingTrace
=
toggle
;
state
.
isScrolledToBottomBeforeReceivingTrace
=
toggle
;
},
},
[
types
.
REQUEST_STAGES
](
state
)
{
state
.
isLoadingStages
=
true
;
},
[
types
.
RECEIVE_STAGES_SUCCESS
](
state
,
stages
)
{
state
.
isLoadingStages
=
false
;
state
.
stages
=
stages
;
},
[
types
.
RECEIVE_STAGES_ERROR
](
state
)
{
state
.
isLoadingStages
=
false
;
state
.
stages
=
[];
},
[
types
.
REQUEST_JOBS_FOR_STAGE
](
state
,
stage
)
{
[
types
.
REQUEST_JOBS_FOR_STAGE
](
state
,
stage
)
{
state
.
isLoadingJobs
=
true
;
state
.
isLoadingJobs
=
true
;
state
.
selectedStage
=
stage
.
name
;
state
.
selectedStage
=
stage
.
name
;
...
...
app/assets/javascripts/jobs/store/state.js
View file @
a96b9ebf
...
@@ -25,7 +25,6 @@ export default () => ({
...
@@ -25,7 +25,6 @@ export default () => ({
traceState
:
null
,
traceState
:
null
,
// sidebar dropdown & list of jobs
// sidebar dropdown & list of jobs
isLoadingStages
:
false
,
isLoadingJobs
:
false
,
isLoadingJobs
:
false
,
selectedStage
:
''
,
selectedStage
:
''
,
stages
:
[],
stages
:
[],
...
...
spec/frontend/jobs/store/mutations_spec.js
View file @
a96b9ebf
...
@@ -150,44 +150,8 @@ describe('Jobs Store Mutations', () => {
...
@@ -150,44 +150,8 @@ describe('Jobs Store Mutations', () => {
});
});
});
});
describe
(
'
REQUEST_STAGES
'
,
()
=>
{
it
(
'
sets isLoadingStages to true
'
,
()
=>
{
mutations
[
types
.
REQUEST_STAGES
](
stateCopy
);
expect
(
stateCopy
.
isLoadingStages
).
toEqual
(
true
);
});
});
describe
(
'
RECEIVE_STAGES_SUCCESS
'
,
()
=>
{
beforeEach
(()
=>
{
mutations
[
types
.
RECEIVE_STAGES_SUCCESS
](
stateCopy
,
[{
name
:
'
build
'
}]);
});
it
(
'
sets isLoadingStages to false
'
,
()
=>
{
expect
(
stateCopy
.
isLoadingStages
).
toEqual
(
false
);
});
it
(
'
sets stages
'
,
()
=>
{
expect
(
stateCopy
.
stages
).
toEqual
([{
name
:
'
build
'
}]);
});
});
describe
(
'
RECEIVE_STAGES_ERROR
'
,
()
=>
{
beforeEach
(()
=>
{
mutations
[
types
.
RECEIVE_STAGES_ERROR
](
stateCopy
);
});
it
(
'
sets isLoadingStages to false
'
,
()
=>
{
expect
(
stateCopy
.
isLoadingStages
).
toEqual
(
false
);
});
it
(
'
resets stages
'
,
()
=>
{
expect
(
stateCopy
.
stages
).
toEqual
([]);
});
});
describe
(
'
REQUEST_JOBS_FOR_STAGE
'
,
()
=>
{
describe
(
'
REQUEST_JOBS_FOR_STAGE
'
,
()
=>
{
it
(
'
sets isLoading
Stage
s to true
'
,
()
=>
{
it
(
'
sets isLoading
Job
s to true
'
,
()
=>
{
mutations
[
types
.
REQUEST_JOBS_FOR_STAGE
](
stateCopy
,
{
name
:
'
deploy
'
});
mutations
[
types
.
REQUEST_JOBS_FOR_STAGE
](
stateCopy
,
{
name
:
'
deploy
'
});
expect
(
stateCopy
.
isLoadingJobs
).
toEqual
(
true
);
expect
(
stateCopy
.
isLoadingJobs
).
toEqual
(
true
);
...
...
spec/javascripts/jobs/components/sidebar_spec.js
View file @
a96b9ebf
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
sidebarDetailsBlock
from
'
~/jobs/components/sidebar.vue
'
;
import
sidebarDetailsBlock
from
'
~/jobs/components/sidebar.vue
'
;
import
createStore
from
'
~/jobs/store
'
;
import
createStore
from
'
~/jobs/store
'
;
import
job
,
{
stages
,
jobsInStage
}
from
'
../mock_data
'
;
import
job
,
{
jobsInStage
}
from
'
../mock_data
'
;
import
{
mountComponentWithStore
}
from
'
../../helpers/vue_mount_component_helper
'
;
import
{
mountComponentWithStore
}
from
'
../../helpers/vue_mount_component_helper
'
;
import
{
trimText
}
from
'
../../helpers/text_helper
'
;
import
{
trimText
}
from
'
../../helpers/text_helper
'
;
...
@@ -131,18 +131,8 @@ describe('Sidebar details block', () => {
...
@@ -131,18 +131,8 @@ describe('Sidebar details block', () => {
store
.
dispatch
(
'
receiveJobSuccess
'
,
job
);
store
.
dispatch
(
'
receiveJobSuccess
'
,
job
);
});
});
describe
(
'
while fetching stages
'
,
()
=>
{
it
(
'
it does not render dropdown
'
,
()
=>
{
store
.
dispatch
(
'
requestStages
'
);
vm
=
mountComponentWithStore
(
SidebarComponent
,
{
store
});
expect
(
vm
.
$el
.
querySelector
(
'
.js-selected-stage
'
)).
toBeNull
();
});
});
describe
(
'
with stages
'
,
()
=>
{
describe
(
'
with stages
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
store
.
dispatch
(
'
receiveStagesSuccess
'
,
stages
);
vm
=
mountComponentWithStore
(
SidebarComponent
,
{
store
});
vm
=
mountComponentWithStore
(
SidebarComponent
,
{
store
});
});
});
...
@@ -156,7 +146,6 @@ describe('Sidebar details block', () => {
...
@@ -156,7 +146,6 @@ describe('Sidebar details block', () => {
describe
(
'
without jobs for stages
'
,
()
=>
{
describe
(
'
without jobs for stages
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
store
.
dispatch
(
'
receiveJobSuccess
'
,
job
);
store
.
dispatch
(
'
receiveJobSuccess
'
,
job
);
store
.
dispatch
(
'
receiveStagesSuccess
'
,
stages
);
vm
=
mountComponentWithStore
(
SidebarComponent
,
{
store
});
vm
=
mountComponentWithStore
(
SidebarComponent
,
{
store
});
});
});
...
@@ -168,7 +157,6 @@ describe('Sidebar details block', () => {
...
@@ -168,7 +157,6 @@ describe('Sidebar details block', () => {
describe
(
'
with jobs for stages
'
,
()
=>
{
describe
(
'
with jobs for stages
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
store
.
dispatch
(
'
receiveJobSuccess
'
,
job
);
store
.
dispatch
(
'
receiveJobSuccess
'
,
job
);
store
.
dispatch
(
'
receiveStagesSuccess
'
,
stages
);
store
.
dispatch
(
'
receiveJobsForStageSuccess
'
,
jobsInStage
.
latest_statuses
);
store
.
dispatch
(
'
receiveJobsForStageSuccess
'
,
jobsInStage
.
latest_statuses
);
vm
=
mountComponentWithStore
(
SidebarComponent
,
{
store
});
vm
=
mountComponentWithStore
(
SidebarComponent
,
{
store
});
});
});
...
...
spec/javascripts/jobs/mock_data.js
View file @
a96b9ebf
...
@@ -3,140 +3,6 @@ import { TEST_HOST } from 'spec/test_constants';
...
@@ -3,140 +3,6 @@ import { TEST_HOST } from 'spec/test_constants';
const
threeWeeksAgo
=
new
Date
();
const
threeWeeksAgo
=
new
Date
();
threeWeeksAgo
.
setDate
(
threeWeeksAgo
.
getDate
()
-
21
);
threeWeeksAgo
.
setDate
(
threeWeeksAgo
.
getDate
()
-
21
);
export
default
{
id
:
4757
,
name
:
'
test
'
,
build_path
:
'
/root/ci-mock/-/jobs/4757
'
,
retry_path
:
'
/root/ci-mock/-/jobs/4757/retry
'
,
cancel_path
:
'
/root/ci-mock/-/jobs/4757/cancel
'
,
new_issue_path
:
'
/root/ci-mock/issues/new
'
,
playable
:
false
,
created_at
:
threeWeeksAgo
.
toISOString
(),
updated_at
:
threeWeeksAgo
.
toISOString
(),
finished_at
:
threeWeeksAgo
.
toISOString
(),
queued
:
9.54
,
status
:
{
icon
:
'
status_success
'
,
text
:
'
passed
'
,
label
:
'
passed
'
,
group
:
'
success
'
,
has_details
:
true
,
details_path
:
`
${
TEST_HOST
}
/root/ci-mock/-/jobs/4757`
,
favicon
:
'
/assets/ci_favicons/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.png
'
,
action
:
{
icon
:
'
retry
'
,
title
:
'
Retry
'
,
path
:
'
/root/ci-mock/-/jobs/4757/retry
'
,
method
:
'
post
'
,
},
},
coverage
:
20
,
erased_at
:
threeWeeksAgo
.
toISOString
(),
erased
:
false
,
duration
:
6.785563
,
tags
:
[
'
tag
'
],
user
:
{
name
:
'
Root
'
,
username
:
'
root
'
,
id
:
1
,
state
:
'
active
'
,
avatar_url
:
'
https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80
\
u0026d=identicon
'
,
web_url
:
'
http://localhost:3000/root
'
,
},
erase_path
:
'
/root/ci-mock/-/jobs/4757/erase
'
,
artifacts
:
[
null
],
runner
:
{
id
:
1
,
description
:
'
local ci runner
'
,
edit_path
:
'
/root/ci-mock/runners/1/edit
'
,
},
pipeline
:
{
id
:
140
,
user
:
{
name
:
'
Root
'
,
username
:
'
root
'
,
id
:
1
,
state
:
'
active
'
,
avatar_url
:
'
https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80
\
u0026d=identicon
'
,
web_url
:
'
http://localhost:3000/root
'
,
},
active
:
false
,
coverage
:
null
,
source
:
'
unknown
'
,
created_at
:
'
2017-05-24T09:59:58.634Z
'
,
updated_at
:
'
2017-06-01T17:32:00.062Z
'
,
path
:
'
/root/ci-mock/pipelines/140
'
,
flags
:
{
latest
:
true
,
stuck
:
false
,
yaml_errors
:
false
,
retryable
:
false
,
cancelable
:
false
,
},
details
:
{
status
:
{
icon
:
'
status_success
'
,
text
:
'
passed
'
,
label
:
'
passed
'
,
group
:
'
success
'
,
has_details
:
true
,
details_path
:
'
/root/ci-mock/pipelines/140
'
,
favicon
:
'
/assets/ci_favicons/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.png
'
,
},
duration
:
6
,
finished_at
:
'
2017-06-01T17:32:00.042Z
'
,
},
ref
:
{
name
:
'
abc
'
,
path
:
'
/root/ci-mock/commits/abc
'
,
tag
:
false
,
branch
:
true
,
},
commit
:
{
id
:
'
c58647773a6b5faf066d4ad6ff2c9fbba5f180f6
'
,
short_id
:
'
c5864777
'
,
title
:
'
Add new file
'
,
created_at
:
'
2017-05-24T10:59:52.000+01:00
'
,
parent_ids
:
[
'
798e5f902592192afaba73f4668ae30e56eae492
'
],
message
:
'
Add new file
'
,
author_name
:
'
Root
'
,
author_email
:
'
admin@example.com
'
,
authored_date
:
'
2017-05-24T10:59:52.000+01:00
'
,
committer_name
:
'
Root
'
,
committer_email
:
'
admin@example.com
'
,
committed_date
:
'
2017-05-24T10:59:52.000+01:00
'
,
author
:
{
name
:
'
Root
'
,
username
:
'
root
'
,
id
:
1
,
state
:
'
active
'
,
avatar_url
:
'
https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80
\
u0026d=identicon
'
,
web_url
:
'
http://localhost:3000/root
'
,
},
author_gravatar_url
:
'
https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80
\
u0026d=identicon
'
,
commit_url
:
'
http://localhost:3000/root/ci-mock/commit/c58647773a6b5faf066d4ad6ff2c9fbba5f180f6
'
,
commit_path
:
'
/root/ci-mock/commit/c58647773a6b5faf066d4ad6ff2c9fbba5f180f6
'
,
},
},
metadata
:
{
timeout_human_readable
:
'
1m 40s
'
,
timeout_source
:
'
runner
'
,
},
merge_request
:
{
iid
:
2
,
path
:
'
/root/ci-mock/merge_requests/2
'
,
},
raw_path
:
'
/root/ci-mock/builds/4757/raw
'
,
has_trace
:
true
,
};
export
const
stages
=
[
export
const
stages
=
[
{
{
name
:
'
build
'
,
name
:
'
build
'
,
...
@@ -1043,6 +909,141 @@ export const stages = [
...
@@ -1043,6 +909,141 @@ export const stages = [
},
},
];
];
export
default
{
id
:
4757
,
name
:
'
test
'
,
build_path
:
'
/root/ci-mock/-/jobs/4757
'
,
retry_path
:
'
/root/ci-mock/-/jobs/4757/retry
'
,
cancel_path
:
'
/root/ci-mock/-/jobs/4757/cancel
'
,
new_issue_path
:
'
/root/ci-mock/issues/new
'
,
playable
:
false
,
created_at
:
threeWeeksAgo
.
toISOString
(),
updated_at
:
threeWeeksAgo
.
toISOString
(),
finished_at
:
threeWeeksAgo
.
toISOString
(),
queued
:
9.54
,
status
:
{
icon
:
'
status_success
'
,
text
:
'
passed
'
,
label
:
'
passed
'
,
group
:
'
success
'
,
has_details
:
true
,
details_path
:
`
${
TEST_HOST
}
/root/ci-mock/-/jobs/4757`
,
favicon
:
'
/assets/ci_favicons/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.png
'
,
action
:
{
icon
:
'
retry
'
,
title
:
'
Retry
'
,
path
:
'
/root/ci-mock/-/jobs/4757/retry
'
,
method
:
'
post
'
,
},
},
coverage
:
20
,
erased_at
:
threeWeeksAgo
.
toISOString
(),
erased
:
false
,
duration
:
6.785563
,
tags
:
[
'
tag
'
],
user
:
{
name
:
'
Root
'
,
username
:
'
root
'
,
id
:
1
,
state
:
'
active
'
,
avatar_url
:
'
https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80
\
u0026d=identicon
'
,
web_url
:
'
http://localhost:3000/root
'
,
},
erase_path
:
'
/root/ci-mock/-/jobs/4757/erase
'
,
artifacts
:
[
null
],
runner
:
{
id
:
1
,
description
:
'
local ci runner
'
,
edit_path
:
'
/root/ci-mock/runners/1/edit
'
,
},
pipeline
:
{
id
:
140
,
user
:
{
name
:
'
Root
'
,
username
:
'
root
'
,
id
:
1
,
state
:
'
active
'
,
avatar_url
:
'
https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80
\
u0026d=identicon
'
,
web_url
:
'
http://localhost:3000/root
'
,
},
active
:
false
,
coverage
:
null
,
source
:
'
unknown
'
,
created_at
:
'
2017-05-24T09:59:58.634Z
'
,
updated_at
:
'
2017-06-01T17:32:00.062Z
'
,
path
:
'
/root/ci-mock/pipelines/140
'
,
flags
:
{
latest
:
true
,
stuck
:
false
,
yaml_errors
:
false
,
retryable
:
false
,
cancelable
:
false
,
},
details
:
{
status
:
{
icon
:
'
status_success
'
,
text
:
'
passed
'
,
label
:
'
passed
'
,
group
:
'
success
'
,
has_details
:
true
,
details_path
:
'
/root/ci-mock/pipelines/140
'
,
favicon
:
'
/assets/ci_favicons/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.png
'
,
},
duration
:
6
,
finished_at
:
'
2017-06-01T17:32:00.042Z
'
,
stages
:
stages
,
},
ref
:
{
name
:
'
abc
'
,
path
:
'
/root/ci-mock/commits/abc
'
,
tag
:
false
,
branch
:
true
,
},
commit
:
{
id
:
'
c58647773a6b5faf066d4ad6ff2c9fbba5f180f6
'
,
short_id
:
'
c5864777
'
,
title
:
'
Add new file
'
,
created_at
:
'
2017-05-24T10:59:52.000+01:00
'
,
parent_ids
:
[
'
798e5f902592192afaba73f4668ae30e56eae492
'
],
message
:
'
Add new file
'
,
author_name
:
'
Root
'
,
author_email
:
'
admin@example.com
'
,
authored_date
:
'
2017-05-24T10:59:52.000+01:00
'
,
committer_name
:
'
Root
'
,
committer_email
:
'
admin@example.com
'
,
committed_date
:
'
2017-05-24T10:59:52.000+01:00
'
,
author
:
{
name
:
'
Root
'
,
username
:
'
root
'
,
id
:
1
,
state
:
'
active
'
,
avatar_url
:
'
https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80
\
u0026d=identicon
'
,
web_url
:
'
http://localhost:3000/root
'
,
},
author_gravatar_url
:
'
https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80
\
u0026d=identicon
'
,
commit_url
:
'
http://localhost:3000/root/ci-mock/commit/c58647773a6b5faf066d4ad6ff2c9fbba5f180f6
'
,
commit_path
:
'
/root/ci-mock/commit/c58647773a6b5faf066d4ad6ff2c9fbba5f180f6
'
,
},
},
metadata
:
{
timeout_human_readable
:
'
1m 40s
'
,
timeout_source
:
'
runner
'
,
},
merge_request
:
{
iid
:
2
,
path
:
'
/root/ci-mock/merge_requests/2
'
,
},
raw_path
:
'
/root/ci-mock/builds/4757/raw
'
,
has_trace
:
true
,
};
export
const
jobsInStage
=
{
export
const
jobsInStage
=
{
name
:
'
build
'
,
name
:
'
build
'
,
title
:
'
build: running
'
,
title
:
'
build: running
'
,
...
...
spec/javascripts/jobs/store/actions_spec.js
View file @
a96b9ebf
...
@@ -16,10 +16,6 @@ import {
...
@@ -16,10 +16,6 @@ import {
stopPollingTrace
,
stopPollingTrace
,
receiveTraceSuccess
,
receiveTraceSuccess
,
receiveTraceError
,
receiveTraceError
,
requestStages
,
fetchStages
,
receiveStagesSuccess
,
receiveStagesError
,
requestJobsForStage
,
requestJobsForStage
,
fetchJobsForStage
,
fetchJobsForStage
,
receiveJobsForStageSuccess
,
receiveJobsForStageSuccess
,
...
@@ -307,107 +303,6 @@ describe('Job State actions', () => {
...
@@ -307,107 +303,6 @@ describe('Job State actions', () => {
});
});
});
});
describe
(
'
requestStages
'
,
()
=>
{
it
(
'
should commit REQUEST_STAGES mutation
'
,
done
=>
{
testAction
(
requestStages
,
null
,
mockedState
,
[{
type
:
types
.
REQUEST_STAGES
}],
[],
done
);
});
});
describe
(
'
fetchStages
'
,
()
=>
{
let
mock
;
beforeEach
(()
=>
{
mockedState
.
job
.
pipeline
=
{
path
:
`
${
TEST_HOST
}
/endpoint`
,
};
mockedState
.
selectedStage
=
'
deploy
'
;
mock
=
new
MockAdapter
(
axios
);
});
afterEach
(()
=>
{
mock
.
restore
();
});
describe
(
'
success
'
,
()
=>
{
it
(
'
dispatches requestStages and receiveStagesSuccess, fetchJobsForStage
'
,
done
=>
{
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint.json`
)
.
replyOnce
(
200
,
{
details
:
{
stages
:
[{
name
:
'
build
'
},
{
name
:
'
deploy
'
}]
}
});
testAction
(
fetchStages
,
null
,
mockedState
,
[],
[
{
type
:
'
requestStages
'
,
},
{
payload
:
[{
name
:
'
build
'
},
{
name
:
'
deploy
'
}],
type
:
'
receiveStagesSuccess
'
,
},
{
payload
:
{
name
:
'
deploy
'
},
type
:
'
fetchJobsForStage
'
,
},
],
done
,
);
});
});
describe
(
'
error
'
,
()
=>
{
beforeEach
(()
=>
{
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint.json`
).
reply
(
500
);
});
it
(
'
dispatches requestStages and receiveStagesError
'
,
done
=>
{
testAction
(
fetchStages
,
null
,
mockedState
,
[],
[
{
type
:
'
requestStages
'
,
},
{
type
:
'
receiveStagesError
'
,
},
],
done
,
);
});
});
});
describe
(
'
receiveStagesSuccess
'
,
()
=>
{
it
(
'
should commit RECEIVE_STAGES_SUCCESS mutation
'
,
done
=>
{
testAction
(
receiveStagesSuccess
,
{},
mockedState
,
[{
type
:
types
.
RECEIVE_STAGES_SUCCESS
,
payload
:
{}
}],
[],
done
,
);
});
});
describe
(
'
receiveStagesError
'
,
()
=>
{
it
(
'
should commit RECEIVE_STAGES_ERROR mutation
'
,
done
=>
{
testAction
(
receiveStagesError
,
null
,
mockedState
,
[{
type
:
types
.
RECEIVE_STAGES_ERROR
}],
[],
done
,
);
});
});
describe
(
'
requestJobsForStage
'
,
()
=>
{
describe
(
'
requestJobsForStage
'
,
()
=>
{
it
(
'
should commit REQUEST_JOBS_FOR_STAGE mutation
'
,
done
=>
{
it
(
'
should commit REQUEST_JOBS_FOR_STAGE mutation
'
,
done
=>
{
testAction
(
testAction
(
...
...
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