Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 网站已安装页面增加分页 #1707

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions backend/app/service/app_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
}
Expand Down
7 changes: 0 additions & 7 deletions frontend/src/views/app-store/apps/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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%;
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/views/app-store/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,9 @@
border: none;
}
}

.page-button {
float: right;
margin-bottom: 10px;
margin-top: 10px;
}
11 changes: 10 additions & 1 deletion frontend/src/views/app-store/installed/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,15 @@
</div>
</el-col>
</el-row>
<div class="page-button" v-if="mode === 'installed'">
<fu-table-pagination
v-model:current-page="paginationConfig.currentPage"
v-model:page-size="paginationConfig.pageSize"
v-bind="paginationConfig"
@change="search"
:layout="'total, sizes, prev, pager, next, jumper'"
/>
</div>
</template>
</LayoutContent>
<Backups ref="backupRef" @close="search" />
Expand Down Expand Up @@ -300,7 +309,7 @@ const tags = ref<App.Tag[]>([]);
const activeTag = ref('all');
const searchReq = reactive({
page: 1,
pageSize: 15,
pageSize: 20,
name: '',
tags: [],
update: false,
Expand Down