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
d6692f4d
Commit
d6692f4d
authored
Feb 15, 2022
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '301003-cancel-button' into 'master'
Add cancel button See merge request gitlab-org/gitlab!80608
parents
51fd9ff0
a15ae913
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
4 deletions
+25
-4
ee/app/assets/javascripts/vulnerabilities/components/new_vulnerability/new_vulnerability.vue
...lities/components/new_vulnerability/new_vulnerability.vue
+11
-3
ee/app/assets/javascripts/vulnerabilities/new_vulnerability_init.js
...ets/javascripts/vulnerabilities/new_vulnerability_init.js
+1
-0
ee/app/views/projects/security/vulnerabilities/new.html.haml
ee/app/views/projects/security/vulnerabilities/new.html.haml
+1
-0
ee/spec/frontend/vulnerabilities/new_vulnerability/new_vulnerability_spec.js
...lnerabilities/new_vulnerability/new_vulnerability_spec.js
+12
-1
No files found.
ee/app/assets/javascripts/vulnerabilities/components/new_vulnerability/new_vulnerability.vue
View file @
d6692f4d
<
script
>
<
script
>
import
{
GlForm
,
GlButton
,
GlAlert
}
from
'
@gitlab/ui
'
;
import
{
GlForm
,
GlButton
,
GlAlert
}
from
'
@gitlab/ui
'
;
import
*
as
Sentry
from
'
@sentry/browser
'
;
import
*
as
Sentry
from
'
@sentry/browser
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
s__
,
__
}
from
'
~/locale
'
;
import
{
convertToGraphQLId
}
from
'
~/graphql_shared/utils
'
;
import
{
convertToGraphQLId
}
from
'
~/graphql_shared/utils
'
;
import
{
TYPE_PROJECT
}
from
'
~/graphql_shared/constants
'
;
import
{
TYPE_PROJECT
}
from
'
~/graphql_shared/constants
'
;
import
{
redirectTo
}
from
'
~/lib/utils/url_utility
'
;
import
{
redirectTo
}
from
'
~/lib/utils/url_utility
'
;
...
@@ -22,7 +22,7 @@ export default {
...
@@ -22,7 +22,7 @@ export default {
SectionName
,
SectionName
,
SectionSolution
,
SectionSolution
,
},
},
inject
:
[
'
projectId
'
],
inject
:
[
'
projectId
'
,
'
vulnerabilityReportPath
'
],
data
()
{
data
()
{
return
{
return
{
form
:
{
form
:
{
...
@@ -181,6 +181,7 @@ export default {
...
@@ -181,6 +181,7 @@ export default {
},
},
i18n
:
{
i18n
:
{
title
:
s__
(
'
VulnerabilityManagement|Add vulnerability finding
'
),
title
:
s__
(
'
VulnerabilityManagement|Add vulnerability finding
'
),
cancel
:
__
(
'
Cancel
'
),
submitVulnerability
:
s__
(
'
VulnerabilityManagement|Submit vulnerability
'
),
submitVulnerability
:
s__
(
'
VulnerabilityManagement|Submit vulnerability
'
),
submitError
:
s__
(
'
VulnerabilityManagement|Something went wrong while creating vulnerability
'
),
submitError
:
s__
(
'
VulnerabilityManagement|Something went wrong while creating vulnerability
'
),
description
:
s__
(
description
:
s__
(
...
@@ -223,10 +224,17 @@ export default {
...
@@ -223,10 +224,17 @@ export default {
<gl-button
<gl-button
type=
"submit"
type=
"submit"
variant=
"confirm"
variant=
"confirm"
class=
"js-no-auto-disable"
class=
"js-no-auto-disable
gl-mr-3
"
:disabled=
"submitting"
:disabled=
"submitting"
>
{{
$options
.
i18n
.
submitVulnerability
}}
</gl-button
>
{{
$options
.
i18n
.
submitVulnerability
}}
</gl-button
>
>
<gl-button
type=
"button"
class=
"js-no-auto-disable"
:disabled=
"submitting"
:href=
"vulnerabilityReportPath"
>
{{
$options
.
i18n
.
cancel
}}
</gl-button
>
</div>
</div>
</gl-form>
</gl-form>
</div>
</div>
...
...
ee/app/assets/javascripts/vulnerabilities/new_vulnerability_init.js
View file @
d6692f4d
...
@@ -13,6 +13,7 @@ export default (el) => {
...
@@ -13,6 +13,7 @@ export default (el) => {
provide
:
{
provide
:
{
markdownDocsPath
:
el
.
dataset
.
markdownDocsPath
,
markdownDocsPath
:
el
.
dataset
.
markdownDocsPath
,
markdownPreviewPath
:
el
.
dataset
.
markdownPreviewPath
,
markdownPreviewPath
:
el
.
dataset
.
markdownPreviewPath
,
vulnerabilityReportPath
:
el
.
dataset
.
vulnerabilityReportPath
,
projectId
:
el
.
dataset
.
projectId
,
projectId
:
el
.
dataset
.
projectId
,
},
},
render
:
(
h
)
=>
h
(
App
),
render
:
(
h
)
=>
h
(
App
),
...
...
ee/app/views/projects/security/vulnerabilities/new.html.haml
View file @
d6692f4d
...
@@ -6,4 +6,5 @@
...
@@ -6,4 +6,5 @@
#js-vulnerability-new
{
data:
{
markdown_docs_path:
help_page_path
(
'user/markdown'
),
#js-vulnerability-new
{
data:
{
markdown_docs_path:
help_page_path
(
'user/markdown'
),
markdown_preview_path:
preview_markdown_path
(
@project
),
markdown_preview_path:
preview_markdown_path
(
@project
),
vulnerability_report_path:
project_security_vulnerability_report_index_path
(
@project
),
project_id:
@project
.
id
}
}
project_id:
@project
.
id
}
}
ee/spec/frontend/vulnerabilities/new_vulnerability/new_vulnerability_spec.js
View file @
d6692f4d
...
@@ -23,6 +23,8 @@ jest.mock('~/lib/utils/url_utility', () => ({
...
@@ -23,6 +23,8 @@ jest.mock('~/lib/utils/url_utility', () => ({
describe
(
'
New vulnerability component
'
,
()
=>
{
describe
(
'
New vulnerability component
'
,
()
=>
{
const
projectId
=
'
22
'
;
const
projectId
=
'
22
'
;
const
vulnerabilityReportPath
=
'
/root/security-reports/-/vulnerability_report
'
;
let
wrapper
;
let
wrapper
;
const
inputs
=
{
const
inputs
=
{
...
@@ -54,13 +56,15 @@ describe('New vulnerability component', () => {
...
@@ -54,13 +56,15 @@ describe('New vulnerability component', () => {
const
findSectionDetails
=
()
=>
wrapper
.
findComponent
(
SectionDetails
);
const
findSectionDetails
=
()
=>
wrapper
.
findComponent
(
SectionDetails
);
const
findSectionSolution
=
()
=>
wrapper
.
findComponent
(
SectionSolution
);
const
findSectionSolution
=
()
=>
wrapper
.
findComponent
(
SectionSolution
);
const
findSectionIdentifiers
=
()
=>
wrapper
.
findComponent
(
SectionIdentifiers
);
const
findSectionIdentifiers
=
()
=>
wrapper
.
findComponent
(
SectionIdentifiers
);
const
findSubmitButton
=
()
=>
wrapper
.
findComponent
(
GlButton
);
const
findSubmitButton
=
()
=>
wrapper
.
findAllComponents
(
GlButton
).
at
(
0
);
const
findCancelButton
=
()
=>
wrapper
.
findAllComponents
(
GlButton
).
at
(
1
);
const
createWrapper
=
({
apolloProvider
}
=
{})
=>
{
const
createWrapper
=
({
apolloProvider
}
=
{})
=>
{
return
shallowMountExtended
(
NewVulnerability
,
{
return
shallowMountExtended
(
NewVulnerability
,
{
apolloProvider
,
apolloProvider
,
provide
:
{
provide
:
{
projectId
,
projectId
,
vulnerabilityReportPath
,
},
},
});
});
};
};
...
@@ -103,6 +107,13 @@ describe('New vulnerability component', () => {
...
@@ -103,6 +107,13 @@ describe('New vulnerability component', () => {
it
(
'
contains a submit button
'
,
()
=>
{
it
(
'
contains a submit button
'
,
()
=>
{
expect
(
findSubmitButton
().
exists
()).
toBe
(
true
);
expect
(
findSubmitButton
().
exists
()).
toBe
(
true
);
});
});
it
(
'
contains a cancel button
'
,
()
=>
{
expect
(
findCancelButton
().
attributes
()).
toMatchObject
({
href
:
vulnerabilityReportPath
,
type
:
'
button
'
,
});
});
});
});
describe
(
'
form submission
'
,
()
=>
{
describe
(
'
form submission
'
,
()
=>
{
...
...
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