Skip to content

Commit

Permalink
Merge pull request #6 from Dot-Liu/main
Browse files Browse the repository at this point in the history
拆分代码
  • Loading branch information
Dot-Liu authored Jul 12, 2024
2 parents 9ba7c05 + c35e4ab commit 567e34f
Show file tree
Hide file tree
Showing 53 changed files with 144 additions and 5,148 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.DS_Store
/.idea/
/build/
/apipark
/config.yml
35 changes: 0 additions & 35 deletions controller/external-app/external_app.go

This file was deleted.

45 changes: 0 additions & 45 deletions controller/external-app/iml.go

This file was deleted.

126 changes: 0 additions & 126 deletions controller/monitor/iml.go

This file was deleted.

31 changes: 0 additions & 31 deletions controller/monitor/statistic.go

This file was deleted.

18 changes: 1 addition & 17 deletions controller/partition/iml.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package partition

import (
"errors"

"github.com/eolinker/apipark/module/partition"
parition_dto "github.com/eolinker/apipark/module/partition/dto"
"github.com/eolinker/go-common/auto"
Expand All @@ -29,22 +29,6 @@ func (p *imlPartition) Check(ctx *gin.Context, input *parition_dto.CheckCluster)
return p.partitionModule.CheckCluster(ctx, input.Address)
}

func (p *imlPartition) DeleteMonitorConfig(ctx *gin.Context, partition string) error {
return p.partitionModule.DeleteMonitorConfig(ctx, partition)
}

func (p *imlPartition) MonitorPartitions(ctx *gin.Context) ([]*parition_dto.MonitorPartition, error) {
return p.partitionModule.MonitorPartitions(ctx)
}

func (p *imlPartition) SaveMonitorConfig(ctx *gin.Context, partition string, cfg *parition_dto.SaveMonitorConfig) (*parition_dto.MonitorConfig, error) {
return p.partitionModule.SaveMonitorConfig(ctx, partition, cfg)
}

func (p *imlPartition) GetMonitorConfig(ctx *gin.Context, partition string) (*parition_dto.MonitorConfig, error) {
return p.partitionModule.GetMonitorConfig(ctx, partition)
}

func (p *imlPartition) SimpleWithCluster(ctx *gin.Context) ([]*parition_dto.SimpleWithCluster, error) {
return p.partitionModule.SimpleWithCluster(ctx)
}
Expand Down
9 changes: 3 additions & 6 deletions controller/partition/partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package partition

import (
"reflect"

parition_dto "github.com/eolinker/apipark/module/partition/dto"

"github.com/eolinker/go-common/auto"
"github.com/eolinker/go-common/autowire"
"github.com/gin-gonic/gin"
Expand All @@ -18,10 +18,7 @@ type IPartitionController interface {
Update(ctx *gin.Context, id string, input *parition_dto.Edit) (*parition_dto.Detail, error)
Delete(ctx *gin.Context, id string) (string, error)
SimpleWithCluster(ctx *gin.Context) ([]*parition_dto.SimpleWithCluster, error)
SaveMonitorConfig(ctx *gin.Context, partition string, cfg *parition_dto.SaveMonitorConfig) (*parition_dto.MonitorConfig, error)
GetMonitorConfig(ctx *gin.Context, partition string) (*parition_dto.MonitorConfig, error)
DeleteMonitorConfig(ctx *gin.Context, partition string) error
MonitorPartitions(ctx *gin.Context) ([]*parition_dto.MonitorPartition, error)

Nodes(ctx *gin.Context, partitionId string) ([]*parition_dto.Node, error)
ResetCluster(ctx *gin.Context, partitionId string, input *parition_dto.ResetCluster) ([]*parition_dto.Node, error)
Check(ctx *gin.Context, input *parition_dto.CheckCluster) ([]*parition_dto.Node, error)
Expand Down
18 changes: 3 additions & 15 deletions controller/project/iml.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
package project

import (
project_monitor "github.com/eolinker/apipark/module/project-monitor"
project_monitor_dto "github.com/eolinker/apipark/module/project-monitor/dto"

"github.com/eolinker/apipark/module/project"
project_dto "github.com/eolinker/apipark/module/project/dto"
"github.com/gin-gonic/gin"
)

var (
_ IProjectController = (*imlProjectController)(nil)
_ IProjectMemberController = (*imlProjectMemberController)(nil)
_ IProjectMonitorController = (*imlProjectMonitorController)(nil)
_ IAppController = (*imlAppController)(nil)
_ IProjectController = (*imlProjectController)(nil)
_ IProjectMemberController = (*imlProjectMemberController)(nil)
_ IAppController = (*imlAppController)(nil)
)

type imlProjectController struct {
Expand Down Expand Up @@ -80,14 +76,6 @@ func (i *imlProjectMemberController) EditProjectMember(ctx *gin.Context, pid str
return i.module.EditProjectMember(ctx, pid, uid, edit.Roles)
}

type imlProjectMonitorController struct {
module project_monitor.IProjectMonitor `autowired:""`
}

func (i *imlProjectMonitorController) MonitorPartitions(ctx *gin.Context, pid string) ([]*project_monitor_dto.MonitorPartition, error) {
return i.module.MonitorPartitions(ctx, pid)
}

type imlAppController struct {
module project.IAppModule `autowired:""`
}
Expand Down
18 changes: 4 additions & 14 deletions controller/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ package project

import (
"reflect"

project_monitor_dto "github.com/eolinker/apipark/module/project-monitor/dto"


project_dto "github.com/eolinker/apipark/module/project/dto"
"github.com/gin-gonic/gin"

"github.com/eolinker/go-common/autowire"
)

Expand Down Expand Up @@ -43,15 +41,10 @@ type IProjectMemberController interface {
SimpleMembersToAdd(ctx *gin.Context, pid string, keyword string) ([]*project_dto.TeamMemberToAdd, error)
}

type IProjectMonitorController interface {
// MonitorPartitions 获取项目监控分区列表
MonitorPartitions(ctx *gin.Context, pid string) ([]*project_monitor_dto.MonitorPartition, error)
}

type IAppController interface {
// CreateApp 创建应用
CreateApp(ctx *gin.Context, teamID string, project *project_dto.CreateApp) (*project_dto.App, error)

UpdateApp(ctx *gin.Context, appId string, project *project_dto.UpdateApp) (*project_dto.App, error)
SearchMyApps(ctx *gin.Context, teamId string, keyword string) ([]*project_dto.AppItem, error)
// SimpleApps 获取简易项目列表
Expand All @@ -68,10 +61,7 @@ func init() {
autowire.Auto[IProjectMemberController](func() reflect.Value {
return reflect.ValueOf(new(imlProjectMemberController))
})
autowire.Auto[IProjectMonitorController](func() reflect.Value {
return reflect.ValueOf(new(imlProjectMonitorController))
})


autowire.Auto[IAppController](func() reflect.Value {
return reflect.ValueOf(new(imlAppController))
})
Expand Down
Loading

0 comments on commit 567e34f

Please sign in to comment.