Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add confirmation to modal before updating #3038

Merged
merged 4 commits into from
Jan 4, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions resources/js/components/updater/Release.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
</div>
<div v-if="showActions">
<button v-if="release.type === 'current'" class="btn opacity-50" disabled v-text="__('Current Version')" />
<button v-else-if="release.latest" @click="$emit('install')" class="btn" v-text="__('Update to Latest')" />
<button v-else @click="$emit('install')" class="btn">
<button v-else-if="release.latest" @click="confirmationPrompt = release" class="btn" v-text="__('Update to Latest')" />
<button v-else @click="confirmationPrompt = release" class="btn">
<template v-if="release.type === 'upgrade'">{{ __('Update to :version', { version: release.version }) }}</template>
<template v-if="release.type === 'downgrade'">{{ __('Downgrade to :version', { version: release.version }) }}</template>
</button>
Expand All @@ -18,6 +18,17 @@
<div class="card-body">
<div v-html="release.body"></div>
</div>

<confirmation-modal
v-if="confirmationPrompt"
:title="packageName"
:bodyText="__('Are you sure you want to :type to :version?', { type: confirmationPrompt.type, version: confirmationPrompt.version })"
duncanmcclean marked this conversation as resolved.
Show resolved Hide resolved
:buttonText="__('Confirm')"
:danger="true"
@confirm="$emit('install')"
@cancel="confirmationPrompt = null"
>
</confirmation-modal>
</div>

</template>
Expand All @@ -27,8 +38,15 @@ export default {

props: {
release: { type: Object, required: true },
packageName: { type: String, required: true },
showActions: { type: Boolean }
}
},

data() {
return {
confirmationPrompt: null,
}
},

}
</script>
2 changes: 2 additions & 0 deletions resources/js/components/updater/Updater.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
v-for="release in unlicensedReleases"
:key="release.version"
:release="release"
:package-name="name"
:show-actions="showActions"
@install="installExplicitVersion(release.version)"
/>
Expand All @@ -45,6 +46,7 @@
v-for="release in licensedReleases"
:key="release.version"
:release="release"
:package-name="name"
:show-actions="showActions"
@install="installExplicitVersion(release.version)"
/>
Expand Down