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
Show 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 }) => {
...
@@ -63,8 +63,8 @@ const fetchEpics = ({ endpoints }) => {
export
default
{
export
default
{
...
actionsCE
,
...
actionsCE
,
toggleShowLabels
({
commit
}
)
{
setShowLabels
({
commit
},
val
)
{
commit
(
types
.
TOGGLE_LABELS
);
commit
(
types
.
SET_SHOW_LABELS
,
val
);
},
},
setActiveListId
({
commit
},
listId
)
{
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';
...
@@ -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_SUCCESS
=
'
RECEIVE_REMOVE_BOARD_SUCCESS
'
;
export
const
RECEIVE_REMOVE_BOARD_ERROR
=
'
RECEIVE_REMOVE_BOARD_ERROR
'
;
export
const
RECEIVE_REMOVE_BOARD_ERROR
=
'
RECEIVE_REMOVE_BOARD_ERROR
'
;
export
const
TOGGLE_PROMOTION_STATE
=
'
TOGGLE_PROMOTION_STATE
'
;
export
const
TOGGLE_PROMOTION_STATE
=
'
TOGGLE_PROMOTION_STATE
'
;
export
const
TOGGLE_LABELS
=
'
TOGGLE_LABELS
'
;
export
const
TOGGLE_EPICS_SWIMLANES
=
'
TOGGLE_EPICS_SWIMLANES
'
;
export
const
TOGGLE_EPICS_SWIMLANES
=
'
TOGGLE_EPICS_SWIMLANES
'
;
export
const
RECEIVE_SWIMLANES_SUCCESS
=
'
RECEIVE_SWIMLANES_SUCCESS
'
;
export
const
RECEIVE_SWIMLANES_SUCCESS
=
'
RECEIVE_SWIMLANES_SUCCESS
'
;
export
const
RECEIVE_SWIMLANES_FAILURE
=
'
RECEIVE_SWIMLANES_FAILURE
'
;
export
const
RECEIVE_SWIMLANES_FAILURE
=
'
RECEIVE_SWIMLANES_FAILURE
'
;
export
const
RECEIVE_EPICS_SUCCESS
=
'
RECEIVE_EPICS_SUCCESS
'
;
export
const
RECEIVE_EPICS_SUCCESS
=
'
RECEIVE_EPICS_SUCCESS
'
;
export
const
SET_ACTIVE_LIST_ID
=
'
SET_ACTIVE_LIST_ID
'
;
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 = () => {
...
@@ -8,8 +8,8 @@ const notImplemented = () => {
export
default
{
export
default
{
...
mutationsCE
,
...
mutationsCE
,
[
mutationTypes
.
TOGGLE_LABELS
]:
state
=>
{
[
mutationTypes
.
SET_SHOW_LABELS
]:
(
state
,
val
)
=>
{
state
.
isShowingLabels
=
!
state
.
isShowingLabels
;
state
.
isShowingLabels
=
val
;
},
},
[
mutationTypes
.
SET_ACTIVE_LIST_ID
]:
(
state
,
id
)
=>
{
[
mutationTypes
.
SET_ACTIVE_LIST_ID
]:
(
state
,
id
)
=>
{
state
.
activeListId
=
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';
...
@@ -3,12 +3,14 @@ import { mapState, mapGetters, mapActions } from 'vuex';
import
{
GlToggle
}
from
'
@gitlab/ui
'
;
import
{
GlToggle
}
from
'
@gitlab/ui
'
;
import
Tracking
from
'
~/tracking
'
;
import
Tracking
from
'
~/tracking
'
;
import
store
from
'
~/boards/stores
'
;
import
store
from
'
~/boards/stores
'
;
import
LocalStorageSync
from
'
~/vue_shared/components/local_storage_sync.vue
'
;
export
default
()
=>
export
default
()
=>
new
Vue
({
new
Vue
({
el
:
document
.
getElementById
(
'
js-board-labels-toggle
'
),
el
:
document
.
getElementById
(
'
js-board-labels-toggle
'
),
components
:
{
components
:
{
GlToggle
,
GlToggle
,
LocalStorageSync
,
},
},
store
,
store
,
computed
:
{
computed
:
{
...
@@ -16,19 +18,24 @@ export default () =>
...
@@ -16,19 +18,24 @@ export default () =>
...
mapGetters
([
'
getLabelToggleState
'
]),
...
mapGetters
([
'
getLabelToggleState
'
]),
},
},
methods
:
{
methods
:
{
...
mapActions
([
'
toggle
ShowLabels
'
]),
...
mapActions
([
'
set
ShowLabels
'
]),
onToggle
()
{
onToggle
(
val
)
{
this
.
toggleShowLabels
(
);
this
.
setShowLabels
(
val
);
Tracking
.
event
(
document
.
body
.
dataset
.
page
,
'
toggle
'
,
{
Tracking
.
event
(
document
.
body
.
dataset
.
page
,
'
toggle
'
,
{
label
:
'
show_labels
'
,
label
:
'
show_labels
'
,
property
:
this
.
getLabelToggleState
,
property
:
this
.
getLabelToggleState
,
});
});
},
},
onStorageUpdate
(
val
)
{
this
.
setShowLabels
(
JSON
.
parse
(
val
));
},
},
},
template
:
`
template
:
`
<div class="board-labels-toggle-wrapper d-flex align-items-center prepend-left-10">
<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
<gl-toggle
:value="isShowingLabels"
:value="isShowingLabels"
label="Show labels"
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 => {
...
@@ -13,13 +13,20 @@ const expectNotImplemented = action => {
});
});
};
};
describe
(
'
toggle
ShowLabels
'
,
()
=>
{
describe
(
'
set
ShowLabels
'
,
()
=>
{
it
(
'
should commit mutation
TOGGLE
_LABELS
'
,
done
=>
{
it
(
'
should commit mutation
SET_SHOW
_LABELS
'
,
done
=>
{
const
state
=
{
const
state
=
{
isShowingLabels
:
true
,
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 => {
...
@@ -8,26 +8,16 @@ const expectNotImplemented = action => {
});
});
};
};
describe
(
'
TOGGLE
_LABELS
'
,
()
=>
{
describe
(
'
SET_SHOW
_LABELS
'
,
()
=>
{
it
(
'
toggles isShowingLabels from true to false
'
,
()
=>
{
it
(
'
updates isShowingLabels
'
,
()
=>
{
const
state
=
{
const
state
=
{
isShowingLabels
:
true
,
isShowingLabels
:
true
,
};
};
mutations
.
TOGGLE_LABELS
(
stat
e
);
mutations
.
SET_SHOW_LABELS
(
state
,
fals
e
);
expect
(
state
.
isShowingLabels
).
toBe
(
false
);
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
'
,
()
=>
{
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