This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch be-logs-api-3
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/be-logs-api-3 by this push:
new cd95d99dc fix: plugins sort
cd95d99dc is described below
commit cd95d99dc63e39c7042a1836cf302d5616911cce
Author: abeizn <[email protected]>
AuthorDate: Wed Mar 27 10:39:54 2024 +0800
fix: plugins sort
---
backend/plugins/github/tasks/milestone_converter.go | 2 +-
backend/server/services/task.go | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/backend/plugins/github/tasks/milestone_converter.go
b/backend/plugins/github/tasks/milestone_converter.go
index 5261c7674..fee9a5670 100644
--- a/backend/plugins/github/tasks/milestone_converter.go
+++ b/backend/plugins/github/tasks/milestone_converter.go
@@ -36,7 +36,7 @@ func init() {
}
var ConvertMilestonesMeta = plugin.SubTaskMeta{
- Name: "Cnvert Milestones",
+ Name: "Convert Milestones",
EntryPoint: ConvertMilestones,
EnabledByDefault: true,
Description: "Convert tool layer table github_milestones into
domain layer table milestones",
diff --git a/backend/server/services/task.go b/backend/server/services/task.go
index 565442756..91989df9c 100644
--- a/backend/server/services/task.go
+++ b/backend/server/services/task.go
@@ -21,6 +21,7 @@ import (
"context"
"fmt"
"math"
+ "sort"
"strings"
"github.com/apache/incubator-devlake/core/dal"
@@ -312,6 +313,8 @@ func GetSubTasksInfo(pipelineId uint64, shouldSanitize
bool, tx dal.Dal) (*model
}
subTasksOuput := &models.SubTasksOuput{}
+ sortTasks(subtasksInfo)
+
subTasksOuput.SubtasksInfo = subtasksInfo
subTasksOuput.Count = totalSubtasksCount
@@ -377,3 +380,15 @@ func getTaskStatus(statuses []string) string {
return status
}
+
+func sortTasks(tasks []models.SubtasksInfo) {
+ sort.Slice(tasks, func(i, j int) bool {
+ if tasks[i].Plugin == "gitextractor" {
+ return false
+ }
+ if tasks[j].Plugin == "gitextractor" {
+ return true
+ }
+ return tasks[i].Plugin < tasks[j].Plugin
+ })
+}