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
768e759c
Commit
768e759c
authored
Jan 07, 2021
by
Kev
Committed by
Kushal Pandya
Jan 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide "Health status" edit button when the user has no permission'
parent
e6ebfd93
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
9 deletions
+64
-9
ee/app/assets/javascripts/sidebar/components/status/sidebar_status.vue
.../javascripts/sidebar/components/status/sidebar_status.vue
+2
-1
ee/app/assets/javascripts/sidebar/components/status/status.vue
...p/assets/javascripts/sidebar/components/status/status.vue
+13
-3
ee/changelogs/unreleased/273156-hide-health-status-tooltip-when-no-permission.yml
.../273156-hide-health-status-tooltip-when-no-permission.yml
+5
-0
ee/spec/frontend/sidebar/components/status/sidebar_status_spec.js
...frontend/sidebar/components/status/sidebar_status_spec.js
+5
-1
ee/spec/frontend/sidebar/components/status/status_spec.js
ee/spec/frontend/sidebar/components/status/status_spec.js
+39
-4
No files found.
ee/app/assets/javascripts/sidebar/components/status/sidebar_status.vue
View file @
768e759c
...
@@ -36,7 +36,8 @@ export default {
...
@@ -36,7 +36,8 @@ export default {
<
template
>
<
template
>
<status
<status
:is-editable=
"mediator.store.editable && isOpen"
:is-open=
"isOpen"
:is-editable=
"mediator.store.editable"
:is-fetching=
"mediator.store.isFetching.status"
:is-fetching=
"mediator.store.isFetching.status"
:status=
"mediator.store.status"
:status=
"mediator.store.status"
@
onDropdownClick=
"handleDropdownClick"
@
onDropdownClick=
"handleDropdownClick"
...
...
ee/app/assets/javascripts/sidebar/components/status/status.vue
View file @
768e759c
...
@@ -26,6 +26,11 @@ export default {
...
@@ -26,6 +26,11 @@ export default {
},
},
mixins
:
[
Tracking
.
mixin
()],
mixins
:
[
Tracking
.
mixin
()],
props
:
{
props
:
{
isOpen
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
isEditable
:
{
isEditable
:
{
type
:
Boolean
,
type
:
Boolean
,
required
:
false
,
required
:
false
,
...
@@ -74,7 +79,7 @@ export default {
...
@@ -74,7 +79,7 @@ export default {
};
};
},
},
editTooltip
()
{
editTooltip
()
{
const
tooltipText
=
!
this
.
is
Editable
const
tooltipText
=
!
this
.
is
Open
?
s__
(
'
Health status cannot be edited because this issue is closed
'
)
?
s__
(
'
Health status cannot be edited because this issue is closed
'
)
:
''
;
:
''
;
...
@@ -147,12 +152,17 @@ export default {
...
@@ -147,12 +152,17 @@ export default {
<div
class=
"hide-collapsed"
>
<div
class=
"hide-collapsed"
>
<p
class=
"title gl-display-flex justify-content-between"
>
<p
class=
"title gl-display-flex justify-content-between"
>
<span
data-testid=
"statusTitle"
>
{{
s__
(
'
Sidebar|Health status
'
)
}}
</span>
<span
data-testid=
"statusTitle"
>
{{
s__
(
'
Sidebar|Health status
'
)
}}
</span>
<span
v-gl-tooltip.topleft=
"editTooltip"
data-testid=
"editButtonTooltip"
tabindex=
"0"
>
<span
v-if=
"isEditable"
v-gl-tooltip.topleft=
"editTooltip"
data-testid=
"editButtonTooltip"
tabindex=
"0"
>
<gl-button
<gl-button
ref=
"editButton"
ref=
"editButton"
variant=
"link"
variant=
"link"
class=
"edit-link btn-link-hover gl-text-black-normal!"
class=
"edit-link btn-link-hover gl-text-black-normal!"
:disabled=
"!is
Editable
"
:disabled=
"!is
Open
"
@
click.stop=
"toggleFormDropdown"
@
click.stop=
"toggleFormDropdown"
@
keydown.esc=
"hideDropdown"
@
keydown.esc=
"hideDropdown"
>
>
...
...
ee/changelogs/unreleased/273156-hide-health-status-tooltip-when-no-permission.yml
0 → 100644
View file @
768e759c
---
title
:
Hide "Health status" edit button when the user has no permission
merge_request
:
49535
author
:
Kev @KevSlashNull
type
:
fixed
ee/spec/frontend/sidebar/components/status/sidebar_status_spec.js
View file @
768e759c
...
@@ -39,7 +39,11 @@ describe('SidebarStatus', () => {
...
@@ -39,7 +39,11 @@ describe('SidebarStatus', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
createMediator
();
createMediator
();
createWrapper
();
createWrapper
({
getters
:
{
getNoteableData
:
{},
},
});
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
...
...
ee/spec/frontend/sidebar/components/status/status_spec.js
View file @
768e759c
...
@@ -76,32 +76,65 @@ describe('Status', () => {
...
@@ -76,32 +76,65 @@ describe('Status', () => {
});
});
describe
(
'
edit button
'
,
()
=>
{
describe
(
'
edit button
'
,
()
=>
{
it
(
'
is displayed when user can edit
'
,
()
=>
{
it
(
'
is displayed when user can edit
and the issue is open
'
,
()
=>
{
const
props
=
{
const
props
=
{
isEditable
:
true
,
isEditable
:
true
,
isOpen
:
true
,
};
};
shallowMountStatus
(
props
);
shallowMountStatus
(
props
);
expect
(
getEditButton
(
wrapper
).
exists
()).
toBe
(
true
);
expect
(
getEditButton
(
wrapper
).
exists
()).
toBe
(
true
);
expect
(
getEditButton
(
wrapper
).
props
().
disabled
).
toBe
(
false
);
});
});
describe
(
'
when
disabled
'
,
()
=>
{
describe
(
'
when
closed and user does not have permission
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
const
props
=
{
const
props
=
{
isEditable
:
false
,
isEditable
:
false
,
isOpen
:
false
,
};
};
shallowMountStatus
(
props
);
shallowMountStatus
(
props
);
});
});
it
(
'
is disabled when user cannot edit
'
,
()
=>
{
expect
(
getEditButton
(
wrapper
).
attributes
().
disabled
).
toBe
(
'
true
'
);
it
(
'
does not render the edit button
'
,
()
=>
{
expect
(
getEditButton
(
wrapper
).
exists
()).
toBe
(
false
);
});
});
describe
(
'
when closed and user has permission
'
,
()
=>
{
beforeEach
(()
=>
{
const
props
=
{
isEditable
:
true
,
isOpen
:
false
,
};
shallowMountStatus
(
props
);
});
});
it
(
'
will render a tooltip with an informative message
'
,
()
=>
{
it
(
'
will render a tooltip with an informative message
'
,
()
=>
{
const
tooltipTitle
=
'
Health status cannot be edited because this issue is closed
'
;
const
tooltipTitle
=
'
Health status cannot be edited because this issue is closed
'
;
expect
(
getEditButtonTooltipValue
(
wrapper
).
title
).
toBe
(
tooltipTitle
);
expect
(
getEditButtonTooltipValue
(
wrapper
).
title
).
toBe
(
tooltipTitle
);
});
});
it
(
'
is disabled
'
,
()
=>
{
expect
(
getEditButton
(
wrapper
).
props
().
disabled
).
toBe
(
true
);
});
});
describe
(
'
when the user does not have permission
'
,
()
=>
{
beforeEach
(()
=>
{
const
props
=
{
isEditable
:
false
,
};
shallowMountStatus
(
props
);
});
it
(
'
does not render the edit button
'
,
()
=>
{
expect
(
getEditButton
(
wrapper
).
exists
()).
toBe
(
false
);
});
});
});
});
});
...
@@ -198,6 +231,7 @@ describe('Status', () => {
...
@@ -198,6 +231,7 @@ describe('Status', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
const
props
=
{
const
props
=
{
isEditable
:
true
,
isEditable
:
true
,
isOpen
:
true
,
};
};
mountStatus
(
props
);
mountStatus
(
props
);
...
@@ -215,6 +249,7 @@ describe('Status', () => {
...
@@ -215,6 +249,7 @@ describe('Status', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
const
props
=
{
const
props
=
{
isEditable
:
true
,
isEditable
:
true
,
isOpen
:
true
,
};
};
mountStatus
(
props
);
mountStatus
(
props
);
...
...
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