feat: 增加节点管理 demo 页面

This commit is contained in:
zhengkunwang223 2024-07-22 13:51:14 +08:00
parent 2ef7b8b3b1
commit ef03a75aea
5 changed files with 88 additions and 52 deletions

View File

@ -93,6 +93,8 @@ func Init() {
migrations.AddShellColumn,
migrations.AddClam,
migrations.AddClamStatus,
migrations.AddHOSTMenu,
})
if err := m.Migrate(); err != nil {
global.LOG.Error(err)

View File

@ -288,3 +288,29 @@ var AddClamStatus = &gormigrate.Migration{
return nil
},
}
var AddHOSTMenu = &gormigrate.Migration{
ID: "20240722-add-xpack-host-menu",
Migrate: func(tx *gorm.DB) error {
var (
setting model.Setting
menu dto.XpackHideMenu
)
tx.Model(&model.Setting{}).Where("key", "XpackHideMenu").First(&setting)
if err := json.Unmarshal([]byte(setting.Value), &menu); err != nil {
return err
}
menu.Children = append(menu.Children, dto.XpackHideMenu{
ID: "7",
Title: "多主机",
Path: "/xpack/multihost/manage",
Label: "Multihost",
IsCheck: true,
})
data, err := json.Marshal(menu)
if err != nil {
return err
}
return tx.Model(&model.Setting{}).Where("key", "XpackHideMenu").Updates(map[string]interface{}{"value": string(data)}).Error
},
}

View File

@ -176,57 +176,63 @@
</el-tooltip>
</span>
<el-button
class="h-button"
plain
round
size="small"
@click="openUploads(installed.appKey, installed.name)"
v-if="mode === 'installed'"
>
{{ $t('database.loadBackup') }}
</el-button>
<el-button
class="h-button"
plain
round
size="small"
@click="openBackups(installed.appKey, installed.name, installed.status)"
v-if="mode === 'installed'"
>
{{ $t('commons.button.backup') }}
</el-button>
<el-button
class="h-button"
plain
round
size="small"
:disabled="installed.status === 'Upgrading'"
@click="openOperate(installed, 'ignore')"
v-if="mode === 'upgrade'"
>
{{ $t('commons.button.ignore') }}
</el-button>
<el-button
class="h-button"
plain
round
size="small"
:disabled="
(installed.status !== 'Running' &&
installed.status !== 'UpgradeErr') ||
installed.appStatus === 'TakeDown'
"
@click="openOperate(installed, 'upgrade')"
v-if="mode === 'upgrade'"
>
{{ $t('commons.button.upgrade') }}
</el-button>
</div>
<div class="d-description">
<el-button class="tagMargin" plain size="small">
{{ $t('app.version') }}{{ installed.version }}
</el-button>
<el-button
class="h-button"
plain
round
size="small"
@click="openUploads(installed.appKey, installed.name)"
v-if="mode === 'installed'"
>
{{ $t('database.loadBackup') }}
</el-button>
<el-button
class="h-button"
plain
round
size="small"
@click="
openBackups(
installed.appKey,
installed.name,
installed.status,
)
"
v-if="mode === 'installed'"
>
{{ $t('commons.button.backup') }}
</el-button>
<el-button
class="h-button"
plain
round
size="small"
:disabled="installed.status === 'Upgrading'"
@click="openOperate(installed, 'ignore')"
v-if="mode === 'upgrade'"
>
{{ $t('commons.button.ignore') }}
</el-button>
<el-button
class="h-button"
plain
round
size="small"
:disabled="
(installed.status !== 'Running' &&
installed.status !== 'UpgradeErr') ||
installed.appStatus === 'TakeDown'
"
@click="openOperate(installed, 'upgrade')"
v-if="mode === 'upgrade'"
>
{{ $t('commons.button.upgrade') }}
</el-button>
</div>
<div class="d-description">
<el-button class="tagMargin" plain size="small">
{{ $t('app.version') }}{{ installed.version }}
</el-button>
<el-button
v-if="installed.httpPort > 0"

2
go.mod
View File

@ -258,7 +258,7 @@ require (
google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
google.golang.org/grpc v1.63.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/apimachinery v0.29.2 // indirect

2
go.sum
View File

@ -1165,6 +1165,8 @@ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/cenkalti/backoff.v2 v2.2.1 h1:eJ9UAg01/HIHG987TwxvnzK2MgxXq97YY6rYDpY9aII=