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
Léo-Paul Géneau
gitlab-ce
Commits
c9d676c1
Commit
c9d676c1
authored
May 30, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed mutations, update single object instead of returning new array
bunch of i18n stuff
🙈
parent
6c9844c1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
47 deletions
+52
-47
app/assets/javascripts/ide/components/pipelines/list.vue
app/assets/javascripts/ide/components/pipelines/list.vue
+10
-6
app/assets/javascripts/ide/stores/modules/pipelines/constants.js
...ets/javascripts/ide/stores/modules/pipelines/constants.js
+4
-0
app/assets/javascripts/ide/stores/modules/pipelines/getters.js
...ssets/javascripts/ide/stores/modules/pipelines/getters.js
+8
-4
app/assets/javascripts/ide/stores/modules/pipelines/mutations.js
...ets/javascripts/ide/stores/modules/pipelines/mutations.js
+10
-28
app/assets/javascripts/ide/stores/modules/pipelines/utils.js
app/assets/javascripts/ide/stores/modules/pipelines/utils.js
+7
-0
spec/javascripts/ide/components/jobs/stage_spec.js
spec/javascripts/ide/components/jobs/stage_spec.js
+13
-9
No files found.
app/assets/javascripts/ide/components/pipelines/list.vue
View file @
c9d676c1
<
script
>
<
script
>
import
{
mapActions
,
mapGetters
,
mapState
}
from
'
vuex
'
;
import
{
mapActions
,
mapGetters
,
mapState
}
from
'
vuex
'
;
import
_
from
'
underscore
'
;
import
{
sprintf
,
__
}
from
'
../../../locale
'
;
import
{
sprintf
,
__
}
from
'
../../../locale
'
;
import
LoadingIcon
from
'
../../../vue_shared/components/loading_icon.vue
'
;
import
LoadingIcon
from
'
../../../vue_shared/components/loading_icon.vue
'
;
import
Icon
from
'
../../../vue_shared/components/icon.vue
'
;
import
Icon
from
'
../../../vue_shared/components/icon.vue
'
;
...
@@ -28,12 +29,15 @@ export default {
...
@@ -28,12 +29,15 @@ export default {
return
sprintf
(
return
sprintf
(
__
(
'
You can also test your .gitlab-ci.yml in the %{linkStart}Lint%{linkEnd}
'
),
__
(
'
You can also test your .gitlab-ci.yml in the %{linkStart}Lint%{linkEnd}
'
),
{
{
linkStart
:
`<a href="
${
this
.
currentProject
.
web_url
}
/-/ci/lint">`
,
linkStart
:
`<a href="
${
_
.
escape
(
this
.
currentProject
.
web_url
)
}
/-/ci/lint">`
,
linkEnd
:
'
</a>
'
,
linkEnd
:
'
</a>
'
,
},
},
false
,
false
,
);
);
},
},
showLoadingIcon
()
{
return
this
.
isLoadingPipeline
&&
this
.
latestPipeline
===
null
;
},
},
},
created
()
{
created
()
{
this
.
fetchLatestPipeline
();
this
.
fetchLatestPipeline
();
...
@@ -47,7 +51,7 @@ export default {
...
@@ -47,7 +51,7 @@ export default {
<
template
>
<
template
>
<div
class=
"ide-pipeline"
>
<div
class=
"ide-pipeline"
>
<loading-icon
<loading-icon
v-if=
"
isLoadingPipeline && latestPipeline === null
"
v-if=
"
showLoadingIcon
"
class=
"prepend-top-default"
class=
"prepend-top-default"
size=
"2"
size=
"2"
/>
/>
...
@@ -62,7 +66,7 @@ export default {
...
@@ -62,7 +66,7 @@ export default {
/>
/>
<span
class=
"prepend-left-8"
>
<span
class=
"prepend-left-8"
>
<strong>
<strong>
Pipeline
{{
__
(
'
Pipeline
'
)
}}
</strong>
</strong>
<a
<a
:href=
"latestPipeline.path"
:href=
"latestPipeline.path"
...
@@ -88,7 +92,7 @@ export default {
...
@@ -88,7 +92,7 @@ export default {
class=
"bs-callout bs-callout-danger"
class=
"bs-callout bs-callout-danger"
>
>
<p
class=
"append-bottom-0"
>
<p
class=
"append-bottom-0"
>
Found errors in your .gitlab-ci.yml:
{{
__
(
'
Found errors in your .gitlab-ci.yml:
'
)
}}
</p>
</p>
<p
class=
"append-bottom-0"
>
<p
class=
"append-bottom-0"
>
{{
latestPipeline
.
yamlError
}}
{{
latestPipeline
.
yamlError
}}
...
@@ -106,7 +110,7 @@ export default {
...
@@ -106,7 +110,7 @@ export default {
:active=
"!pipelineFailed"
:active=
"!pipelineFailed"
>
>
<template
slot=
"title"
>
<template
slot=
"title"
>
Jobs
{{
__
(
'
Jobs
'
)
}}
<span
<span
v-if=
"jobsCount"
v-if=
"jobsCount"
class=
"badge badge-pill"
class=
"badge badge-pill"
...
@@ -123,7 +127,7 @@ export default {
...
@@ -123,7 +127,7 @@ export default {
:active=
"pipelineFailed"
:active=
"pipelineFailed"
>
>
<
template
slot=
"title"
>
<
template
slot=
"title"
>
Failed Jobs
{{
__
(
'
Failed Jobs
'
)
}}
<span
<span
v-if=
"failedJobsCount"
v-if=
"failedJobsCount"
class=
"badge badge-pill"
class=
"badge badge-pill"
...
...
app/assets/javascripts/ide/stores/modules/pipelines/constants.js
0 → 100644
View file @
c9d676c1
// eslint-disable-next-line import/prefer-default-export
export
const
states
=
{
failed
:
'
failed
'
,
};
app/assets/javascripts/ide/stores/modules/pipelines/getters.js
View file @
c9d676c1
import
{
states
}
from
'
./constants
'
;
export
const
hasLatestPipeline
=
state
=>
!
state
.
isLoadingPipeline
&&
!!
state
.
latestPipeline
;
export
const
hasLatestPipeline
=
state
=>
!
state
.
isLoadingPipeline
&&
!!
state
.
latestPipeline
;
export
const
pipelineFailed
=
state
=>
export
const
pipelineFailed
=
state
=>
state
.
latestPipeline
&&
state
.
latestPipeline
.
details
.
status
.
text
===
'
failed
'
;
state
.
latestPipeline
&&
state
.
latestPipeline
.
details
.
status
.
text
===
states
.
failed
;
export
const
failedStages
=
state
=>
export
const
failedStages
=
state
=>
state
.
stages
.
filter
(
stage
=>
stage
.
status
.
text
.
toLowerCase
()
===
'
failed
'
).
map
(
stage
=>
({
state
.
stages
.
filter
(
stage
=>
stage
.
status
.
text
.
toLowerCase
()
===
states
.
failed
).
map
(
stage
=>
({
...
stage
,
...
stage
,
jobs
:
stage
.
jobs
.
filter
(
job
=>
job
.
status
.
text
.
toLowerCase
()
===
'
failed
'
),
jobs
:
stage
.
jobs
.
filter
(
job
=>
job
.
status
.
text
.
toLowerCase
()
===
states
.
failed
),
}));
}));
export
const
failedJobsCount
=
state
=>
export
const
failedJobsCount
=
state
=>
state
.
stages
.
reduce
(
state
.
stages
.
reduce
(
(
acc
,
stage
)
=>
acc
+
stage
.
jobs
.
filter
(
j
=>
j
.
status
.
text
===
'
failed
'
).
length
,
(
acc
,
stage
)
=>
acc
+
stage
.
jobs
.
filter
(
j
=>
j
.
status
.
text
===
states
.
failed
).
length
,
0
,
0
,
);
);
export
const
jobsCount
=
state
=>
state
.
stages
.
reduce
((
acc
,
stage
)
=>
acc
+
stage
.
jobs
.
length
,
0
);
export
const
jobsCount
=
state
=>
state
.
stages
.
reduce
((
acc
,
stage
)
=>
acc
+
stage
.
jobs
.
length
,
0
);
export
default
()
=>
{};
app/assets/javascripts/ide/stores/modules/pipelines/mutations.js
View file @
c9d676c1
/* eslint-disable no-param-reassign */
/* eslint-disable no-param-reassign */
import
*
as
types
from
'
./mutation_types
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
{
normalizeJob
}
from
'
./utils
'
;
export
default
{
export
default
{
[
types
.
REQUEST_LATEST_PIPELINE
](
state
)
{
[
types
.
REQUEST_LATEST_PIPELINE
](
state
)
{
...
@@ -38,39 +39,20 @@ export default {
...
@@ -38,39 +39,20 @@ export default {
}
}
},
},
[
types
.
REQUEST_JOBS
](
state
,
id
)
{
[
types
.
REQUEST_JOBS
](
state
,
id
)
{
state
.
stages
=
state
.
stages
.
map
(
stage
=>
const
stage
=
state
.
stages
.
find
(
s
=>
s
.
id
===
id
);
Object
.
assign
(
stage
,
{
stage
.
isLoading
=
true
;
isLoading
:
id
===
stage
.
id
?
true
:
stage
.
isLoading
,
}),
);
},
},
[
types
.
RECEIVE_JOBS_ERROR
](
state
,
id
)
{
[
types
.
RECEIVE_JOBS_ERROR
](
state
,
id
)
{
state
.
stages
=
state
.
stages
.
map
(
stage
=>
const
stage
=
state
.
stages
.
find
(
s
=>
s
.
id
===
id
);
Object
.
assign
(
stage
,
{
stage
.
isLoading
=
false
;
isLoading
:
id
===
stage
.
id
?
false
:
stage
.
isLoading
,
}),
);
},
},
[
types
.
RECEIVE_JOBS_SUCCESS
](
state
,
{
id
,
data
})
{
[
types
.
RECEIVE_JOBS_SUCCESS
](
state
,
{
id
,
data
})
{
const
normalizeData
=
job
=>
({
const
stage
=
state
.
stages
.
find
(
s
=>
s
.
id
===
id
);
id
:
job
.
id
,
stage
.
isLoading
=
false
;
name
:
job
.
name
,
stage
.
jobs
=
data
.
latest_statuses
.
map
(
normalizeJob
);
status
:
job
.
status
,
path
:
job
.
build_path
,
});
state
.
stages
=
state
.
stages
.
map
(
stage
=>
Object
.
assign
(
stage
,
{
isLoading
:
id
===
stage
.
id
?
false
:
stage
.
isLoading
,
jobs
:
id
===
stage
.
id
?
data
.
latest_statuses
.
map
(
normalizeData
)
:
stage
.
jobs
,
}),
);
},
},
[
types
.
TOGGLE_STAGE_COLLAPSE
](
state
,
id
)
{
[
types
.
TOGGLE_STAGE_COLLAPSE
](
state
,
id
)
{
state
.
stages
=
state
.
stages
.
map
(
stage
=>
const
stage
=
state
.
stages
.
find
(
s
=>
s
.
id
===
id
);
Object
.
assign
(
stage
,
{
stage
.
isCollapsed
=
!
stage
.
isCollapsed
;
isCollapsed
:
stage
.
id
===
id
?
!
stage
.
isCollapsed
:
stage
.
isCollapsed
,
}),
);
},
},
};
};
app/assets/javascripts/ide/stores/modules/pipelines/utils.js
0 → 100644
View file @
c9d676c1
// eslint-disable-next-line import/prefer-default-export
export
const
normalizeJob
=
job
=>
({
id
:
job
.
id
,
name
:
job
.
name
,
status
:
job
.
status
,
path
:
job
.
build_path
,
});
spec/javascripts/ide/components/jobs/stage_spec.js
View file @
c9d676c1
...
@@ -16,14 +16,18 @@ describe('IDE pipeline stage', () => {
...
@@ -16,14 +16,18 @@ describe('IDE pipeline stage', () => {
const
store
=
createStore
();
const
store
=
createStore
();
mock
=
new
MockAdapter
(
axios
);
mock
=
new
MockAdapter
(
axios
);
store
.
state
.
pipelines
.
stages
=
stages
.
map
((
mappedState
,
i
)
=>
({
Vue
.
set
(
...
mappedState
,
store
.
state
.
pipelines
,
id
:
i
,
'
stages
'
,
dropdownPath
:
mappedState
.
dropdown_path
,
stages
.
map
((
mappedState
,
i
)
=>
({
jobs
:
[],
...
mappedState
,
isLoading
:
false
,
id
:
i
,
isCollapsed
:
false
,
dropdownPath
:
mappedState
.
dropdown_path
,
}));
jobs
:
[],
isLoading
:
false
,
isCollapsed
:
false
,
})),
);
stage
=
store
.
state
.
pipelines
.
stages
[
0
];
stage
=
store
.
state
.
pipelines
.
stages
[
0
];
...
@@ -35,7 +39,7 @@ describe('IDE pipeline stage', () => {
...
@@ -35,7 +39,7 @@ describe('IDE pipeline stage', () => {
stage
,
stage
,
}).
$mount
();
}).
$mount
();
setTimeout
(
done
);
setTimeout
(
done
,
500
);
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
...
...
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