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
93cb0599
Commit
93cb0599
authored
Feb 27, 2021
by
Jonston Chan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update references to "issuable_vue_app:change" to use constant
parent
50f16077
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
16 additions
and
10 deletions
+16
-10
app/assets/javascripts/issuable/constants.js
app/assets/javascripts/issuable/constants.js
+1
-0
app/assets/javascripts/issue.js
app/assets/javascripts/issue.js
+1
-3
app/assets/javascripts/issue_show/components/header_actions.vue
...sets/javascripts/issue_show/components/header_actions.vue
+2
-1
app/assets/javascripts/notes/stores/actions.js
app/assets/javascripts/notes/stores/actions.js
+2
-1
ee/app/assets/javascripts/epic/components/epic_header.vue
ee/app/assets/javascripts/epic/components/epic_header.vue
+2
-1
ee/app/assets/javascripts/epic/store/actions.js
ee/app/assets/javascripts/epic/store/actions.js
+2
-1
ee/spec/frontend/epic/store/actions_spec.js
ee/spec/frontend/epic/store/actions_spec.js
+2
-1
spec/frontend/issue_spec.js
spec/frontend/issue_spec.js
+2
-1
spec/frontend/notes/stores/actions_spec.js
spec/frontend/notes/stores/actions_spec.js
+2
-1
No files found.
app/assets/javascripts/issuable/constants.js
0 → 100644
View file @
93cb0599
export
const
EVENT_ISSUABLE_VUE_APP_CHANGE
=
'
issuable_vue_app:change
'
;
app/assets/javascripts/issue.js
View file @
93cb0599
...
@@ -2,13 +2,11 @@ import $ from 'jquery';
...
@@ -2,13 +2,11 @@ import $ from 'jquery';
import
{
joinPaths
}
from
'
~/lib/utils/url_utility
'
;
import
{
joinPaths
}
from
'
~/lib/utils/url_utility
'
;
import
CreateMergeRequestDropdown
from
'
./create_merge_request_dropdown
'
;
import
CreateMergeRequestDropdown
from
'
./create_merge_request_dropdown
'
;
import
{
deprecatedCreateFlash
as
flash
}
from
'
./flash
'
;
import
{
deprecatedCreateFlash
as
flash
}
from
'
./flash
'
;
import
{
EVENT_ISSUABLE_VUE_APP_CHANGE
}
from
'
./issuable/constants
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
{
addDelimiter
}
from
'
./lib/utils/text_utility
'
;
import
{
addDelimiter
}
from
'
./lib/utils/text_utility
'
;
import
{
__
}
from
'
./locale
'
;
import
{
__
}
from
'
./locale
'
;
// TODO: Update all references of "issuable_vue_app:change" https://gitlab.com/gitlab-org/gitlab/-/issues/322760
export
const
EVENT_ISSUABLE_VUE_APP_CHANGE
=
'
issuable_vue_app:change
'
;
export
default
class
Issue
{
export
default
class
Issue
{
constructor
()
{
constructor
()
{
if
(
$
(
'
.js-alert-moved-from-service-desk-warning
'
).
length
)
{
if
(
$
(
'
.js-alert-moved-from-service-desk-warning
'
).
length
)
{
...
...
app/assets/javascripts/issue_show/components/header_actions.vue
View file @
93cb0599
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
{
GlButton
,
GlDropdown
,
GlDropdownItem
,
GlIcon
,
GlLink
,
GlModal
}
from
'
@gitlab/ui
'
;
import
{
GlButton
,
GlDropdown
,
GlDropdownItem
,
GlIcon
,
GlLink
,
GlModal
}
from
'
@gitlab/ui
'
;
import
{
mapActions
,
mapGetters
,
mapState
}
from
'
vuex
'
;
import
{
mapActions
,
mapGetters
,
mapState
}
from
'
vuex
'
;
import
createFlash
,
{
FLASH_TYPES
}
from
'
~/flash
'
;
import
createFlash
,
{
FLASH_TYPES
}
from
'
~/flash
'
;
import
{
EVENT_ISSUABLE_VUE_APP_CHANGE
}
from
'
~/issuable/constants
'
;
import
{
IssuableType
}
from
'
~/issuable_show/constants
'
;
import
{
IssuableType
}
from
'
~/issuable_show/constants
'
;
import
{
IssuableStatus
,
IssueStateEvent
}
from
'
~/issue_show/constants
'
;
import
{
IssuableStatus
,
IssueStateEvent
}
from
'
~/issue_show/constants
'
;
import
{
capitalizeFirstCharacter
}
from
'
~/lib/utils/text_utility
'
;
import
{
capitalizeFirstCharacter
}
from
'
~/lib/utils/text_utility
'
;
...
@@ -148,7 +149,7 @@ export default {
...
@@ -148,7 +149,7 @@ export default {
};
};
// Dispatch event which updates open/close state, shared among the issue show page
// Dispatch event which updates open/close state, shared among the issue show page
document
.
dispatchEvent
(
new
CustomEvent
(
'
issuable_vue_app:change
'
,
payload
));
document
.
dispatchEvent
(
new
CustomEvent
(
EVENT_ISSUABLE_VUE_APP_CHANGE
,
payload
));
})
})
.
catch
(()
=>
createFlash
({
message
:
__
(
'
Error occurred while updating the issue status
'
)
}))
.
catch
(()
=>
createFlash
({
message
:
__
(
'
Error occurred while updating the issue status
'
)
}))
.
finally
(()
=>
{
.
finally
(()
=>
{
...
...
app/assets/javascripts/notes/stores/actions.js
View file @
93cb0599
...
@@ -2,6 +2,7 @@ import $ from 'jquery';
...
@@ -2,6 +2,7 @@ import $ from 'jquery';
import
Visibility
from
'
visibilityjs
'
;
import
Visibility
from
'
visibilityjs
'
;
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
Api
from
'
~/api
'
;
import
Api
from
'
~/api
'
;
import
{
EVENT_ISSUABLE_VUE_APP_CHANGE
}
from
'
~/issuable/constants
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
{
confidentialWidget
}
from
'
~/sidebar/components/confidential/sidebar_confidentiality_widget.vue
'
;
import
{
confidentialWidget
}
from
'
~/sidebar/components/confidential/sidebar_confidentiality_widget.vue
'
;
...
@@ -267,7 +268,7 @@ export const toggleStateButtonLoading = ({ commit }, value) =>
...
@@ -267,7 +268,7 @@ export const toggleStateButtonLoading = ({ commit }, value) =>
commit
(
types
.
TOGGLE_STATE_BUTTON_LOADING
,
value
);
commit
(
types
.
TOGGLE_STATE_BUTTON_LOADING
,
value
);
export
const
emitStateChangedEvent
=
({
getters
},
data
)
=>
{
export
const
emitStateChangedEvent
=
({
getters
},
data
)
=>
{
const
event
=
new
CustomEvent
(
'
issuable_vue_app:change
'
,
{
const
event
=
new
CustomEvent
(
EVENT_ISSUABLE_VUE_APP_CHANGE
,
{
detail
:
{
detail
:
{
data
,
data
,
isClosed
:
getters
.
openState
===
constants
.
CLOSED
,
isClosed
:
getters
.
openState
===
constants
.
CLOSED
,
...
...
ee/app/assets/javascripts/epic/components/epic_header.vue
View file @
93cb0599
<
script
>
<
script
>
import
{
GlButton
,
GlIcon
,
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
import
{
GlButton
,
GlIcon
,
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
import
{
mapState
,
mapGetters
,
mapActions
}
from
'
vuex
'
;
import
{
mapState
,
mapGetters
,
mapActions
}
from
'
vuex
'
;
import
{
EVENT_ISSUABLE_VUE_APP_CHANGE
}
from
'
~/issuable/constants
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
...
@@ -58,7 +59,7 @@ export default {
...
@@ -58,7 +59,7 @@ export default {
* across the UI so we directly call `requestEpicStatusChangeSuccess` action
* across the UI so we directly call `requestEpicStatusChangeSuccess` action
* to update store state.
* to update store state.
*/
*/
epicUtils
.
bindDocumentEvent
(
'
issuable_vue_app:change
'
,
(
e
,
isClosed
)
=>
{
epicUtils
.
bindDocumentEvent
(
EVENT_ISSUABLE_VUE_APP_CHANGE
,
(
e
,
isClosed
)
=>
{
const
isEpicOpen
=
e
.
detail
?
!
e
.
detail
.
isClosed
:
!
isClosed
;
const
isEpicOpen
=
e
.
detail
?
!
e
.
detail
.
isClosed
:
!
isClosed
;
this
.
requestEpicStatusChangeSuccess
({
this
.
requestEpicStatusChangeSuccess
({
state
:
isEpicOpen
?
statusType
.
open
:
statusType
.
close
,
state
:
isEpicOpen
?
statusType
.
open
:
statusType
.
close
,
...
...
ee/app/assets/javascripts/epic/store/actions.js
View file @
93cb0599
import
epicDetailsQuery
from
'
shared_queries/epic/epic_details.query.graphql
'
;
import
epicDetailsQuery
from
'
shared_queries/epic/epic_details.query.graphql
'
;
import
{
deprecatedCreateFlash
as
flash
}
from
'
~/flash
'
;
import
{
deprecatedCreateFlash
as
flash
}
from
'
~/flash
'
;
import
{
EVENT_ISSUABLE_VUE_APP_CHANGE
}
from
'
~/issuable/constants
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
visitUrl
}
from
'
~/lib/utils/url_utility
'
;
import
{
visitUrl
}
from
'
~/lib/utils/url_utility
'
;
...
@@ -60,7 +61,7 @@ export const triggerIssuableEvent = (_, { isEpicOpen }) => {
...
@@ -60,7 +61,7 @@ export const triggerIssuableEvent = (_, { isEpicOpen }) => {
// comment form (part of Notes app) We've wrapped
// comment form (part of Notes app) We've wrapped
// call to `$(document).trigger` within `triggerDocumentEvent`
// call to `$(document).trigger` within `triggerDocumentEvent`
// for ease of testing
// for ease of testing
epicUtils
.
triggerDocumentEvent
(
'
issuable_vue_app:change
'
,
isEpicOpen
);
epicUtils
.
triggerDocumentEvent
(
EVENT_ISSUABLE_VUE_APP_CHANGE
,
isEpicOpen
);
epicUtils
.
triggerDocumentEvent
(
'
issuable:change
'
,
isEpicOpen
);
epicUtils
.
triggerDocumentEvent
(
'
issuable:change
'
,
isEpicOpen
);
};
};
...
...
ee/spec/frontend/epic/store/actions_spec.js
View file @
93cb0599
...
@@ -6,6 +6,7 @@ import defaultState from 'ee/epic/store/state';
...
@@ -6,6 +6,7 @@ import defaultState from 'ee/epic/store/state';
import
epicUtils
from
'
ee/epic/utils/epic_utils
'
;
import
epicUtils
from
'
ee/epic/utils/epic_utils
'
;
import
testAction
from
'
helpers/vuex_action_helper
'
;
import
testAction
from
'
helpers/vuex_action_helper
'
;
import
{
EVENT_ISSUABLE_VUE_APP_CHANGE
}
from
'
~/issuable/constants
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
mockEpicMeta
,
mockEpicData
}
from
'
../mock_data
'
;
import
{
mockEpicMeta
,
mockEpicData
}
from
'
../mock_data
'
;
...
@@ -216,7 +217,7 @@ describe('Epic Store Actions', () => {
...
@@ -216,7 +217,7 @@ describe('Epic Store Actions', () => {
actions
.
triggerIssuableEvent
({},
data
);
actions
.
triggerIssuableEvent
({},
data
);
expect
(
epicUtils
.
triggerDocumentEvent
).
toHaveBeenCalledWith
(
expect
(
epicUtils
.
triggerDocumentEvent
).
toHaveBeenCalledWith
(
'
issuable_vue_app:change
'
,
EVENT_ISSUABLE_VUE_APP_CHANGE
,
data
.
isEpicOpen
,
data
.
isEpicOpen
,
);
);
...
...
spec/frontend/issue_spec.js
View file @
93cb0599
import
{
getByText
}
from
'
@testing-library/dom
'
;
import
{
getByText
}
from
'
@testing-library/dom
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
Issue
,
{
EVENT_ISSUABLE_VUE_APP_CHANGE
}
from
'
~/issue
'
;
import
{
EVENT_ISSUABLE_VUE_APP_CHANGE
}
from
'
~/issuable/constants
'
;
import
Issue
from
'
~/issue
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
describe
(
'
Issue
'
,
()
=>
{
describe
(
'
Issue
'
,
()
=>
{
...
...
spec/frontend/notes/stores/actions_spec.js
View file @
93cb0599
...
@@ -3,6 +3,7 @@ import testAction from 'helpers/vuex_action_helper';
...
@@ -3,6 +3,7 @@ import testAction from 'helpers/vuex_action_helper';
import
{
TEST_HOST
}
from
'
spec/test_constants
'
;
import
{
TEST_HOST
}
from
'
spec/test_constants
'
;
import
Api
from
'
~/api
'
;
import
Api
from
'
~/api
'
;
import
{
deprecatedCreateFlash
as
Flash
}
from
'
~/flash
'
;
import
{
deprecatedCreateFlash
as
Flash
}
from
'
~/flash
'
;
import
{
EVENT_ISSUABLE_VUE_APP_CHANGE
}
from
'
~/issuable/constants
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
*
as
notesConstants
from
'
~/notes/constants
'
;
import
*
as
notesConstants
from
'
~/notes/constants
'
;
import
createStore
from
'
~/notes/stores
'
;
import
createStore
from
'
~/notes/stores
'
;
...
@@ -202,7 +203,7 @@ describe('Actions Notes Store', () => {
...
@@ -202,7 +203,7 @@ describe('Actions Notes Store', () => {
describe
(
'
emitStateChangedEvent
'
,
()
=>
{
describe
(
'
emitStateChangedEvent
'
,
()
=>
{
it
(
'
emits an event on the document
'
,
()
=>
{
it
(
'
emits an event on the document
'
,
()
=>
{
document
.
addEventListener
(
'
issuable_vue_app:change
'
,
(
event
)
=>
{
document
.
addEventListener
(
EVENT_ISSUABLE_VUE_APP_CHANGE
,
(
event
)
=>
{
expect
(
event
.
detail
.
data
).
toEqual
({
id
:
'
1
'
,
state
:
'
closed
'
});
expect
(
event
.
detail
.
data
).
toEqual
({
id
:
'
1
'
,
state
:
'
closed
'
});
expect
(
event
.
detail
.
isClosed
).
toEqual
(
false
);
expect
(
event
.
detail
.
isClosed
).
toEqual
(
false
);
});
});
...
...
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