diff --git a/backend/app/dto/app.go b/backend/app/dto/app.go index 7e286f18c..1bbf77617 100644 --- a/backend/app/dto/app.go +++ b/backend/app/dto/app.go @@ -133,17 +133,17 @@ type AppList struct { } type AppDefine struct { - Key string `json:"key"` - Name string `json:"name"` - Tags []string `json:"tags"` - Versions []string `json:"versions"` - //Icon string `json:"icon"` + Key string `json:"key"` + Name string `json:"name"` + Tags []string `json:"tags"` + Versions []string `json:"versions"` Author string `json:"author"` Source string `json:"source"` ShortDesc string `json:"short_desc"` Type string `json:"type"` Required []string `json:"Required"` CrossVersionUpdate bool `json:"crossVersionUpdate"` + Limit int `json:"limit"` } func (define AppDefine) GetRequired() string { diff --git a/backend/app/service/app.go b/backend/app/service/app.go index ffb92616b..dd2153667 100644 --- a/backend/app/service/app.go +++ b/backend/app/service/app.go @@ -136,7 +136,7 @@ func (a AppService) Install(name string, appDetailId uint, params map[string]int } httpsPort, err := checkPort("PANEL_APP_PORT_HTTPS", params) if err != nil { - return nil, fmt.Errorf("%d port is in used", httpPort) + return nil, fmt.Errorf("%d port is in used", httpsPort) } appDetail, err := appDetailRepo.GetFirst(commonRepo.WithByID(appDetailId)) @@ -483,51 +483,5 @@ func (a AppService) SyncAppList() error { tx.Commit() - go syncCanUpdate() return nil } - -func syncCanUpdate() { - apps, err := appRepo.GetBy() - if err != nil { - global.LOG.Errorf("sync update app error: %s", err.Error()) - } - for _, app := range apps { - details, err := appDetailRepo.GetBy(appDetailRepo.WithAppId(app.ID)) - if err != nil { - global.LOG.Errorf("sync update app error: %s", err.Error()) - } - var versions []string - for _, detail := range details { - versions = append(versions, detail.Version) - } - versions = common.GetSortedVersions(versions) - lastVersion := versions[0] - - var updateDetailIds []uint - for _, detail := range details { - if lastVersion == detail.Version { - continue - } - if common.CompareVersion(lastVersion, detail.Version) && (app.CrossVersionUpdate || !common.IsCrossVersion(detail.Version, lastVersion)) { - updateDetailIds = append(updateDetailIds, detail.ID) - } - } - if err := appDetailRepo.BatchUpdateBy(map[string]interface{}{"last_version": ""}); err != nil { - global.LOG.Errorf("sync update app error: %s", err.Error()) - } - - if err := appInstallRepo.BatchUpdateBy(map[string]interface{}{"can_update": 0}); err != nil { - global.LOG.Errorf("sync update app error: %s", err.Error()) - } - if len(updateDetailIds) > 0 { - if err := appDetailRepo.BatchUpdateBy(map[string]interface{}{"last_version": lastVersion}, commonRepo.WithIdsIn(updateDetailIds)); err != nil { - global.LOG.Errorf("sync update app error: %s", err.Error()) - } - //if err := appInstallRepo.BatchUpdateBy(map[string]interface{}{"can_update": 1}, appInstallRepo.WithDetailIdsIn(updateDetailIds)); err != nil { - // global.LOG.Errorf("sync update app error: %s", err.Error()) - //} - } - - } -} diff --git a/backend/app/service/app_utils.go b/backend/app/service/app_utils.go index db373af56..b919b72ae 100644 --- a/backend/app/service/app_utils.go +++ b/backend/app/service/app_utils.go @@ -488,6 +488,7 @@ func getApps(oldApps []model.App, items []dto.AppDefine) map[string]model.App { app = model.App{} } app.Name = item.Name + app.Limit = item.Limit app.Key = item.Key app.ShortDesc = item.ShortDesc app.Author = item.Author diff --git a/frontend/src/views/app-store/installed/index.vue b/frontend/src/views/app-store/installed/index.vue index bf699e705..1f533cd14 100644 --- a/frontend/src/views/app-store/installed/index.vue +++ b/frontend/src/views/app-store/installed/index.vue @@ -57,14 +57,14 @@ /> - -
+ /> --> +

{{ $t('app.versioneSelect') }}

{ }); }; -const getMsg = (op: string) => { - let tip = ''; - switch (op) { - case 'up': - tip = i18n.global.t('app.up'); - break; - case 'down': - tip = i18n.global.t('app.down'); - break; - case 'restart': - tip = i18n.global.t('app.restart'); - break; - case 'delete': - tip = i18n.global.t('app.deleteWarn'); - break; - case 'sync': - tip = i18n.global.t('app.sync'); - break; - default: - } - return tip; -}; +// const getMsg = (op: string) => { +// let tip = ''; +// switch (op) { +// case 'up': +// tip = i18n.global.t('app.up'); +// break; +// case 'down': +// tip = i18n.global.t('app.down'); +// break; +// case 'restart': +// tip = i18n.global.t('app.restart'); +// break; +// case 'delete': +// tip = i18n.global.t('app.deleteWarn'); +// break; +// case 'sync': +// tip = i18n.global.t('app.sync'); +// break; +// default: +// } +// return tip; +// }; const buttons = [ {