Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Rainbond
Commits
0789badb
Commit
0789badb
authored
4 years ago
by
yangk
Browse files
Options
Download
Email Patches
Plain Diff
modified single probe and depend_service_id field
parent
b129212d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/handler/service.go
+1
-6
api/handler/service.go
api/model/component.go
+29
-9
api/model/component.go
with
30 additions
and
15 deletions
+30
-15
api/handler/service.go
+
1
-
6
View file @
0789badb
...
...
@@ -2621,13 +2621,8 @@ func (s *ServiceAction) SyncComponentProbes(tx *gorm.DB, components []*api_model
probes
[]
*
dbmodel
.
TenantServiceProbe
)
for
_
,
component
:=
range
components
{
if
component
.
Probes
==
nil
{
continue
}
componentIDs
=
append
(
componentIDs
,
component
.
ComponentBase
.
ComponentID
)
for
_
,
probe
:=
range
component
.
Probes
{
probes
=
append
(
probes
,
probe
.
DbModel
(
component
.
ComponentBase
.
ComponentID
))
}
probes
=
append
(
probes
,
component
.
Probe
.
DbModel
(
component
.
ComponentBase
.
ComponentID
))
}
if
err
:=
db
.
GetManager
()
.
ServiceProbeDaoTransactions
(
tx
)
.
DeleteByComponentIDs
(
componentIDs
);
err
!=
nil
{
return
err
...
...
This diff is collapsed.
Click to expand it.
api/model/component.go
+
29
-
9
View file @
0789badb
...
...
@@ -9,7 +9,7 @@ import (
type
ComponentBase
struct
{
// in: body
// required: true
ComponentID
string
`json:"component_id" validate:"
component_i
d"`
ComponentID
string
`json:"component_id" validate:"
require
d"`
// 服务名称,用于有状态服务DNS
// in: body
// required: false
...
...
@@ -17,7 +17,7 @@ type ComponentBase struct {
// 服务别名
// in: body
// required: true
ComponentAlias
string
`json:"component_alias" validate:"
component_alias
"`
ComponentAlias
string
`json:"component_alias" validate:"
required
"`
// 服务描述
// in: body
// required: false
...
...
@@ -62,10 +62,6 @@ type ComponentBase struct {
// in: body
// required: false
Namespace
string
`json:"namespace" validate:"namespace"`
// 更新时间
// in: body
// required: false
UpdateTime
time
.
Time
`json:"update_time" validate:"update_time"`
// 服务创建类型cloud云市服务,assistant云帮服务
// in: body
// required: false
...
...
@@ -99,7 +95,7 @@ func (c *ComponentBase) DbModel(tenantID, appID string) *dbmodel.TenantServices
// TenantComponentRelation -
type
TenantComponentRelation
struct
{
DependServiceID
string
`json:"dep
end
_service_id"`
DependServiceID
string
`json:"dep_service_id"`
DependServiceType
string
`json:"dep_service_type"`
DependOrder
int
`json:"dep_order"`
}
...
...
@@ -204,6 +200,30 @@ func (l *ComponentLabel) DbModel(componentID string) *dbmodel.TenantServiceLable
}
}
//ComponentEnv -
type
ComponentEnv
struct
{
ContainerPort
int
`validate:"container_port|numeric_between:1,65535" json:"container_port"`
Name
string
`validate:"name" json:"name"`
AttrName
string
`validate:"attr_name|required" json:"attr_name"`
AttrValue
string
`validate:"attr_value" json:"attr_value"`
IsChange
bool
`validate:"is_change|bool" json:"is_change"`
Scope
string
`validate:"scope|in:outer,inner,both,build" json:"scope"`
}
// DbModel return database model
func
(
e
*
ComponentEnv
)
DbModel
(
tenantID
,
componentID
string
)
*
dbmodel
.
TenantServiceEnvVar
{
return
&
dbmodel
.
TenantServiceEnvVar
{
TenantID
:
tenantID
,
ServiceID
:
componentID
,
Name
:
e
.
Name
,
AttrName
:
e
.
AttrName
,
AttrValue
:
e
.
AttrValue
,
ContainerPort
:
e
.
ContainerPort
,
IsChange
:
true
,
Scope
:
e
.
Scope
,
}
}
// Component All attributes related to the component
type
Component
struct
{
ComponentBase
ComponentBase
`json:"component_base"`
...
...
@@ -212,8 +232,8 @@ type Component struct {
Monitors
[]
AddServiceMonitorRequestStruct
`json:"monitors"`
Ports
[]
TenantServicesPort
`json:"ports"`
Relations
[]
TenantComponentRelation
`json:"relations"`
Envs
[]
AddTenantServiceEnvVar
`json:"envs"`
Probe
s
[]
ServiceProbe
`json:"probe
s
"`
Envs
[]
ComponentEnv
`json:"envs"`
Probe
ServiceProbe
`json:"probe"`
AppConfigGroupRels
[]
AppConfigGroupRelations
`json:"app_config_groups"`
Labels
[]
ComponentLabel
`json:"labels"`
Plugins
[]
ComponentPlugin
`json:"plugins"`
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help