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.AddShellColumn,
migrations.AddClam, migrations.AddClam,
migrations.AddClamStatus, migrations.AddClamStatus,
migrations.AddHOSTMenu,
}) })
if err := m.Migrate(); err != nil { if err := m.Migrate(); err != nil {
global.LOG.Error(err) global.LOG.Error(err)

View File

@ -288,3 +288,29 @@ var AddClamStatus = &gormigrate.Migration{
return nil 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> </el-tooltip>
</span> </span>
<el-button <el-button
class="h-button" class="h-button"
plain plain
round round
size="small" size="small"
@click="openUploads(installed.appKey, installed.name)" @click="openUploads(installed.appKey, installed.name)"
v-if="mode === 'installed'" v-if="mode === 'installed'"
> >
{{ $t('database.loadBackup') }} {{ $t('database.loadBackup') }}
</el-button> </el-button>
<el-button <el-button
class="h-button" class="h-button"
plain plain
round round
size="small" size="small"
@click="openBackups(installed.appKey, installed.name, installed.status)" @click="
v-if="mode === 'installed'" openBackups(
> installed.appKey,
{{ $t('commons.button.backup') }} installed.name,
</el-button> installed.status,
<el-button )
class="h-button" "
plain v-if="mode === 'installed'"
round >
size="small" {{ $t('commons.button.backup') }}
:disabled="installed.status === 'Upgrading'" </el-button>
@click="openOperate(installed, 'ignore')" <el-button
v-if="mode === 'upgrade'" class="h-button"
> plain
{{ $t('commons.button.ignore') }} round
</el-button> size="small"
<el-button :disabled="installed.status === 'Upgrading'"
class="h-button" @click="openOperate(installed, 'ignore')"
plain v-if="mode === 'upgrade'"
round >
size="small" {{ $t('commons.button.ignore') }}
:disabled=" </el-button>
(installed.status !== 'Running' && <el-button
installed.status !== 'UpgradeErr') || class="h-button"
installed.appStatus === 'TakeDown' plain
" round
@click="openOperate(installed, 'upgrade')" size="small"
v-if="mode === 'upgrade'" :disabled="
> (installed.status !== 'Running' &&
{{ $t('commons.button.upgrade') }} installed.status !== 'UpgradeErr') ||
</el-button> installed.appStatus === 'TakeDown'
</div> "
<div class="d-description"> @click="openOperate(installed, 'upgrade')"
<el-button class="tagMargin" plain size="small"> v-if="mode === 'upgrade'"
{{ $t('app.version') }}{{ installed.version }} >
</el-button> {{ $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 <el-button
v-if="installed.httpPort > 0" 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/api v0.0.0-20240311132316-a219d84964c2 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
google.golang.org/grpc v1.63.1 // 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/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/apimachinery v0.29.2 // 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.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 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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/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/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/cenkalti/backoff.v2 v2.2.1 h1:eJ9UAg01/HIHG987TwxvnzK2MgxXq97YY6rYDpY9aII= gopkg.in/cenkalti/backoff.v2 v2.2.1 h1:eJ9UAg01/HIHG987TwxvnzK2MgxXq97YY6rYDpY9aII=