mirror of https://github.com/1Panel-dev/1Panel
feat: 增加应用列表更新提示
parent
b518463c90
commit
2091fdbe5d
|
@ -128,3 +128,18 @@ func (b *BaseApi) GetAppTags(c *gin.Context) {
|
|||
}
|
||||
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)
|
||||
Install(ctx context.Context, req request.AppInstallCreate) (*model.AppInstall, error)
|
||||
SyncAppList() error
|
||||
GetAppUpdate() (*response.AppUpdateRes, error)
|
||||
}
|
||||
|
||||
func NewIAppService() IAppService {
|
||||
|
|
|
@ -16,6 +16,7 @@ func (a *AppRouter) InitAppRouter(Router *gin.RouterGroup) {
|
|||
baseApi := v1.ApiGroupApp.BaseApi
|
||||
{
|
||||
appRouter.POST("/sync", baseApi.SyncApp)
|
||||
appRouter.POST("/checkupdate", baseApi.GetAppListUpdate)
|
||||
appRouter.POST("/search", baseApi.SearchApp)
|
||||
appRouter.GET("/:key", baseApi.GetApp)
|
||||
appRouter.GET("/detail/:appId/:version", baseApi.GetAppDetail)
|
||||
|
|
|
@ -27,6 +27,11 @@ export namespace App {
|
|||
items: App.App[];
|
||||
}
|
||||
|
||||
export interface AppUpdateRes {
|
||||
version: string;
|
||||
canUpdate: boolean;
|
||||
}
|
||||
|
||||
export interface AppDetail extends CommonModel {
|
||||
appId: string;
|
||||
icon: string;
|
||||
|
|
|
@ -6,6 +6,10 @@ export const SyncApp = () => {
|
|||
return http.post<any>('apps/sync', {});
|
||||
};
|
||||
|
||||
export const GetAppListUpdate = () => {
|
||||
return http.post<App.AppUpdateRes>('apps/checkupdate', {});
|
||||
};
|
||||
|
||||
export const SearchApp = (req: App.AppReq) => {
|
||||
return http.post<App.AppResPage>('apps/search', req);
|
||||
};
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
import LayoutContent from '@/layout/layout-content.vue';
|
||||
import { App } from '@/api/interface/app';
|
||||
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 Detail from '../detail/index.vue';
|
||||
import router from '@/routers';
|
||||
|
@ -147,6 +147,7 @@ const sync = () => {
|
|||
SyncApp()
|
||||
.then(() => {
|
||||
MsgSuccess(i18n.global.t('app.syncSuccess'));
|
||||
canUpdate.value = false;
|
||||
search(req);
|
||||
})
|
||||
.finally(() => {
|
||||
|
@ -154,6 +155,11 @@ const sync = () => {
|
|||
});
|
||||
};
|
||||
|
||||
const getAppListUpdate = async () => {
|
||||
const res = await GetAppListUpdate();
|
||||
canUpdate.value = res.data.canUpdate;
|
||||
};
|
||||
|
||||
const changeTag = (key: string) => {
|
||||
req.tags = [];
|
||||
activeTag.value = key;
|
||||
|
@ -169,6 +175,7 @@ const searchByName = (name: string) => {
|
|||
};
|
||||
|
||||
onMounted(() => {
|
||||
getAppListUpdate();
|
||||
search(req);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -75,17 +75,6 @@
|
|||
>
|
||||
<template #default="{ row }">
|
||||
<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)">
|
||||
<span style="margin-left: 10px">{{ row.primaryDomain }}</span>
|
||||
</el-link>
|
||||
|
|
Loading…
Reference in New Issue