From 481da3b1a945dfb5c74ad81cacc2f0e8e71ee39d Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Fri, 9 Oct 2020 14:38:54 +0300 Subject: [PATCH] Docs Module: Merge "Remove from cache" & "Delete from database" buttons resolves https://github.com/abpframework/abp/issues/5751 --- .../Documents/IDocumentAdminAppService.cs | 2 -- .../Docs/ApplicationContracts/ar.json | 3 +-- .../Docs/ApplicationContracts/cs.json | 1 - .../Docs/ApplicationContracts/en.json | 1 - .../Docs/ApplicationContracts/tr.json | 3 +-- .../Documents/DocumentAdminAppService.cs | 11 +--------- .../Docs/Admin/DocumentsAdminController.cs | 7 ------- .../Pages/Docs/Admin/Documents/index.js | 21 +------------------ 8 files changed, 4 insertions(+), 45 deletions(-) diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/IDocumentAdminAppService.cs b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/IDocumentAdminAppService.cs index 01c15f0eee2..0770ec5d722 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/IDocumentAdminAppService.cs +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/IDocumentAdminAppService.cs @@ -19,7 +19,5 @@ public interface IDocumentAdminAppService : IApplicationService Task RemoveFromCacheAsync(Guid documentId); Task ReindexAsync(Guid documentId); - - Task DeleteFromDatabaseAsync(Guid documentId); } } diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/ar.json b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/ar.json index 3d22afabe9c..4849da66e5d 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/ar.json +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/ar.json @@ -43,7 +43,6 @@ "RemovedFromCache": "تم الحذف من ذاكرة التخزين", "RemoveFromCacheConfirmation": "هل أنت متأكد من حذف هذا العنصر من ذاكرة التخزين؟", "ReIndexDocumentConfirmation": "هل أنت متأكد من إعادة فهرسة هذا العنصر؟", - "DeleteDocumentFromDbConfirmation": "هل أنت متأكد من حذف هذا العنصر من قاعدة البيانات؟", "DeleteFromDatabase": "حذف من قاعدة البيانات", "Deleted": "محذوف", "Search": "بحث", @@ -57,4 +56,4 @@ "FileName": "اسم الملف", "LastCachedTime": "وقت ذاكرة التخزين" } -} \ No newline at end of file +} diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/cs.json b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/cs.json index f02fa96f50a..fa65dc8a726 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/cs.json +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/cs.json @@ -43,7 +43,6 @@ "RemovedFromCache": "Odebráno z mezipaměti", "RemoveFromCacheConfirmation": "Opravdu chcete tuto položku odebrat z mezipaměti?", "ReIndexDocumentConfirmation": "Opravdu chcete tuto položku reindexovat?", - "DeleteDocumentFromDbConfirmation": "Opravdu chcete tuto položku odstranit z databáze?", "DeleteFromDatabase": "Odstranit z databáze", "Deleted": "Vymazáno", "Search": "Vyhledávání", diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/en.json b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/en.json index 8b940df86de..2b1571c0b93 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/en.json +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/en.json @@ -43,7 +43,6 @@ "RemovedFromCache": "Removed from cache", "RemoveFromCacheConfirmation": "Are you sure you want to remove this item from cache?", "ReIndexDocumentConfirmation": "Are you sure you want to reindex this item?", - "DeleteDocumentFromDbConfirmation": "Are you sure you want to delete this item from database?", "DeleteFromDatabase": "Delete from database", "Deleted": "Deleted", "Search": "Search", diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/tr.json b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/tr.json index 319a9010045..530283c91d0 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/tr.json +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/tr.json @@ -41,8 +41,7 @@ "RemovedFromCache": "Önbellekten kaldırıldı", "RemoveFromCacheConfirmation": "Bu maddeyi önbellekten kaldırmak istediğiniz emin misiniz?", "ReIndexDocumentConfirmation": "Bu maddeyi yeniden indekslemek istediğinize emin misiniz?", - "DeleteDocumentFromDbConfirmation": "Bu maddeyi veritabanından silmek istediğinize emin misiniz?", "DeleteFromDatabase": "Veritabanından sil", "Deleted": "Silindi" } -} \ No newline at end of file +} diff --git a/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Documents/DocumentAdminAppService.cs b/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Documents/DocumentAdminAppService.cs index c6758127cfe..4f1a493a2b6 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Documents/DocumentAdminAppService.cs +++ b/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Documents/DocumentAdminAppService.cs @@ -205,10 +205,7 @@ public async Task RemoveFromCacheAsync(Guid documentId) ); await _documentUpdateCache.RemoveAsync(documentUpdateInfoCacheKey); - - document.LastCachedTime = DateTime.MinValue; - - await _documentRepository.UpdateAsync(document); + await _documentRepository.DeleteAsync(document); } public async Task ReindexAsync(Guid documentId) @@ -218,12 +215,6 @@ public async Task ReindexAsync(Guid documentId) await _documentFullSearch.AddOrUpdateAsync(document); } - public async Task DeleteFromDatabaseAsync(Guid documentId) - { - var document = await _documentRepository.GetAsync(documentId); - await _documentRepository.DeleteAsync(document); - } - private async Task UpdateDocumentUpdateInfoCache(Document document) { var cacheKey = $"DocumentUpdateInfo{document.ProjectId}#{document.Name}#{document.LanguageCode}#{document.Version}"; diff --git a/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/DocumentsAdminController.cs b/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/DocumentsAdminController.cs index ff143bfdb08..99c3060f5de 100644 --- a/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/DocumentsAdminController.cs +++ b/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/DocumentsAdminController.cs @@ -63,12 +63,5 @@ public async Task ReindexAsync(Guid documentId) { await _documentAdminAppService.ReindexAsync(documentId); } - - [HttpDelete] - [Route("DeleteDocumentFromDatabase")] - public async Task DeleteFromDatabaseAsync(Guid documentId) - { - await _documentAdminAppService.DeleteFromDatabaseAsync(documentId); - } } } diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js index 3f0f30270fa..23203a23f5d 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js @@ -80,26 +80,7 @@ dataTable.ajax.reload(); }); }, - }, - { - text: l('DeleteFromDatabase'), - visible: abp.auth.isGranted( - 'Docs.Admin.Documents' - ), - confirmMessage: function (data) { - return l( - 'DeleteDocumentFromDbConfirmation' - ); - }, - action: function (data) { - service - .deleteFromDatabase(data.record.id) - .then(function () { - abp.message.success(l('Deleted')); - dataTable.ajax.reload(); - }); - }, - }, + } ], }, },