mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 14:08:06 +08:00
fix: 解决 node.js 运行环境模块页面打开失败的问题 (#2498)
This commit is contained in:
parent
153fe5c1db
commit
8f713c0eda
@ -191,7 +191,7 @@ func (b *BaseApi) GetNodeModules(c *gin.Context) {
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /runtimes/node/modules/operate [post]
|
||||
func (b *BaseApi) OperateNodeModules(c *gin.Context) {
|
||||
var req request.NodeModuleReq
|
||||
var req request.NodeModuleOperateReq
|
||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -54,9 +54,13 @@ type RuntimeOperate struct {
|
||||
ID uint `json:"ID"`
|
||||
}
|
||||
|
||||
type NodeModuleReq struct {
|
||||
type NodeModuleOperateReq struct {
|
||||
Operate string `json:"operate" validate:"oneof=install uninstall update"`
|
||||
ID uint `json:"ID" validate:"required"`
|
||||
Module string `json:"module"`
|
||||
PkgManager string `json:"pkgManager" validate:"oneof=npm yarn"`
|
||||
}
|
||||
|
||||
type NodeModuleReq struct {
|
||||
ID uint `json:"ID" validate:"required"`
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ type IRuntimeService interface {
|
||||
GetNodePackageRunScript(req request.NodePackageReq) ([]response.PackageScripts, error)
|
||||
OperateRuntime(req request.RuntimeOperate) error
|
||||
GetNodeModules(req request.NodeModuleReq) ([]response.NodeModule, error)
|
||||
OperateNodeModules(req request.NodeModuleReq) error
|
||||
OperateNodeModules(req request.NodeModuleOperateReq) error
|
||||
}
|
||||
|
||||
func NewRuntimeService() IRuntimeService {
|
||||
@ -482,7 +482,7 @@ func (r *RuntimeService) GetNodeModules(req request.NodeModuleReq) ([]response.N
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (r *RuntimeService) OperateNodeModules(req request.NodeModuleReq) error {
|
||||
func (r *RuntimeService) OperateNodeModules(req request.NodeModuleOperateReq) error {
|
||||
runtime, err := runtimeRepo.GetFirst(commonRepo.WithByID(req.ID))
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
x
Reference in New Issue
Block a user