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
9b454740
Commit
9b454740
authored
Dec 11, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First iteration of FE changes for docker reporFirst iteration of FE changes for docker reportt
parent
8556d701
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
102 additions
and
16 deletions
+102
-16
ee/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
...javascripts/vue_merge_request_widget/mr_widget_options.js
+85
-16
ee/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
...cripts/vue_merge_request_widget/stores/mr_widget_store.js
+17
-0
No files found.
ee/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
View file @
9b454740
...
...
@@ -18,9 +18,11 @@ export default {
isLoadingCodequality
:
false
,
isLoadingPerformance
:
false
,
isLoadingSecurity
:
false
,
isLoadingDocker
:
false
,
loadingCodequalityFailed
:
false
,
loadingPerformanceFailed
:
false
,
loadingSecurityFailed
:
false
,
loadingDockerFailed
:
false
,
};
},
computed
:
{
...
...
@@ -38,6 +40,9 @@ export default {
shouldRenderSecurityReport
()
{
return
this
.
mr
.
sast
;
},
shouldRenderDockerReport
()
{
return
this
.
mr
.
clair
;
},
codequalityText
()
{
const
{
newIssues
,
resolvedIssues
}
=
this
.
mr
.
codeclimateMetrics
;
const
text
=
[];
...
...
@@ -116,34 +121,68 @@ export default {
return
'
No security vulnerabilities detected
'
;
},
codequalityStatus
()
{
if
(
this
.
isLoadingCodequality
)
{
return
'
loading
'
;
}
else
if
(
this
.
loadingCodequalityFailed
)
{
return
'
error
'
;
dockerText
()
{
const
{
vulnerabilities
,
approved
,
unapproved
}
=
this
.
mr
.
dockerReport
;
const
text
=
[];
if
(
vulnerabilities
.
length
)
{
text
.
push
(
n__
(
'
%d vulnerability.
'
,
'
%d vulnerabilities.
'
,
vulnerabilities
.
length
,
));
}
return
'
success
'
;
if
(
approved
.
length
)
{
text
.
push
(
n__
(
'
%d of those was approved.
'
,
'
%d of those were approved.
'
,
approved
.
length
,
));
}
if
(
approved
.
length
>
0
&&
unapproved
.
length
>
0
)
{
text
.
push
(
'
and
'
);
}
if
(
unapproved
.
length
)
{
text
.
push
(
n__
(
'
%d of those was unapproved.
'
,
'
%d of those were unapproved.
'
,
unapproved
.
length
,
));
}
return
text
.
join
(
'
'
);
},
codequalityStatus
()
{
return
this
.
checkStatus
(
this
.
isLoadingCodequality
,
this
.
loadingCodequalityFailed
);
},
performanceStatus
()
{
if
(
this
.
isLoadingPerformance
)
{
return
'
loading
'
;
}
else
if
(
this
.
loadingPerformanceFailed
)
{
return
'
error
'
;
}
return
'
success
'
;
return
this
.
checkStatus
(
this
.
isLoadingPerformance
,
this
.
loadingPerformanceFailed
);
},
securityStatus
()
{
if
(
this
.
isLoadingSecurity
)
{
return
this
.
checkStatus
(
this
.
isLoadingSecurity
,
this
.
loadingSecurityFailed
);
},
dockerStatus
()
{
return
this
.
checkStatus
(
this
.
isLoadingDocker
,
this
.
loadingDockerFailed
);
},
},
methods
:
{
checkStatus
(
loading
,
error
)
{
if
(
loading
)
{
return
'
loading
'
;
}
else
if
(
this
.
loadingSecurityFailed
)
{
}
else
if
(
error
)
{
return
'
error
'
;
}
return
'
success
'
;
},
},
methods
:
{
fetchCodeQuality
()
{
const
{
head_path
,
head_blob_path
,
base_path
,
base_blob_path
}
=
this
.
mr
.
codeclimate
;
...
...
@@ -196,6 +235,21 @@ export default {
this
.
loadingSecurityFailed
=
true
;
});
},
fetchDockerReport
()
{
const
{
path
}
=
this
.
mr
.
clair
;
this
.
isLoadingDocker
=
true
;
this
.
service
.
fetchReport
(
path
)
.
then
((
data
)
=>
{
this
.
mr
.
setDockerReport
(
data
);
this
.
isLoadingDocker
=
false
;
})
.
catch
(()
=>
{
this
.
isLoadingDocker
=
false
;
this
.
loadingDockerFailed
=
true
;
});
},
},
created
()
{
if
(
this
.
shouldRenderCodeQuality
)
{
...
...
@@ -209,6 +263,10 @@ export default {
if
(
this
.
shouldRenderSecurityReport
)
{
this
.
fetchSecurity
();
}
if
(
this
.
shouldRenderDockerReport
)
{
this
.
fetchDockerReport
();
}
},
template
:
`
<div class="mr-state-widget prepend-top-default">
...
...
@@ -260,6 +318,17 @@ export default {
:success-text="securityText"
:unresolvedIssues="mr.securityReport"
/>
<collapsible-section
class="js-docker-widget"
v-if="shouldRenderDockerReport"
type="codequality"
:status="dockerStatus"
loading-text="Loading clair report"
error-text="Failed to load clair report"
:success-text="dockerText"
:unresolvedIssues="mr.dockerReport.unapproved"
:resolvedIssues="mr.dockerReport.approved"
/>
<div class="mr-widget-section">
<component
:is="componentName"
...
...
ee/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
View file @
9b454740
...
...
@@ -6,6 +6,7 @@ export default class MergeRequestStore extends CEMergeRequestStore {
this
.
initCodeclimate
(
data
);
this
.
initPerformanceReport
(
data
);
this
.
initSecurityReport
(
data
);
this
.
initDockerReport
(
data
);
}
setData
(
data
)
{
...
...
@@ -71,10 +72,26 @@ export default class MergeRequestStore extends CEMergeRequestStore {
this
.
securityReport
=
[];
}
initDockerReport
(
data
)
{
this
.
clair
=
data
.
clair
;
this
.
dockerReport
=
{
approved
:
[],
unapproved
:
[],
vulnerabilities
:
[],
};
}
setSecurityReport
(
issues
,
path
)
{
this
.
securityReport
=
MergeRequestStore
.
parseIssues
(
issues
,
path
);
}
setDockerReport
(
data
)
{
// Set data - TODO parse the data
this
.
dockerReport
.
approved
=
data
.
approved
||
[];
this
.
dockerReport
.
unapproved
=
data
.
unapproved
||
[];
this
.
dockerReport
.
vulnerabilities
=
data
.
vulnerabilities
||
[];
}
compareCodeclimateMetrics
(
headIssues
,
baseIssues
,
headBlobPath
,
baseBlobPath
)
{
const
parsedHeadIssues
=
MergeRequestStore
.
parseIssues
(
headIssues
,
headBlobPath
);
const
parsedBaseIssues
=
MergeRequestStore
.
parseIssues
(
baseIssues
,
baseBlobPath
);
...
...
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