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
cda08103
Commit
cda08103
authored
May 27, 2020
by
Olena Horal-Koretska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove create issue feature flag
parent
afd320b4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
92 deletions
+68
-92
app/assets/javascripts/alert_management/components/alert_details.vue
...javascripts/alert_management/components/alert_details.vue
+21
-25
app/controllers/projects/alert_management_controller.rb
app/controllers/projects/alert_management_controller.rb
+0
-1
changelogs/unreleased/218045-remove-create-issue-feature-flag-FE.yml
...unreleased/218045-remove-create-issue-feature-flag-FE.yml
+5
-0
spec/frontend/alert_management/components/alert_management_detail_spec.js
...ert_management/components/alert_management_detail_spec.js
+42
-66
No files found.
app/assets/javascripts/alert_management/components/alert_details.vue
View file @
cda08103
...
...
@@ -14,7 +14,6 @@ import { s__ } from '~/locale';
import
query
from
'
../graphql/queries/details.query.graphql
'
;
import
{
fetchPolicies
}
from
'
~/lib/graphql
'
;
import
TimeAgoTooltip
from
'
~/vue_shared/components/time_ago_tooltip.vue
'
;
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
import
{
ALERTS_SEVERITY_LABELS
,
trackAlertsDetailsViewsOptions
}
from
'
../constants
'
;
import
createIssueQuery
from
'
../graphql/mutations/create_issue_from_alert.graphql
'
;
import
{
visitUrl
,
joinPaths
}
from
'
~/lib/utils/url_utility
'
;
...
...
@@ -47,7 +46,6 @@ export default {
TimeAgoTooltip
,
AlertSidebar
,
},
mixins
:
[
glFeatureFlagsMixin
()],
props
:
{
alertId
:
{
type
:
String
,
...
...
@@ -204,29 +202,27 @@ export default {
<
template
#tool
>
{{
alert
.
monitoringTool
}}
</
template
>
</gl-sprintf>
</div>
<div
v-if=
"glFeatures.alertManagementCreateAlertIssue"
>
<gl-button
v-if=
"alert.issueIid"
class=
"gl-mt-3 mt-sm-0 align-self-center align-self-sm-baseline alert-details-issue-button"
data-testid=
"viewIssueBtn"
:href=
"issuePath(alert.issueIid)"
category=
"primary"
variant=
"success"
>
{{ s__('AlertManagement|View issue') }}
</gl-button>
<gl-button
v-else
class=
"gl-mt-3 mt-sm-0 align-self-center align-self-sm-baseline alert-details-issue-button"
data-testid=
"createIssueBtn"
:loading=
"issueCreationInProgress"
category=
"primary"
variant=
"success"
@
click=
"createIssue()"
>
{{ s__('AlertManagement|Create issue') }}
</gl-button>
</div>
<gl-button
v-if=
"alert.issueIid"
class=
"gl-mt-3 mt-sm-0 align-self-center align-self-sm-baseline alert-details-issue-button"
data-testid=
"viewIssueBtn"
:href=
"issuePath(alert.issueIid)"
category=
"primary"
variant=
"success"
>
{{ s__('AlertManagement|View issue') }}
</gl-button>
<gl-button
v-else
class=
"gl-mt-3 mt-sm-0 align-self-center align-self-sm-baseline alert-details-issue-button"
data-testid=
"createIssueBtn"
:loading=
"issueCreationInProgress"
category=
"primary"
variant=
"success"
@
click=
"createIssue()"
>
{{ s__('AlertManagement|Create issue') }}
</gl-button>
<gl-button
:aria-label=
"__('Toggle sidebar')"
category=
"primary"
...
...
app/controllers/projects/alert_management_controller.rb
View file @
cda08103
...
...
@@ -3,7 +3,6 @@
class
Projects::AlertManagementController
<
Projects
::
ApplicationController
before_action
:authorize_read_alert_management_alert!
before_action
do
push_frontend_feature_flag
(
:alert_management_create_alert_issue
,
project
)
push_frontend_feature_flag
(
:alert_assignee
,
project
)
end
...
...
changelogs/unreleased/218045-remove-create-issue-feature-flag-FE.yml
0 → 100644
View file @
cda08103
---
title
:
Create issue from alert
merge_request
:
33213
author
:
type
:
added
spec/frontend/alert_management/components/alert_management_detail_spec.js
View file @
cda08103
...
...
@@ -17,13 +17,7 @@ describe('AlertDetails', () => {
const
findDetailsTable
=
()
=>
wrapper
.
find
(
GlTable
);
function
mountComponent
({
data
,
alertManagementCreateAlertIssue
=
false
,
loading
=
false
,
mountMethod
=
shallowMount
,
stubs
=
{},
}
=
{})
{
function
mountComponent
({
data
,
loading
=
false
,
mountMethod
=
shallowMount
,
stubs
=
{}
}
=
{})
{
wrapper
=
mountMethod
(
AlertDetails
,
{
propsData
:
{
alertId
:
'
alertId
'
,
...
...
@@ -33,9 +27,6 @@ describe('AlertDetails', () => {
data
()
{
return
{
alert
:
{
...
mockAlert
},
...
data
};
},
provide
:
{
glFeatures
:
{
alertManagementCreateAlertIssue
},
},
mocks
:
{
$apollo
:
{
mutate
:
jest
.
fn
(),
...
...
@@ -123,69 +114,54 @@ describe('AlertDetails', () => {
});
describe
(
'
Create issue from alert
'
,
()
=>
{
describe
(
'
createIssueFromAlertEnabled feature flag enabled
'
,
()
=>
{
it
(
'
should display "View issue" button that links the issue page when issue exists
'
,
()
=>
{
const
issueIid
=
'
3
'
;
mountComponent
({
alertManagementCreateAlertIssue
:
true
,
data
:
{
alert
:
{
...
mockAlert
,
issueIid
}
},
});
expect
(
findViewIssueBtn
().
exists
()).
toBe
(
true
);
expect
(
findViewIssueBtn
().
attributes
(
'
href
'
)).
toBe
(
joinPaths
(
projectIssuesPath
,
issueIid
),
);
expect
(
findCreateIssueBtn
().
exists
()).
toBe
(
false
);
it
(
'
should display "View issue" button that links the issue page when issue exists
'
,
()
=>
{
const
issueIid
=
'
3
'
;
mountComponent
({
data
:
{
alert
:
{
...
mockAlert
,
issueIid
}
},
});
expect
(
findViewIssueBtn
().
exists
()).
toBe
(
true
);
expect
(
findViewIssueBtn
().
attributes
(
'
href
'
)).
toBe
(
joinPaths
(
projectIssuesPath
,
issueIid
));
expect
(
findCreateIssueBtn
().
exists
()).
toBe
(
false
);
});
it
(
'
should display "Create issue" button when issue doesn
\'
t exist yet
'
,
()
=>
{
const
issueIid
=
null
;
mountComponent
({
mountMethod
:
mount
,
alertManagementCreateAlertIssue
:
true
,
data
:
{
alert
:
{
...
mockAlert
,
issueIid
}
},
});
expect
(
findViewIssueBtn
().
exists
()).
toBe
(
false
);
expect
(
findCreateIssueBtn
().
exists
()).
toBe
(
true
);
it
(
'
should display "Create issue" button when issue doesn
\'
t exist yet
'
,
()
=>
{
const
issueIid
=
null
;
mountComponent
({
mountMethod
:
mount
,
data
:
{
alert
:
{
...
mockAlert
,
issueIid
}
},
});
it
(
'
calls `$apollo.mutate` with `createIssueQuery`
'
,
()
=>
{
const
issueIid
=
'
10
'
;
jest
.
spyOn
(
wrapper
.
vm
.
$apollo
,
'
mutate
'
)
.
mockResolvedValue
({
data
:
{
createAlertIssue
:
{
issue
:
{
iid
:
issueIid
}
}
}
});
findCreateIssueBtn
().
trigger
(
'
click
'
);
expect
(
wrapper
.
vm
.
$apollo
.
mutate
).
toHaveBeenCalledWith
({
mutation
:
createIssueQuery
,
variables
:
{
iid
:
mockAlert
.
iid
,
projectPath
,
},
});
expect
(
findViewIssueBtn
().
exists
()).
toBe
(
false
);
expect
(
findCreateIssueBtn
().
exists
()).
toBe
(
true
);
});
it
(
'
calls `$apollo.mutate` with `createIssueQuery`
'
,
()
=>
{
const
issueIid
=
'
10
'
;
jest
.
spyOn
(
wrapper
.
vm
.
$apollo
,
'
mutate
'
)
.
mockResolvedValue
({
data
:
{
createAlertIssue
:
{
issue
:
{
iid
:
issueIid
}
}
}
});
findCreateIssueBtn
().
trigger
(
'
click
'
);
expect
(
wrapper
.
vm
.
$apollo
.
mutate
).
toHaveBeenCalledWith
({
mutation
:
createIssueQuery
,
variables
:
{
iid
:
mockAlert
.
iid
,
projectPath
,
},
});
});
it
(
'
shows error alert when issue creation fails
'
,
()
=>
{
const
errorMsg
=
'
Something went wrong
'
;
mountComponent
({
mountMethod
:
mount
,
alertManagementCreateAlertIssue
:
true
,
data
:
{
alert
:
{
...
mockAlert
,
alertIid
:
1
}
},
});
jest
.
spyOn
(
wrapper
.
vm
.
$apollo
,
'
mutate
'
).
mockRejectedValue
(
errorMsg
);
findCreateIssueBtn
().
trigger
(
'
click
'
);
setImmediate
(()
=>
{
expect
(
findIssueCreationAlert
().
text
()).
toBe
(
errorMsg
);
});
it
(
'
shows error alert when issue creation fails
'
,
()
=>
{
const
errorMsg
=
'
Something went wrong
'
;
mountComponent
({
mountMethod
:
mount
,
data
:
{
alert
:
{
...
mockAlert
,
alertIid
:
1
}
},
});
});
describe
(
'
createIssueFromAlertEnabled feature flag disabled
'
,
()
=>
{
it
(
'
should not display a View or Create issue button
'
,
()
=>
{
mountComponent
({
alertManagementCreateAlertIssue
:
false
});
expect
(
findCreateIssueBtn
().
exists
()).
toBe
(
false
);
expect
(
find
ViewIssueBtn
().
exists
()).
toBe
(
false
);
jest
.
spyOn
(
wrapper
.
vm
.
$apollo
,
'
mutate
'
).
mockRejectedValue
(
errorMsg
);
findCreateIssueBtn
().
trigger
(
'
click
'
);
setImmediate
(()
=>
{
expect
(
find
IssueCreationAlert
().
text
()).
toBe
(
errorMsg
);
});
});
});
...
...
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