mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-09 07:00:48 +08:00
fix: Add backward compatibility for overview page api (#10310)
This commit is contained in:
parent
011914339e
commit
f75b786916
3 changed files with 25 additions and 24 deletions
|
@ -3,6 +3,11 @@ package dto
|
|||
import "time"
|
||||
|
||||
type DashboardBase struct {
|
||||
WebsiteNumber int `json:"websiteNumber"`
|
||||
DatabaseNumber int `json:"databaseNumber"`
|
||||
CronjobNumber int `json:"cronjobNumber"`
|
||||
AppInstalledNumber int `json:"appInstalledNumber"`
|
||||
|
||||
Hostname string `json:"hostname"`
|
||||
OS string `json:"os"`
|
||||
Platform string `json:"platform"`
|
||||
|
|
|
@ -572,22 +572,30 @@ func loadOutboundIP() string {
|
|||
}
|
||||
|
||||
func loadQuickJump(base *dto.DashboardBase) {
|
||||
website, _ := websiteRepo.GetBy()
|
||||
base.WebsiteNumber = len(website)
|
||||
|
||||
postgresqlDbs, _ := postgresqlRepo.List()
|
||||
mysqlDbs, _ := mysqlRepo.List()
|
||||
base.DatabaseNumber = len(mysqlDbs) + len(postgresqlDbs)
|
||||
|
||||
cronjobs, _ := cronjobRepo.List()
|
||||
base.CronjobNumber = len(cronjobs)
|
||||
|
||||
appInstall, _ := appInstallRepo.ListBy(context.Background())
|
||||
base.AppInstalledNumber = len(appInstall)
|
||||
|
||||
quicks := launcherRepo.ListQuickJump(false)
|
||||
for i := 0; i < len(quicks); i++ {
|
||||
switch quicks[i].Name {
|
||||
case "Website":
|
||||
website, _ := websiteRepo.GetBy()
|
||||
quicks[i].Detail = fmt.Sprintf("%d", len(website))
|
||||
quicks[i].Detail = fmt.Sprintf("%d", base.WebsiteNumber)
|
||||
case "Database":
|
||||
postgresqlDbs, _ := postgresqlRepo.List()
|
||||
mysqlDbs, _ := mysqlRepo.List()
|
||||
quicks[i].Detail = fmt.Sprintf("%d", len(mysqlDbs)+len(postgresqlDbs))
|
||||
quicks[i].Detail = fmt.Sprintf("%d", base.DatabaseNumber)
|
||||
case "Cronjob":
|
||||
cronjobs, _ := cronjobRepo.List()
|
||||
quicks[i].Detail = fmt.Sprintf("%d", len(cronjobs))
|
||||
quicks[i].Detail = fmt.Sprintf("%d", base.CronjobNumber)
|
||||
case "AppInstalled":
|
||||
appInstall, _ := appInstallRepo.ListBy(context.Background())
|
||||
quicks[i].Detail = fmt.Sprintf("%d", len(appInstall))
|
||||
quicks[i].Detail = fmt.Sprintf("%d", base.AppInstalledNumber)
|
||||
}
|
||||
var item dto.QuickJump
|
||||
_ = copier.Copy(&item, quicks[i])
|
||||
|
|
|
@ -247,11 +247,7 @@
|
|||
: form.websiteList
|
||||
"
|
||||
>
|
||||
<el-option
|
||||
:disabled="websiteOptions.length === 0"
|
||||
:label="$t('commons.table.all')"
|
||||
value="all"
|
||||
/>
|
||||
<el-option :label="$t('commons.table.all')" value="all" />
|
||||
<el-option
|
||||
v-for="(item, index) in websiteOptions"
|
||||
:key="index"
|
||||
|
@ -281,11 +277,7 @@
|
|||
: form.appIdList
|
||||
"
|
||||
>
|
||||
<el-option
|
||||
:disabled="appOptions.length === 0"
|
||||
:label="$t('commons.table.all')"
|
||||
value="all"
|
||||
/>
|
||||
<el-option :label="$t('commons.table.all')" value="all" />
|
||||
<div v-for="item in appOptions" :key="item.id">
|
||||
<el-option :value="item.id + ''" :label="item.name">
|
||||
<span>{{ item.name }}</span>
|
||||
|
@ -320,11 +312,7 @@
|
|||
: form.dbNameList
|
||||
"
|
||||
>
|
||||
<el-option
|
||||
:disabled="dbInfo.dbs.length === 0"
|
||||
:label="$t('commons.table.all')"
|
||||
value="all"
|
||||
/>
|
||||
<el-option :label="$t('commons.table.all')" value="all" />
|
||||
<el-option
|
||||
v-for="item in dbInfo.dbs"
|
||||
:key="item.id"
|
||||
|
|
Loading…
Add table
Reference in a new issue