diff --git a/platform-core/api/api.go b/platform-core/api/api.go index 3c52e1b282..70ecc4310e 100644 --- a/platform-core/api/api.go +++ b/platform-core/api/api.go @@ -164,6 +164,7 @@ func init() { &handlerFuncObj{Url: "/process/definitions/collect/add", Method: "POST", HandlerFunc: process.AddProcDefCollect, ApiCode: "add-proc-collect"}, &handlerFuncObj{Url: "/process/definitions/collect/del", Method: "POST", HandlerFunc: process.DelProcDefCollect, ApiCode: "del-proc-collect"}, &handlerFuncObj{Url: "/process/definitions/sub/list", Method: "POST", HandlerFunc: process.SubProcDefList, ApiCode: "sub-proc-list"}, + &handlerFuncObj{Url: "/process/definitions/nodes/empty-query", Method: "GET", HandlerFunc: process.QueryEmptyNodes, ApiCode: "query-empty-node"}, // process runtime &handlerFuncObj{Url: "/process/definitions", Method: "GET", HandlerFunc: process.ProcDefList, ApiCode: "list-process-def"}, diff --git a/platform-core/api/v1/process/manage.go b/platform-core/api/v1/process/manage.go index 9d25bec238..35b2b74c5a 100644 --- a/platform-core/api/v1/process/manage.go +++ b/platform-core/api/v1/process/manage.go @@ -1734,3 +1734,31 @@ func DelProcDefCollect(c *gin.Context) { middleware.ReturnSuccess(c) } } + +func QueryEmptyNodes(c *gin.Context) { + var nodeIds, result []string + var err error + var procDefNodes []*models.ProcDefNode + processSessionId := c.Query("processSessionId") + procDefId := c.Query("procDefId") + if strings.TrimSpace(processSessionId) == "" || strings.TrimSpace(procDefId) == "" { + middleware.ReturnError(c, exterror.Catch(exterror.New().RequestParamValidateError, fmt.Errorf("processSessionId or procDefId empty"))) + return + } + if procDefNodes, err = database.GetProcDefNodeById(c, procDefId); err != nil { + middleware.ReturnError(c, err) + return + } + if nodeIds, err = database.GetProcDefNodeIdsBySessionId(c, processSessionId); err != nil { + middleware.ReturnError(c, err) + return + } + for _, node := range procDefNodes { + if node.NodeType == string(models.ProcDefNodeTypeAutomatic) || node.NodeType == string(models.ProcDefNodeSubProcess) || node.NodeType == string(models.ProcDefNodeTypeData) { + if !tools.Contains(nodeIds, node.Id) { + result = append(result, node.Name) + } + } + } + middleware.ReturnData(c, result) +} diff --git a/platform-core/common/tools/utils.go b/platform-core/common/tools/utils.go index 57731175f7..a9cf1e818a 100644 --- a/platform-core/common/tools/utils.go +++ b/platform-core/common/tools/utils.go @@ -131,3 +131,13 @@ func RSADecrypt(inputString, rsaPemContent string) (string, error) { result = string(decodeBytes) return result, nil } + +func Contains(ids []string, id string) bool { + var exist = false + for _, item := range ids { + if item == id { + exist = true + } + } + return exist +} diff --git a/platform-core/services/database/process-exec.go b/platform-core/services/database/process-exec.go index 3b996810b9..24c79ea2ad 100644 --- a/platform-core/services/database/process-exec.go +++ b/platform-core/services/database/process-exec.go @@ -266,6 +266,11 @@ func CreateProcPreview(ctx context.Context, previewRows []*models.ProcDataPrevie return } +func GetProcDefNodeIdsBySessionId(ctx context.Context, sessionId string) (result []string, err error) { + err = db.MysqlEngine.Context(ctx).SQL("select proc_def_node_id from proc_data_preview where proc_session_id=?", sessionId).Find(&result) + return +} + func ProcInsTaskNodeBindings(ctx context.Context, sessionId, taskNodeId string) (result []*models.TaskNodeBindingObj, err error) { var previewRows []*models.ProcDataPreview nodeBindDataMap := make(map[string][]*models.ProcDataBinding) diff --git a/wecube-portal/src/pages/login.vue b/wecube-portal/src/pages/login.vue index 426141dd85..d6f7e37bec 100644 --- a/wecube-portal/src/pages/login.vue +++ b/wecube-portal/src/pages/login.vue @@ -58,7 +58,7 @@ export default { data() { return { username: '', - password: '', + ***REMOVED*** encryptKey: '', loading: false, showRoleApply: false,