You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by li...@apache.org on 2023/01/10 03:06:35 UTC

[incubator-devlake] branch main updated: fix(tapd): fix minor bugs (#4160)

This is an automated email from the ASF dual-hosted git repository.

likyh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 51351c95a fix(tapd): fix minor bugs (#4160)
51351c95a is described below

commit 51351c95ab1241527e4f1153b381013794e6afb8
Author: Warren Chen <yi...@merico.dev>
AuthorDate: Tue Jan 10 11:06:30 2023 +0800

    fix(tapd): fix minor bugs (#4160)
---
 .../components/advanced-editor/example/tapd.ts     |  1 +
 .../EngineeringThroughputAndCycleTime.json         | 28 +++++++++--------
 .../EngineeringThroughputAndCycleTimeTeamView.json | 36 ++++++++++------------
 plugins/tapd/tasks/bug_commit_collector.go         |  1 -
 plugins/tapd/tasks/story_bug_collector.go          |  1 -
 plugins/tapd/tasks/story_commit_collector.go       |  1 -
 plugins/tapd/tasks/task_commit_collector.go        |  2 --
 7 files changed, 34 insertions(+), 36 deletions(-)

diff --git a/config-ui/src/pages/blueprint/components/advanced-editor/example/tapd.ts b/config-ui/src/pages/blueprint/components/advanced-editor/example/tapd.ts
index 81ce0873f..045454280 100644
--- a/config-ui/src/pages/blueprint/components/advanced-editor/example/tapd.ts
+++ b/config-ui/src/pages/blueprint/components/advanced-editor/example/tapd.ts
@@ -21,6 +21,7 @@ const tapd = [
     {
       plugin: 'tapd',
       options: {
+        createdDateAfter: '2006-01-02T15:04:05Z',
         companyId: 1,
         workspaceId: 1,
         connectionId: 1,
diff --git a/grafana/dashboards/EngineeringThroughputAndCycleTime.json b/grafana/dashboards/EngineeringThroughputAndCycleTime.json
index 86d96c3cd..d6544996b 100644
--- a/grafana/dashboards/EngineeringThroughputAndCycleTime.json
+++ b/grafana/dashboards/EngineeringThroughputAndCycleTime.json
@@ -15,8 +15,8 @@
   "editable": true,
   "gnetId": null,
   "graphTooltip": 0,
-  "id": 28,
-  "iteration": 1671764780962,
+  "id": 4,
+  "iteration": 1673270412454,
   "links": [],
   "panels": [
     {
@@ -987,7 +987,7 @@
           "hide": false,
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "with _prs as(\n  SELECT\n    pr.id,\n    pr.url,\n    pr.author_id,\n    min(c.authored_date) as first_commit_authored_date,\n    pr.created_date as pr_issued_date,\n    min(prc.created_date) as first_comment_date,\n    max(prc.created_date) as last_comment_date,\n    pr.merged_date as pr_merged_date\n  FROM pull_requests pr\n    left join pull_request_comments prc on pr.id = prc.pull_request_id\n    left join pull_request_commits prc2 on pr.id = prc2.pull_request_id [...]
+          "rawSql": "with _prs as(\n  SELECT\n    pr.id,\n    pr.created_date as pr_issued_date,\n\t\tprm.pr_cycle_time/60 as cycle_time\n  FROM pull_requests pr\n    left join project_pr_metrics prm on pr.id = prm.id\n    join project_mapping pm on pr.base_repo_id = pm.row_id\n  WHERE\n    $__timeFilter(pr.created_date)\n    and pm.project_name in ($project)\n  GROUP BY 1,2,3\n)\n\nSELECT \n  DATE_ADD(date(pr_issued_date), INTERVAL -DAYOFMONTH(date(pr_issued_date))+1 DAY) as time,\n  av [...]
           "refId": "A",
           "select": [
             [
@@ -1091,7 +1091,7 @@
           "hide": false,
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "with _prs as(\n  SELECT\n    pr.id,\n    pr.url,\n    pr.author_id,\n    min(c.authored_date) as first_commit_authored_date,\n    pr.created_date as pr_issued_date,\n    min(prc.created_date) as first_comment_date,\n    max(prc.created_date) as last_comment_date,\n    pr.merged_date as pr_merged_date\n  FROM pull_requests pr\n    left join pull_request_comments prc on pr.id = prc.pull_request_id\n    left join pull_request_commits prc2 on pr.id = prc2.pull_request_id [...]
+          "rawSql": "with _prs as(\n  SELECT\n    pr.id,\n    pr.created_date as pr_issued_date,\n\t\tprm.pr_coding_time/60 as coding_time\n  FROM pull_requests pr\n    left join project_pr_metrics prm on pr.id = prm.id\n    join project_mapping pm on pr.base_repo_id = pm.row_id\n  WHERE\n    $__timeFilter(pr.created_date)\n    and pm.project_name in ($project)\n  GROUP BY 1,2,3\n)\n\nSELECT \n  DATE_ADD(date(pr_issued_date), INTERVAL -$interval(date(pr_issued_date))+1 DAY) as time,\n  a [...]
           "refId": "A",
           "select": [
             [
@@ -1226,7 +1226,7 @@
           "hide": false,
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "with _prs as(\n  SELECT\n    pr.id,\n    pr.url,\n    pr.author_id,\n    min(c.authored_date) as first_commit_authored_date,\n    pr.created_date as pr_issued_date,\n    min(prc.created_date) as first_comment_date,\n    max(prc.created_date) as last_comment_date,\n    pr.merged_date as pr_merged_date\n  FROM pull_requests pr\n    left join pull_request_comments prc on pr.id = prc.pull_request_id\n    left join pull_request_commits prc2 on pr.id = prc2.pull_request_id [...]
+          "rawSql": "with _prs as(\n  SELECT\n    pr.id,\n    pr.created_date as pr_issued_date,\n\t\tprm.pr_pickup_time/60 as pickup_time\n  FROM pull_requests pr\n    left join project_pr_metrics prm on pr.id = prm.id\n    join project_mapping pm on pr.base_repo_id = pm.row_id\n  WHERE\n    $__timeFilter(pr.created_date)\n    and pm.project_name in ($project)\n  GROUP BY 1,2,3\n)\n\nSELECT \n  DATE_ADD(date(pr_issued_date), INTERVAL -$interval(date(pr_issued_date))+1 DAY) as time,\n  a [...]
           "refId": "A",
           "select": [
             [
@@ -1361,7 +1361,7 @@
           "hide": false,
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "with _prs as(\n  SELECT\n    pr.id,\n    pr.url,\n    pr.author_id,\n    min(c.authored_date) as first_commit_authored_date,\n    pr.created_date as pr_issued_date,\n    min(prc.created_date) as first_comment_date,\n    max(prc.created_date) as last_comment_date,\n    pr.merged_date as pr_merged_date\n  FROM pull_requests pr\n    left join pull_request_comments prc on pr.id = prc.pull_request_id\n    left join pull_request_commits prc2 on pr.id = prc2.pull_request_id [...]
+          "rawSql": "with _prs as(\n  SELECT\n    pr.id,\n    pr.created_date as pr_issued_date,\n\t\tprm.pr_review_time/60 as review_time\n  FROM pull_requests pr\n    left join project_pr_metrics prm on pr.id = prm.id\n    join project_mapping pm on pr.base_repo_id = pm.row_id\n  WHERE\n    $__timeFilter(pr.created_date)\n    and pm.project_name in ($project)\n  GROUP BY 1,2,3\n)\n\nSELECT \n  DATE_ADD(date(pr_issued_date), INTERVAL -$interval(date(pr_issued_date))+1 DAY) as time,\n  a [...]
           "refId": "A",
           "select": [
             [
@@ -1421,8 +1421,12 @@
         "allValue": null,
         "current": {
           "selected": false,
-          "text": "All",
-          "value": "$__all"
+          "text": [
+            "Louis"
+          ],
+          "value": [
+            "Louis"
+          ]
         },
         "datasource": "mysql",
         "definition": "select distinct project_name from project_mapping",
@@ -1444,7 +1448,7 @@
       {
         "allValue": "",
         "current": {
-          "selected": true,
+          "selected": false,
           "text": [
             "All"
           ],
@@ -1472,7 +1476,7 @@
       {
         "allValue": null,
         "current": {
-          "selected": true,
+          "selected": false,
           "text": "Month",
           "value": "DAYOFMONTH"
         },
@@ -1503,7 +1507,7 @@
       {
         "allValue": null,
         "current": {
-          "selected": true,
+          "selected": false,
           "text": "Last Comment Date",
           "value": "last_comment_date"
         },
@@ -1541,5 +1545,5 @@
   "timezone": "",
   "title": "Engineering Throughput and Cycle Time",
   "uid": "Jaaimc67k",
-  "version": 6
+  "version": 2
 }
\ No newline at end of file
diff --git a/grafana/dashboards/EngineeringThroughputAndCycleTimeTeamView.json b/grafana/dashboards/EngineeringThroughputAndCycleTimeTeamView.json
index 7a4f0ca68..845502784 100644
--- a/grafana/dashboards/EngineeringThroughputAndCycleTimeTeamView.json
+++ b/grafana/dashboards/EngineeringThroughputAndCycleTimeTeamView.json
@@ -15,8 +15,8 @@
   "editable": true,
   "gnetId": null,
   "graphTooltip": 0,
-  "id": 24,
-  "iteration": 1671604319285,
+  "id": 20,
+  "iteration": 1673318859459,
   "links": [],
   "panels": [
     {
@@ -1890,7 +1890,7 @@
           "hide": false,
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "with _prs as(\n  SELECT\n    pr.id,\n    pr.url,\n    pr.author_id,\n    min(c.authored_date) as first_commit_authored_date,\n    pr.created_date as pr_issued_date,\n    min(prc.created_date) as first_comment_date,\n    max(prc.created_date) as last_comment_date,\n    pr.merged_date as pr_merged_date,\n    u.id as user_id,\n    u.name as user_name,\n    t.id as team_id,\n    t.name as team\n  FROM pull_requests pr\n    join project_mapping pm on pr.base_repo_id = pm. [...]
+          "rawSql": "with _prs as(\n  SELECT\n    pr.id,\n    pr.created_date as pr_issued_date,\n\t\tprm.pr_cycle_time/60 as cycle_time,\n\t\tpr.author_id,\n    u.id as user_id,\n    u.name as user_name,\n    t.id as team_id,\n    t.name as team\n  FROM pull_requests pr\n    join project_mapping pm on pr.base_repo_id = pm.row_id\n\t\tleft join project_pr_metrics prm on pr.id = prm.id\n    left join user_accounts ua on pr.author_id = ua.account_id\n    left join users u on ua.user_id = u [...]
           "refId": "A",
           "select": [
             [
@@ -2025,7 +2025,7 @@
           "hide": false,
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "with _prs as(\n  SELECT\n    pr.id,\n    pr.url,\n    pr.author_id,\n    min(c.authored_date) as first_commit_authored_date,\n    pr.created_date as pr_issued_date,\n    min(prc.created_date) as first_comment_date,\n    max(prc.created_date) as last_comment_date,\n    pr.merged_date as pr_merged_date,\n    u.id as user_id,\n    u.name as user_name,\n    t.id as team_id,\n    t.name as team\n  FROM pull_requests pr\n    join project_mapping pm on pr.base_repo_id = pm. [...]
+          "rawSql": "with _prs as(\n  SELECT\n    pr.id,\n    pr.created_date as pr_issued_date,\n\t\tprm.pr_coding_time/60 as coding_time,\n\t\tpr.author_id,\n    u.id as user_id,\n    u.name as user_name,\n    t.id as team_id,\n    t.name as team\n  FROM pull_requests pr\n    join project_mapping pm on pr.base_repo_id = pm.row_id\n\t\tleft join project_pr_metrics prm on pr.id = prm.id\n    left join user_accounts ua on pr.author_id = ua.account_id\n    left join users u on ua.user_id = [...]
           "refId": "A",
           "select": [
             [
@@ -2160,7 +2160,7 @@
           "hide": false,
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "with _prs as(\n  SELECT\n    pr.id,\n    pr.url,\n    pr.author_id,\n    min(c.authored_date) as first_commit_authored_date,\n    pr.created_date as pr_issued_date,\n    min(prc.created_date) as first_comment_date,\n    max(prc.created_date) as last_comment_date,\n    pr.merged_date as pr_merged_date,\n    u.id as user_id,\n    u.name as user_name,\n    t.id as team_id,\n    t.name as team\n  FROM pull_requests pr\n    join project_mapping pm on pr.base_repo_id = pm. [...]
+          "rawSql": "with _prs as(\n  SELECT\n    pr.id,\n    pr.created_date as pr_issued_date,\n\t\tprm.pr_pickup_time/60 as pickup_time,\n\t\tpr.author_id,\n    u.id as user_id,\n    u.name as user_name,\n    t.id as team_id,\n    t.name as team\n  FROM pull_requests pr\n    join project_mapping pm on pr.base_repo_id = pm.row_id\n\t\tleft join project_pr_metrics prm on pr.id = prm.id\n    left join user_accounts ua on pr.author_id = ua.account_id\n    left join users u on ua.user_id = [...]
           "refId": "A",
           "select": [
             [
@@ -2295,7 +2295,7 @@
           "hide": false,
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "with _prs as(\n  SELECT\n    pr.id,\n    pr.url,\n    pr.author_id,\n    min(c.authored_date) as first_commit_authored_date,\n    pr.created_date as pr_issued_date,\n    min(prc.created_date) as first_comment_date,\n    max(prc.created_date) as last_comment_date,\n    pr.merged_date as pr_merged_date,\n    u.id as user_id,\n    u.name as user_name,\n    t.id as team_id,\n    t.name as team\n  FROM pull_requests pr\n    join project_mapping pm on pr.base_repo_id = pm. [...]
+          "rawSql": "with _prs as(\n  SELECT\n    pr.id,\n    pr.created_date as pr_issued_date,\n\t\tprm.pr_review_time/60 as review_time,\n\t\tpr.author_id,\n    u.id as user_id,\n    u.name as user_name,\n    t.id as team_id,\n    t.name as team\n  FROM pull_requests pr\n    join project_mapping pm on pr.base_repo_id = pm.row_id\n\t\tleft join project_pr_metrics prm on pr.id = prm.id\n    left join user_accounts ua on pr.author_id = ua.account_id\n    left join users u on ua.user_id = [...]
           "refId": "A",
           "select": [
             [
@@ -2503,13 +2503,9 @@
       {
         "allValue": null,
         "current": {
-          "selected": true,
-          "text": [
-            "p2"
-          ],
-          "value": [
-            "p2"
-          ]
+          "selected": false,
+          "text": "All",
+          "value": "$__all"
         },
         "datasource": "mysql",
         "definition": "select distinct project_name from project_mapping",
@@ -2531,9 +2527,10 @@
       {
         "allValue": "",
         "current": {
+          "isNone": true,
           "selected": false,
-          "text": "Green",
-          "value": "2"
+          "text": "None",
+          "value": ""
         },
         "datasource": "mysql",
         "definition": "select concat(name, '--', id) as text from teams",
@@ -2555,9 +2552,10 @@
       {
         "allValue": "",
         "current": {
+          "isNone": true,
           "selected": false,
-          "text": "Orange",
-          "value": "1"
+          "text": "None",
+          "value": ""
         },
         "datasource": "mysql",
         "definition": "select concat(name, '--', id) as text from teams",
@@ -2579,7 +2577,7 @@
       {
         "allValue": "",
         "current": {
-          "selected": false,
+          "selected": true,
           "text": [
             "All"
           ],
@@ -2676,5 +2674,5 @@
   "timezone": "",
   "title": "Engineering Throughput and Cycle Time - Team View",
   "uid": "nJ1ijje7k",
-  "version": 22
+  "version": 3
 }
\ No newline at end of file
diff --git a/plugins/tapd/tasks/bug_commit_collector.go b/plugins/tapd/tasks/bug_commit_collector.go
index 928ec36f3..bcbec6d41 100644
--- a/plugins/tapd/tasks/bug_commit_collector.go
+++ b/plugins/tapd/tasks/bug_commit_collector.go
@@ -66,7 +66,6 @@ func CollectBugCommits(taskCtx core.SubTaskContext) errors.Error {
 	}
 	err = collectorWithState.InitCollector(helper.ApiCollectorArgs{
 		ApiClient:   data.ApiClient,
-		PageSize:    100,
 		Incremental: incremental,
 		Input:       iterator,
 		UrlTemplate: "code_commit_infos",
diff --git a/plugins/tapd/tasks/story_bug_collector.go b/plugins/tapd/tasks/story_bug_collector.go
index e5b266633..761859a0b 100644
--- a/plugins/tapd/tasks/story_bug_collector.go
+++ b/plugins/tapd/tasks/story_bug_collector.go
@@ -63,7 +63,6 @@ func CollectStoryBugs(taskCtx core.SubTaskContext) errors.Error {
 	}
 	err = collectorWithState.InitCollector(helper.ApiCollectorArgs{
 		ApiClient:   data.ApiClient,
-		PageSize:    100,
 		Incremental: incremental,
 		Input:       iterator,
 		UrlTemplate: "stories/get_related_bugs",
diff --git a/plugins/tapd/tasks/story_commit_collector.go b/plugins/tapd/tasks/story_commit_collector.go
index 8178832ef..9e24be129 100644
--- a/plugins/tapd/tasks/story_commit_collector.go
+++ b/plugins/tapd/tasks/story_commit_collector.go
@@ -65,7 +65,6 @@ func CollectStoryCommits(taskCtx core.SubTaskContext) errors.Error {
 	}
 	err = collectorWithState.InitCollector(helper.ApiCollectorArgs{
 		ApiClient:   data.ApiClient,
-		PageSize:    100,
 		Incremental: incremental,
 		Input:       iterator,
 		UrlTemplate: "code_commit_infos",
diff --git a/plugins/tapd/tasks/task_commit_collector.go b/plugins/tapd/tasks/task_commit_collector.go
index 7410cc76c..b9c69a519 100644
--- a/plugins/tapd/tasks/task_commit_collector.go
+++ b/plugins/tapd/tasks/task_commit_collector.go
@@ -65,9 +65,7 @@ func CollectTaskCommits(taskCtx core.SubTaskContext) errors.Error {
 	}
 	err = collectorWithState.InitCollector(helper.ApiCollectorArgs{
 		ApiClient:   data.ApiClient,
-		PageSize:    100,
 		Incremental: incremental,
-		//PageSize:    100,
 		Input:       iterator,
 		UrlTemplate: "code_commit_infos",
 		Query: func(reqData *helper.RequestData) (url.Values, errors.Error) {