diff --git a/sqle/api/app.go b/sqle/api/app.go index 3b3bfc2ce..2affdb575 100644 --- a/sqle/api/app.go +++ b/sqle/api/app.go @@ -508,7 +508,9 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config *config.SqleOpti v1Router.GET("/dashboard/sql_manages", v1.GetGlobalSqlManageList) v1Router.GET("/dashboard/sql_manages/statistics", v1.GetGlobalSqlManageStatistics) v1Router.GET("/dashboard/workflows", v1.GetGlobalWorkflowsV1) + v1Router.GET("/dashboard/data_export_workflows", v1.GetGlobalDataExportWorkflowsV1) v1Router.GET("/dashboard/workflows/statistics", v1.GetGlobalWorkflowStatistics) + v1Router.GET("/dashboard/data_export_workflows/statistics", v1.GetGlobalDataExportWorkflowStatisticsV1) // configurations v1Router.GET("/configurations/drivers", v1.GetDrivers) diff --git a/sqle/api/controller/v1/workflow.go b/sqle/api/controller/v1/workflow.go index 071e083ba..27f245d3c 100644 --- a/sqle/api/controller/v1/workflow.go +++ b/sqle/api/controller/v1/workflow.go @@ -929,6 +929,42 @@ func GetGlobalWorkflowStatistics(c echo.Context) error { }) } +// GetGlobalDataExportWorkflowsV1 +// @Summary 获取全局导出工单列表 +// @Description get global data export workflows list +// @Tags workflow +// @Id getGlobalDataExportWorkflowsV1 +// @Security ApiKeyAuth +// @Param filter_create_user_id query string false "filter create user id" +// @Param filter_status_list query []string false "filter by workflow status,support using many status" Enums(wait_for_approve,wait_for_export,exporting,failed,rejected,cancel,finish) +// @Param filter_project_uid query string false "filter by project uid" +// @Param filter_instance_id query string false "filter by instance id in project" +// @Param filter_project_priority query string false "filter by project priority" Enums(high,medium,low) +// @Param page_index query uint32 true "page index" +// @Param page_size query uint32 true "size of per page" +// @Success 200 {object} v1.GetWorkflowsResV1 +// @router /v1/dashboard/data_export_workflows [get] +func GetGlobalDataExportWorkflowsV1(c echo.Context) error { + return getGlobalDataExportWorkflowsV1(c) +} + +// GetGlobalDataExportWorkflowStatisticsV1 +// @Summary 获取全局导出工单统计数据 +// @Description get global data export workflows statistics +// @Tags workflow +// @Id getGlobalDataExportWorkflowStatisticsV1 +// @Security ApiKeyAuth +// @Param filter_create_user_id query string false "filter create user id" +// @Param filter_status_list query []string false "filter by workflow status,support using many status" Enums(wait_for_approve,wait_for_export,exporting,failed,rejected,cancel,finish) +// @Param filter_project_uid query string false "filter by project uid" +// @Param filter_instance_id query string false "filter by instance id in project" +// @Param filter_project_priority query string false "filter by project priority" Enums(high,medium,low) +// @Success 200 {object} v1.GlobalWorkflowStatisticsResV1 +// @router /v1/dashboard/data_export_workflows/statistics [get] +func GetGlobalDataExportWorkflowStatisticsV1(c echo.Context) error { + return getGlobalDataExportWorkflowStatisticsV1(c) +} + type globalWorkflowBasicFilter struct { FilterCreateUserId string `json:"filter_create_user_id" query:"filter_create_user_id"` FilterStatusList []string `json:"filter_status_list" query:"filter_status_list" validate:"dive,oneof=wait_for_audit wait_for_execution rejected canceled executing exec_failed finished"` diff --git a/sqle/api/controller/v1/workflow_ce.go b/sqle/api/controller/v1/workflow_ce.go index 4a62fda36..c6489ec83 100644 --- a/sqle/api/controller/v1/workflow_ce.go +++ b/sqle/api/controller/v1/workflow_ce.go @@ -21,6 +21,7 @@ var ( errCommunityEditionDoesNotSupportFeatureExportWorkflowList = errors.New(errors.EnterpriseEditionFeatures, e.New("community edition does not support feature export workflow list")) errCommunityEditionDoesNotSupportWorkflowTemplate = errors.New(errors.EnterpriseEditionFeatures, e.New("community edition does not support workflow template")) errCommunityEditionDoesNotSupportFileOrder = errors.New(errors.EnterpriseEditionFeatures, e.New("community edition does not support file order")) + errCommunityEditionDoesNotSupportDataExportWorkflowList = errors.New(errors.EnterpriseEditionFeatures, e.New("community edition does not support data export workflow list")) ) func exportWorkflowV1(c echo.Context) error { @@ -50,3 +51,11 @@ func updateWorkflowTemplate(c echo.Context) error { func updateSqlFileOrderByWorkflow(c echo.Context) error { return controller.JSONBaseErrorReq(c, errCommunityEditionDoesNotSupportFileOrder) } + +func getGlobalDataExportWorkflowsV1(c echo.Context) error { + return controller.JSONBaseErrorReq(c, errCommunityEditionDoesNotSupportDataExportWorkflowList) +} + +func getGlobalDataExportWorkflowStatisticsV1(c echo.Context) error { + return controller.JSONBaseErrorReq(c, errCommunityEditionDoesNotSupportDataExportWorkflowList) +} diff --git a/sqle/docs/docs.go b/sqle/docs/docs.go index af109125e..a738d9dfb 100644 --- a/sqle/docs/docs.go +++ b/sqle/docs/docs.go @@ -1026,6 +1026,164 @@ var doc = `{ } } }, + "/v1/dashboard/data_export_workflows": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "get global data export workflows list", + "tags": [ + "workflow" + ], + "summary": "获取全局导出工单列表", + "operationId": "getGlobalDataExportWorkflowsV1", + "parameters": [ + { + "type": "string", + "description": "filter create user id", + "name": "filter_create_user_id", + "in": "query" + }, + { + "enum": [ + "wait_for_approve", + "wait_for_export", + "exporting", + "failed", + "rejected", + "cancel", + "finish" + ], + "type": "array", + "items": { + "type": "string" + }, + "description": "filter by workflow status,support using many status", + "name": "filter_status_list", + "in": "query" + }, + { + "type": "string", + "description": "filter by project uid", + "name": "filter_project_uid", + "in": "query" + }, + { + "type": "string", + "description": "filter by instance id in project", + "name": "filter_instance_id", + "in": "query" + }, + { + "enum": [ + "high", + "medium", + "low" + ], + "type": "string", + "description": "filter by project priority", + "name": "filter_project_priority", + "in": "query" + }, + { + "type": "integer", + "description": "page index", + "name": "page_index", + "in": "query", + "required": true + }, + { + "type": "integer", + "description": "size of per page", + "name": "page_size", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1.GetWorkflowsResV1" + } + } + } + } + }, + "/v1/dashboard/data_export_workflows/statistics": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "get global data export workflows statistics", + "tags": [ + "workflow" + ], + "summary": "获取全局导出工单统计数据", + "operationId": "getGlobalDataExportWorkflowStatisticsV1", + "parameters": [ + { + "type": "string", + "description": "filter create user id", + "name": "filter_create_user_id", + "in": "query" + }, + { + "enum": [ + "wait_for_approve", + "wait_for_export", + "exporting", + "failed", + "rejected", + "cancel", + "finish" + ], + "type": "array", + "items": { + "type": "string" + }, + "description": "filter by workflow status,support using many status", + "name": "filter_status_list", + "in": "query" + }, + { + "type": "string", + "description": "filter by project uid", + "name": "filter_project_uid", + "in": "query" + }, + { + "type": "string", + "description": "filter by instance id in project", + "name": "filter_instance_id", + "in": "query" + }, + { + "enum": [ + "high", + "medium", + "low" + ], + "type": "string", + "description": "filter by project priority", + "name": "filter_project_priority", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1.GlobalWorkflowStatisticsResV1" + } + } + } + } + }, "/v1/dashboard/sql_manages": { "get": { "security": [ diff --git a/sqle/docs/swagger.json b/sqle/docs/swagger.json index 9381c2ac2..c4a78b90d 100644 --- a/sqle/docs/swagger.json +++ b/sqle/docs/swagger.json @@ -1010,6 +1010,164 @@ } } }, + "/v1/dashboard/data_export_workflows": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "get global data export workflows list", + "tags": [ + "workflow" + ], + "summary": "获取全局导出工单列表", + "operationId": "getGlobalDataExportWorkflowsV1", + "parameters": [ + { + "type": "string", + "description": "filter create user id", + "name": "filter_create_user_id", + "in": "query" + }, + { + "enum": [ + "wait_for_approve", + "wait_for_export", + "exporting", + "failed", + "rejected", + "cancel", + "finish" + ], + "type": "array", + "items": { + "type": "string" + }, + "description": "filter by workflow status,support using many status", + "name": "filter_status_list", + "in": "query" + }, + { + "type": "string", + "description": "filter by project uid", + "name": "filter_project_uid", + "in": "query" + }, + { + "type": "string", + "description": "filter by instance id in project", + "name": "filter_instance_id", + "in": "query" + }, + { + "enum": [ + "high", + "medium", + "low" + ], + "type": "string", + "description": "filter by project priority", + "name": "filter_project_priority", + "in": "query" + }, + { + "type": "integer", + "description": "page index", + "name": "page_index", + "in": "query", + "required": true + }, + { + "type": "integer", + "description": "size of per page", + "name": "page_size", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1.GetWorkflowsResV1" + } + } + } + } + }, + "/v1/dashboard/data_export_workflows/statistics": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "get global data export workflows statistics", + "tags": [ + "workflow" + ], + "summary": "获取全局导出工单统计数据", + "operationId": "getGlobalDataExportWorkflowStatisticsV1", + "parameters": [ + { + "type": "string", + "description": "filter create user id", + "name": "filter_create_user_id", + "in": "query" + }, + { + "enum": [ + "wait_for_approve", + "wait_for_export", + "exporting", + "failed", + "rejected", + "cancel", + "finish" + ], + "type": "array", + "items": { + "type": "string" + }, + "description": "filter by workflow status,support using many status", + "name": "filter_status_list", + "in": "query" + }, + { + "type": "string", + "description": "filter by project uid", + "name": "filter_project_uid", + "in": "query" + }, + { + "type": "string", + "description": "filter by instance id in project", + "name": "filter_instance_id", + "in": "query" + }, + { + "enum": [ + "high", + "medium", + "low" + ], + "type": "string", + "description": "filter by project priority", + "name": "filter_project_priority", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1.GlobalWorkflowStatisticsResV1" + } + } + } + } + }, "/v1/dashboard/sql_manages": { "get": { "security": [ diff --git a/sqle/docs/swagger.yaml b/sqle/docs/swagger.yaml index 7d29e65e2..f52e5fe85 100644 --- a/sqle/docs/swagger.yaml +++ b/sqle/docs/swagger.yaml @@ -8012,6 +8012,114 @@ paths: summary: 获取 dashboard 信息 tags: - dashboard + /v1/dashboard/data_export_workflows: + get: + description: get global data export workflows list + operationId: getGlobalDataExportWorkflowsV1 + parameters: + - description: filter create user id + in: query + name: filter_create_user_id + type: string + - description: filter by workflow status,support using many status + enum: + - wait_for_approve + - wait_for_export + - exporting + - failed + - rejected + - cancel + - finish + in: query + items: + type: string + name: filter_status_list + type: array + - description: filter by project uid + in: query + name: filter_project_uid + type: string + - description: filter by instance id in project + in: query + name: filter_instance_id + type: string + - description: filter by project priority + enum: + - high + - medium + - low + in: query + name: filter_project_priority + type: string + - description: page index + in: query + name: page_index + required: true + type: integer + - description: size of per page + in: query + name: page_size + required: true + type: integer + responses: + "200": + description: OK + schema: + $ref: '#/definitions/v1.GetWorkflowsResV1' + security: + - ApiKeyAuth: [] + summary: 获取全局导出工单列表 + tags: + - workflow + /v1/dashboard/data_export_workflows/statistics: + get: + description: get global data export workflows statistics + operationId: getGlobalDataExportWorkflowStatisticsV1 + parameters: + - description: filter create user id + in: query + name: filter_create_user_id + type: string + - description: filter by workflow status,support using many status + enum: + - wait_for_approve + - wait_for_export + - exporting + - failed + - rejected + - cancel + - finish + in: query + items: + type: string + name: filter_status_list + type: array + - description: filter by project uid + in: query + name: filter_project_uid + type: string + - description: filter by instance id in project + in: query + name: filter_instance_id + type: string + - description: filter by project priority + enum: + - high + - medium + - low + in: query + name: filter_project_priority + type: string + responses: + "200": + description: OK + schema: + $ref: '#/definitions/v1.GlobalWorkflowStatisticsResV1' + security: + - ApiKeyAuth: [] + summary: 获取全局导出工单统计数据 + tags: + - workflow /v1/dashboard/sql_manages: get: description: get global sql manage list