Bugzilla – Attachment 147943 Details for
Bug 32991
Improve our Dialog component and remove routes for deletion
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32991: Local Packages: Add delete dialog to list and show. Removed FormConfirmDelete component and routes.
Bug-32991-Local-Packages-Add-delete-dialog-to-list.patch (text/plain), 12.32 KB, created by
Agustín Moyano
on 2023-03-08 14:39:55 UTC
(
hide
)
Description:
Bug 32991: Local Packages: Add delete dialog to list and show. Removed FormConfirmDelete component and routes.
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2023-03-08 14:39:55 UTC
Size:
12.32 KB
patch
obsolete
>From cf6c5ad46f25ad52f7d05d1629305271589b4bdc Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Fri, 24 Feb 2023 18:30:54 +0000 >Subject: [PATCH] Bug 32991: Local Packages: Add delete dialog to list and > show. Removed FormConfirmDelete component and routes. >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> > >Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Signed-off-by: AgustÃn Moyano <agustinmoyano@theke.io> >--- > ...HoldingsLocalPackagesFormConfirmDelete.vue | 76 ------------------- > .../ERM/EHoldingsLocalPackagesList.vue | 43 +++++++++-- > .../ERM/EHoldingsLocalPackagesShow.vue | 42 +++++++++- > .../intranet-tmpl/prog/js/vue/routes/erm.js | 17 ----- > 4 files changed, 76 insertions(+), 102 deletions(-) > delete mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesFormConfirmDelete.vue > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesFormConfirmDelete.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesFormConfirmDelete.vue >deleted file mode 100644 >index 352e18b01d..0000000000 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesFormConfirmDelete.vue >+++ /dev/null >@@ -1,76 +0,0 @@ >-<template> >- <div v-if="!initialized">{{ $__("Loading") }}</div> >- <div v-else id="packages_confirm_delete"> >- <h2>{{ $__("Delete package") }}</h2> >- <div> >- <form @submit="onSubmit($event)"> >- <fieldset class="rows"> >- <ol> >- <li> >- {{ $__("Package name") }}: >- {{ erm_package.name }} >- </li> >- </ol> >- </fieldset> >- <fieldset class="action"> >- <input >- type="submit" >- variant="primary" >- :value="$__('Yes, delete')" >- /> >- <router-link >- to="/cgi-bin/koha/erm/eholdings/local/packages" >- role="button" >- class="cancel" >- >{{ $__("No, do not delete") }}</router-link >- > >- </fieldset> >- </form> >- </div> >- </div> >-</template> >- >-<script> >-import { setMessage, setError } from "../../messages" >-import { APIClient } from "../../fetch/api-client.js" >- >-export default { >- data() { >- return { >- erm_package: {}, >- initialized: false, >- } >- }, >- beforeRouteEnter(to, from, next) { >- next(vm => { >- vm.getPackage(to.params.package_id) >- }) >- }, >- methods: { >- getPackage(package_id) { >- const client = APIClient.erm >- client.localPackages.get(package_id).then( >- erm_package => { >- this.erm_package = erm_package >- this.initialized = true >- }, >- error => {} >- ) >- }, >- onSubmit(e) { >- e.preventDefault() >- const client = APIClient.erm >- client.localPackages.delete(this.erm_package.package_id).then( >- success => { >- setMessage(this.$__("Package deleted")) >- this.$router.push( >- "/cgi-bin/koha/erm/eholdings/local/packages" >- ) >- }, >- error => {} >- ) >- }, >- }, >- name: "EHoldingsLocalPackagesFormConfirmDelete", >-} >-</script> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesList.vue >index 348edf92df..24871fc973 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesList.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesList.vue >@@ -32,6 +32,8 @@ export default { > const AVStore = inject("AVStore") > const { get_lib_from_av, map_av_dt_filter } = AVStore > >+ const { setConfirmationDialog, setMessage } = inject("mainStore") >+ > const table_id = "package_list" > useDataTable(table_id) > >@@ -40,6 +42,8 @@ export default { > get_lib_from_av, > map_av_dt_filter, > table_id, >+ setConfirmationDialog, >+ setMessage, > } > }, > data: function () { >@@ -78,10 +82,35 @@ export default { > "/cgi-bin/koha/erm/eholdings/local/packages/edit/" + package_id > ) > }, >- delete_package: function (package_id) { >- this.$router.push( >- "/cgi-bin/koha/erm/eholdings/local/packages/delete/" + >- package_id >+ delete_package: function (package_id, package_name) { >+ this.setConfirmationDialog( >+ { >+ title: this.$__( >+ "Are you sure you want to remove this package?" >+ ), >+ message: package_name, >+ accept_label: this.$__("Yes, delete"), >+ cancel_label: this.$__("No, do not delete"), >+ }, >+ () => { >+ const client = APIClient.erm >+ client.localPackages.delete(package_id).then( >+ success => { >+ this.setMessage( >+ this.$__("Local package %s deleted").format( >+ package_name >+ ) >+ ) >+ $("#" + this.table_id) >+ .DataTable() >+ .ajax.url( >+ "/api/v1/erm/eholdings/local/packages" >+ ) >+ .draw() >+ }, >+ error => {} >+ ) >+ } > ) > }, > build_datatable: function () { >@@ -205,6 +234,7 @@ export default { > function (index, e) { > let tr = $(this).parent().parent() > let package_id = api.row(tr).data().package_id >+ let package_name = api.row(tr).data().name > let editButton = createVNode( > "a", > { >@@ -229,7 +259,10 @@ export default { > class: "btn btn-default btn-xs", > role: "button", > onClick: () => { >- delete_package(package_id) >+ delete_package( >+ package_id, >+ package_name >+ ) > }, > }, > [ >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesShow.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesShow.vue >index f0bdd27108..65ea981073 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesShow.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesShow.vue >@@ -10,11 +10,12 @@ > ><i class="fa fa-pencil"></i > ></router-link> > >- <router-link >- :to="`/cgi-bin/koha/erm/eholdings/local/packages/delete/${erm_package.package_id}`" >- :title="$__('Delete')" >+ <a >+ @click=" >+ delete_package(erm_package.package_id, erm_package.name) >+ " > ><i class="fa fa-trash"></i >- ></router-link> >+ ></a> > </span> > </h2> > <div> >@@ -112,12 +113,16 @@ export default { > setup() { > const format_date = $date > >+ const { setConfirmationDialog, setMessage } = inject("mainStore") >+ > const AVStore = inject("AVStore") > const { get_lib_from_av } = AVStore > > return { > format_date, > get_lib_from_av, >+ setConfirmationDialog, >+ setMessage, > } > }, > data() { >@@ -155,6 +160,34 @@ export default { > error => {} > ) > }, >+ delete_package: function (package_id, package_name) { >+ this.setConfirmationDialog( >+ { >+ title: this.$__( >+ "Are you sure you want to remove this package?" >+ ), >+ message: package_name, >+ accept_label: this.$__("Yes, delete"), >+ cancel_label: this.$__("No, do not delete"), >+ }, >+ () => { >+ const client = APIClient.erm >+ client.localPackages.delete(package_id).then( >+ success => { >+ this.setMessage( >+ this.$__("Local package %s deleted").format( >+ package_name >+ ) >+ ) >+ this.$router.push( >+ "/cgi-bin/koha/erm/eholdings/local/packages" >+ ) >+ }, >+ error => {} >+ ) >+ } >+ ) >+ }, > }, > components: { > EHoldingsPackageTitlesList, >@@ -166,6 +199,7 @@ export default { > .action_links a { > padding-left: 0.2em; > font-size: 11px; >+ cursor: pointer; > } > fieldset.rows label { > width: 25rem; >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js b/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js >index dd84078ea5..127e910f6d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js >@@ -8,7 +8,6 @@ import EHoldingsLocalTitlesFormAdd from "../components/ERM/EHoldingsLocalTitlesF > import EHoldingsLocalTitlesFormImport from "../components/ERM/EHoldingsLocalTitlesFormImport.vue"; > import EHoldingsLocalPackagesList from "../components/ERM/EHoldingsLocalPackagesList.vue"; > import EHoldingsLocalPackagesShow from "../components/ERM/EHoldingsLocalPackagesShow.vue"; >-import EHoldingsLocalPackagesFormConfirmDelete from "../components/ERM/EHoldingsLocalPackagesFormConfirmDelete.vue"; > import EHoldingsLocalResourcesShow from "../components/ERM/EHoldingsLocalResourcesShow.vue"; > import EHoldingsLocalTitlesList from "../components/ERM/EHoldingsLocalTitlesList.vue"; > import EHoldingsLocalTitlesShow from "../components/ERM/EHoldingsLocalTitlesShow.vue"; >@@ -236,22 +235,6 @@ export const routes = [ > ), > }, > }, >- { >- path: "delete/:package_id", >- component: >- EHoldingsLocalPackagesFormConfirmDelete, >- meta: { >- breadcrumb: () => >- build_breadcrumb( >- [ >- breadcrumb_paths.eholdings_local, >- breadcrumbs.eholdings.local >- .packages, >- ], >- "Delete package" // $t("Delete package") >- ), >- }, >- }, > { > path: "add", > component: EHoldingsLocalPackagesFormAdd, >-- >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 32991
:
146828
|
146829
|
147051
|
147052
|
147053
|
147054
|
147082
|
147083
|
147281
|
147282
|
147291
|
147305
|
147350
|
147383
|
147384
|
147385
|
147387
|
147388
|
147389
|
147390
|
147391
|
147392
|
147393
|
147394
|
147429
|
147439
|
147445
|
147447
|
147448
|
147449
|
147450
|
147451
|
147452
|
147453
|
147454
|
147455
|
147456
|
147461
|
147483
|
147485
|
147486
|
147487
|
147542
|
147543
|
147544
|
147545
|
147546
|
147547
|
147548
|
147549
|
147550
|
147551
|
147552
|
147553
|
147554
|
147569
|
147573
|
147584
|
147588
|
147589
|
147590
|
147591
|
147592
|
147593
|
147594
|
147595
|
147596
|
147597
|
147598
|
147599
|
147600
|
147601
|
147602
|
147603
|
147604
|
147937
|
147938
|
147939
|
147940
|
147941
|
147942
| 147943 |
147944
|
147945
|
147946
|
147947
|
147948
|
147949
|
147950
|
147951