From aa8816f3ec82160feb6a4b2dd4b77521d5a6ff0a Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Tue, 18 Jul 2023 14:22:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BD=91=E7=AB=99=E5=B7=B2=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0=E5=88=86=E9=A1=B5?= =?UTF-8?q?=20(#1707)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/app_install.go | 23 +++++++++++++++---- frontend/src/views/app-store/apps/index.vue | 7 ------ frontend/src/views/app-store/index.scss | 6 +++++ .../src/views/app-store/installed/index.vue | 11 ++++++++- 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/backend/app/service/app_install.go b/backend/app/service/app_install.go index ab80e9677..3272ac6e5 100644 --- a/backend/app/service/app_install.go +++ b/backend/app/service/app_install.go @@ -61,7 +61,12 @@ func NewIAppInstalledService() IAppInstallService { } func (a *AppInstallService) Page(req request.AppInstalledSearch) (int64, []response.AppInstalledDTO, error) { - var opts []repo.DBOption + var ( + opts []repo.DBOption + total int64 + installs []model.AppInstall + err error + ) if req.Name != "" { opts = append(opts, commonRepo.WithLikeName(req.Name)) @@ -87,15 +92,25 @@ func (a *AppInstallService) Page(req request.AppInstalledSearch) (int64, []respo opts = append(opts, appInstallRepo.WithAppIdsIn(appIds)) } - total, installs, err := appInstallRepo.Page(req.Page, req.PageSize, opts...) - if err != nil { - return 0, nil, err + if req.Update { + installs, err = appInstallRepo.ListBy(opts...) + if err != nil { + return 0, nil, err + } + } else { + total, installs, err = appInstallRepo.Page(req.Page, req.PageSize, opts...) + if err != nil { + return 0, nil, err + } } installDTOs, err := handleInstalled(installs, req.Update) if err != nil { return 0, nil, err } + if req.Update { + total = int64(len(installDTOs)) + } return total, installDTOs, nil } diff --git a/frontend/src/views/app-store/apps/index.vue b/frontend/src/views/app-store/apps/index.vue index 079643a67..1f9785ed8 100644 --- a/frontend/src/views/app-store/apps/index.vue +++ b/frontend/src/views/app-store/apps/index.vue @@ -287,13 +287,6 @@ onMounted(() => { border: none; } } - -.page-button { - float: right; - margin-bottom: 10px; - margin-top: 10px; -} - @media only screen and (min-width: 768px) and (max-width: 1200px) { .app-col-12 { max-width: 50%; diff --git a/frontend/src/views/app-store/index.scss b/frontend/src/views/app-store/index.scss index ac766654e..ab8d82fcc 100644 --- a/frontend/src/views/app-store/index.scss +++ b/frontend/src/views/app-store/index.scss @@ -91,3 +91,9 @@ border: none; } } + +.page-button { + float: right; + margin-bottom: 10px; + margin-top: 10px; +} diff --git a/frontend/src/views/app-store/installed/index.vue b/frontend/src/views/app-store/installed/index.vue index 19ec5d836..90b62f27b 100644 --- a/frontend/src/views/app-store/installed/index.vue +++ b/frontend/src/views/app-store/installed/index.vue @@ -234,6 +234,15 @@ +
+ +
@@ -300,7 +309,7 @@ const tags = ref([]); const activeTag = ref('all'); const searchReq = reactive({ page: 1, - pageSize: 15, + pageSize: 20, name: '', tags: [], update: false,