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
3222456d
Commit
3222456d
authored
Aug 12, 2020
by
Jarek Ostrowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update requirements buttons to gl-button
MR:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39372
parent
e82018c4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
62 deletions
+34
-62
ee/app/assets/javascripts/requirements/components/requirement_item.vue
.../javascripts/requirements/components/requirement_item.vue
+14
-33
ee/app/assets/stylesheets/pages/requirements.scss
ee/app/assets/stylesheets/pages/requirements.scss
+10
-3
ee/changelogs/unreleased/219911-req-button.yml
ee/changelogs/unreleased/219911-req-button.yml
+5
-0
ee/spec/frontend/requirements/components/requirement_item_spec.js
...frontend/requirements/components/requirement_item_spec.js
+5
-26
No files found.
ee/app/assets/javascripts/requirements/components/requirement_item.vue
View file @
3222456d
<
script
>
<
script
>
import
{
escape
}
from
'
lodash
'
;
import
{
escape
}
from
'
lodash
'
;
import
{
import
{
GlPopover
,
GlLink
,
GlAvatar
,
GlButton
,
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
GlPopover
,
GlLink
,
GlAvatar
,
GlDeprecatedButton
,
GlIcon
,
GlLoadingIcon
,
GlTooltipDirective
,
}
from
'
@gitlab/ui
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
{
getTimeago
}
from
'
~/lib/utils/datetime_utility
'
;
import
{
getTimeago
}
from
'
~/lib/utils/datetime_utility
'
;
import
timeagoMixin
from
'
~/vue_shared/mixins/timeago
'
;
import
timeagoMixin
from
'
~/vue_shared/mixins/timeago
'
;
...
@@ -22,9 +14,7 @@ export default {
...
@@ -22,9 +14,7 @@ export default {
GlPopover
,
GlPopover
,
GlLink
,
GlLink
,
GlAvatar
,
GlAvatar
,
GlDeprecatedButton
,
GlButton
,
GlIcon
,
GlLoadingIcon
,
RequirementStatusBadge
,
RequirementStatusBadge
,
},
},
directives
:
{
directives
:
{
...
@@ -149,7 +139,7 @@ export default {
...
@@ -149,7 +139,7 @@ export default {
class=
"d-block d-sm-none"
class=
"d-block d-sm-none"
/>
/>
</div>
</div>
<div
class=
"
issuable-meta
"
>
<div
class=
"
d-flex
"
>
<ul
v-if=
"showIssuableMetaActions"
class=
"controls flex-column flex-sm-row"
>
<ul
v-if=
"showIssuableMetaActions"
class=
"controls flex-column flex-sm-row"
>
<requirement-status-badge
<requirement-status-badge
v-if=
"testReport"
v-if=
"testReport"
...
@@ -158,36 +148,27 @@ export default {
...
@@ -158,36 +148,27 @@ export default {
class=
"d-none d-sm-block"
class=
"d-none d-sm-block"
/>
/>
<li
v-if=
"canUpdate && !isArchived"
class=
"requirement-edit d-sm-block"
>
<li
v-if=
"canUpdate && !isArchived"
class=
"requirement-edit d-sm-block"
>
<gl-
deprecated-
button
<gl-button
v-gl-tooltip
v-gl-tooltip
size=
"sm"
icon=
"pencil"
class=
"border-0"
:title=
"__('Edit')"
:title=
"__('Edit')"
@
click=
"$emit('editClick', requirement)"
@
click=
"$emit('editClick', requirement)"
>
/>
<gl-icon
name=
"pencil"
/>
</gl-deprecated-button>
</li>
</li>
<li
v-if=
"canArchive && !isArchived"
class=
"requirement-archive d-sm-block"
>
<li
v-if=
"canArchive && !isArchived"
class=
"requirement-archive d-sm-block"
>
<gl-deprecated-button
<gl-button
v-if=
"!stateChangeRequestActive"
v-gl-tooltip
v-gl-tooltip
size=
"sm
"
icon=
"archive
"
class=
"border-0
"
:loading=
"stateChangeRequestActive
"
:title=
"__('Archive')"
:title=
"__('Archive')"
@
click=
"handleArchiveClick"
@
click=
"handleArchiveClick"
>
/>
<gl-icon
v-if=
"!stateChangeRequestActive"
name=
"archive"
/>
<gl-loading-icon
v-else
/>
</gl-deprecated-button>
</li>
</li>
<li
v-if=
"canArchive && isArchived"
class=
"requirement-reopen d-sm-block"
>
<li
v-if=
"canArchive && isArchived"
class=
"requirement-reopen d-sm-block"
>
<gl-deprecated-button
<gl-button
:loading=
"stateChangeRequestActive"
@
click=
"handleReopenClick"
>
{{
size=
"xs"
__
(
'
Reopen
'
)
class=
"p-2"
}}
</gl-button>
:loading=
"stateChangeRequestActive"
@
click=
"handleReopenClick"
>
{{
__
(
'
Reopen
'
)
}}
</gl-deprecated-button
>
</li>
</li>
</ul>
</ul>
</div>
</div>
...
...
ee/app/assets/stylesheets/pages/requirements.scss
View file @
3222456d
...
@@ -42,9 +42,16 @@
...
@@ -42,9 +42,16 @@
}
}
.controls
{
.controls
{
.requirement-edit
.btn
,
align-items
:
flex-start
;
.requirement-archive
.btn
{
padding
:
$gl-padding-4
$gl-vert-padding
;
@include
media-breakpoint-down
(
xs
)
{
.requirement-archive
{
margin-top
:
$gl-padding-4
;
}
.requirement-edit
{
margin-right
:
0
;
}
}
}
}
}
...
...
ee/changelogs/unreleased/219911-req-button.yml
0 → 100644
View file @
3222456d
---
title
:
Update requirements list buttons to gl-button
merge_request
:
39372
author
:
type
:
changed
ee/spec/frontend/requirements/components/requirement_item_spec.js
View file @
3222456d
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
GlLink
,
Gl
DeprecatedButton
,
GlIcon
,
GlLoadingIc
on
}
from
'
@gitlab/ui
'
;
import
{
GlLink
,
Gl
Butt
on
}
from
'
@gitlab/ui
'
;
import
RequirementItem
from
'
ee/requirements/components/requirement_item.vue
'
;
import
RequirementItem
from
'
ee/requirements/components/requirement_item.vue
'
;
import
RequirementStatusBadge
from
'
ee/requirements/components/requirement_status_badge.vue
'
;
import
RequirementStatusBadge
from
'
ee/requirements/components/requirement_status_badge.vue
'
;
...
@@ -172,7 +172,7 @@ describe('RequirementItem', () => {
...
@@ -172,7 +172,7 @@ describe('RequirementItem', () => {
it
(
'
renders requirement-status-badge component
'
,
()
=>
{
it
(
'
renders requirement-status-badge component
'
,
()
=>
{
const
statusBadgeElSm
=
wrapper
.
find
(
'
.issuable-main-info
'
).
find
(
RequirementStatusBadge
);
const
statusBadgeElSm
=
wrapper
.
find
(
'
.issuable-main-info
'
).
find
(
RequirementStatusBadge
);
const
statusBadgeElMd
=
wrapper
.
find
(
'
.
issuable-meta
'
).
find
(
RequirementStatusBadge
);
const
statusBadgeElMd
=
wrapper
.
find
(
'
.
controls
'
).
find
(
RequirementStatusBadge
);
expect
(
statusBadgeElSm
.
exists
()).
toBe
(
true
);
expect
(
statusBadgeElSm
.
exists
()).
toBe
(
true
);
expect
(
statusBadgeElMd
.
exists
()).
toBe
(
true
);
expect
(
statusBadgeElMd
.
exists
()).
toBe
(
true
);
...
@@ -182,12 +182,10 @@ describe('RequirementItem', () => {
...
@@ -182,12 +182,10 @@ describe('RequirementItem', () => {
});
});
it
(
'
renders element containing requirement `Edit` button when `requirement.userPermissions.updateRequirement` is true
'
,
()
=>
{
it
(
'
renders element containing requirement `Edit` button when `requirement.userPermissions.updateRequirement` is true
'
,
()
=>
{
const
editButtonEl
=
wrapper
.
find
(
'
.controls .requirement-edit
'
).
find
(
Gl
Deprecated
Button
);
const
editButtonEl
=
wrapper
.
find
(
'
.controls .requirement-edit
'
).
find
(
GlButton
);
expect
(
editButtonEl
.
exists
()).
toBe
(
true
);
expect
(
editButtonEl
.
exists
()).
toBe
(
true
);
expect
(
editButtonEl
.
attributes
(
'
title
'
)).
toBe
(
'
Edit
'
);
expect
(
editButtonEl
.
attributes
(
'
title
'
)).
toBe
(
'
Edit
'
);
expect
(
editButtonEl
.
find
(
GlIcon
).
exists
()).
toBe
(
true
);
expect
(
editButtonEl
.
find
(
GlIcon
).
props
(
'
name
'
)).
toBe
(
'
pencil
'
);
});
});
it
(
'
does not render element containing requirement `Edit` button when `requirement.userPermissions.updateRequirement` is false
'
,
()
=>
{
it
(
'
does not render element containing requirement `Edit` button when `requirement.userPermissions.updateRequirement` is false
'
,
()
=>
{
...
@@ -205,14 +203,10 @@ describe('RequirementItem', () => {
...
@@ -205,14 +203,10 @@ describe('RequirementItem', () => {
});
});
it
(
'
renders element containing requirement `Archive` button when `requirement.userPermissions.adminRequirement` is true
'
,
()
=>
{
it
(
'
renders element containing requirement `Archive` button when `requirement.userPermissions.adminRequirement` is true
'
,
()
=>
{
const
archiveButtonEl
=
wrapper
const
archiveButtonEl
=
wrapper
.
find
(
'
.controls .requirement-archive
'
).
find
(
GlButton
);
.
find
(
'
.controls .requirement-archive
'
)
.
find
(
GlDeprecatedButton
);
expect
(
archiveButtonEl
.
exists
()).
toBe
(
true
);
expect
(
archiveButtonEl
.
exists
()).
toBe
(
true
);
expect
(
archiveButtonEl
.
attributes
(
'
title
'
)).
toBe
(
'
Archive
'
);
expect
(
archiveButtonEl
.
attributes
(
'
title
'
)).
toBe
(
'
Archive
'
);
expect
(
archiveButtonEl
.
find
(
GlIcon
).
exists
()).
toBe
(
true
);
expect
(
archiveButtonEl
.
find
(
GlIcon
).
props
(
'
name
'
)).
toBe
(
'
archive
'
);
});
});
it
(
'
does not render element containing requirement `Archive` button when `requirement.userPermissions.adminRequirement` is false
'
,
()
=>
{
it
(
'
does not render element containing requirement `Archive` button when `requirement.userPermissions.adminRequirement` is false
'
,
()
=>
{
...
@@ -229,23 +223,8 @@ describe('RequirementItem', () => {
...
@@ -229,23 +223,8 @@ describe('RequirementItem', () => {
wrapperNoArchive
.
destroy
();
wrapperNoArchive
.
destroy
();
});
});
it
(
'
renders loading icon within archive button when `stateChangeRequestActive` prop is true
'
,
()
=>
{
wrapper
.
setProps
({
stateChangeRequestActive
:
true
,
});
return
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
wrapper
.
find
(
'
.requirement-archive
'
)
.
find
(
GlLoadingIcon
)
.
exists
(),
).
toBe
(
true
);
});
});
it
(
'
renders `Reopen` button when current requirement is archived and `requirement.userPermissions.adminRequirement` is true
'
,
()
=>
{
it
(
'
renders `Reopen` button when current requirement is archived and `requirement.userPermissions.adminRequirement` is true
'
,
()
=>
{
const
reopenButton
=
wrapperArchived
.
find
(
'
.requirement-reopen
'
).
find
(
Gl
Deprecated
Button
);
const
reopenButton
=
wrapperArchived
.
find
(
'
.requirement-reopen
'
).
find
(
GlButton
);
expect
(
reopenButton
.
exists
()).
toBe
(
true
);
expect
(
reopenButton
.
exists
()).
toBe
(
true
);
expect
(
reopenButton
.
props
(
'
loading
'
)).
toBe
(
false
);
expect
(
reopenButton
.
props
(
'
loading
'
)).
toBe
(
false
);
...
...
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