From c73bc0bed1552effc2fc539b829417d92dd186ec Mon Sep 17 00:00:00 2001 From: Andrej Date: Tue, 9 Jan 2024 16:53:46 +0100 Subject: [PATCH] Fix loading of non-repository tables on item cards changes [SCI-9970] --- app/assets/javascripts/sitewide/repository_row_card.js | 2 +- .../item_relationships/RepositoryItemRelationshipsModal.vue | 2 +- .../vue/repository_item_sidebar/RepositoryItemSidebar.vue | 4 ++-- .../vue/repository_item_sidebar/mixins/date_time_range.js | 2 +- .../repository_values/RepositoryAssetValue.vue | 2 +- .../repository_values/date_time_component.vue | 6 +++--- app/views/my_modules/repositories/_full_view_table.html.erb | 2 +- .../my_modules/repositories/_repositories_list.html.erb | 2 +- app/views/repositories/_repository_table.html.erb | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/assets/javascripts/sitewide/repository_row_card.js b/app/assets/javascripts/sitewide/repository_row_card.js index 0fdb8c3f6..837133903 100644 --- a/app/assets/javascripts/sitewide/repository_row_card.js +++ b/app/assets/javascripts/sitewide/repository_row_card.js @@ -93,7 +93,7 @@ updateCallback = (data) => { if (!data?.value) return; // reload dataTable - if ($('.dataTable')[0]) $('.dataTable').DataTable().ajax.reload(null, false); + if ($('.dataTable.repository-dataTable')[0]) $('.dataTable.repository-dataTable').DataTable().ajax.reload(null, false); // update item card stock column window.manageStockCallback && window.manageStockCallback(data.value); $link.data('manageStockUrl', data.value.stock_url) diff --git a/app/javascript/vue/item_relationships/RepositoryItemRelationshipsModal.vue b/app/javascript/vue/item_relationships/RepositoryItemRelationshipsModal.vue index 47ec945fd..5da40250c 100644 --- a/app/javascript/vue/item_relationships/RepositoryItemRelationshipsModal.vue +++ b/app/javascript/vue/item_relationships/RepositoryItemRelationshipsModal.vue @@ -270,7 +270,7 @@ export default { }, success: (result) => { $this.addRelationCallback(result, relation); - if ($('.dataTable')[0]) $('.dataTable').DataTable().ajax.reload(null, false); + if ($('.dataTable.repository-dataTable')[0]) $('.dataTable.repository-dataTable').DataTable().ajax.reload(null, false); } }); this.close(); diff --git a/app/javascript/vue/repository_item_sidebar/RepositoryItemSidebar.vue b/app/javascript/vue/repository_item_sidebar/RepositoryItemSidebar.vue index 0a8b2744a..219fccba7 100644 --- a/app/javascript/vue/repository_item_sidebar/RepositoryItemSidebar.vue +++ b/app/javascript/vue/repository_item_sidebar/RepositoryItemSidebar.vue @@ -544,7 +544,7 @@ export default { }).done((response) => { if (response) { this.customColumns = this.customColumns.map((col) => (col.id === response.id ? { ...col, ...response } : col)); - if ($('.dataTable')[0]) $('.dataTable').DataTable().ajax.reload(null, false); + if ($('.dataTable.repository-dataTable')[0]) $('.dataTable.repository-dataTable').DataTable().ajax.reload(null, false); } }); }, @@ -560,7 +560,7 @@ export default { async unlinkItem() { await axios.delete(this.selectedToUnlink.unlink_path); this.loadRepositoryRow(this.currentItemUrl); - if ($('.dataTable')[0]) $('.dataTable').DataTable().ajax.reload(null, false); + if ($('.dataTable.repository-dataTable')[0]) $('.dataTable.repository-dataTable').DataTable().ajax.reload(null, false); this.selectedToUnlink = null; } } diff --git a/app/javascript/vue/repository_item_sidebar/mixins/date_time_range.js b/app/javascript/vue/repository_item_sidebar/mixins/date_time_range.js index e11c92302..54783689f 100644 --- a/app/javascript/vue/repository_item_sidebar/mixins/date_time_range.js +++ b/app/javascript/vue/repository_item_sidebar/mixins/date_time_range.js @@ -74,7 +74,7 @@ export default { break; } Object.assign($this.$data, { isEditing: false, isSaving: false, values: result?.value }); - if ($('.dataTable')[0]) $('.dataTable').DataTable().ajax.reload(null, false); + if ($('.dataTable.repository-dataTable')[0]) $('.dataTable.repository-dataTable').DataTable().ajax.reload(null, false); } }); }, diff --git a/app/javascript/vue/repository_item_sidebar/repository_values/RepositoryAssetValue.vue b/app/javascript/vue/repository_item_sidebar/repository_values/RepositoryAssetValue.vue index f69f8cc81..4cc769ba7 100644 --- a/app/javascript/vue/repository_item_sidebar/repository_values/RepositoryAssetValue.vue +++ b/app/javascript/vue/repository_item_sidebar/repository_values/RepositoryAssetValue.vue @@ -166,7 +166,7 @@ export default { } else { this.file_name = ''; } - if ($('.dataTable')[0]) $('.dataTable').DataTable().ajax.reload(null, false); + if ($('.dataTable.repository-dataTable')[0]) $('.dataTable.repository-dataTable').DataTable().ajax.reload(null, false); }, error: () => { this.error = I18n.t('repositories.item_card.repository_asset_value.errors.upload_failed_general'); diff --git a/app/javascript/vue/repository_item_sidebar/repository_values/date_time_component.vue b/app/javascript/vue/repository_item_sidebar/repository_values/date_time_component.vue index 342b947b0..15a4cfae2 100644 --- a/app/javascript/vue/repository_item_sidebar/repository_values/date_time_component.vue +++ b/app/javascript/vue/repository_item_sidebar/repository_values/date_time_component.vue @@ -186,10 +186,10 @@ export default { success: () => { this.defaultStartDate = this.startDate; this.defaultEndDate = this.endDate; - if ($('.dataTable')[0]) { - $('.dataTable').DataTable().ajax.reload(null, false); - this.reloadRepoItemSidebar(); + if ($('.dataTable.repository-dataTable')[0]) { + $('.dataTable.repository-dataTable').DataTable().ajax.reload(null, false); } + this.reloadRepoItemSidebar(); } }); }, diff --git a/app/views/my_modules/repositories/_full_view_table.html.erb b/app/views/my_modules/repositories/_full_view_table.html.erb index 104e457ab..80228c763 100644 --- a/app/views/my_modules/repositories/_full_view_table.html.erb +++ b/app/views/my_modules/repositories/_full_view_table.html.erb @@ -1,4 +1,4 @@ - -
diff --git a/app/views/repositories/_repository_table.html.erb b/app/views/repositories/_repository_table.html.erb index fc01250a8..59ec696d5 100644 --- a/app/views/repositories/_repository_table.html.erb +++ b/app/views/repositories/_repository_table.html.erb @@ -1,6 +1,6 @@
-