mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-09 23:17:21 +08:00
feat: 增加应用列表更新提示
This commit is contained in:
parent
b518463c90
commit
2091fdbe5d
7 changed files with 34 additions and 12 deletions
|
@ -128,3 +128,18 @@ func (b *BaseApi) GetAppTags(c *gin.Context) {
|
||||||
}
|
}
|
||||||
helper.SuccessWithData(c, tags)
|
helper.SuccessWithData(c, tags)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags App
|
||||||
|
// @Summary Get app list update
|
||||||
|
// @Description 获取应用更新版本
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Router /apps/checkupdate [get]
|
||||||
|
func (b *BaseApi) GetAppListUpdate(c *gin.Context) {
|
||||||
|
res, err := appService.GetAppUpdate()
|
||||||
|
if err != nil {
|
||||||
|
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, res)
|
||||||
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ type IAppService interface {
|
||||||
GetAppDetail(appId uint, version string) (response.AppDetailDTO, error)
|
GetAppDetail(appId uint, version string) (response.AppDetailDTO, error)
|
||||||
Install(ctx context.Context, req request.AppInstallCreate) (*model.AppInstall, error)
|
Install(ctx context.Context, req request.AppInstallCreate) (*model.AppInstall, error)
|
||||||
SyncAppList() error
|
SyncAppList() error
|
||||||
|
GetAppUpdate() (*response.AppUpdateRes, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewIAppService() IAppService {
|
func NewIAppService() IAppService {
|
||||||
|
|
|
@ -16,6 +16,7 @@ func (a *AppRouter) InitAppRouter(Router *gin.RouterGroup) {
|
||||||
baseApi := v1.ApiGroupApp.BaseApi
|
baseApi := v1.ApiGroupApp.BaseApi
|
||||||
{
|
{
|
||||||
appRouter.POST("/sync", baseApi.SyncApp)
|
appRouter.POST("/sync", baseApi.SyncApp)
|
||||||
|
appRouter.POST("/checkupdate", baseApi.GetAppListUpdate)
|
||||||
appRouter.POST("/search", baseApi.SearchApp)
|
appRouter.POST("/search", baseApi.SearchApp)
|
||||||
appRouter.GET("/:key", baseApi.GetApp)
|
appRouter.GET("/:key", baseApi.GetApp)
|
||||||
appRouter.GET("/detail/:appId/:version", baseApi.GetAppDetail)
|
appRouter.GET("/detail/:appId/:version", baseApi.GetAppDetail)
|
||||||
|
|
|
@ -27,6 +27,11 @@ export namespace App {
|
||||||
items: App.App[];
|
items: App.App[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface AppUpdateRes {
|
||||||
|
version: string;
|
||||||
|
canUpdate: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export interface AppDetail extends CommonModel {
|
export interface AppDetail extends CommonModel {
|
||||||
appId: string;
|
appId: string;
|
||||||
icon: string;
|
icon: string;
|
||||||
|
|
|
@ -6,6 +6,10 @@ export const SyncApp = () => {
|
||||||
return http.post<any>('apps/sync', {});
|
return http.post<any>('apps/sync', {});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const GetAppListUpdate = () => {
|
||||||
|
return http.post<App.AppUpdateRes>('apps/checkupdate', {});
|
||||||
|
};
|
||||||
|
|
||||||
export const SearchApp = (req: App.AppReq) => {
|
export const SearchApp = (req: App.AppReq) => {
|
||||||
return http.post<App.AppResPage>('apps/search', req);
|
return http.post<App.AppResPage>('apps/search', req);
|
||||||
};
|
};
|
||||||
|
|
|
@ -95,7 +95,7 @@
|
||||||
import LayoutContent from '@/layout/layout-content.vue';
|
import LayoutContent from '@/layout/layout-content.vue';
|
||||||
import { App } from '@/api/interface/app';
|
import { App } from '@/api/interface/app';
|
||||||
import { onMounted, reactive, ref } from 'vue';
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
import { GetAppTags, SearchApp, SyncApp } from '@/api/modules/app';
|
import { GetAppListUpdate, GetAppTags, SearchApp, SyncApp } from '@/api/modules/app';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import Detail from '../detail/index.vue';
|
import Detail from '../detail/index.vue';
|
||||||
import router from '@/routers';
|
import router from '@/routers';
|
||||||
|
@ -147,6 +147,7 @@ const sync = () => {
|
||||||
SyncApp()
|
SyncApp()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
MsgSuccess(i18n.global.t('app.syncSuccess'));
|
MsgSuccess(i18n.global.t('app.syncSuccess'));
|
||||||
|
canUpdate.value = false;
|
||||||
search(req);
|
search(req);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
@ -154,6 +155,11 @@ const sync = () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getAppListUpdate = async () => {
|
||||||
|
const res = await GetAppListUpdate();
|
||||||
|
canUpdate.value = res.data.canUpdate;
|
||||||
|
};
|
||||||
|
|
||||||
const changeTag = (key: string) => {
|
const changeTag = (key: string) => {
|
||||||
req.tags = [];
|
req.tags = [];
|
||||||
activeTag.value = key;
|
activeTag.value = key;
|
||||||
|
@ -169,6 +175,7 @@ const searchByName = (name: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
getAppListUpdate();
|
||||||
search(req);
|
search(req);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -75,17 +75,6 @@
|
||||||
>
|
>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button link :icon="Promotion" @click="openUrl(row)"></el-button>
|
<el-button link :icon="Promotion" @click="openUrl(row)"></el-button>
|
||||||
<!-- <span>
|
|
||||||
<el-link
|
|
||||||
style="margin-left: 10px"
|
|
||||||
type="primary"
|
|
||||||
:underline="false"
|
|
||||||
@click="openConfig(row.id)"
|
|
||||||
>
|
|
||||||
<MsgInfo :info="row.primaryDomain" width="300" />
|
|
||||||
</el-link>
|
|
||||||
</span> -->
|
|
||||||
|
|
||||||
<el-link type="primary" :underline="false" @click="openConfig(row.id)">
|
<el-link type="primary" :underline="false" @click="openConfig(row.id)">
|
||||||
<span style="margin-left: 10px">{{ row.primaryDomain }}</span>
|
<span style="margin-left: 10px">{{ row.primaryDomain }}</span>
|
||||||
</el-link>
|
</el-link>
|
||||||
|
|
Loading…
Add table
Reference in a new issue