diff --git a/backend/app/dto/app.go b/backend/app/dto/app.go index 83cdabc62..d2fc64d4a 100644 --- a/backend/app/dto/app.go +++ b/backend/app/dto/app.go @@ -64,6 +64,7 @@ type AppInstalled struct { type AppInstalledRequest struct { PageInfo Type string `json:"type"` + Name string `json:"name"` } type AppBackupRequest struct { diff --git a/backend/app/service/app_install.go b/backend/app/service/app_install.go index fd9176fe5..4d2bf6d7e 100644 --- a/backend/app/service/app_install.go +++ b/backend/app/service/app_install.go @@ -3,6 +3,7 @@ package service import ( "context" "fmt" + "github.com/1Panel-dev/1Panel/backend/app/repo" "io/ioutil" "os" "path" @@ -25,7 +26,13 @@ type AppInstallService struct { } func (a AppInstallService) Page(req dto.AppInstalledRequest) (int64, []dto.AppInstalled, error) { - total, installs, err := appInstallRepo.Page(req.Page, req.PageSize) + var opts []repo.DBOption + + if req.Name != "" { + opts = append(opts, commonRepo.WithLikeName(req.Name)) + } + + total, installs, err := appInstallRepo.Page(req.Page, req.PageSize, opts...) if err != nil { return 0, nil, err } diff --git a/frontend/src/api/interface/app.ts b/frontend/src/api/interface/app.ts index fadaed347..73cfe20c0 100644 --- a/frontend/src/api/interface/app.ts +++ b/frontend/src/api/interface/app.ts @@ -63,6 +63,9 @@ export namespace App { params: any; } + export interface AppInstallSearch extends ReqPage { + name?: string; + } export interface ChangePort { key: string; name: string; diff --git a/frontend/src/api/modules/app.ts b/frontend/src/api/modules/app.ts index 1067d9125..a299e5ff7 100644 --- a/frontend/src/api/modules/app.ts +++ b/frontend/src/api/modules/app.ts @@ -1,5 +1,5 @@ import http from '@/api'; -import { ReqPage, ResPage } from '../interface'; +import { ResPage } from '../interface'; import { App } from '../interface/app'; export const SyncApp = () => { @@ -26,15 +26,15 @@ export const ChangePort = (params: App.ChangePort) => { return http.post('apps/installed/port/change', params); }; -export const GetAppInstalled = (info: ReqPage) => { - return http.post>('apps/installed', info); +export const SearchAppInstalled = (search: App.AppInstallSearch) => { + return http.post>('apps/installed', search); }; export const CheckAppInstalled = (key: string) => { return http.get(`apps/installed/check/${key}`); }; -export const SearchAppInstalled = (search: App.AppInstalledSearch) => { +export const GetAppInstalled = (search: App.AppInstalledSearch) => { return http.post('apps/installed', search); }; diff --git a/frontend/src/views/app-store/apps/index.vue b/frontend/src/views/app-store/apps/index.vue index c2d72961a..babf24c9b 100644 --- a/frontend/src/views/app-store/apps/index.vue +++ b/frontend/src/views/app-store/apps/index.vue @@ -1,17 +1,39 @@ - + diff --git a/frontend/src/views/app-store/installed/index.vue b/frontend/src/views/app-store/installed/index.vue index 457f82b2d..4708f3213 100644 --- a/frontend/src/views/app-store/installed/index.vue +++ b/frontend/src/views/app-store/installed/index.vue @@ -1,91 +1,114 @@