Bugzilla – Attachment 146436 Details for
Bug 32925
Display loading info when a form is submitted
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32925: Use a new state for this message
Bug-32925-Use-a-new-state-for-this-message.patch (text/plain), 7.89 KB, created by
Jonathan Druart
on 2023-02-09 15:25:42 UTC
(
hide
)
Description:
Bug 32925: Use a new state for this message
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-02-09 15:25:42 UTC
Size:
7.89 KB
patch
obsolete
>From 64c0aff187c63a18920e8df4c97598a3a5517bdd Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 9 Feb 2023 16:17:09 +0100 >Subject: [PATCH] Bug 32925: Use a new state for this message > >The previous patch didn't work, there is a validation step that make the >form non-accessible after it's greyed out. > >This patch is using a new state is_submitting, like the other messages. >--- > .../prog/js/vue/components/ButtonSubmit.vue | 32 ++----------------- > .../vue/components/ERM/AgreementsFormAdd.vue | 10 +++++- > .../ERM/AgreementsFormConfirmDelete.vue | 6 ++-- > .../prog/js/vue/components/ERM/Dialog.vue | 27 ++++++++++++++-- > .../intranet-tmpl/prog/js/vue/messages.js | 10 ++++++ > .../intranet-tmpl/prog/js/vue/stores/main.js | 7 ++++ > 6 files changed, 57 insertions(+), 35 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ButtonSubmit.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ButtonSubmit.vue >index 87e055e47a8..453344956ce 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ButtonSubmit.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ButtonSubmit.vue >@@ -1,8 +1,5 @@ > <template> >- <input type="submit" variant="primary" :value="text" @click="submitting = true" /> >- <div v-if="submitting" class="modal"> >- <div class="spinner dialog alert">Submitting...</div> >- </div> >+ <input type="submit" variant="primary" :value="text" /> > </template> > > <script> >@@ -14,31 +11,6 @@ export default { > default: __("Submit"), > required: false, > }, >- submitting: { >- type: Boolean, >- default: false, >- required: false, >- }, > }, >-}; >-</script> >- >-<style scoped> >-.modal { >- position: fixed; >- z-index: 9998; >- display: table; >- transition: opacity 0.3s ease; >- left: 0px; >- top: 0px; >- width: 100%; >- height: 100%; >- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33); >-} >-.spinner { >- position: absolute; >- top: 50%; >- left: 40%; >- width: 10% > } >-</style> >\ No newline at end of file >+</script> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue >index 3b138b3d8bc..95c71855e38 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue >@@ -190,7 +190,13 @@ import AgreementLicenses from "./AgreementLicenses.vue" > import AgreementRelationships from "./AgreementRelationships.vue" > import Documents from "./Documents.vue" > import ButtonSubmit from "../ButtonSubmit.vue" >-import { setMessage, setError, setWarning } from "../../messages" >+import { >+ setMessage, >+ setError, >+ setWarning, >+ isSubmitting, >+ submitted, >+} from "../../messages" > import { fetchAgreement } from "../../fetch" > import { storeToRefs } from "pinia" > >@@ -384,6 +390,7 @@ export default { > }, > } > >+ isSubmitting() > fetch(apiUrl, options) > .then(response => { > if (response.status == 200) { >@@ -399,6 +406,7 @@ export default { > .catch(error => { > setError(error) > }) >+ .then(() => submitted()) > }, > onStatusChanged(e) { > if (e.authorised_value != "closed") { >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormConfirmDelete.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormConfirmDelete.vue >index 6e741dccea9..a0bfe6529a7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormConfirmDelete.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormConfirmDelete.vue >@@ -18,7 +18,7 @@ > </ol> > </fieldset> > <fieldset class="action"> >- <ButtonSubmit :text="$__('Yes, delete')"/> >+ <ButtonSubmit :text="$__('Yes, delete')" /> > <router-link > to="/cgi-bin/koha/erm/agreements" > role="button" >@@ -33,7 +33,7 @@ > > <script> > import { fetchAgreement } from "../../fetch" >-import { setMessage, setError } from "../../messages" >+import { setMessage, setError, isSubmitting, submitted } from "../../messages" > import ButtonSubmit from "../ButtonSubmit.vue" > > export default { >@@ -66,6 +66,7 @@ export default { > }, > } > >+ isSubmitting() > fetch(apiUrl, options) > .then(response => { > if (response.status == 204) { >@@ -75,6 +76,7 @@ export default { > setError(response.message || response.statusText) > } > }) >+ .then(() => submitted()) > .catch(error => { > setError(error) > }) >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Dialog.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Dialog.vue >index ae336ce1dd1..2d35277f2b3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Dialog.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Dialog.vue >@@ -12,6 +12,10 @@ > > > </div> > <!-- Must be styled differently --> >+ >+ <div class="modal_centered" v-if="is_submitting"> >+ <div class="spinner dialog alert">{{ $__("Submitting...") }}</div> >+ </div> > </template> > > <script> >@@ -20,9 +24,10 @@ import { storeToRefs } from "pinia" > export default { > setup() { > const mainStore = inject("mainStore") >- const { message, error, warning } = storeToRefs(mainStore) >+ const { message, error, warning, is_submitting } = >+ storeToRefs(mainStore) > const { removeMessages } = mainStore >- return { message, error, warning, removeMessages } >+ return { message, error, warning, is_submitting, removeMessages } > }, > } > </script> >@@ -42,4 +47,22 @@ export default { > float: right; > cursor: pointer; > } >+ >+.modal_centered { >+ position: fixed; >+ z-index: 9998; >+ display: table; >+ transition: opacity 0.3s ease; >+ left: 0px; >+ top: 0px; >+ width: 100%; >+ height: 100%; >+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33); >+} >+.spinner { >+ position: absolute; >+ top: 50%; >+ left: 40%; >+ width: 10%; >+} > </style> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/messages.js b/koha-tmpl/intranet-tmpl/prog/js/vue/messages.js >index 14f8ac2ffa9..7285f31a9fe 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/messages.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/messages.js >@@ -22,3 +22,13 @@ export const removeMessages = function () { > const { removeMessages } = mainStore; > removeMessages(); > }; >+export const isSubmitting = function () { >+ const mainStore = useMainStore(); >+ const { isSubmitting } = mainStore; >+ isSubmitting(); >+}; >+export const submitted = function () { >+ const mainStore = useMainStore(); >+ const { submitted } = mainStore; >+ submitted(); >+}; >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js >index 94311f727f3..54bfe099efd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js >@@ -8,6 +8,7 @@ export const useMainStore = defineStore("main", { > previousMessage: null, > previousError: null, > displayed_already: false, >+ is_submitting: false, > }), > actions: { > setMessage(message) { >@@ -34,5 +35,11 @@ export const useMainStore = defineStore("main", { > } > this.displayed_already = true; > }, >+ isSubmitting(){ >+ this.is_submitting = true; >+ }, >+ submitted(){ >+ this.is_submitting = false; >+ }, > }, > }); >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32925
:
146428
|
146436
|
146469
|
146683
|
146684
|
146685
|
146686
|
146689
|
147045
|
147046
|
147047
|
147048
|
147049
|
147076
|
147077
|
147078
|
147079
|
147080
|
147324
|
147325
|
147326
|
147327
|
147328