mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-11 16:06:02 +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"
|
import "time"
|
||||||
|
|
||||||
type DashboardBase struct {
|
type DashboardBase struct {
|
||||||
|
WebsiteNumber int `json:"websiteNumber"`
|
||||||
|
DatabaseNumber int `json:"databaseNumber"`
|
||||||
|
CronjobNumber int `json:"cronjobNumber"`
|
||||||
|
AppInstalledNumber int `json:"appInstalledNumber"`
|
||||||
|
|
||||||
Hostname string `json:"hostname"`
|
Hostname string `json:"hostname"`
|
||||||
OS string `json:"os"`
|
OS string `json:"os"`
|
||||||
Platform string `json:"platform"`
|
Platform string `json:"platform"`
|
||||||
|
|
|
@ -572,22 +572,30 @@ func loadOutboundIP() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadQuickJump(base *dto.DashboardBase) {
|
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)
|
quicks := launcherRepo.ListQuickJump(false)
|
||||||
for i := 0; i < len(quicks); i++ {
|
for i := 0; i < len(quicks); i++ {
|
||||||
switch quicks[i].Name {
|
switch quicks[i].Name {
|
||||||
case "Website":
|
case "Website":
|
||||||
website, _ := websiteRepo.GetBy()
|
quicks[i].Detail = fmt.Sprintf("%d", base.WebsiteNumber)
|
||||||
quicks[i].Detail = fmt.Sprintf("%d", len(website))
|
|
||||||
case "Database":
|
case "Database":
|
||||||
postgresqlDbs, _ := postgresqlRepo.List()
|
quicks[i].Detail = fmt.Sprintf("%d", base.DatabaseNumber)
|
||||||
mysqlDbs, _ := mysqlRepo.List()
|
|
||||||
quicks[i].Detail = fmt.Sprintf("%d", len(mysqlDbs)+len(postgresqlDbs))
|
|
||||||
case "Cronjob":
|
case "Cronjob":
|
||||||
cronjobs, _ := cronjobRepo.List()
|
quicks[i].Detail = fmt.Sprintf("%d", base.CronjobNumber)
|
||||||
quicks[i].Detail = fmt.Sprintf("%d", len(cronjobs))
|
|
||||||
case "AppInstalled":
|
case "AppInstalled":
|
||||||
appInstall, _ := appInstallRepo.ListBy(context.Background())
|
quicks[i].Detail = fmt.Sprintf("%d", base.AppInstalledNumber)
|
||||||
quicks[i].Detail = fmt.Sprintf("%d", len(appInstall))
|
|
||||||
}
|
}
|
||||||
var item dto.QuickJump
|
var item dto.QuickJump
|
||||||
_ = copier.Copy(&item, quicks[i])
|
_ = copier.Copy(&item, quicks[i])
|
||||||
|
|
|
@ -247,11 +247,7 @@
|
||||||
: form.websiteList
|
: form.websiteList
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option :label="$t('commons.table.all')" value="all" />
|
||||||
:disabled="websiteOptions.length === 0"
|
|
||||||
:label="$t('commons.table.all')"
|
|
||||||
value="all"
|
|
||||||
/>
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(item, index) in websiteOptions"
|
v-for="(item, index) in websiteOptions"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
@ -281,11 +277,7 @@
|
||||||
: form.appIdList
|
: form.appIdList
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option :label="$t('commons.table.all')" value="all" />
|
||||||
:disabled="appOptions.length === 0"
|
|
||||||
:label="$t('commons.table.all')"
|
|
||||||
value="all"
|
|
||||||
/>
|
|
||||||
<div v-for="item in appOptions" :key="item.id">
|
<div v-for="item in appOptions" :key="item.id">
|
||||||
<el-option :value="item.id + ''" :label="item.name">
|
<el-option :value="item.id + ''" :label="item.name">
|
||||||
<span>{{ item.name }}</span>
|
<span>{{ item.name }}</span>
|
||||||
|
@ -320,11 +312,7 @@
|
||||||
: form.dbNameList
|
: form.dbNameList
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option :label="$t('commons.table.all')" value="all" />
|
||||||
:disabled="dbInfo.dbs.length === 0"
|
|
||||||
:label="$t('commons.table.all')"
|
|
||||||
value="all"
|
|
||||||
/>
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dbInfo.dbs"
|
v-for="item in dbInfo.dbs"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
|
|
Loading…
Add table
Reference in a new issue