implement remote call for remote action
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
package rule
|
||||
|
||||
package rule
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
"cloud.o-forge.io/core/oc-lib/tools"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type Rule struct {
|
||||
utils.AbstractObject
|
||||
Description string `json:"description,omitempty" bson:"description,omitempty"`
|
||||
Condition string `json:"condition,omitempty" bson:"condition,omitempty"`
|
||||
Actions []string `json:"actions,omitempty" bson:"actions,omitempty"`
|
||||
Description string `json:"description,omitempty" bson:"description,omitempty"`
|
||||
Condition string `json:"condition,omitempty" bson:"condition,omitempty"`
|
||||
Actions []string `json:"actions,omitempty" bson:"actions,omitempty"`
|
||||
}
|
||||
|
||||
func (ao *Rule) GetID() string {
|
||||
@@ -26,9 +27,9 @@ func (d *Rule) GetName() string {
|
||||
return d.Name
|
||||
}
|
||||
|
||||
func (d *Rule) GetAccessor() utils.Accessor {
|
||||
func (d *Rule) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
||||
data := New()
|
||||
data.SetLogger(utils.RULE)
|
||||
data.Init(utils.RULE, caller)
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
"cloud.o-forge.io/core/oc-lib/tools"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
@@ -30,9 +31,9 @@ func (d *SharedWorkspace) GetName() string {
|
||||
return d.Name
|
||||
}
|
||||
|
||||
func (d *SharedWorkspace) GetAccessor() utils.Accessor {
|
||||
func (d *SharedWorkspace) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
||||
data := New()
|
||||
data.SetLogger(utils.SHARED_WORKSPACE)
|
||||
data.Init(utils.SHARED_WORKSPACE, caller)
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ func (wfa *sharedWorkspaceMongoAccessor) sharedWorkspace(shared *SharedWorkspace
|
||||
eldest, code, _ := wfa.LoadOne(id)
|
||||
if code == 200 {
|
||||
eld := eldest.(*SharedWorkspace)
|
||||
accessor := (&workspace.Workspace{}).GetAccessor()
|
||||
accessor := (&workspace.Workspace{}).GetAccessor(nil)
|
||||
if eld.Workspaces != nil {
|
||||
for _, v := range eld.Workspaces {
|
||||
accessor.UpdateOne(&workspace.Workspace{Shared: false}, v)
|
||||
@@ -43,7 +43,7 @@ func (wfa *sharedWorkspaceMongoAccessor) sharedWorkspace(shared *SharedWorkspace
|
||||
}
|
||||
|
||||
func (wfa *sharedWorkspaceMongoAccessor) sharedWorkflow(shared *SharedWorkspace, id string) {
|
||||
accessor := (&w.Workflow{}).GetAccessor()
|
||||
accessor := (&w.Workflow{}).GetAccessor(nil)
|
||||
eldest, code, _ := wfa.LoadOne(id)
|
||||
if code == 200 {
|
||||
eld := eldest.(*SharedWorkspace)
|
||||
|
||||
Reference in New Issue
Block a user