mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-11-10 03:30:53 +08:00
feat: 增加应用忽略升级功能 (#1515)
This commit is contained in:
parent
01c08a8ef9
commit
695d4b4a16
17 changed files with 414 additions and 24 deletions
|
|
@ -305,3 +305,25 @@ func (b *BaseApi) UpdateInstalled(c *gin.Context) {
|
||||||
}
|
}
|
||||||
helper.SuccessWithData(c, nil)
|
helper.SuccessWithData(c, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags App
|
||||||
|
// @Summary ignore App Update
|
||||||
|
// @Description 忽略应用升级版本
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.AppInstalledIgnoreUpgrade true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Router /apps/installed/ignore [post]
|
||||||
|
// @x-panel-log {"bodyKeys":["installId"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"忽略应用 [installId] 版本升级","formatEN":"Application param update [installId]"}
|
||||||
|
func (b *BaseApi) IgnoreUpgrade(c *gin.Context) {
|
||||||
|
var req request.AppInstalledIgnoreUpgrade
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := appInstallService.IgnoreUpgrade(req); err != nil {
|
||||||
|
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithOutData(c)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,11 @@ type AppInstalledUpdate struct {
|
||||||
AppContainerConfig
|
AppContainerConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type AppInstalledIgnoreUpgrade struct {
|
||||||
|
InstallId uint `json:"installId" validate:"required"`
|
||||||
|
DetailId uint `json:"detailId" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
type PortUpdate struct {
|
type PortUpdate struct {
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|
|
||||||
|
|
@ -12,4 +12,5 @@ type AppDetail struct {
|
||||||
DownloadUrl string `json:"downloadUrl" gorm:"type:varchar;"`
|
DownloadUrl string `json:"downloadUrl" gorm:"type:varchar;"`
|
||||||
DownloadCallBackUrl string `json:"downloadCallBackUrl" gorm:"type:longtext;"`
|
DownloadCallBackUrl string `json:"downloadCallBackUrl" gorm:"type:longtext;"`
|
||||||
Update bool `json:"update"`
|
Update bool `json:"update"`
|
||||||
|
IgnoreUpgrade bool `json:"ignoreUpgrade"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ type IAppInstallService interface {
|
||||||
SearchForWebsite(req request.AppInstalledSearch) ([]response.AppInstalledDTO, error)
|
SearchForWebsite(req request.AppInstalledSearch) ([]response.AppInstalledDTO, error)
|
||||||
Operate(req request.AppInstalledOperate) error
|
Operate(req request.AppInstalledOperate) error
|
||||||
Update(req request.AppInstalledUpdate) error
|
Update(req request.AppInstalledUpdate) error
|
||||||
|
IgnoreUpgrade(req request.AppInstalledIgnoreUpgrade) error
|
||||||
SyncAll(systemInit bool) error
|
SyncAll(systemInit bool) error
|
||||||
GetServices(key string) ([]response.AppService, error)
|
GetServices(key string) ([]response.AppService, error)
|
||||||
GetUpdateVersions(installId uint) ([]dto.AppVersion, error)
|
GetUpdateVersions(installId uint) ([]dto.AppVersion, error)
|
||||||
|
|
@ -352,6 +353,15 @@ func (a *AppInstallService) Update(req request.AppInstalledUpdate) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *AppInstallService) IgnoreUpgrade(req request.AppInstalledIgnoreUpgrade) error {
|
||||||
|
appDetail, err := appDetailRepo.GetFirst(commonRepo.WithByID(req.DetailId))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
appDetail.IgnoreUpgrade = true
|
||||||
|
return appDetailRepo.Update(context.Background(), appDetail)
|
||||||
|
}
|
||||||
|
|
||||||
func (a *AppInstallService) SyncAll(systemInit bool) error {
|
func (a *AppInstallService) SyncAll(systemInit bool) error {
|
||||||
allList, err := appInstallRepo.ListBy()
|
allList, err := appInstallRepo.ListBy()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -412,6 +422,9 @@ func (a *AppInstallService) GetUpdateVersions(installId uint) ([]dto.AppVersion,
|
||||||
return versions, err
|
return versions, err
|
||||||
}
|
}
|
||||||
for _, detail := range details {
|
for _, detail := range details {
|
||||||
|
if detail.IgnoreUpgrade {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if common.IsCrossVersion(install.Version, detail.Version) && !app.CrossVersionUpdate {
|
if common.IsCrossVersion(install.Version, detail.Version) && !app.CrossVersionUpdate {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -751,7 +751,7 @@ func handleErr(install model.AppInstall, err error, out string) error {
|
||||||
func handleInstalled(appInstallList []model.AppInstall, updated bool) ([]response.AppInstalledDTO, error) {
|
func handleInstalled(appInstallList []model.AppInstall, updated bool) ([]response.AppInstalledDTO, error) {
|
||||||
var res []response.AppInstalledDTO
|
var res []response.AppInstalledDTO
|
||||||
for _, installed := range appInstallList {
|
for _, installed := range appInstallList {
|
||||||
if updated && installed.App.Type == "php" {
|
if updated && installed.App.Type == "php" || installed.Status == constant.Installing {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
installDTO := response.AppInstalledDTO{
|
installDTO := response.AppInstalledDTO{
|
||||||
|
|
@ -768,6 +768,9 @@ func handleInstalled(appInstallList []model.AppInstall, updated bool) ([]respons
|
||||||
}
|
}
|
||||||
var versions []string
|
var versions []string
|
||||||
for _, detail := range details {
|
for _, detail := range details {
|
||||||
|
if detail.IgnoreUpgrade {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if common.IsCrossVersion(installed.Version, detail.Version) && !app.CrossVersionUpdate {
|
if common.IsCrossVersion(installed.Version, detail.Version) && !app.CrossVersionUpdate {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ func Init() {
|
||||||
migrations.UpdateWebsite,
|
migrations.UpdateWebsite,
|
||||||
migrations.AddBackupAccountDir,
|
migrations.AddBackupAccountDir,
|
||||||
migrations.AddMfaInterval,
|
migrations.AddMfaInterval,
|
||||||
|
migrations.UpdateAppDetail,
|
||||||
})
|
})
|
||||||
if err := m.Migrate(); err != nil {
|
if err := m.Migrate(); err != nil {
|
||||||
global.LOG.Error(err)
|
global.LOG.Error(err)
|
||||||
|
|
|
||||||
|
|
@ -413,3 +413,16 @@ var AddMfaInterval = &gormigrate.Migration{
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var UpdateAppDetail = &gormigrate.Migration{
|
||||||
|
ID: "20230704-update-app-detail",
|
||||||
|
Migrate: func(tx *gorm.DB) error {
|
||||||
|
if err := tx.AutoMigrate(&model.AppDetail{}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := tx.Model(&model.AppDetail{}).Where("1 = 1").Update("ignore_upgrade", "0").Error; err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,5 +36,6 @@ func (a *AppRouter) InitAppRouter(Router *gin.RouterGroup) {
|
||||||
appRouter.GET("/installed/conf/:key", baseApi.GetDefaultConfig)
|
appRouter.GET("/installed/conf/:key", baseApi.GetDefaultConfig)
|
||||||
appRouter.GET("/installed/params/:appInstallId", baseApi.GetParams)
|
appRouter.GET("/installed/params/:appInstallId", baseApi.GetParams)
|
||||||
appRouter.POST("/installed/params/update", baseApi.UpdateInstalled)
|
appRouter.POST("/installed/params/update", baseApi.UpdateInstalled)
|
||||||
|
appRouter.POST("/installed/ignore", baseApi.IgnoreUpgrade)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -387,6 +387,48 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/apps/installed/ignore": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "忽略应用升级版本",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"App"
|
||||||
|
],
|
||||||
|
"summary": "ignore App Update",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "request",
|
||||||
|
"name": "request",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/request.AppInstalledIgnoreUpgrade"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-panel-log": {
|
||||||
|
"BeforeFuntions": [],
|
||||||
|
"bodyKeys": [
|
||||||
|
"installId"
|
||||||
|
],
|
||||||
|
"formatEN": "Application param update [installId]",
|
||||||
|
"formatZH": "忽略应用 [installId] 版本升级",
|
||||||
|
"paramKeys": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/apps/installed/loadport/:key": {
|
"/apps/installed/loadport/:key": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
|
|
@ -1865,6 +1907,31 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/containers/list": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "获取容器名称",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Container"
|
||||||
|
],
|
||||||
|
"summary": "List containers",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/containers/network": {
|
"/containers/network": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
|
|
@ -9632,7 +9699,7 @@ const docTemplate = `{
|
||||||
"ApiKeyAuth": []
|
"ApiKeyAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "更新 php 配置",
|
"description": "更新 php 配置文件",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
|
|
@ -10967,6 +11034,9 @@ const docTemplate = `{
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"containerName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"day": {
|
"day": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
|
@ -11046,6 +11116,9 @@ const docTemplate = `{
|
||||||
"specType"
|
"specType"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"containerName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"day": {
|
"day": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
|
@ -12265,6 +12338,12 @@ const docTemplate = `{
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"order": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"orderBy": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"page": {
|
"page": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
|
@ -12819,6 +12898,12 @@ const docTemplate = `{
|
||||||
"info": {
|
"info": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"order": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"orderBy": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"page": {
|
"page": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
|
@ -12911,6 +12996,9 @@ const docTemplate = `{
|
||||||
"sslType": {
|
"sslType": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"systemIP": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"systemVersion": {
|
"systemVersion": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
@ -13562,6 +13650,21 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"request.AppInstalledIgnoreUpgrade": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"detailId",
|
||||||
|
"installId"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"detailId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"installId": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"request.AppInstalledOperate": {
|
"request.AppInstalledOperate": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
|
|
@ -14863,6 +14966,12 @@ const docTemplate = `{
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"order": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"orderBy": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"page": {
|
"page": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
|
@ -15078,6 +15187,9 @@ const docTemplate = `{
|
||||||
"id": {
|
"id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
"ignoreUpgrade": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"image": {
|
"image": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -380,6 +380,48 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/apps/installed/ignore": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "忽略应用升级版本",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"App"
|
||||||
|
],
|
||||||
|
"summary": "ignore App Update",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "request",
|
||||||
|
"name": "request",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/request.AppInstalledIgnoreUpgrade"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-panel-log": {
|
||||||
|
"BeforeFuntions": [],
|
||||||
|
"bodyKeys": [
|
||||||
|
"installId"
|
||||||
|
],
|
||||||
|
"formatEN": "Application param update [installId]",
|
||||||
|
"formatZH": "忽略应用 [installId] 版本升级",
|
||||||
|
"paramKeys": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/apps/installed/loadport/:key": {
|
"/apps/installed/loadport/:key": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
|
|
@ -1858,6 +1900,31 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/containers/list": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "获取容器名称",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Container"
|
||||||
|
],
|
||||||
|
"summary": "List containers",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/containers/network": {
|
"/containers/network": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
|
|
@ -9625,7 +9692,7 @@
|
||||||
"ApiKeyAuth": []
|
"ApiKeyAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "更新 php 配置",
|
"description": "更新 php 配置文件",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
|
|
@ -10960,6 +11027,9 @@
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"containerName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"day": {
|
"day": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
|
@ -11039,6 +11109,9 @@
|
||||||
"specType"
|
"specType"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"containerName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"day": {
|
"day": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
|
@ -12258,6 +12331,12 @@
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"order": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"orderBy": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"page": {
|
"page": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
|
@ -12812,6 +12891,12 @@
|
||||||
"info": {
|
"info": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"order": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"orderBy": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"page": {
|
"page": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
|
@ -12904,6 +12989,9 @@
|
||||||
"sslType": {
|
"sslType": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"systemIP": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"systemVersion": {
|
"systemVersion": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
@ -13555,6 +13643,21 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"request.AppInstalledIgnoreUpgrade": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"detailId",
|
||||||
|
"installId"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"detailId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"installId": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"request.AppInstalledOperate": {
|
"request.AppInstalledOperate": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
|
|
@ -14856,6 +14959,12 @@
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"order": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"orderBy": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"page": {
|
"page": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
|
@ -15071,6 +15180,9 @@
|
||||||
"id": {
|
"id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
"ignoreUpgrade": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"image": {
|
"image": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -385,6 +385,8 @@ definitions:
|
||||||
type: object
|
type: object
|
||||||
dto.CronjobCreate:
|
dto.CronjobCreate:
|
||||||
properties:
|
properties:
|
||||||
|
containerName:
|
||||||
|
type: string
|
||||||
day:
|
day:
|
||||||
type: integer
|
type: integer
|
||||||
dbName:
|
dbName:
|
||||||
|
|
@ -439,6 +441,8 @@ definitions:
|
||||||
type: object
|
type: object
|
||||||
dto.CronjobUpdate:
|
dto.CronjobUpdate:
|
||||||
properties:
|
properties:
|
||||||
|
containerName:
|
||||||
|
type: string
|
||||||
day:
|
day:
|
||||||
type: integer
|
type: integer
|
||||||
dbName:
|
dbName:
|
||||||
|
|
@ -1258,6 +1262,10 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
name:
|
name:
|
||||||
type: string
|
type: string
|
||||||
|
order:
|
||||||
|
type: string
|
||||||
|
orderBy:
|
||||||
|
type: string
|
||||||
page:
|
page:
|
||||||
type: integer
|
type: integer
|
||||||
pageSize:
|
pageSize:
|
||||||
|
|
@ -1627,6 +1635,10 @@ definitions:
|
||||||
properties:
|
properties:
|
||||||
info:
|
info:
|
||||||
type: string
|
type: string
|
||||||
|
order:
|
||||||
|
type: string
|
||||||
|
orderBy:
|
||||||
|
type: string
|
||||||
page:
|
page:
|
||||||
type: integer
|
type: integer
|
||||||
pageSize:
|
pageSize:
|
||||||
|
|
@ -1691,6 +1703,8 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
sslType:
|
sslType:
|
||||||
type: string
|
type: string
|
||||||
|
systemIP:
|
||||||
|
type: string
|
||||||
systemVersion:
|
systemVersion:
|
||||||
type: string
|
type: string
|
||||||
theme:
|
theme:
|
||||||
|
|
@ -2121,6 +2135,16 @@ definitions:
|
||||||
- appDetailId
|
- appDetailId
|
||||||
- name
|
- name
|
||||||
type: object
|
type: object
|
||||||
|
request.AppInstalledIgnoreUpgrade:
|
||||||
|
properties:
|
||||||
|
detailId:
|
||||||
|
type: integer
|
||||||
|
installId:
|
||||||
|
type: integer
|
||||||
|
required:
|
||||||
|
- detailId
|
||||||
|
- installId
|
||||||
|
type: object
|
||||||
request.AppInstalledOperate:
|
request.AppInstalledOperate:
|
||||||
properties:
|
properties:
|
||||||
backupId:
|
backupId:
|
||||||
|
|
@ -2993,6 +3017,10 @@ definitions:
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
type: string
|
type: string
|
||||||
|
order:
|
||||||
|
type: string
|
||||||
|
orderBy:
|
||||||
|
type: string
|
||||||
page:
|
page:
|
||||||
type: integer
|
type: integer
|
||||||
pageSize:
|
pageSize:
|
||||||
|
|
@ -3140,6 +3168,8 @@ definitions:
|
||||||
type: boolean
|
type: boolean
|
||||||
id:
|
id:
|
||||||
type: integer
|
type: integer
|
||||||
|
ignoreUpgrade:
|
||||||
|
type: boolean
|
||||||
image:
|
image:
|
||||||
type: string
|
type: string
|
||||||
lastModified:
|
lastModified:
|
||||||
|
|
@ -3644,6 +3674,33 @@ paths:
|
||||||
summary: Check before delete
|
summary: Check before delete
|
||||||
tags:
|
tags:
|
||||||
- App
|
- App
|
||||||
|
/apps/installed/ignore:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: 忽略应用升级版本
|
||||||
|
parameters:
|
||||||
|
- description: request
|
||||||
|
in: body
|
||||||
|
name: request
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/request.AppInstalledIgnoreUpgrade'
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: ignore App Update
|
||||||
|
tags:
|
||||||
|
- App
|
||||||
|
x-panel-log:
|
||||||
|
BeforeFuntions: []
|
||||||
|
bodyKeys:
|
||||||
|
- installId
|
||||||
|
formatEN: Application param update [installId]
|
||||||
|
formatZH: 忽略应用 [installId] 版本升级
|
||||||
|
paramKeys: []
|
||||||
/apps/installed/loadport/:key:
|
/apps/installed/loadport/:key:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
|
|
@ -4586,6 +4643,21 @@ paths:
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: Load container limis
|
summary: Load container limis
|
||||||
|
/containers/list:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: 获取容器名称
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: List containers
|
||||||
|
tags:
|
||||||
|
- Container
|
||||||
/containers/network:
|
/containers/network:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
|
|
@ -9521,7 +9593,7 @@ paths:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: 更新 php 配置
|
description: 更新 php 配置文件
|
||||||
parameters:
|
parameters:
|
||||||
- description: request
|
- description: request
|
||||||
in: body
|
in: body
|
||||||
|
|
|
||||||
|
|
@ -89,3 +89,7 @@ export const GetAppInstallParams = (id: number) => {
|
||||||
export const UpdateAppInstallParams = (req: any) => {
|
export const UpdateAppInstallParams = (req: any) => {
|
||||||
return http.post<any>(`apps/installed/params/update`, req);
|
return http.post<any>(`apps/installed/params/update`, req);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const IgnoreUpgrade = (req: any) => {
|
||||||
|
return http.post<any>(`apps/installed/ignore`, req);
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ const message = {
|
||||||
refresh: 'Refresh',
|
refresh: 'Refresh',
|
||||||
get: 'Get',
|
get: 'Get',
|
||||||
upgrade: 'Upgrade',
|
upgrade: 'Upgrade',
|
||||||
|
ignoreUpgrade: 'Ignore upgrade',
|
||||||
},
|
},
|
||||||
search: {
|
search: {
|
||||||
timeStart: 'Time start',
|
timeStart: 'Time start',
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ const message = {
|
||||||
refresh: '刷新',
|
refresh: '刷新',
|
||||||
get: '獲取',
|
get: '獲取',
|
||||||
upgrade: '升級',
|
upgrade: '升級',
|
||||||
|
ignoreUpgrade: '忽略升級',
|
||||||
},
|
},
|
||||||
search: {
|
search: {
|
||||||
timeStart: '開始時間',
|
timeStart: '開始時間',
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ const message = {
|
||||||
refresh: '刷新',
|
refresh: '刷新',
|
||||||
get: '获取',
|
get: '获取',
|
||||||
upgrade: '升级',
|
upgrade: '升级',
|
||||||
|
ignoreUpgrade: '忽略升级',
|
||||||
},
|
},
|
||||||
search: {
|
search: {
|
||||||
timeStart: '开始时间',
|
timeStart: '开始时间',
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,17 @@
|
||||||
>
|
>
|
||||||
{{ $t('commons.button.backup') }}
|
{{ $t('commons.button.backup') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
class="h-button"
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
round
|
||||||
|
size="small"
|
||||||
|
@click="openOperate(installed, 'ignoreUpgrade')"
|
||||||
|
v-if="mode === 'upgrade'"
|
||||||
|
>
|
||||||
|
{{ $t('commons.button.ignoreUpgrade') }}
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
class="h-button"
|
class="h-button"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|
@ -322,8 +333,8 @@ const search = () => {
|
||||||
const openOperate = (row: any, op: string) => {
|
const openOperate = (row: any, op: string) => {
|
||||||
operateReq.installId = row.id;
|
operateReq.installId = row.id;
|
||||||
operateReq.operate = op;
|
operateReq.operate = op;
|
||||||
if (op == 'upgrade') {
|
if (op == 'upgrade' || op == 'ignoreUpgrade') {
|
||||||
upgradeRef.value.acceptParams(row.id, row.name);
|
upgradeRef.value.acceptParams(row.id, row.name, op);
|
||||||
} else if (op == 'delete') {
|
} else if (op == 'delete') {
|
||||||
AppInstalledDeleteCheck(row.id).then(async (res) => {
|
AppInstalledDeleteCheck(row.id).then(async (res) => {
|
||||||
const items = res.data;
|
const items = res.data;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<el-drawer :close-on-click-modal="false" v-model="open" size="30%">
|
<el-drawer :close-on-click-modal="false" v-model="open" size="30%">
|
||||||
<template #header>
|
<template #header>
|
||||||
<Header :header="$t('commons.button.upgrade')" :resource="resourceName" :back="handleClose"></Header>
|
<Header
|
||||||
|
:header="$t('commons.button.' + operateReq.operate)"
|
||||||
|
:resource="resourceName"
|
||||||
|
:back="handleClose"
|
||||||
|
></Header>
|
||||||
</template>
|
</template>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="22" :offset="1">
|
<el-col :span="22" :offset="1">
|
||||||
|
|
@ -38,7 +42,7 @@
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { App } from '@/api/interface/app';
|
import { App } from '@/api/interface/app';
|
||||||
import { GetAppUpdateVersions, InstalledOp } from '@/api/modules/app';
|
import { GetAppUpdateVersions, IgnoreUpgrade, InstalledOp } from '@/api/modules/app';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { ElMessageBox, FormInstance } from 'element-plus';
|
import { ElMessageBox, FormInstance } from 'element-plus';
|
||||||
import { reactive, ref, onBeforeUnmount } from 'vue';
|
import { reactive, ref, onBeforeUnmount } from 'vue';
|
||||||
|
|
@ -48,16 +52,16 @@ import { Rules } from '@/global/form-rules';
|
||||||
import bus from '../../bus';
|
import bus from '../../bus';
|
||||||
|
|
||||||
const updateRef = ref<FormInstance>();
|
const updateRef = ref<FormInstance>();
|
||||||
let open = ref(false);
|
const open = ref(false);
|
||||||
let loading = ref(false);
|
const loading = ref(false);
|
||||||
let versions = ref<App.VersionDetail[]>();
|
const versions = ref<App.VersionDetail[]>();
|
||||||
let operateReq = reactive({
|
const operateReq = reactive({
|
||||||
detailId: 0,
|
detailId: 0,
|
||||||
operate: 'upgrade',
|
operate: 'upgrade',
|
||||||
installId: 0,
|
installId: 0,
|
||||||
});
|
});
|
||||||
const resourceName = ref('');
|
const resourceName = ref('');
|
||||||
let rules = ref<any>({
|
const rules = ref<any>({
|
||||||
detailId: [Rules.requiredSelect],
|
detailId: [Rules.requiredSelect],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -67,8 +71,9 @@ const handleClose = () => {
|
||||||
em('close', open);
|
em('close', open);
|
||||||
};
|
};
|
||||||
|
|
||||||
const acceptParams = (id: number, name: string) => {
|
const acceptParams = (id: number, name: string, op: string) => {
|
||||||
operateReq.installId = id;
|
operateReq.installId = id;
|
||||||
|
operateReq.operate = op;
|
||||||
resourceName.value = name;
|
resourceName.value = name;
|
||||||
GetAppUpdateVersions(id).then((res) => {
|
GetAppUpdateVersions(id).then((res) => {
|
||||||
versions.value = res.data;
|
versions.value = res.data;
|
||||||
|
|
@ -81,20 +86,32 @@ const acceptParams = (id: number, name: string) => {
|
||||||
|
|
||||||
const operate = async () => {
|
const operate = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
await InstalledOp(operateReq)
|
if (operateReq.operate === 'upgrade') {
|
||||||
.then(() => {
|
await InstalledOp(operateReq)
|
||||||
MsgSuccess(i18n.global.t('app.upgradeStart'));
|
.then(() => {
|
||||||
bus.emit('upgrade', true);
|
MsgSuccess(i18n.global.t('app.upgradeStart'));
|
||||||
handleClose();
|
bus.emit('upgrade', true);
|
||||||
})
|
handleClose();
|
||||||
.finally(() => {
|
})
|
||||||
loading.value = false;
|
.finally(() => {
|
||||||
});
|
loading.value = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await IgnoreUpgrade(operateReq)
|
||||||
|
.then(() => {
|
||||||
|
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||||
|
bus.emit('upgrade', true);
|
||||||
|
handleClose();
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onOperate = async () => {
|
const onOperate = async () => {
|
||||||
ElMessageBox.confirm(
|
ElMessageBox.confirm(
|
||||||
i18n.global.t('app.operatorHelper', [i18n.global.t('commons.button.upgrade')]),
|
i18n.global.t('app.operatorHelper', [i18n.global.t('commons.button.' + operateReq.operate)]),
|
||||||
i18n.global.t('commons.button.upgrade'),
|
i18n.global.t('commons.button.upgrade'),
|
||||||
{
|
{
|
||||||
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue