Merge pull request #745 from mynameisny/feature/process-instance-assignment

设置任务审批人功能优化
This commit is contained in:
yunion-ci-robot
2019-05-07 14:28:15 +08:00
committed by GitHub
2 changed files with 19 additions and 3 deletions
+2 -1
View File
@@ -27,7 +27,8 @@ func init() {
* 使用文件创建部署
*/
type DeploymentCreateOptions struct {
FILE string `help:"The local bpmn filename to Upload"`
FILE string `help:"The local bpmn filename to Upload"`
TenantID string `help:"ID of tenant"`
}
R(&DeploymentCreateOptions{}, "process-deployment-create", "Create deployment by upload BPMN file", func(s *mcclient.ClientSession, args *DeploymentCreateOptions) error {
// TODO
+17 -2
View File
@@ -29,15 +29,30 @@ func init() {
type ProcessInstanceCreateOptions struct {
PROCESS_DEFINITION_KEY string `help:"Key of the process definition"`
INITIATOR string `help:"ID of user who launch the process instance"`
ASSIGNEE string `help:"ID of assignee"`
SERVER_CREATE_PARAMTER string `help:"Onecloud server create spec json string"`
UserId string `help:"ID of user"`
RoleId string `help:"ID of role"`
ProjectId string `help:"ID of project"`
Percent string `help:"Great than Percent of nrOfCompletedInstances/nrOfInstances"`
}
R(&ProcessInstanceCreateOptions{}, "process-instance-create", "Create process instance", func(s *mcclient.ClientSession, args *ProcessInstanceCreateOptions) error {
variables_params := jsonutils.NewDict()
variables_params.Add(jsonutils.NewString(args.PROCESS_DEFINITION_KEY), "process_definition_key")
variables_params.Add(jsonutils.NewString(args.INITIATOR), "initiator")
variables_params.Add(jsonutils.NewString(args.ASSIGNEE), "assignee")
variables_params.Add(jsonutils.NewString(args.SERVER_CREATE_PARAMTER), "server-create-paramter")
if len(args.UserId) > 0 {
variables_params.Add(jsonutils.NewString(args.UserId), "user-id")
} else {
if len(args.RoleId) > 0 {
variables_params.Add(jsonutils.NewString(args.RoleId), "role-id")
}
if len(args.ProjectId) > 0 {
variables_params.Add(jsonutils.NewString(args.ProjectId), "project-id")
}
}
if len(args.Percent) > 0 {
variables_params.Add(jsonutils.NewString(args.Percent), "percent")
}
params := jsonutils.NewDict()
params.Add(variables_params, "variables")
result, err := modules.ProcessInstance.Create(s, params)