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
1070148c
Commit
1070148c
authored
May 04, 2020
by
Gilang Gumilar
Committed by
Kushal Pandya
May 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix showing New requirement button to unauthenticated user
parent
ce588f38
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
7 deletions
+38
-7
ee/app/assets/javascripts/requirements/components/requirements_empty_state.vue
...ipts/requirements/components/requirements_empty_state.vue
+5
-1
ee/app/assets/javascripts/requirements/components/requirements_root.vue
...javascripts/requirements/components/requirements_root.vue
+5
-0
ee/app/assets/javascripts/requirements/requirements_bundle.js
...pp/assets/javascripts/requirements/requirements_bundle.js
+3
-0
ee/app/views/projects/requirements/index.html.haml
ee/app/views/projects/requirements/index.html.haml
+1
-0
ee/changelogs/unreleased/214991-fix-showing-new-requirement-button-to-unauthenticated-user.yml
...howing-new-requirement-button-to-unauthenticated-user.yml
+5
-0
ee/spec/frontend/requirements/components/requirements_empty_state_spec.js
.../requirements/components/requirements_empty_state_spec.js
+17
-6
ee/spec/frontend/requirements/components/requirements_root_spec.js
...rontend/requirements/components/requirements_root_spec.js
+2
-0
No files found.
ee/app/assets/javascripts/requirements/components/requirements_empty_state.vue
View file @
1070148c
...
...
@@ -22,6 +22,10 @@ export default {
type
:
Object
,
required
:
true
,
},
canCreateRequirement
:
{
type
:
Boolean
,
required
:
true
,
},
},
computed
:
{
emptyStateTitle
()
{
...
...
@@ -48,7 +52,7 @@ export default {
:title=
"emptyStateTitle"
:description=
"emptyStateDescription"
>
<template
v-if=
"emptyStateDescription"
#actions
>
<template
v-if=
"emptyStateDescription
&& canCreateRequirement
"
#actions
>
<gl-deprecated-button
category=
"primary"
variant=
"success"
...
...
ee/app/assets/javascripts/requirements/components/requirements_root.vue
View file @
1070148c
...
...
@@ -60,6 +60,10 @@ export default {
type
:
String
,
required
:
true
,
},
canCreateRequirement
:
{
type
:
Boolean
,
required
:
true
,
},
requirementsWebUrl
:
{
type
:
String
,
required
:
true
,
...
...
@@ -429,6 +433,7 @@ export default {
:filter-by=
"filterBy"
:empty-state-path=
"emptyStatePath"
:requirements-count=
"requirementsCount"
:can-create-requirement=
"canCreateRequirement"
@
clickNewRequirement=
"handleNewRequirementClick"
/>
<requirements-loading
...
...
ee/app/assets/javascripts/requirements/requirements_bundle.js
View file @
1070148c
...
...
@@ -48,6 +48,7 @@ export default () => {
opened
,
archived
,
all
,
canCreateRequirement
,
requirementsWebUrl
,
}
=
el
.
dataset
;
const
stateFilterBy
=
filterBy
?
FilterState
[
filterBy
]
:
FilterState
.
opened
;
...
...
@@ -68,6 +69,7 @@ export default () => {
next
,
emptyStatePath
,
projectPath
,
canCreateRequirement
,
requirementsWebUrl
,
};
},
...
...
@@ -81,6 +83,7 @@ export default () => {
prev
:
this
.
prev
,
next
:
this
.
next
,
emptyStatePath
:
this
.
emptyStatePath
,
canCreateRequirement
:
this
.
canCreateRequirement
,
requirementsWebUrl
:
this
.
requirementsWebUrl
,
},
});
...
...
ee/app/views/projects/requirements/index.html.haml
View file @
1070148c
...
...
@@ -50,6 +50,7 @@
archived:
requirements_count
[
'archived'
],
all:
total_requirements
,
requirements_web_url:
project_requirements_path
(
@project
),
can_create_requirement:
can?
(
current_user
,
:create_requirement
,
@project
),
empty_state_path:
image_path
(
'illustrations/empty-state/empty-requirements-lg.svg'
)
}
}
-
if
current_tab_count
==
0
-# Show regular spinner only when there will be no
...
...
ee/changelogs/unreleased/214991-fix-showing-new-requirement-button-to-unauthenticated-user.yml
0 → 100644
View file @
1070148c
---
title
:
Fix showing New requirement button to unauthenticated user.
merge_request
:
30085
author
:
Gilang Gumilar
type
:
fixed
ee/spec/frontend/requirements/components/requirements_empty_state_spec.js
View file @
1070148c
...
...
@@ -4,19 +4,18 @@ import { GlEmptyState, GlDeprecatedButton } from '@gitlab/ui';
import
RequirementsEmptyState
from
'
ee/requirements/components/requirements_empty_state.vue
'
;
import
{
FilterState
}
from
'
ee/requirements/constants
'
;
const
createComponent
=
(
filterBy
=
FilterState
.
opened
,
emptyStatePath
=
'
/assets/illustrations/empty-state/requirements.svg
'
,
)
=>
const
createComponent
=
(
props
=
{})
=>
shallowMount
(
RequirementsEmptyState
,
{
propsData
:
{
filterBy
,
emptyStatePath
,
filterBy
:
FilterState
.
opened
,
emptyStatePath
:
'
/assets/illustrations/empty-state/requirements.svg
'
,
requirementsCount
:
{
OPENED
:
0
,
ARCHIVED
:
0
,
ALL
:
0
,
},
canCreateRequirement
:
true
,
...
props
,
},
stubs
:
{
GlEmptyState
},
});
...
...
@@ -128,5 +127,17 @@ describe('RequirementsEmptyState', () => {
expect
(
newReqButton
.
exists
()).
toBe
(
false
);
});
});
it
(
'
does not render new requirement button when user is not authenticated
'
,
()
=>
{
wrapper
=
createComponent
({
canCreateRequirement
:
false
,
});
return
wrapper
.
vm
.
$nextTick
(()
=>
{
const
newReqButton
=
wrapper
.
find
(
GlDeprecatedButton
);
expect
(
newReqButton
.
exists
()).
toBe
(
false
);
});
});
});
});
ee/spec/frontend/requirements/components/requirements_root_spec.js
View file @
1070148c
...
...
@@ -47,6 +47,7 @@ const createComponent = ({
showCreateRequirement
=
false
,
emptyStatePath
=
'
/assets/illustrations/empty-state/requirements.svg
'
,
loading
=
false
,
canCreateRequirement
=
true
,
requirementsWebUrl
=
'
/gitlab-org/gitlab-shell/-/requirements
'
,
}
=
{})
=>
shallowMount
(
RequirementsRoot
,
{
...
...
@@ -56,6 +57,7 @@ const createComponent = ({
requirementsCount
,
showCreateRequirement
,
emptyStatePath
,
canCreateRequirement
,
requirementsWebUrl
,
},
mocks
:
{
...
...
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