From 95734dea8a79d6daa4ec501faad2eac5b57e5495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=92=E6=B9=9B?= <0x1304570@gmail.com> Date: Mon, 30 Sep 2024 21:20:10 +1300 Subject: [PATCH 1/6] fix: limit the wrapper width to 960 (#8120) --- config-ui/src/routes/layout/layout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config-ui/src/routes/layout/layout.tsx b/config-ui/src/routes/layout/layout.tsx index 9e5b519f2f3..2591722f5b5 100644 --- a/config-ui/src/routes/layout/layout.tsx +++ b/config-ui/src/routes/layout/layout.tsx @@ -126,7 +126,7 @@ export const Layout = () => { ))} -
+
From 94fb75fa02264418dff2064ac250dcd47152a150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=92=E6=B9=9B?= <0x1304570@gmail.com> Date: Mon, 30 Sep 2024 21:20:31 +1300 Subject: [PATCH 2/6] fix: rewriting to remove warnings (#8119) --- config-ui/{.eslintrc.js => .eslintrc.cjs} | 0 config-ui/{.prettierrc.js => .prettierrc.cjs} | 0 config-ui/README.md | 1 + config-ui/package.json | 1 + config-ui/public/onboard/step-1/github.md | 2 +- config-ui/public/onboard/step-3/azuredevops.md | 2 +- config-ui/src/index.css | 3 +-- config-ui/src/main.tsx | 7 ++++--- .../src/plugins/components/scope-config-form/index.tsx | 2 +- 9 files changed, 10 insertions(+), 8 deletions(-) rename config-ui/{.eslintrc.js => .eslintrc.cjs} (100%) rename config-ui/{.prettierrc.js => .prettierrc.cjs} (100%) diff --git a/config-ui/.eslintrc.js b/config-ui/.eslintrc.cjs similarity index 100% rename from config-ui/.eslintrc.js rename to config-ui/.eslintrc.cjs diff --git a/config-ui/.prettierrc.js b/config-ui/.prettierrc.cjs similarity index 100% rename from config-ui/.prettierrc.js rename to config-ui/.prettierrc.cjs diff --git a/config-ui/README.md b/config-ui/README.md index e1a4d3e851f..6171b21f9ac 100644 --- a/config-ui/README.md +++ b/config-ui/README.md @@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> + # DevLake - Configuration UI The **Config-UI Application** is a **React.js** SPA (Single-Page-Application) that manages the setup and configuration of a **DevLake** Instance. diff --git a/config-ui/package.json b/config-ui/package.json index d765f38340c..9a69135161b 100644 --- a/config-ui/package.json +++ b/config-ui/package.json @@ -3,6 +3,7 @@ "private": true, "version": "0.0.0", "packageManager": "yarn@3.4.1", + "type": "module", "scripts": { "start": "vite", "build": "vite build", diff --git a/config-ui/public/onboard/step-1/github.md b/config-ui/public/onboard/step-1/github.md index 7ce5e9d8166..e08d8ad9258 100644 --- a/config-ui/public/onboard/step-1/github.md +++ b/config-ui/public/onboard/step-1/github.md @@ -22,7 +22,7 @@ limitations under the License. ![1](/onboard/assets/github/1.png) 2. What is the turnaround time for your Code Review process? - + ![2](/onboard/assets/github/2.png) 3. How effective is your CI/CD pipeline? diff --git a/config-ui/public/onboard/step-3/azuredevops.md b/config-ui/public/onboard/step-3/azuredevops.md index 8a17a63c77a..90dee2b01b8 100644 --- a/config-ui/public/onboard/step-3/azuredevops.md +++ b/config-ui/public/onboard/step-3/azuredevops.md @@ -31,4 +31,4 @@ Yes, data transformations can be applied by setting up a Scope Config for the se ##### Q4. How often is the data synchronized? -Data synchronization occurs daily. This frequency can be modified on the project details page as needed. \ No newline at end of file +Data synchronization occurs daily. This frequency can be modified on the project details page as needed. diff --git a/config-ui/src/index.css b/config-ui/src/index.css index a2d32515dd1..6ddcf4c6416 100644 --- a/config-ui/src/index.css +++ b/config-ui/src/index.css @@ -71,7 +71,6 @@ p { height: 100vh; } - .ant-tour-title { padding-right: 28px; -} \ No newline at end of file +} diff --git a/config-ui/src/main.tsx b/config-ui/src/main.tsx index d3b35c690ac..d463e53cbd3 100644 --- a/config-ui/src/main.tsx +++ b/config-ui/src/main.tsx @@ -16,7 +16,7 @@ * */ -import ReactDOM from 'react-dom'; +import { createRoot } from 'react-dom/client'; import { Provider } from 'react-redux'; import { RouterProvider } from 'react-router-dom'; import { ConfigProvider } from 'antd'; @@ -27,7 +27,9 @@ import { store } from './app/store'; import { router } from './app/routrer'; import './index.css'; -ReactDOM.render( +const root = createRoot(document.getElementById('root') as HTMLElement); + +root.render( } /> , - document.getElementById('root'), ); diff --git a/config-ui/src/plugins/components/scope-config-form/index.tsx b/config-ui/src/plugins/components/scope-config-form/index.tsx index d4f4c04f49e..9a954c18895 100644 --- a/config-ui/src/plugins/components/scope-config-form/index.tsx +++ b/config-ui/src/plugins/components/scope-config-form/index.tsx @@ -150,7 +150,7 @@ export const ScopeConfigForm = ({ title="Data Entities" description={ <> - Select the data entities you wish to collect for the Data Scope. + Select the data entities you wish to collect for the Data Scope. Learn about data entities } From 88a26a2db0fb47d66ec89433793fcf6d268047b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=92=E6=B9=9B?= <0x1304570@gmail.com> Date: Tue, 8 Oct 2024 22:35:31 +1300 Subject: [PATCH 3/6] feat: adjust the menu (#8133) --- config-ui/src/app/routrer.tsx | 23 ++--------------------- config-ui/src/routes/layout/config.tsx | 12 +++--------- 2 files changed, 5 insertions(+), 30 deletions(-) diff --git a/config-ui/src/app/routrer.tsx b/config-ui/src/app/routrer.tsx index f59b0a58a97..2ee79bfb919 100644 --- a/config-ui/src/app/routrer.tsx +++ b/config-ui/src/app/routrer.tsx @@ -30,11 +30,8 @@ import { ProjectGeneralSettings, ProjectWebhook, ProjectAdditionalSettings, - BlueprintHomePage, - BlueprintDetailPage, BlueprintConnectionDetailPage, Pipelines, - Pipeline, ApiKeys, NotFound, } from '@/routes'; @@ -112,31 +109,15 @@ export const router = createBrowserRouter( path: 'advanced', children: [ { - path: 'blueprints', - element: , - }, - { - path: 'blueprints/:id', - element: , - }, - { - path: 'blueprints/:bid/:unique', - element: , + path: 'keys', + element: , }, { path: 'pipelines', element: , }, - { - path: 'pipeline/:id', - element: , - }, ], }, - { - path: 'keys', - element: , - }, ], }, ], diff --git a/config-ui/src/routes/layout/config.tsx b/config-ui/src/routes/layout/config.tsx index 8e2b9a6d247..069798c1dcb 100644 --- a/config-ui/src/routes/layout/config.tsx +++ b/config-ui/src/routes/layout/config.tsx @@ -20,7 +20,6 @@ import { AppstoreOutlined, ProjectOutlined, ExperimentOutlined, - KeyOutlined, DashboardOutlined, FileSearchOutlined, ApiOutlined, @@ -54,20 +53,15 @@ export const menuItems: MenuItem[] = [ icon: , children: [ { - key: '/advanced/blueprints', - label: 'Blueprints', + key: '/advanced/keys', + label: 'API Keys', }, { key: '/advanced/pipelines', - label: 'Pipelines', + label: 'Pipeline Results', }, ], }, - { - key: '/keys', - label: 'API Keys', - icon: , - }, ]; const getMenuMatchs = (items: MenuItem[], parentKey?: string) => { From 0b8c8ea251917e6d04c1b168dd91f4a8fa0dc716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=92=E6=B9=9B?= <0x1304570@gmail.com> Date: Tue, 8 Oct 2024 22:35:54 +1300 Subject: [PATCH 4/6] refactor: remove the environment variable copyright hide (#8134) --- config-ui/env.example | 1 - config-ui/src/routes/layout/layout.tsx | 26 ++++++++++---------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/config-ui/env.example b/config-ui/env.example index 078e902a541..723a06fd3b5 100644 --- a/config-ui/env.example +++ b/config-ui/env.example @@ -19,7 +19,6 @@ # DEVLAKE_PATH_PREFIX= # DEVLAKE_TITLE_CUSTOM= # DEVLAKE_COLOR_CUSTOM= -# DEVLAKE_COPYRIGHT_HIDE= # All plugins are loaded by default, optional plugins can be loaded # eg. DEVLAKE_PLUGINS=github,gitlab diff --git a/config-ui/src/routes/layout/layout.tsx b/config-ui/src/routes/layout/layout.tsx index 2591722f5b5..b33b563ed17 100644 --- a/config-ui/src/routes/layout/layout.tsx +++ b/config-ui/src/routes/layout/layout.tsx @@ -113,28 +113,22 @@ export const Layout = () => { background: 'transparent', }} > - {headerItems - .filter((item) => - import.meta.env.DEVLAKE_COPYRIGHT_HIDE ? !['Dashboards', 'GitHub', 'Slack'].includes(item.label) : true, - ) - .map((item, i, arr) => ( - - {item.icon} - {item.label} - {i !== arr.length - 1 && } - - ))} + {headerItems.map((item, i, arr) => ( + + {item.icon} + {item.label} + {i !== arr.length - 1 && } + + ))}
- {!import.meta.env.DEVLAKE_COPYRIGHT_HIDE && ( -
-

Apache 2.0 License

-
- )} +
+

Apache 2.0 License

+
From c60230ee8987f8e160c48ab74cff0f3170a91f3f Mon Sep 17 00:00:00 2001 From: "Louis.z" Date: Thu, 10 Oct 2024 17:28:44 +0800 Subject: [PATCH 5/6] fix: #8091 sonarqube dashboard (#8137) Co-authored-by: Startrekzky --- grafana/dashboards/Sonarqube.json | 409 +++++++----------------------- 1 file changed, 93 insertions(+), 316 deletions(-) diff --git a/grafana/dashboards/Sonarqube.json b/grafana/dashboards/Sonarqube.json index fc6001d770a..d8708f36d93 100644 --- a/grafana/dashboards/Sonarqube.json +++ b/grafana/dashboards/Sonarqube.json @@ -18,7 +18,6 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 21, "links": [], "liveNow": false, "panels": [ @@ -50,7 +49,7 @@ "content": "- Use Cases: This dashboard shows the code quality metrics from SonarQube.\n- Data Source Required: SonarQube v8.2+\n- This dashboard does not honor the time filter on the top-right side as SonarQube metrics are all from the latest scan.", "mode": "markdown" }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.2.0", "targets": [ { "datasource": { @@ -89,10 +88,7 @@ "type": "row" }, { - "datasource": { - "type": "datasource", - "uid": "-- Mixed --" - }, + "datasource": "mysql", "fieldConfig": { "defaults": { "color": { @@ -135,6 +131,7 @@ "graphMode": "area", "justifyMode": "center", "orientation": "vertical", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -142,32 +139,20 @@ "fields": "/.*/", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "value" + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.2.0", "targets": [ { "datasource": "mysql", "editorMode": "code", "format": "table", - "group": [], - "hide": false, - "metricColumn": "none", - "queryType": "randomWalk", "rawQuery": true, - "rawSql": "SELECT\n count(distinct id) as 'Bugs'\nFROM cq_issues\nWHERE\n project_key in (${project_id})\n and type = 'BUG'\n and severity in (${severity})\n ", + "rawSql": "SELECT\n count(distinct id) as 'Bugs'\nFROM cq_issues\nWHERE\n project_key in (${project_id})\n and type = 'BUG'\n and severity in (${severity})", "refId": "A", - "select": [ - [ - { - "params": [ - "blueprint_id" - ], - "type": "column" - } - ] - ], "sql": { "columns": [ { @@ -184,27 +169,14 @@ } ], "limit": 50 - }, - "table": "_devlake_blueprint_labels", - "timeColumn": "created_at", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] + } } ], "title": "Reliability", "type": "stat" }, { - "datasource": { - "type": "datasource", - "uid": "-- Mixed --" - }, + "datasource": "mysql", "fieldConfig": { "defaults": { "color": { @@ -247,6 +219,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -254,32 +227,20 @@ "fields": "", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "value" + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.2.0", "targets": [ { "datasource": "mysql", "editorMode": "code", "format": "table", - "group": [], - "hide": false, - "metricColumn": "none", - "queryType": "randomWalk", "rawQuery": true, "rawSql": "SELECT\n count(distinct id) as 'Vulnerabilities'\nFROM cq_issues\nWHERE\n project_key in (${project_id})\n and type = 'VULNERABILITY'\n and severity in (${severity})", "refId": "A", - "select": [ - [ - { - "params": [ - "blueprint_id" - ], - "type": "column" - } - ] - ], "sql": { "columns": [ { @@ -296,27 +257,14 @@ } ], "limit": 50 - }, - "table": "_devlake_blueprint_labels", - "timeColumn": "created_at", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] + } } ], "title": "Security", "type": "stat" }, { - "datasource": { - "type": "datasource", - "uid": "-- Mixed --" - }, + "datasource": "mysql", "description": "", "fieldConfig": { "defaults": { @@ -360,6 +308,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -367,32 +316,20 @@ "fields": "/.*/", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.2.0", "targets": [ { "datasource": "mysql", "editorMode": "code", "format": "table", - "group": [], - "hide": false, - "metricColumn": "none", - "queryType": "randomWalk", "rawQuery": true, "rawSql": "SELECT\n COUNT(distinct id) AS 'Security Hotspots'\nFROM cq_issues\nWHERE\n project_key in (${project_id})\n and type = 'HOTSPOTS'\n and severity in (${severity})\n", "refId": "A", - "select": [ - [ - { - "params": [ - "blueprint_id" - ], - "type": "column" - } - ] - ], "sql": { "columns": [ { @@ -409,27 +346,14 @@ } ], "limit": 50 - }, - "table": "_devlake_blueprint_labels", - "timeColumn": "created_at", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] + } } ], "title": "Security Hotspots", "type": "stat" }, { - "datasource": { - "type": "datasource", - "uid": "-- Mixed --" - }, + "datasource": "mysql", "description": "", "fieldConfig": { "defaults": { @@ -472,6 +396,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -479,32 +404,20 @@ "fields": "/.*/", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.2.0", "targets": [ { "datasource": "mysql", "editorMode": "code", "format": "table", - "group": [], - "hide": false, - "metricColumn": "none", - "queryType": "randomWalk", "rawQuery": true, "rawSql": "SELECT\n CONCAT(ROUND(COUNT(IF(status != 'TO_REVIEW', id, NULL)) / COUNT(distinct id) * 100, 2), '%') AS 'Reviewed'\nFROM cq_issues\nWHERE\n project_key in (${project_id})\n and type = 'HOTSPOTS'\n and severity in (${severity})", "refId": "A", - "select": [ - [ - { - "params": [ - "blueprint_id" - ], - "type": "column" - } - ] - ], "sql": { "columns": [ { @@ -521,17 +434,7 @@ } ], "limit": 50 - }, - "table": "_devlake_blueprint_labels", - "timeColumn": "created_at", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] + } } ], "title": "Security Reviewed", @@ -564,10 +467,7 @@ "type": "row" }, { - "datasource": { - "type": "datasource", - "uid": "-- Mixed --" - }, + "datasource": "mysql", "description": "", "fieldConfig": { "defaults": { @@ -610,6 +510,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -617,31 +518,20 @@ "fields": "/.*/", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.2.0", "targets": [ { "datasource": "mysql", + "editorMode": "code", "format": "table", - "group": [], - "hide": false, - "metricColumn": "none", - "queryType": "randomWalk", "rawQuery": true, "rawSql": "SELECT\n CONCAT(ROUND((sum(lines_to_cover) - sum(uncovered_lines)) / sum(lines_to_cover) * 100, 1), '% ', 'Coverage on ', ROUND(sum(lines_to_cover) / 1000, 0),'k Lines to cover')\nFROM cq_file_metrics\nWHERE\n project_key in (${project_id})\n", "refId": "A", - "select": [ - [ - { - "params": [ - "blueprint_id" - ], - "type": "column" - } - ] - ], "sql": { "columns": [ { @@ -658,27 +548,14 @@ } ], "limit": 50 - }, - "table": "_devlake_blueprint_labels", - "timeColumn": "created_at", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] + } } ], "title": "Test", "type": "stat" }, { - "datasource": { - "type": "datasource", - "uid": "-- Mixed --" - }, + "datasource": "mysql", "description": "", "fieldConfig": { "defaults": { @@ -722,6 +599,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -729,31 +607,20 @@ "fields": "/.*/", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "value" + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.2.0", "targets": [ { "datasource": "mysql", + "editorMode": "code", "format": "table", - "group": [], - "hide": false, - "metricColumn": "none", - "queryType": "randomWalk", "rawQuery": true, - "rawSql": "SELECT\n concat(FLOOR(SUM(debt)/8/60), \" day(s) \", FLOOR((SUM(debt)%480)/60), \" hour(s) \") AS 'Debt'\nFROM cq_issues\nWHERE\n project_key in (${project_id})\n and type = 'CODE_SMELL'\n and severity in (${severity})\n ", + "rawSql": "SELECT\n concat(FLOOR(SUM(debt)/8/60), \" day(s) \", FLOOR((SUM(debt)%480)/60), \" hour(s) \") AS 'Debt'\nFROM cq_issues\nWHERE\n project_key in (${project_id})\n and type = 'CODE_SMELL'\n and severity in (${severity})", "refId": "A", - "select": [ - [ - { - "params": [ - "blueprint_id" - ], - "type": "column" - } - ] - ], "sql": { "columns": [ { @@ -770,27 +637,14 @@ } ], "limit": 50 - }, - "table": "_devlake_blueprint_labels", - "timeColumn": "created_at", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] + } } ], "title": "Maintainability - Debt", "type": "stat" }, { - "datasource": { - "type": "datasource", - "uid": "-- Mixed --" - }, + "datasource": "mysql", "description": "", "fieldConfig": { "defaults": { @@ -834,6 +688,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -841,32 +696,20 @@ "fields": "/.*/", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "value" + "textMode": "value", + "wideLayout": true }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.2.0", "targets": [ { "datasource": "mysql", "editorMode": "code", "format": "table", - "group": [], - "hide": false, - "metricColumn": "none", - "queryType": "randomWalk", "rawQuery": true, "rawSql": "SELECT\n\tCOUNT(distinct id) as 'Code Smells'\nFROM cq_issues\nWHERE\n project_key in (${project_id})\n and type = 'CODE_SMELL'\n and severity in (${severity})", "refId": "A", - "select": [ - [ - { - "params": [ - "blueprint_id" - ], - "type": "column" - } - ] - ], "sql": { "columns": [ { @@ -883,17 +726,7 @@ } ], "limit": 50 - }, - "table": "_devlake_blueprint_labels", - "timeColumn": "created_at", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] + } } ], "title": "Maintainability - Code Smells", @@ -926,10 +759,7 @@ "type": "row" }, { - "datasource": { - "type": "datasource", - "uid": "-- Mixed --" - }, + "datasource": "mysql", "description": "", "fieldConfig": { "defaults": { @@ -972,6 +802,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -979,31 +810,20 @@ "fields": "/.*/", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.2.0", "targets": [ { "datasource": "mysql", + "editorMode": "code", "format": "table", - "group": [], - "hide": false, - "metricColumn": "none", - "queryType": "randomWalk", "rawQuery": true, - "rawSql": "SELECT\n sum(duplicated_blocks)\nFROM cq_file_metrics\nWHERE\n project_key in (${project_id})\n", + "rawSql": "SELECT\n sum(duplicated_blocks)\nFROM cq_file_metrics\nWHERE\n project_key in (${project_id})", "refId": "A", - "select": [ - [ - { - "params": [ - "blueprint_id" - ], - "type": "column" - } - ] - ], "sql": { "columns": [ { @@ -1020,27 +840,14 @@ } ], "limit": 50 - }, - "table": "_devlake_blueprint_labels", - "timeColumn": "created_at", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] + } } ], "title": "Duplicated Blocks", "type": "stat" }, { - "datasource": { - "type": "datasource", - "uid": "-- Mixed --" - }, + "datasource": "mysql", "description": "", "fieldConfig": { "defaults": { @@ -1083,6 +890,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -1090,51 +898,44 @@ "fields": "/.*/", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.2.0", "targets": [ { "datasource": "mysql", + "editorMode": "code", "format": "table", - "group": [], - "hide": false, - "metricColumn": "none", - "queryType": "randomWalk", "rawQuery": true, - "rawSql": "SELECT\n CONCAT(ROUND(sum(duplicated_lines) / sum(num_of_lines) * 100, 1), '% ', 'Duplications on ', ROUND(sum(ncloc) / 1000, 0),'k Lines')\nFROM cq_file_metrics\nWHERE\n project_key in (${project_id})\n", + "rawSql": "SELECT\n CONCAT(ROUND(sum(duplicated_lines) / sum(num_of_lines) * 100, 1), '% ', 'Duplications on ', ROUND(sum(ncloc) / 1000, 0),'k Lines')\nFROM cq_file_metrics\nWHERE\n project_key in (${project_id})", "refId": "A", - "select": [ - [ + "sql": { + "columns": [ { - "params": [ - "blueprint_id" - ], - "type": "column" + "parameters": [], + "type": "function" } - ] - ], - "table": "_devlake_blueprint_labels", - "timeColumn": "created_at", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } } ], "title": "Duplicated Lines", "type": "stat" }, { - "datasource": { - "type": "datasource", - "uid": "-- Mixed --" - }, + "datasource": "mysql", "description": "", "fieldConfig": { "defaults": { @@ -1192,28 +993,15 @@ }, "showHeader": true }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.2.0", "targets": [ { "datasource": "mysql", + "editorMode": "code", "format": "table", - "group": [], - "hide": false, - "metricColumn": "none", - "queryType": "randomWalk", "rawQuery": true, "rawSql": "SELECT\n\tfile_name, num_of_lines as 'Lines of Code', bugs as 'Bugs', vulnerabilities as 'Vulnerabilities', code_smells as 'Code Smells', \n\tsecurity_hotspots as 'Security Hotspots', CONCAT(ROUND(coverage, 2), '%') as 'Coverage', CONCAT(ROUND(duplicated_lines_density, 2), '%') as 'Duplications'\nFROM cq_file_metrics\nWHERE\n project_key in (${project_id})\nORDER BY bugs desc\nlimit 20", "refId": "A", - "select": [ - [ - { - "params": [ - "blueprint_id" - ], - "type": "column" - } - ] - ], "sql": { "columns": [ { @@ -1230,17 +1018,7 @@ } ], "limit": 50 - }, - "table": "_devlake_blueprint_labels", - "timeColumn": "created_at", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] + } } ], "title": "Code Quality Metrics by Files (Top 20 order by Bugs)", @@ -1248,8 +1026,7 @@ } ], "refresh": "", - "schemaVersion": 38, - "style": "dark", + "schemaVersion": 39, "tags": [ "Data Source Dashboard", "Stable Data Sources" @@ -1314,8 +1091,8 @@ }, "timepicker": {}, "timezone": "utc", - "title": "SonarQube", + "title": "SonarQube Server", "uid": "WA0qbuJ4k", - "version": 2, + "version": 3, "weekStart": "" } \ No newline at end of file From 3d6299e2b0cf5676261e2d3a3b3998262af7c4ed Mon Sep 17 00:00:00 2001 From: Startrekzky Date: Fri, 11 Oct 2024 12:13:23 +0800 Subject: [PATCH 6/6] feat: add SonarCloud dashboard --- grafana/dashboards/SonarQubeCloud.json | 1503 ++++++++++++++++++++++++ 1 file changed, 1503 insertions(+) create mode 100644 grafana/dashboards/SonarQubeCloud.json diff --git a/grafana/dashboards/SonarQubeCloud.json b/grafana/dashboards/SonarQubeCloud.json new file mode 100644 index 00000000000..1a290703897 --- /dev/null +++ b/grafana/dashboards/SonarQubeCloud.json @@ -0,0 +1,1503 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 40, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "gridPos": { + "h": 4, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 19, + "links": [ + { + "targetBlank": true, + "title": "SonarQube", + "url": "https://devlake.apache.org/docs/Plugins/sonarqube" + } + ], + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "- Use Cases: This dashboard shows the code quality metrics from SonarCloud.\n- Data Source Required: SonarCloud\n- This dashboard does not honor the time filter on the top-right side as SonarQube metrics are all from the latest scan.", + "mode": "markdown" + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "queryType": "randomWalk", + "refId": "A" + } + ], + "title": "Dashboard Introduction", + "type": "text" + }, + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 4 + }, + "id": 16, + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "refId": "A" + } + ], + "title": "Software Quality", + "type": "row" + }, + { + "datasource": "mysql", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 0, + "y": 5 + }, + "id": 3, + "links": [ + { + "targetBlank": true, + "title": "Code Quality Issue Count", + "url": "https://devlake.apache.org/docs/Metrics/CQIssueCount" + } + ], + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "value", + "wideLayout": true + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "dataset": "lake", + "datasource": "mysql", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n count(distinct ci.id)\nFROM \n cq_issues ci\n join cq_issue_impacts cii on ci.id = cii.cq_issue_id\nWHERE\n ci.project_key in (${project_id})\n and cii.software_quality = 'SECURITY'\n and ci.severity in (${severity})", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Security", + "type": "stat" + }, + { + "datasource": "mysql", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 8, + "y": 5 + }, + "id": 2, + "links": [ + { + "targetBlank": true, + "title": "Code Quality Issue Count", + "url": "https://devlake.apache.org/docs/Metrics/CQIssueCount" + } + ], + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "vertical", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "value", + "wideLayout": true + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "dataset": "lake", + "datasource": "mysql", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n count(distinct ci.id)\nFROM \n cq_issues ci\n join cq_issue_impacts cii on ci.id = cii.cq_issue_id\nWHERE\n ci.project_key in (${project_id})\n and cii.software_quality = 'RELIABILITY'\n and ci.severity in (${severity})", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Reliability", + "type": "stat" + }, + { + "datasource": "mysql", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 16, + "y": 5 + }, + "id": 20, + "links": [ + { + "targetBlank": true, + "title": "Code Quality Issue Count", + "url": "https://devlake.apache.org/docs/Metrics/CQIssueCount" + } + ], + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "vertical", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "value", + "wideLayout": true + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "dataset": "lake", + "datasource": "mysql", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n count(distinct ci.id)\nFROM \n cq_issues ci\n join cq_issue_impacts cii on ci.id = cii.cq_issue_id\nWHERE\n ci.project_key in (${project_id})\n and cii.software_quality = 'MAINTAINABILITY'\n and ci.severity in (${severity})", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Maintainability", + "type": "stat" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 10 + }, + "id": 21, + "panels": [], + "title": "Security Review", + "type": "row" + }, + { + "datasource": "mysql", + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 0, + "y": 11 + }, + "id": 4, + "links": [ + { + "targetBlank": true, + "title": "Code Quality Issue Count", + "url": "https://devlake.apache.org/docs/Metrics/CQIssueCount" + } + ], + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "dataset": "lake", + "datasource": "mysql", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n COUNT(distinct id) AS 'Security Hotspots'\nFROM cq_issues\nWHERE\n project_key in (${project_id})\n and type = 'HOTSPOTS'\n and severity in (${severity})\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Security Hotspots", + "type": "stat" + }, + { + "datasource": "mysql", + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 8, + "y": 11 + }, + "id": 13, + "links": [ + { + "targetBlank": true, + "title": "Code Quality Issue Count", + "url": "https://devlake.apache.org/docs/Metrics/CQIssueCount" + } + ], + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "dataset": "lake", + "datasource": "mysql", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n CONCAT(ROUND(COUNT(IF(status != 'TO_REVIEW', id, NULL)) / COUNT(distinct id) * 100, 2), '%') AS 'Reviewed'\nFROM cq_issues\nWHERE\n project_key in (${project_id})\n and type = 'HOTSPOTS'\n and severity in (${severity})", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Hotspots Reviewed", + "type": "stat" + }, + { + "collapsed": false, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 16 + }, + "id": 12, + "panels": [], + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "refId": "A" + } + ], + "title": "Test & Maintainability", + "type": "row" + }, + { + "datasource": "mysql", + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 0, + "y": 17 + }, + "id": 8, + "links": [ + { + "targetBlank": true, + "title": "Code Quality Test", + "url": "https://devlake.apache.org/docs/Metrics/CQTest" + } + ], + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "dataset": "lake", + "datasource": "mysql", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n CONCAT(ROUND((sum(lines_to_cover) - sum(uncovered_lines)) / sum(lines_to_cover) * 100, 1), '% ', 'Coverage on ', ROUND(sum(lines_to_cover) / 1000, 0),'k Lines to cover')\nFROM cq_file_metrics\nWHERE\n project_key in (${project_id})\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Test Coverage", + "type": "stat" + }, + { + "datasource": "mysql", + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "code smells" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 8, + "y": 17 + }, + "id": 14, + "links": [ + { + "targetBlank": true, + "title": "Code Quality Maintainability-Debt", + "url": "https://devlake.apache.org/docs/Metrics/CQMaintainability-Debt" + } + ], + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "value", + "wideLayout": true + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "dataset": "lake", + "datasource": "mysql", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n\tCOUNT(distinct id) as 'Code Smells'\nFROM cq_issues\nWHERE\n project_key in (${project_id})\n and type = 'CODE_SMELL'\n and severity in (${severity})", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Maintainability - Code Smells", + "type": "stat" + }, + { + "datasource": "mysql", + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "string" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 16, + "y": 17 + }, + "id": 7, + "links": [ + { + "targetBlank": true, + "title": "Code Quality Maintainability-Debt", + "url": "https://devlake.apache.org/docs/Metrics/CQMaintainability-Debt" + } + ], + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "value", + "wideLayout": true + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "dataset": "lake", + "datasource": "mysql", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n concat(FLOOR(SUM(debt)/8/60), \" day(s) \", FLOOR((SUM(debt)%480)/60), \" hour(s) \") AS 'Debt'\nFROM cq_issues\nWHERE\n project_key in (${project_id})\n and type = 'CODE_SMELL'\n and severity in (${severity})", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Maintainability - Debt", + "type": "stat" + }, + { + "collapsed": false, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 22 + }, + "id": 6, + "panels": [], + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "refId": "A" + } + ], + "title": "Duplications", + "type": "row" + }, + { + "datasource": "mysql", + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 0, + "y": 23 + }, + "id": 10, + "links": [ + { + "targetBlank": true, + "title": "Code Quality Duplicated Blocks", + "url": "https://devlake.apache.org/docs/Metrics/CQDuplicatedBlocks" + } + ], + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "dataset": "lake", + "datasource": "mysql", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n sum(duplicated_blocks)\nFROM cq_file_metrics\nWHERE\n project_key in (${project_id})", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Duplicated Blocks", + "type": "stat" + }, + { + "datasource": "mysql", + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 8, + "y": 23 + }, + "id": 9, + "links": [ + { + "targetBlank": true, + "title": "Code Quality Duplicated Lines", + "url": "https://devlake.apache.org/docs/Metrics/CQDuplicatedLines" + } + ], + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "dataset": "lake", + "datasource": "mysql", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n CONCAT(ROUND(sum(duplicated_lines) / sum(num_of_lines) * 100, 1), '% ', 'Duplications on ', ROUND(sum(ncloc) / 1000, 0),'k Lines')\nFROM cq_file_metrics\nWHERE\n project_key in (${project_id})", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Duplicated Lines", + "type": "stat" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 28 + }, + "id": 22, + "panels": [], + "title": "Size", + "type": "row" + }, + { + "datasource": "mysql", + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 0, + "y": 29 + }, + "id": 23, + "links": [ + { + "targetBlank": true, + "title": "Code Quality Duplicated Blocks", + "url": "https://devlake.apache.org/docs/Metrics/CQDuplicatedBlocks" + } + ], + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "dataset": "lake", + "datasource": "mysql", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n sum(ncloc)\nFROM cq_file_metrics\nWHERE\n project_key in (${project_id})", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Lines of Code", + "type": "stat" + }, + { + "datasource": "mysql", + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 8, + "y": 29 + }, + "id": 24, + "links": [ + { + "targetBlank": true, + "title": "Code Quality Duplicated Blocks", + "url": "https://devlake.apache.org/docs/Metrics/CQDuplicatedBlocks" + } + ], + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "dataset": "lake", + "datasource": "mysql", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n sum(num_of_lines)\nFROM cq_file_metrics\nWHERE\n project_key in (${project_id})", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Lines", + "type": "stat" + }, + { + "datasource": "mysql", + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 16, + "y": 29 + }, + "id": 25, + "links": [ + { + "targetBlank": true, + "title": "Code Quality Duplicated Blocks", + "url": "https://devlake.apache.org/docs/Metrics/CQDuplicatedBlocks" + } + ], + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "showPercentChange": false, + "text": {}, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "dataset": "lake", + "datasource": "mysql", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n count(distinct file_path)\nFROM cq_file_metrics\nWHERE\n project_key in (${project_id})", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Files", + "type": "stat" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 34 + }, + "id": 26, + "panels": [], + "title": "Overall Code Quality Metrics", + "type": "row" + }, + { + "datasource": "mysql", + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "color-text" + }, + "filterable": false, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 24, + "x": 0, + "y": 35 + }, + "id": 17, + "links": [ + { + "targetBlank": true, + "title": "Code Quality Issue Count", + "url": "https://devlake.apache.org/docs/Metrics/CQIssueCount" + } + ], + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "dataset": "lake", + "datasource": "mysql", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n\tfile_name, num_of_lines as 'Lines of Code', bugs as 'Bugs', vulnerabilities as 'Vulnerabilities', code_smells as 'Code Smells', \n\tsecurity_hotspots as 'Security Hotspots', CONCAT(ROUND(coverage, 2), '%') as 'Coverage', CONCAT(ROUND(duplicated_lines_density, 2), '%') as 'Duplications'\nFROM cq_file_metrics\nWHERE\n project_key in (${project_id})\nORDER BY bugs desc\nlimit 20", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Code Quality Metrics by Files (Top 20 order by Bugs)", + "type": "table" + } + ], + "refresh": "", + "schemaVersion": 39, + "tags": [ + "Data Source Dashboard", + "Stable Data Sources" + ], + "templating": { + "list": [ + { + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": "mysql", + "definition": "select concat(name, '--', id) as text from cq_projects", + "hide": 0, + "includeAll": true, + "label": "SonarQube Project", + "multi": true, + "name": "project_id", + "options": [], + "query": "select concat(name, '--', id) as text from cq_projects", + "refresh": 1, + "regex": "/^(?.*)--(?.*)$/", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": "mysql", + "definition": "select distinct severity from cq_issues where id like 'sonar%'", + "hide": 0, + "includeAll": true, + "label": "Severity", + "multi": true, + "name": "severity", + "options": [], + "query": "select distinct severity from cq_issues where id like 'sonar%'", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] + }, + "time": { + "from": "now", + "to": "now" + }, + "timepicker": {}, + "timezone": "utc", + "title": "SonarQube Cloud", + "uid": "WA0qbuJ4l", + "version": 1, + "weekStart": "" +} \ No newline at end of file