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
74393bf0
Commit
74393bf0
authored
Jul 09, 2020
by
Jake Lear
Committed by
Paul Slaughter
Jul 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make "show labels" toggle persist with localStorage
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/34728
parent
6566448f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
24 deletions
+33
-24
ee/app/assets/javascripts/boards/stores/actions.js
ee/app/assets/javascripts/boards/stores/actions.js
+2
-2
ee/app/assets/javascripts/boards/stores/mutation_types.js
ee/app/assets/javascripts/boards/stores/mutation_types.js
+1
-1
ee/app/assets/javascripts/boards/stores/mutations.js
ee/app/assets/javascripts/boards/stores/mutations.js
+2
-2
ee/app/assets/javascripts/boards/toggle_labels.js
ee/app/assets/javascripts/boards/toggle_labels.js
+10
-3
ee/changelogs/unreleased/jl-sticky-label-toggle.yml
ee/changelogs/unreleased/jl-sticky-label-toggle.yml
+5
-0
ee/spec/frontend/boards/stores/actions_spec.js
ee/spec/frontend/boards/stores/actions_spec.js
+10
-3
ee/spec/frontend/boards/stores/mutations_spec.js
ee/spec/frontend/boards/stores/mutations_spec.js
+3
-13
No files found.
ee/app/assets/javascripts/boards/stores/actions.js
View file @
74393bf0
...
...
@@ -63,8 +63,8 @@ const fetchEpics = ({ endpoints }) => {
export
default
{
...
actionsCE
,
toggleShowLabels
({
commit
}
)
{
commit
(
types
.
TOGGLE_LABELS
);
setShowLabels
({
commit
},
val
)
{
commit
(
types
.
SET_SHOW_LABELS
,
val
);
},
setActiveListId
({
commit
},
listId
)
{
...
...
ee/app/assets/javascripts/boards/stores/mutation_types.js
View file @
74393bf0
...
...
@@ -11,9 +11,9 @@ export const REQUEST_REMOVE_BOARD = 'REQUEST_REMOVE_BOARD';
export
const
RECEIVE_REMOVE_BOARD_SUCCESS
=
'
RECEIVE_REMOVE_BOARD_SUCCESS
'
;
export
const
RECEIVE_REMOVE_BOARD_ERROR
=
'
RECEIVE_REMOVE_BOARD_ERROR
'
;
export
const
TOGGLE_PROMOTION_STATE
=
'
TOGGLE_PROMOTION_STATE
'
;
export
const
TOGGLE_LABELS
=
'
TOGGLE_LABELS
'
;
export
const
TOGGLE_EPICS_SWIMLANES
=
'
TOGGLE_EPICS_SWIMLANES
'
;
export
const
RECEIVE_SWIMLANES_SUCCESS
=
'
RECEIVE_SWIMLANES_SUCCESS
'
;
export
const
RECEIVE_SWIMLANES_FAILURE
=
'
RECEIVE_SWIMLANES_FAILURE
'
;
export
const
RECEIVE_EPICS_SUCCESS
=
'
RECEIVE_EPICS_SUCCESS
'
;
export
const
SET_ACTIVE_LIST_ID
=
'
SET_ACTIVE_LIST_ID
'
;
export
const
SET_SHOW_LABELS
=
'
SET_SHOW_LABELS
'
;
ee/app/assets/javascripts/boards/stores/mutations.js
View file @
74393bf0
...
...
@@ -8,8 +8,8 @@ const notImplemented = () => {
export
default
{
...
mutationsCE
,
[
mutationTypes
.
TOGGLE_LABELS
]:
state
=>
{
state
.
isShowingLabels
=
!
state
.
isShowingLabels
;
[
mutationTypes
.
SET_SHOW_LABELS
]:
(
state
,
val
)
=>
{
state
.
isShowingLabels
=
val
;
},
[
mutationTypes
.
SET_ACTIVE_LIST_ID
]:
(
state
,
id
)
=>
{
state
.
activeListId
=
id
;
...
...
ee/app/assets/javascripts/boards/toggle_labels.js
View file @
74393bf0
...
...
@@ -3,12 +3,14 @@ import { mapState, mapGetters, mapActions } from 'vuex';
import
{
GlToggle
}
from
'
@gitlab/ui
'
;
import
Tracking
from
'
~/tracking
'
;
import
store
from
'
~/boards/stores
'
;
import
LocalStorageSync
from
'
~/vue_shared/components/local_storage_sync.vue
'
;
export
default
()
=>
new
Vue
({
el
:
document
.
getElementById
(
'
js-board-labels-toggle
'
),
components
:
{
GlToggle
,
LocalStorageSync
,
},
store
,
computed
:
{
...
...
@@ -16,19 +18,24 @@ export default () =>
...
mapGetters
([
'
getLabelToggleState
'
]),
},
methods
:
{
...
mapActions
([
'
toggle
ShowLabels
'
]),
...
mapActions
([
'
set
ShowLabels
'
]),
onToggle
()
{
this
.
toggleShowLabels
(
);
onToggle
(
val
)
{
this
.
setShowLabels
(
val
);
Tracking
.
event
(
document
.
body
.
dataset
.
page
,
'
toggle
'
,
{
label
:
'
show_labels
'
,
property
:
this
.
getLabelToggleState
,
});
},
onStorageUpdate
(
val
)
{
this
.
setShowLabels
(
JSON
.
parse
(
val
));
},
},
template
:
`
<div class="board-labels-toggle-wrapper d-flex align-items-center prepend-left-10">
<local-storage-sync storage-key="gl-show-board-labels" :value="JSON.stringify(isShowingLabels)" @input="onStorageUpdate" />
<gl-toggle
:value="isShowingLabels"
label="Show labels"
...
...
ee/changelogs/unreleased/jl-sticky-label-toggle.yml
0 → 100644
View file @
74393bf0
---
title
:
Update the "show labels" toggle on boards to persist using localStorage
merge_request
:
34728
author
:
type
:
changed
ee/spec/frontend/boards/stores/actions_spec.js
View file @
74393bf0
...
...
@@ -13,13 +13,20 @@ const expectNotImplemented = action => {
});
};
describe
(
'
toggle
ShowLabels
'
,
()
=>
{
it
(
'
should commit mutation
TOGGLE
_LABELS
'
,
done
=>
{
describe
(
'
set
ShowLabels
'
,
()
=>
{
it
(
'
should commit mutation
SET_SHOW
_LABELS
'
,
done
=>
{
const
state
=
{
isShowingLabels
:
true
,
};
testAction
(
actions
.
toggleShowLabels
,
null
,
state
,
[{
type
:
types
.
TOGGLE_LABELS
}],
[],
done
);
testAction
(
actions
.
setShowLabels
,
false
,
state
,
[{
type
:
types
.
SET_SHOW_LABELS
,
payload
:
false
}],
[],
done
,
);
});
});
...
...
ee/spec/frontend/boards/stores/mutations_spec.js
View file @
74393bf0
...
...
@@ -8,26 +8,16 @@ const expectNotImplemented = action => {
});
};
describe
(
'
TOGGLE
_LABELS
'
,
()
=>
{
it
(
'
toggles isShowingLabels from true to false
'
,
()
=>
{
describe
(
'
SET_SHOW
_LABELS
'
,
()
=>
{
it
(
'
updates isShowingLabels
'
,
()
=>
{
const
state
=
{
isShowingLabels
:
true
,
};
mutations
.
TOGGLE_LABELS
(
stat
e
);
mutations
.
SET_SHOW_LABELS
(
state
,
fals
e
);
expect
(
state
.
isShowingLabels
).
toBe
(
false
);
});
it
(
'
toggles isShowingLabels from false to true
'
,
()
=>
{
const
state
=
{
isShowingLabels
:
false
,
};
mutations
.
TOGGLE_LABELS
(
state
);
expect
(
state
.
isShowingLabels
).
toBe
(
true
);
});
});
describe
(
'
SET_ACTIVE_LIST_ID
'
,
()
=>
{
...
...
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