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
18dcb756
Commit
18dcb756
authored
Oct 06, 2020
by
Amelia Bauerly
Committed by
Jose Ivan Vargas
Oct 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate DeprecatedModal to GitLab UI Modal
parent
d50d8d25
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
53 deletions
+45
-53
app/assets/javascripts/pages/milestones/shared/components/delete_milestone_modal.vue
...s/milestones/shared/components/delete_milestone_modal.vue
+17
-14
app/assets/javascripts/pages/milestones/shared/delete_milestone_modal_init.js
...ts/pages/milestones/shared/delete_milestone_modal_init.js
+20
-34
app/views/projects/milestones/index.html.haml
app/views/projects/milestones/index.html.haml
+1
-1
app/views/shared/milestones/_delete_button.html.haml
app/views/shared/milestones/_delete_button.html.haml
+2
-4
changelogs/unreleased/Migrate-deprecated-delete-milestone-modal-ab.yml
...released/Migrate-deprecated-delete-milestone-modal-ab.yml
+5
-0
No files found.
app/assets/javascripts/pages/milestones/shared/components/delete_milestone_modal.vue
View file @
18dcb756
<
script
>
<
script
>
import
{
GlSafeHtmlDirective
as
SafeHtml
}
from
'
@gitlab/ui
'
;
import
{
GlSafeHtmlDirective
as
SafeHtml
,
GlModal
}
from
'
@gitlab/ui
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
deprecatedCreateFlash
as
Flash
}
from
'
~/flash
'
;
import
{
deprecatedCreateFlash
as
Flash
}
from
'
~/flash
'
;
import
DeprecatedModal
from
'
~/vue_shared/components/deprecated_modal.vue
'
;
import
{
__
,
n__
,
s__
,
sprintf
}
from
'
~/locale
'
;
import
{
n__
,
s__
,
sprintf
}
from
'
~/locale
'
;
import
{
redirectTo
}
from
'
~/lib/utils/url_utility
'
;
import
{
redirectTo
}
from
'
~/lib/utils/url_utility
'
;
import
eventHub
from
'
../event_hub
'
;
import
eventHub
from
'
../event_hub
'
;
export
default
{
export
default
{
components
:
{
components
:
{
Deprecated
Modal
,
Gl
Modal
,
},
},
directives
:
{
directives
:
{
SafeHtml
,
SafeHtml
,
...
@@ -115,20 +114,24 @@ Once deleted, it cannot be undone or recovered.`),
...
@@ -115,20 +114,24 @@ Once deleted, it cannot be undone or recovered.`),
});
});
},
},
},
},
primaryProps
:
{
text
:
s__
(
'
Milestones|Delete milestone
'
),
attributes
:
[{
variant
:
'
danger
'
},
{
category
:
'
primary
'
}],
},
cancelProps
:
{
text
:
__
(
'
Cancel
'
),
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
<
deprecated
-modal
<
gl
-modal
id=
"delete-milestone-modal"
modal-
id=
"delete-milestone-modal"
:title=
"title"
:title=
"title"
:text=
"text"
:action-primary=
"$options.primaryProps"
:primary-button-label=
"s__('Milestones|Delete milestone')"
:action-cancel=
"$options.cancelProps"
kind=
"danger"
@
primary=
"onSubmit"
@
submit=
"onSubmit"
>
>
<template
#body
="
props
"
>
<p
v-safe-html=
"text"
></p>
<p
v-safe-html=
"props.text"
></p>
</gl-modal>
</
template
>
</deprecated-modal>
</
template
>
</
template
>
app/assets/javascripts/pages/milestones/shared/delete_milestone_modal_init.js
View file @
18dcb756
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
import
d
eleteMilestoneModal
from
'
./components/delete_milestone_modal.vue
'
;
import
D
eleteMilestoneModal
from
'
./components/delete_milestone_modal.vue
'
;
import
eventHub
from
'
./event_hub
'
;
import
eventHub
from
'
./event_hub
'
;
export
default
()
=>
{
export
default
()
=>
{
...
@@ -18,6 +18,8 @@ export default () => {
...
@@ -18,6 +18,8 @@ export default () => {
button
.
querySelector
(
'
.js-loading-icon
'
).
classList
.
add
(
'
hidden
'
);
button
.
querySelector
(
'
.js-loading-icon
'
).
classList
.
add
(
'
hidden
'
);
};
};
const
deleteMilestoneButtons
=
document
.
querySelectorAll
(
'
.js-delete-milestone-button
'
);
const
onRequestStarted
=
milestoneUrl
=>
{
const
onRequestStarted
=
milestoneUrl
=>
{
const
button
=
document
.
querySelector
(
const
button
=
document
.
querySelector
(
`.js-delete-milestone-button[data-milestone-url="
${
milestoneUrl
}
"]`
,
`.js-delete-milestone-button[data-milestone-url="
${
milestoneUrl
}
"]`
,
...
@@ -27,35 +29,8 @@ export default () => {
...
@@ -27,35 +29,8 @@ export default () => {
eventHub
.
$once
(
'
deleteMilestoneModal.requestFinished
'
,
onRequestFinished
);
eventHub
.
$once
(
'
deleteMilestoneModal.requestFinished
'
,
onRequestFinished
);
};
};
const
onDeleteButtonClick
=
event
=>
{
const
button
=
event
.
currentTarget
;
const
modalProps
=
{
milestoneId
:
parseInt
(
button
.
dataset
.
milestoneId
,
10
),
milestoneTitle
:
button
.
dataset
.
milestoneTitle
,
milestoneUrl
:
button
.
dataset
.
milestoneUrl
,
issueCount
:
parseInt
(
button
.
dataset
.
milestoneIssueCount
,
10
),
mergeRequestCount
:
parseInt
(
button
.
dataset
.
milestoneMergeRequestCount
,
10
),
};
eventHub
.
$once
(
'
deleteMilestoneModal.requestStarted
'
,
onRequestStarted
);
eventHub
.
$emit
(
'
deleteMilestoneModal.props
'
,
modalProps
);
};
const
deleteMilestoneButtons
=
document
.
querySelectorAll
(
'
.js-delete-milestone-button
'
);
deleteMilestoneButtons
.
forEach
(
button
=>
{
button
.
addEventListener
(
'
click
'
,
onDeleteButtonClick
);
});
eventHub
.
$once
(
'
deleteMilestoneModal.mounted
'
,
()
=>
{
deleteMilestoneButtons
.
forEach
(
button
=>
{
button
.
removeAttribute
(
'
disabled
'
);
});
});
return
new
Vue
({
return
new
Vue
({
el
:
'
#delete-milestone-modal
'
,
el
:
'
#js-delete-milestone-modal
'
,
components
:
{
deleteMilestoneModal
,
},
data
()
{
data
()
{
return
{
return
{
modalProps
:
{
modalProps
:
{
...
@@ -69,10 +44,21 @@ export default () => {
...
@@ -69,10 +44,21 @@ export default () => {
},
},
mounted
()
{
mounted
()
{
eventHub
.
$on
(
'
deleteMilestoneModal.props
'
,
this
.
setModalProps
);
eventHub
.
$on
(
'
deleteMilestoneModal.props
'
,
this
.
setModalProps
);
eventHub
.
$emit
(
'
deleteMilestoneModal.mounted
'
);
deleteMilestoneButtons
.
forEach
(
button
=>
{
},
button
.
removeAttribute
(
'
disabled
'
);
beforeDestroy
()
{
button
.
addEventListener
(
'
click
'
,
()
=>
{
eventHub
.
$off
(
'
deleteMilestoneModal.props
'
,
this
.
setModalProps
);
this
.
$root
.
$emit
(
'
bv::show::modal
'
,
'
delete-milestone-modal
'
);
eventHub
.
$once
(
'
deleteMilestoneModal.requestStarted
'
,
onRequestStarted
);
this
.
setModalProps
({
milestoneId
:
parseInt
(
button
.
dataset
.
milestoneId
,
10
),
milestoneTitle
:
button
.
dataset
.
milestoneTitle
,
milestoneUrl
:
button
.
dataset
.
milestoneUrl
,
issueCount
:
parseInt
(
button
.
dataset
.
milestoneIssueCount
,
10
),
mergeRequestCount
:
parseInt
(
button
.
dataset
.
milestoneMergeRequestCount
,
10
),
});
});
});
},
},
methods
:
{
methods
:
{
setModalProps
(
modalProps
)
{
setModalProps
(
modalProps
)
{
...
@@ -80,7 +66,7 @@ export default () => {
...
@@ -80,7 +66,7 @@ export default () => {
},
},
},
},
render
(
createElement
)
{
render
(
createElement
)
{
return
createElement
(
d
eleteMilestoneModal
,
{
return
createElement
(
D
eleteMilestoneModal
,
{
props
:
this
.
modalProps
,
props
:
this
.
modalProps
,
});
});
},
},
...
...
app/views/projects/milestones/index.html.haml
View file @
18dcb756
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
=
_
(
'New milestone'
)
=
_
(
'New milestone'
)
.milestones
.milestones
#delete-milestone-modal
#
js-
delete-milestone-modal
#promote-milestone-modal
#promote-milestone-modal
%ul
.content-list
%ul
.content-list
...
...
app/views/shared/milestones/_delete_button.html.haml
View file @
18dcb756
-
milestone_url
=
@milestone
.
project_milestone?
?
project_milestone_path
(
@project
,
@milestone
)
:
group_milestone_path
(
@group
,
@milestone
)
-
milestone_url
=
@milestone
.
project_milestone?
?
project_milestone_path
(
@project
,
@milestone
)
:
group_milestone_path
(
@group
,
@milestone
)
%button
.js-delete-milestone-button.btn.btn-grouped.btn-danger
{
data:
{
toggle:
'modal'
,
%button
.js-delete-milestone-button.btn.btn-grouped.btn-danger
{
data:
{
milestone_id:
@milestone
.
id
,
target:
'#delete-milestone-modal'
,
milestone_id:
@milestone
.
id
,
milestone_title:
markdown_field
(
@milestone
,
:title
),
milestone_title:
markdown_field
(
@milestone
,
:title
),
milestone_url:
milestone_url
,
milestone_url:
milestone_url
,
milestone_issue_count:
@milestone
.
issues
.
count
,
milestone_issue_count:
@milestone
.
issues
.
count
,
...
@@ -11,4 +9,4 @@
...
@@ -11,4 +9,4 @@
=
_
(
'Delete'
)
=
_
(
'Delete'
)
.spinner.js-loading-icon.hidden
.spinner.js-loading-icon.hidden
#delete-milestone-modal
#
js-
delete-milestone-modal
changelogs/unreleased/Migrate-deprecated-delete-milestone-modal-ab.yml
0 → 100644
View file @
18dcb756
---
title
:
Migrate DeprecatedModal to GitLab UI Modal
merge_request
:
42113
author
:
type
:
changed
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