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
58cff01d
Commit
58cff01d
authored
Jul 26, 2018
by
Lukas Eipert
Committed by
Phil Hughes
Jul 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make report_issues.vue easily extendable
parent
c364c37c
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
110 additions
and
60 deletions
+110
-60
app/assets/javascripts/vue_shared/components/reports/constants.js
...ts/javascripts/vue_shared/components/reports/constants.js
+3
-0
app/assets/javascripts/vue_shared/components/reports/issue_body.js
...s/javascripts/vue_shared/components/reports/issue_body.js
+3
-0
app/assets/javascripts/vue_shared/components/reports/issue_status_icon.vue
...ripts/vue_shared/components/reports/issue_status_icon.vue
+58
-0
app/assets/javascripts/vue_shared/components/reports/issues_list.vue
...javascripts/vue_shared/components/reports/issues_list.vue
+20
-16
app/assets/javascripts/vue_shared/components/reports/report_issues.vue
...vascripts/vue_shared/components/reports/report_issues.vue
+18
-37
app/assets/javascripts/vue_shared/components/reports/report_section.vue
...ascripts/vue_shared/components/reports/report_section.vue
+4
-3
spec/javascripts/vue_shared/components/reports/report_issues_spec.js
...ripts/vue_shared/components/reports/report_issues_spec.js
+0
-0
spec/javascripts/vue_shared/components/reports/report_section_spec.js
...ipts/vue_shared/components/reports/report_section_spec.js
+4
-4
No files found.
app/assets/javascripts/vue_shared/components/reports/constants.js
0 → 100644
View file @
58cff01d
export
const
STATUS_FAILED
=
'
failed
'
;
export
const
STATUS_SUCCESS
=
'
success
'
;
export
const
STATUS_NEUTRAL
=
'
neutral
'
;
app/assets/javascripts/vue_shared/components/reports/issue_body.js
0 → 100644
View file @
58cff01d
export
const
components
=
{};
export
const
componentNames
=
{};
app/assets/javascripts/vue_shared/components/reports/issue_status_icon.vue
0 → 100644
View file @
58cff01d
<
script
>
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
{
STATUS_FAILED
,
STATUS_NEUTRAL
,
STATUS_SUCCESS
,
}
from
'
~/vue_shared/components/reports/constants
'
;
export
default
{
name
:
'
IssueStatusIcon
'
,
components
:
{
Icon
,
},
props
:
{
// failed || success
status
:
{
type
:
String
,
required
:
true
,
},
},
computed
:
{
iconName
()
{
if
(
this
.
isStatusFailed
)
{
return
'
status_failed_borderless
'
;
}
else
if
(
this
.
isStatusSuccess
)
{
return
'
status_success_borderless
'
;
}
return
'
status_created_borderless
'
;
},
isStatusFailed
()
{
return
this
.
status
===
STATUS_FAILED
;
},
isStatusSuccess
()
{
return
this
.
status
===
STATUS_SUCCESS
;
},
isStatusNeutral
()
{
return
this
.
status
===
STATUS_NEUTRAL
;
},
},
};
</
script
>
<
template
>
<div
:class=
"
{
failed: isStatusFailed,
success: isStatusSuccess,
neutral: isStatusNeutral,
}"
class="report-block-list-icon"
>
<icon
:name=
"iconName"
:size=
"32"
/>
</div>
</
template
>
app/assets/javascripts/vue_shared/components/reports/issues_list.vue
View file @
58cff01d
<
script
>
import
IssuesBlock
from
'
./report_issues.vue
'
;
import
IssuesBlock
from
'
~/vue_shared/components/reports/report_issues.vue
'
;
import
{
STATUS_SUCCESS
,
STATUS_FAILED
,
STATUS_NEUTRAL
,
}
from
'
~/vue_shared/components/reports/constants
'
;
/**
* Renders block of issues
...
...
@@ -9,6 +14,9 @@ export default {
components
:
{
IssuesBlock
,
},
success
:
STATUS_SUCCESS
,
failed
:
STATUS_FAILED
,
neutral
:
STATUS_NEUTRAL
,
props
:
{
unresolvedIssues
:
{
type
:
Array
,
...
...
@@ -30,9 +38,10 @@ export default {
required
:
false
,
default
:
()
=>
[],
},
type
:
{
component
:
{
type
:
String
,
required
:
true
,
required
:
false
,
default
:
''
,
},
},
data
()
{
...
...
@@ -40,11 +49,6 @@ export default {
isFullReportVisible
:
false
,
};
},
computed
:
{
unresolvedIssuesStatus
()
{
return
this
.
type
===
'
license
'
?
'
neutral
'
:
'
failed
'
;
},
},
methods
:
{
openFullReport
()
{
this
.
isFullReportVisible
=
true
;
...
...
@@ -57,34 +61,34 @@ export default {
<issues-block
v-if=
"unresolvedIssues.length"
:type=
"type"
:status=
"unresolvedIssuesStatus"
:component=
"component"
:issues=
"unresolvedIssues"
:status=
"$options.failed"
class=
"js-mr-code-new-issues"
/>
<issues-block
v-if=
"isFullReportVisible"
:
type=
"type
"
:
component=
"component
"
:issues=
"allIssues"
:status=
"$options.failed"
class=
"js-mr-code-all-issues"
status=
"failed"
/>
<issues-block
v-if=
"neutralIssues.length"
:
type=
"type
"
:
component=
"component
"
:issues=
"neutralIssues"
:status=
"$options.neutral"
class=
"js-mr-code-non-issues"
status=
"neutral"
/>
<issues-block
v-if=
"resolvedIssues.length"
:
type=
"type
"
:
component=
"component
"
:issues=
"resolvedIssues"
:status=
"$options.success"
class=
"js-mr-code-resolved-issues"
status=
"success"
/>
<button
...
...
app/assets/javascripts/vue_shared/components/reports/report_issues.vue
View file @
58cff01d
<
script
>
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
IssueStatusIcon
from
'
~/vue_shared/components/reports/issue_status_icon.vue
'
;
import
{
components
,
componentNames
}
from
'
~/vue_shared/components/reports/issue_body
'
;
export
default
{
name
:
'
ReportIssues
'
,
components
:
{
Icon
,
IssueStatusIcon
,
...
components
,
},
props
:
{
issues
:
{
type
:
Array
,
required
:
true
,
},
type
:
{
component
:
{
type
:
String
,
required
:
true
,
required
:
false
,
default
:
''
,
validator
:
value
=>
value
===
''
||
Object
.
values
(
componentNames
).
includes
(
value
),
},
// failed || success
status
:
{
...
...
@@ -21,26 +25,6 @@ export default {
required
:
true
,
},
},
computed
:
{
iconName
()
{
if
(
this
.
isStatusFailed
)
{
return
'
status_failed_borderless
'
;
}
else
if
(
this
.
isStatusSuccess
)
{
return
'
status_success_borderless
'
;
}
return
'
status_created_borderless
'
;
},
isStatusFailed
()
{
return
this
.
status
===
'
failed
'
;
},
isStatusSuccess
()
{
return
this
.
status
===
'
success
'
;
},
isStatusNeutral
()
{
return
this
.
status
===
'
neutral
'
;
},
},
};
</
script
>
<
template
>
...
...
@@ -52,20 +36,17 @@ export default {
:key="index"
class="report-block-list-issue"
>
<div
:class=
"
{
failed: isStatusFailed,
success: isStatusSuccess,
neutral: isStatusNeutral,
}"
class="report-block-list-icon append-right-5"
>
<icon
:name=
"iconName"
:size=
"32"
<issue-status-icon
:status=
"issue.status || status"
class=
"append-right-5"
/>
</div>
<component
v-if=
"component"
:is=
"component"
:issue=
"issue"
:status=
"issue.status || status"
/>
</li>
</ul>
</div>
...
...
app/assets/javascripts/vue_shared/components/reports/report_section.vue
View file @
58cff01d
...
...
@@ -21,7 +21,7 @@ export default {
required
:
false
,
default
:
false
,
},
type
:
{
component
:
{
type
:
String
,
required
:
false
,
default
:
''
,
...
...
@@ -149,7 +149,7 @@ export default {
:status=
"statusIconName"
/>
<div
class=
"media-body space-children d-flex"
class=
"media-body space-children d-flex
flex-align-self-center
"
>
<span
class=
"js-code-text code-text"
...
...
@@ -183,8 +183,9 @@ export default {
<issues-list
:unresolved-issues=
"unresolvedIssues"
:resolved-issues=
"resolvedIssues"
:neutral-issues=
"neutralIssues"
:all-issues=
"allIssues"
:
type=
"type
"
:
component=
"component
"
/>
</slot>
</div>
...
...
spec/javascripts/vue_shared/components/reports/report_issues_spec.js
deleted
100644 → 0
View file @
c364c37c
spec/javascripts/vue_shared/components/reports/report_section_spec.js
View file @
58cff01d
...
...
@@ -23,7 +23,7 @@ describe('Report section', () => {
describe
(
'
computed
'
,
()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponent
(
ReportSection
,
{
type
:
'
codequality
'
,
component
:
'
'
,
status
:
'
SUCCESS
'
,
loadingText
:
'
Loading codeclimate report
'
,
errorText
:
'
foo
'
,
...
...
@@ -89,7 +89,7 @@ describe('Report section', () => {
describe
(
'
when it is loading
'
,
()
=>
{
it
(
'
should render loading indicator
'
,
()
=>
{
vm
=
mountComponent
(
ReportSection
,
{
type
:
'
codequality
'
,
component
:
'
'
,
status
:
'
LOADING
'
,
loadingText
:
'
Loading codeclimate report
'
,
errorText
:
'
foo
'
,
...
...
@@ -103,7 +103,7 @@ describe('Report section', () => {
describe
(
'
with success status
'
,
()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponent
(
ReportSection
,
{
type
:
'
codequality
'
,
component
:
'
'
,
status
:
'
SUCCESS
'
,
loadingText
:
'
Loading codeclimate report
'
,
errorText
:
'
foo
'
,
...
...
@@ -161,7 +161,7 @@ describe('Report section', () => {
describe
(
'
with failed request
'
,
()
=>
{
it
(
'
should render error indicator
'
,
()
=>
{
vm
=
mountComponent
(
ReportSection
,
{
type
:
'
codequality
'
,
component
:
'
'
,
status
:
'
ERROR
'
,
loadingText
:
'
Loading codeclimate report
'
,
errorText
:
'
Failed to load codeclimate report
'
,
...
...
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