Skip to content

Commit 4f8625f

Browse files
committed
feat(env_group): add upstream test type: local, remote, mirror
1 parent 16aed0c commit 4f8625f

File tree

33 files changed

+1609
-739
lines changed

33 files changed

+1609
-739
lines changed

.air.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ full_bin = "APP_ENV=dev APP_USER=air ./tmp/main"
1515
# Watch these filename extensions.
1616
include_ext = ["go", "tpl", "tmpl", "html", "toml", "po", "conf"]
1717
# Ignore these filename extensions or directories.
18-
exclude_dir = ["assets", "tmp", "vendor", "app/node_modules", "upload", "docs", "resources", ".idea", "cmd"]
18+
exclude_dir = ["assets", "tmp", "vendor", "app/node_modules", "upload", "docs", "resources", ".idea", "cmd", ".go"]
1919
# Watch these directories if you specified.
2020
include_dir = []
2121
# Exclude files.

.devcontainer/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
container_name: nginx-ui
66
volumes:
77
- ../..:/workspaces:cached
8-
- ./go-path:/root/go
8+
- ../.go:/root/go
99
- ./data/nginx:/etc/nginx
1010
- /var/run/docker.sock:/var/run/docker.sock
1111
command: sleep infinity

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ internal/**/*.gen.go
1919
.devcontainer/data
2020
.devcontainer/casdoor.pem
2121
.vscode/.i18n-gettext.secret
22+
.go/

api/analytic/nodes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func GetNodesAnalytic(c *gin.Context) {
107107
defer ws.Close()
108108

109109
for {
110-
// write
110+
// Send NodeMap data to client
111111
err = ws.WriteJSON(analytic.NodeMap)
112112
if err != nil {
113113
if helper.IsUnexpectedWebsocketError(err) {

api/cluster/group.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,19 +110,21 @@ func RestartNginx(c *gin.Context) {
110110
func AddGroup(c *gin.Context) {
111111
cosy.Core[model.EnvGroup](c).
112112
SetValidRules(gin.H{
113-
"name": "required",
114-
"sync_node_ids": "omitempty",
115-
"post_sync_action": "omitempty,oneof=" + model.PostSyncActionNone + " " + model.PostSyncActionReloadNginx,
113+
"name": "required",
114+
"sync_node_ids": "omitempty",
115+
"post_sync_action": "omitempty,oneof=" + model.PostSyncActionNone + " " + model.PostSyncActionReloadNginx,
116+
"upstream_test_type": "omitempty,oneof=" + model.UpstreamTestLocal + " " + model.UpstreamTestRemote + " " + model.UpstreamTestMirror,
116117
}).
117118
Create()
118119
}
119120

120121
func ModifyGroup(c *gin.Context) {
121122
cosy.Core[model.EnvGroup](c).
122123
SetValidRules(gin.H{
123-
"name": "required",
124-
"sync_node_ids": "omitempty",
125-
"post_sync_action": "omitempty,oneof=" + model.PostSyncActionNone + " " + model.PostSyncActionReloadNginx,
124+
"name": "required",
125+
"sync_node_ids": "omitempty",
126+
"post_sync_action": "omitempty,oneof=" + model.PostSyncActionNone + " " + model.PostSyncActionReloadNginx,
127+
"upstream_test_type": "omitempty,oneof=" + model.UpstreamTestLocal + " " + model.UpstreamTestRemote + " " + model.UpstreamTestMirror,
126128
}).
127129
Modify()
128130
}

app/src/api/env_group.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@ export const PostSyncAction = {
77
ReloadNginx: 'reload_nginx',
88
}
99

10+
// Upstream test types
11+
export const UpstreamTestType = {
12+
Local: 'local',
13+
Remote: 'remote',
14+
Mirror: 'mirror',
15+
}
16+
1017
export interface EnvGroup extends ModelBase {
1118
name: string
1219
sync_node_ids: number[]
1320
post_sync_action?: string
21+
upstream_test_type?: string
1422
}
1523

1624
const baseUrl = '/env_groups'

0 commit comments

Comments
 (0)