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
f3136e25
Commit
f3136e25
authored
Nov 01, 2021
by
Ezekiel Kigbo
Committed by
Phil Hughes
Nov 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add confirm modal stories to vue shared
parent
980005f6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
7 deletions
+50
-7
app/assets/javascripts/vue_shared/components/confirm_danger/confirm_danger_modal.stories.js
...components/confirm_danger/confirm_danger_modal.stories.js
+28
-0
app/assets/javascripts/vue_shared/components/confirm_danger/confirm_danger_modal.vue
...shared/components/confirm_danger/confirm_danger_modal.vue
+21
-7
app/assets/javascripts/vue_shared/components/confirm_danger/constants.js
...scripts/vue_shared/components/confirm_danger/constants.js
+1
-0
No files found.
app/assets/javascripts/vue_shared/components/confirm_danger/confirm_danger_modal.stories.js
0 → 100644
View file @
f3136e25
/* eslint-disable @gitlab/require-i18n-strings */
import
ConfirmDanger
from
'
./confirm_danger.vue
'
;
export
default
{
component
:
ConfirmDanger
,
title
:
'
vue_shared/components/modals/confirm_danger_modal
'
,
};
const
Template
=
(
args
,
{
argTypes
})
=>
({
components
:
{
ConfirmDanger
},
props
:
Object
.
keys
(
argTypes
),
template
:
'
<confirm-danger v-bind="$props" />
'
,
provide
:
{
confirmDangerMessage
:
'
You require more Vespene Gas
'
,
},
});
export
const
Default
=
Template
.
bind
({});
Default
.
args
=
{
phrase
:
'
You must construct additional pylons
'
,
buttonText
:
'
Confirm button text
'
,
};
export
const
Disabled
=
Template
.
bind
({});
Disabled
.
args
=
{
...
Default
.
args
,
disabled
:
true
,
};
app/assets/javascripts/vue_shared/components/confirm_danger/confirm_danger_modal.vue
View file @
f3136e25
<
script
>
import
{
GlModal
,
GlFormGroup
,
GlFormInput
,
GlSprintf
}
from
'
@gitlab/ui
'
;
import
{
Gl
Alert
,
Gl
Modal
,
GlFormGroup
,
GlFormInput
,
GlSprintf
}
from
'
@gitlab/ui
'
;
import
{
CONFIRM_DANGER_MODAL_BUTTON
,
CONFIRM_DANGER_MODAL_TITLE
,
CONFIRM_DANGER_PHRASE_TEXT
,
CONFIRM_DANGER_WARNING
,
CONFIRM_DANGER_MODAL_ERROR
,
}
from
'
./constants
'
;
export
default
{
name
:
'
ConfirmDangerModal
'
,
components
:
{
GlAlert
,
GlModal
,
GlFormGroup
,
GlFormInput
,
...
...
@@ -38,8 +40,8 @@ export default {
},
computed
:
{
isValid
()
{
return
(
this
.
confirmationPhrase
.
length
&&
this
.
equalString
(
this
.
confirmationPhrase
,
this
.
phrase
)
return
Boolean
(
this
.
confirmationPhrase
.
length
&&
this
.
equalString
(
this
.
confirmationPhrase
,
this
.
phrase
)
,
);
},
actionPrimary
()
{
...
...
@@ -59,6 +61,7 @@ export default {
CONFIRM_DANGER_MODAL_TITLE
,
CONFIRM_DANGER_WARNING
,
CONFIRM_DANGER_PHRASE_TEXT
,
CONFIRM_DANGER_MODAL_ERROR
,
},
};
</
script
>
...
...
@@ -71,9 +74,15 @@ export default {
:action-primary=
"actionPrimary"
@
primary=
"$emit('confirm')"
>
<p
v-if=
"confirmDangerMessage"
class=
"text-danger"
data-testid=
"confirm-danger-message"
>
<gl-alert
v-if=
"confirmDangerMessage"
variant=
"danger"
data-testid=
"confirm-danger-message"
:dismissible=
"false"
class=
"gl-mb-4"
>
{{
confirmDangerMessage
}}
</
p
>
</
gl-alert
>
<p
data-testid=
"confirm-danger-warning"
>
{{
$options
.
i18n
.
CONFIRM_DANGER_WARNING
}}
</p>
<p
data-testid=
"confirm-danger-phrase"
>
<gl-sprintf
:message=
"$options.i18n.CONFIRM_DANGER_PHRASE_TEXT"
>
...
...
@@ -82,8 +91,13 @@ export default {
</
template
>
</gl-sprintf>
</p>
<gl-form-group
class=
"form-control"
:state=
"isValid"
>
<gl-form-input
v-model=
"confirmationPhrase"
data-testid=
"confirm-danger-input"
type=
"text"
/>
<gl-form-group
:state=
"isValid"
:invalid-feedback=
"$options.i18n.CONFIRM_DANGER_MODAL_ERROR"
>
<gl-form-input
v-model=
"confirmationPhrase"
class=
"form-control"
data-testid=
"confirm-danger-input"
type=
"text"
/>
</gl-form-group>
</gl-modal>
</template>
app/assets/javascripts/vue_shared/components/confirm_danger/constants.js
View file @
f3136e25
...
...
@@ -2,6 +2,7 @@ import { __ } from '~/locale';
export
const
CONFIRM_DANGER_MODAL_ID
=
'
confirm-danger-modal
'
;
export
const
CONFIRM_DANGER_MODAL_TITLE
=
__
(
'
Confirmation required
'
);
export
const
CONFIRM_DANGER_MODAL_ERROR
=
__
(
'
Confirmation required
'
);
export
const
CONFIRM_DANGER_MODAL_BUTTON
=
__
(
'
Confirm
'
);
export
const
CONFIRM_DANGER_WARNING
=
__
(
'
This action can lead to data loss. To prevent accidental actions we ask you to confirm your intention.
'
,
...
...
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