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
f8dc1826
Commit
f8dc1826
authored
Jan 28, 2019
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for Parent Epic in Epic sidebar
Add Parent epic link within Sidebar.
parent
e098b089
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
1 deletion
+56
-1
ee/app/assets/javascripts/epic/components/epic_sidebar.vue
ee/app/assets/javascripts/epic/components/epic_sidebar.vue
+7
-0
ee/app/assets/javascripts/epic/store/getters.js
ee/app/assets/javascripts/epic/store/getters.js
+2
-0
ee/app/assets/javascripts/epic/store/state.js
ee/app/assets/javascripts/epic/store/state.js
+1
-0
ee/spec/javascripts/epic/components/epic_sidebar_spec.js
ee/spec/javascripts/epic/components/epic_sidebar_spec.js
+20
-1
ee/spec/javascripts/epic/mock_data.js
ee/spec/javascripts/epic/mock_data.js
+6
-0
ee/spec/javascripts/epic/store/getters_spec.js
ee/spec/javascripts/epic/store/getters_spec.js
+20
-0
No files found.
ee/app/assets/javascripts/epic/components/epic_sidebar.vue
View file @
f8dc1826
<
script
>
import
{
mapState
,
mapGetters
,
mapActions
}
from
'
vuex
'
;
import
SidebarParentEpic
from
'
ee/sidebar/components/sidebar_item_epic.vue
'
;
import
epicUtils
from
'
../utils/epic_utils
'
;
import
SidebarHeader
from
'
./sidebar_items/sidebar_header.vue
'
;
...
...
@@ -19,6 +21,7 @@ export default {
SidebarDatePicker
,
SidebarDatePickerCollapsed
,
SidebarLabels
,
SidebarParentEpic
,
},
computed
:
{
...
mapState
([
...
...
@@ -48,6 +51,7 @@ export default {
'
dueDateTimeFromMilestones
'
,
'
dueDateTime
'
,
'
dueDateForCollapsedSidebar
'
,
'
parentEpic
'
,
]),
},
mounted
()
{
...
...
@@ -175,6 +179,9 @@ export default {
@
toggleCollapse=
"toggleSidebar(
{ sidebarCollapsed })"
/>
<sidebar-labels
:can-update=
"canUpdate"
:sidebar-collapsed=
"sidebarCollapsed"
/>
<div
class=
"block parent-epic"
>
<sidebar-parent-epic
:block-title=
"__('Parent epic')"
:initial-epic=
"parentEpic"
/>
</div>
</div>
</aside>
</
template
>
ee/app/assets/javascripts/epic/store/getters.js
View file @
f8dc1826
...
...
@@ -55,5 +55,7 @@ export const isDateInvalid = (state, getters) => {
);
};
export
const
parentEpic
=
state
=>
(
state
.
parent
?
state
.
parent
:
{});
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export
default
()
=>
{};
ee/app/assets/javascripts/epic/store/state.js
View file @
f8dc1826
...
...
@@ -54,6 +54,7 @@ export default () => ({
dueDateFromMilestones
:
''
,
dueDate
:
''
,
labels
:
[],
parent
:
null
,
participants
:
[],
subscribed
:
false
,
...
...
ee/spec/javascripts/epic/components/epic_sidebar_spec.js
View file @
f8dc1826
...
...
@@ -7,7 +7,7 @@ import epicUtils from 'ee/epic/utils/epic_utils';
import
{
dateTypes
}
from
'
ee/epic/constants
'
;
import
{
mountComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
mockEpicMeta
,
mockEpicData
}
from
'
../mock_data
'
;
import
{
mockEpicMeta
,
mockEpicData
,
mockParentEpic
}
from
'
../mock_data
'
;
describe
(
'
EpicSidebarComponent
'
,
()
=>
{
const
originalUserId
=
gon
.
current_user_id
;
...
...
@@ -19,6 +19,7 @@ describe('EpicSidebarComponent', () => {
store
=
createStore
();
store
.
dispatch
(
'
setEpicMeta
'
,
mockEpicMeta
);
store
.
dispatch
(
'
setEpicData
'
,
mockEpicData
);
store
.
state
.
parent
=
mockParentEpic
;
vm
=
mountComponentWithStore
(
Component
,
{
store
,
...
...
@@ -202,5 +203,23 @@ describe('EpicSidebarComponent', () => {
it
(
'
renders labels select element
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-labels-block
'
)).
not
.
toBeNull
();
});
it
(
'
renders parent epic link element
'
,
done
=>
{
store
.
dispatch
(
'
toggleSidebarFlag
'
,
false
);
vm
.
$nextTick
()
.
then
(()
=>
{
const
parentEpicEl
=
vm
.
$el
.
querySelector
(
'
.block.parent-epic
'
);
expect
(
parentEpicEl
).
not
.
toBeNull
();
expect
(
parentEpicEl
.
querySelector
(
'
.title
'
).
innerText
.
trim
()).
toBe
(
'
Parent epic
'
);
expect
(
parentEpicEl
.
querySelector
(
'
.value
'
).
innerText
.
trim
()).
toBe
(
mockParentEpic
.
title
);
expect
(
parentEpicEl
.
querySelector
(
'
.value a
'
).
getAttribute
(
'
href
'
)).
toBe
(
mockParentEpic
.
url
,
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
});
ee/spec/javascripts/epic/mock_data.js
View file @
f8dc1826
...
...
@@ -44,3 +44,9 @@ export const mockLabels = [
text_color
:
'
#FFFFFF
'
,
},
];
export
const
mockParentEpic
=
{
id
:
1
,
title
:
'
Sample Parent Epic
'
,
url
:
'
/groups/gitlab-org/-/epics/6
'
,
};
ee/spec/javascripts/epic/store/getters_spec.js
View file @
f8dc1826
...
...
@@ -259,4 +259,24 @@ describe('Epic Store Getters', () => {
).
toBe
(
false
);
});
});
describe
(
'
parentEpic
'
,
()
=>
{
it
(
'
returns `parent` from state when parent is not null
'
,
()
=>
{
const
parent
=
getters
.
parentEpic
({
parent
:
{
id
:
1
,
},
});
expect
(
parent
.
id
).
toBe
(
1
);
});
it
(
'
returns empty object when `parent` within state is null
'
,
()
=>
{
const
parent
=
getters
.
parentEpic
({
parent
:
null
,
});
expect
(
parent
).
not
.
toBeNull
();
});
});
});
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