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
c57ff227
Commit
c57ff227
authored
Sep 30, 2020
by
Marvin Karegyeya
Committed by
Jose Ivan Vargas
Sep 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace GlDeprecatedDropdown in app/assets/javascripts/alertmanagement
parent
73756dad
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
75 deletions
+57
-75
app/assets/javascripts/alert_management/components/alert_status.vue
.../javascripts/alert_management/components/alert_status.vue
+10
-20
app/assets/javascripts/alert_management/components/sidebar/sidebar_assignee.vue
.../alert_management/components/sidebar/sidebar_assignee.vue
+4
-4
app/assets/javascripts/alert_management/components/sidebar/sidebar_assignees.vue
...alert_management/components/sidebar/sidebar_assignees.vue
+27
-37
changelogs/unreleased/Replace-GIDeprecatedDropdown-in-app-assets-javascripts-alert_management.yml
...edDropdown-in-app-assets-javascripts-alert_management.yml
+5
-0
spec/frontend/alert_management/components/alert_management_table_spec.js
...lert_management/components/alert_management_table_spec.js
+4
-4
spec/frontend/alert_management/components/sidebar/alert_managment_sidebar_assignees_spec.js
...ponents/sidebar/alert_managment_sidebar_assignees_spec.js
+2
-2
spec/frontend/alert_management/components/sidebar/alert_sidebar_status_spec.js
...anagement/components/sidebar/alert_sidebar_status_spec.js
+5
-8
No files found.
app/assets/javascripts/alert_management/components/alert_status.vue
View file @
c57ff227
<
script
>
import
{
GlD
eprecatedDropdown
,
GlDeprecatedDropdownItem
,
GlButton
}
from
'
@gitlab/ui
'
;
import
{
GlD
ropdown
,
GlDropdownItem
}
from
'
@gitlab/ui
'
;
import
{
s__
}
from
'
~/locale
'
;
import
Tracking
from
'
~/tracking
'
;
import
{
trackAlertStatusUpdateOptions
}
from
'
../constants
'
;
...
...
@@ -18,9 +18,8 @@ export default {
RESOLVED
:
s__
(
'
AlertManagement|Resolved
'
),
},
components
:
{
GlDeprecatedDropdown
,
GlDeprecatedDropdownItem
,
GlButton
,
GlDropdown
,
GlDropdownItem
,
},
props
:
{
projectPath
:
{
...
...
@@ -91,39 +90,30 @@ export default {
<
template
>
<div
class=
"dropdown dropdown-menu-selectable"
:class=
"dropdownClass"
>
<gl-d
eprecated-d
ropdown
<gl-dropdown
ref=
"dropdown"
right
:text=
"$options.statuses[alert.status]"
class=
"w-100"
toggle-class=
"dropdown-menu-toggle"
variant=
"outline-default"
@
keydown.esc.native=
"$emit('hide-dropdown')"
@
hide=
"$emit('hide-dropdown')"
>
<div
v-if=
"isSidebar"
class=
"dropdown-title gl-display-flex"
>
<span
class=
"alert-title gl-ml-auto"
>
{{
s__
(
'
AlertManagement|Assign status
'
)
}}
</span>
<gl-button
:aria-label=
"__('Close')"
variant=
"link"
class=
"dropdown-title-button dropdown-menu-close gl-ml-auto gl-text-black-normal!"
icon=
"close"
@
click=
"$emit('hide-dropdown')"
/>
</div>
<p
v-if=
"isSidebar"
class=
"gl-new-dropdown-header-top"
data-testid=
"dropdown-header"
>
{{
s__
(
'
AlertManagement|Assign status
'
)
}}
</p>
<div
class=
"dropdown-content dropdown-body"
>
<gl-d
eprecated-d
ropdown-item
<gl-dropdown-item
v-for=
"(label, field) in $options.statuses"
:key=
"field"
data-testid=
"statusDropdownItem"
class=
"gl-vertical-align-middle"
:active=
"label.toUpperCase() === alert.status"
:active-class=
"'is-active'"
@
click=
"updateAlertStatus(label)"
>
{{
label
}}
</gl-d
eprecated-d
ropdown-item>
</gl-dropdown-item>
</div>
</gl-d
eprecated-d
ropdown>
</gl-dropdown>
</div>
</
template
>
app/assets/javascripts/alert_management/components/sidebar/sidebar_assignee.vue
View file @
c57ff227
<
script
>
import
{
GlD
eprecatedD
ropdownItem
}
from
'
@gitlab/ui
'
;
import
{
GlDropdownItem
}
from
'
@gitlab/ui
'
;
export
default
{
components
:
{
GlD
eprecatedD
ropdownItem
,
GlDropdownItem
,
},
props
:
{
user
:
{
...
...
@@ -24,7 +24,7 @@ export default {
</
script
>
<
template
>
<gl-d
eprecated-d
ropdown-item
<gl-dropdown-item
:key=
"user.username"
data-testid=
"assigneeDropdownItem"
class=
"assignee-dropdown-item gl-vertical-align-middle"
...
...
@@ -47,5 +47,5 @@ export default {
</strong>
<span
class=
"dropdown-menu-user-username"
>
{{
user
.
username
}}
</span>
</span>
</gl-d
eprecated-d
ropdown-item>
</gl-dropdown-item>
</
template
>
app/assets/javascripts/alert_management/components/sidebar/sidebar_assignees.vue
View file @
c57ff227
<
script
>
import
{
GlIcon
,
GlDeprecatedDropdown
,
GlDeprecatedDropdownDivider
,
GlDeprecatedDropdownHeader
,
GlDeprecatedDropdownItem
,
GlDropdown
,
GlDropdownDivider
,
GlDropdownSectionHeader
,
GlDropdownItem
,
GlSearchBoxByType
,
GlLoadingIcon
,
GlTooltip
,
GlButton
,
...
...
@@ -33,10 +34,11 @@ export default {
},
components
:
{
GlIcon
,
GlDeprecatedDropdown
,
GlDeprecatedDropdownItem
,
GlDeprecatedDropdownDivider
,
GlDeprecatedDropdownHeader
,
GlDropdown
,
GlDropdownItem
,
GlDropdownDivider
,
GlDropdownSectionHeader
,
GlSearchBoxByType
,
GlLoadingIcon
,
GlTooltip
,
GlButton
,
...
...
@@ -216,48 +218,36 @@ export default {
</p>
<div
class=
"dropdown dropdown-menu-selectable"
:class=
"dropdownClass"
>
<gl-d
eprecated-d
ropdown
<gl-dropdown
ref=
"dropdown"
:text=
"userName"
class=
"w-100"
toggle-class=
"dropdown-menu-toggle"
variant=
"outline-default"
@
keydown.esc.native=
"hideDropdown"
@
hide=
"hideDropdown"
>
<div
class=
"dropdown-title gl-display-flex"
>
<span
class=
"alert-title gl-ml-auto"
>
{{ __('Assign To') }}
</span>
<gl-button
:aria-label=
"__('Close')"
variant=
"link"
class=
"dropdown-title-button dropdown-menu-close gl-ml-auto gl-text-black-normal!"
icon=
"close"
@
click=
"hideDropdown"
/>
</div>
<div
class=
"dropdown-input"
>
<input
v-model.trim=
"search"
class=
"dropdown-input-field"
type=
"search"
:placeholder=
"__('Search users')"
/>
<gl-icon
name=
"search"
class=
"dropdown-input-search ic-search"
data-hidden=
"true"
/>
</div>
<p
class=
"gl-new-dropdown-header-top"
>
{{ __('Assign To') }}
</p>
<gl-search-box-by-type
v-model.trim=
"search"
class=
"m-2"
:placeholder=
"__('Search users')"
/>
<div
class=
"dropdown-content dropdown-body"
>
<
template
v-if=
"userListValid"
>
<gl-d
eprecated-d
ropdown-item
<gl-dropdown-item
:active=
"!userName"
active-class=
"is-active"
@
click=
"updateAlertAssignees('')"
>
{{
__
(
'
Unassigned
'
)
}}
</gl-d
eprecated-d
ropdown-item>
<gl-d
eprecated-d
ropdown-divider
/>
</gl-dropdown-item>
<gl-dropdown-divider
/>
<gl-d
eprecated-dropdown-header
class=
"mt-0"
>
<gl-d
ropdown-section-header
>
{{
__
(
'
Assignee
'
)
}}
</gl-d
eprecated-dropdow
n-header>
</gl-d
ropdown-sectio
n-header>
<sidebar-assignee
v-for=
"user in sortedUsers"
:key=
"user.username"
...
...
@@ -266,12 +256,12 @@ export default {
@
update-alert-assignees=
"updateAlertAssignees"
/>
</
template
>
<
gl-deprecated-dropdown-item
v-else-if=
"userListEmpty
"
>
<
p
v-else-if=
"userListEmpty"
class=
"mx-3 my-2
"
>
{{ __('No Matching Results') }}
</
gl-deprecated-dropdown-item
>
</
p
>
<gl-loading-icon
v-else
/>
</div>
</gl-d
eprecated-d
ropdown>
</gl-dropdown>
</div>
<gl-loading-icon
v-if=
"isUpdating"
:inline=
"true"
/>
...
...
changelogs/unreleased/Replace-GIDeprecatedDropdown-in-app-assets-javascripts-alert_management.yml
0 → 100644
View file @
c57ff227
---
title
:
Replace-GIDeprecatedDropdown-in-app/assets/javascripts/alert_management
merge_request
:
41409
author
:
nuwe1
type
:
other
spec/frontend/alert_management/components/alert_management_table_spec.js
View file @
c57ff227
...
...
@@ -3,8 +3,8 @@ import {
GlTable
,
GlAlert
,
GlLoadingIcon
,
GlD
eprecatedD
ropdown
,
GlD
eprecatedD
ropdownItem
,
GlDropdown
,
GlDropdownItem
,
GlIcon
,
GlTabs
,
GlTab
,
...
...
@@ -34,12 +34,12 @@ describe('AlertManagementTable', () => {
const
findAlerts
=
()
=>
wrapper
.
findAll
(
'
table tbody tr
'
);
const
findAlert
=
()
=>
wrapper
.
find
(
GlAlert
);
const
findLoader
=
()
=>
wrapper
.
find
(
GlLoadingIcon
);
const
findStatusDropdown
=
()
=>
wrapper
.
find
(
GlD
eprecatedD
ropdown
);
const
findStatusDropdown
=
()
=>
wrapper
.
find
(
GlDropdown
);
const
findStatusFilterTabs
=
()
=>
wrapper
.
findAll
(
GlTab
);
const
findStatusTabs
=
()
=>
wrapper
.
find
(
GlTabs
);
const
findStatusFilterBadge
=
()
=>
wrapper
.
findAll
(
GlBadge
);
const
findDateFields
=
()
=>
wrapper
.
findAll
(
TimeAgo
);
const
findFirstStatusOption
=
()
=>
findStatusDropdown
().
find
(
GlD
eprecatedD
ropdownItem
);
const
findFirstStatusOption
=
()
=>
findStatusDropdown
().
find
(
GlDropdownItem
);
const
findPagination
=
()
=>
wrapper
.
find
(
GlPagination
);
const
findSearch
=
()
=>
wrapper
.
find
(
GlSearchBoxByType
);
const
findSeverityColumnHeader
=
()
=>
...
...
spec/frontend/alert_management/components/sidebar/alert_managment_sidebar_assignees_spec.js
View file @
c57ff227
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
axios
from
'
axios
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
{
GlD
eprecatedD
ropdownItem
}
from
'
@gitlab/ui
'
;
import
{
GlDropdownItem
}
from
'
@gitlab/ui
'
;
import
SidebarAssignee
from
'
~/alert_management/components/sidebar/sidebar_assignee.vue
'
;
import
SidebarAssignees
from
'
~/alert_management/components/sidebar/sidebar_assignees.vue
'
;
import
AlertSetAssignees
from
'
~/alert_management/graphql/mutations/alert_set_assignees.mutation.graphql
'
;
...
...
@@ -106,7 +106,7 @@ describe('Alert Details Sidebar Assignees', () => {
it
(
'
renders a unassigned option
'
,
async
()
=>
{
wrapper
.
setData
({
isDropdownSearching
:
false
});
await
wrapper
.
vm
.
$nextTick
();
expect
(
wrapper
.
find
(
GlD
eprecatedD
ropdownItem
).
text
()).
toBe
(
'
Unassigned
'
);
expect
(
wrapper
.
find
(
GlDropdownItem
).
text
()).
toBe
(
'
Unassigned
'
);
});
it
(
'
calls `$apollo.mutate` with `AlertSetAssignees` mutation and variables containing `iid`, `assigneeUsernames`, & `projectPath`
'
,
async
()
=>
{
...
...
spec/frontend/alert_management/components/sidebar/alert_sidebar_status_spec.js
View file @
c57ff227
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
GlD
eprecatedDropdown
,
GlDeprecated
DropdownItem
,
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
GlD
ropdown
,
Gl
DropdownItem
,
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
trackAlertStatusUpdateOptions
}
from
'
~/alert_management/constants
'
;
import
AlertSidebarStatus
from
'
~/alert_management/components/sidebar/sidebar_status.vue
'
;
import
updateAlertStatus
from
'
~/alert_management/graphql/mutations/update_alert_status.mutation.graphql
'
;
...
...
@@ -10,9 +10,10 @@ const mockAlert = mockAlerts[0];
describe
(
'
Alert Details Sidebar Status
'
,
()
=>
{
let
wrapper
;
const
findStatusDropdown
=
()
=>
wrapper
.
find
(
GlD
eprecatedD
ropdown
);
const
findStatusDropdownItem
=
()
=>
wrapper
.
find
(
GlD
eprecatedD
ropdownItem
);
const
findStatusDropdown
=
()
=>
wrapper
.
find
(
GlDropdown
);
const
findStatusDropdownItem
=
()
=>
wrapper
.
find
(
GlDropdownItem
);
const
findStatusLoadingIcon
=
()
=>
wrapper
.
find
(
GlLoadingIcon
);
const
findStatusDropdownHeader
=
()
=>
wrapper
.
find
(
'
[data-testid="dropdown-header"]
'
);
function
mountComponent
({
data
,
sidebarCollapsed
=
true
,
loading
=
false
,
stubs
=
{}
}
=
{})
{
wrapper
=
mount
(
AlertSidebarStatus
,
{
...
...
@@ -56,11 +57,7 @@ describe('Alert Details Sidebar Status', () => {
});
it
(
'
displays the dropdown status header
'
,
()
=>
{
expect
(
findStatusDropdown
()
.
find
(
'
.dropdown-title
'
)
.
exists
(),
).
toBe
(
true
);
expect
(
findStatusDropdownHeader
().
exists
()).
toBe
(
true
);
});
describe
(
'
updating the alert status
'
,
()
=>
{
...
...
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