From a5cf0ce14e122aa9080bd08064b84a4eac4c00de Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 27 May 2025 11:22:56 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9Aissue=5Ftype?= =?UTF-8?q?=E4=B8=BAnil?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/api/pm/issues/create_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/api/pm/issues/create_service.rb b/app/services/api/pm/issues/create_service.rb index 20c5a1219..3003869ea 100644 --- a/app/services/api/pm/issues/create_service.rb +++ b/app/services/api/pm/issues/create_service.rb @@ -60,7 +60,7 @@ class Api::Pm::Issues::CreateService < ApplicationService if @root_subject.present? && [4, 5].include?(@pm_issue_type.to_i) @root_issue = Issue.find_by(subject: @root_subject, pm_issue_type: [4,5], pm_project_id: @pm_project_id,enterprise_identifier: @enterprise_identifier) unless @root_issue.present? - @root_issue = Issue.create(subject: @root_subject, pm_issue_type: [4,5], pm_project_id: @pm_project_id, enterprise_identifier: @enterprise_identifier, status_id: 1, priority_id: 1, tracker_id: Tracker.first.id, project_id: @project.id, author_id: current_user.id) + @root_issue = Issue.create(subject: @root_subject, pm_issue_type: @pm_issue_type.to_i, pm_project_id: @pm_project_id, enterprise_identifier: @enterprise_identifier, status_id: 1, priority_id: 1, tracker_id: Tracker.first.id, project_id: @project.id, author_id: current_user.id) end @created_issue.root_id = @root_issue.id else From bff009d67394d491da2e9e2053f5d21dabed3fcf Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 27 May 2025 11:35:39 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E9=80=9A=E8=BF=87=E4=BC=81=E4=B8=9A=E6=A0=87=E8=AF=86?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E5=91=A8=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/api/v1/issues/list_service.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/api/v1/issues/list_service.rb b/app/services/api/v1/issues/list_service.rb index 6f9be57c0..8075f06f1 100644 --- a/app/services/api/v1/issues/list_service.rb +++ b/app/services/api/v1/issues/list_service.rb @@ -97,8 +97,8 @@ class Api::V1::Issues::ListService < ApplicationService end end - issues = issues.where(enterprise_identifier: enterprise_identifier) if enterprise_identifier.present? && [4,5].include?(pm_issue_type.to_i) - + issues = issues.where(enterprise_identifier: enterprise_identifier) if enterprise_identifier.present? && ([4,5].include?(pm_issue_type.to_i) || pm_issue_types.present?) + #pm相关 # root_id# -1 查一级目录 issues = if root_id.to_i == -1 From 3038f3bfb9b08fb40eb213cc31c6bc1676398ad5 Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 27 May 2025 14:45:00 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A=E5=B1=95?= =?UTF-8?q?=E7=A4=BAissue=E4=BB=85=E5=8C=85=E6=8B=AC=E6=88=91=E8=B4=9F?= =?UTF-8?q?=E8=B4=A3=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/pm/weekly_issues_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/pm/weekly_issues_controller.rb b/app/controllers/api/pm/weekly_issues_controller.rb index 8f7b0b8b6..dac4d65d3 100644 --- a/app/controllers/api/pm/weekly_issues_controller.rb +++ b/app/controllers/api/pm/weekly_issues_controller.rb @@ -3,7 +3,7 @@ class Api::Pm::WeeklyIssuesController < Api::Pm::BaseController def personal @enterprise_identifier = params[:enterprise_identifier] || '' return render_error('请输入正确的用户ID.') if params[:user_id].blank? - @all_issues = Issue.joins(:issue_participants).where(issue_participants: {participant_id: params[:user_id], participant_type: ['authored', 'assigned']}) + @all_issues = Issue.joins(:issue_participants).where(issue_participants: {participant_id: params[:user_id], participant_type: ['assigned']}) @all_issues = @all_issues.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3]) @this_week_all_issues = @all_issues.where("due_date >= ? and start_date <= ?", Date.today.beginning_of_week.to_s, Date.today.end_of_week.to_s).distinct @this_week_all_issues = @this_week_all_issues.order('created_on desc') @@ -65,7 +65,7 @@ class Api::Pm::WeeklyIssuesController < Api::Pm::BaseController def personal_issues @enterprise_identifier = params[:enterprise_identifier] || '' return render_error('请输入正确的用户ID.') if params[:user_id].blank? - @all_issues = Issue.joins(:issue_participants).where(issue_participants: {participant_id: params[:user_id], participant_type: ['authored', 'assigned']}) + @all_issues = Issue.joins(:issue_participants).where(issue_participants: {participant_id: params[:user_id], participant_type: ['assigned']}) @all_issues = @all_issues.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3]) @this_week_all_issues = @all_issues.where("due_date >= ? and start_date <= ?", Date.today.beginning_of_week.to_s, Date.today.end_of_week.to_s).distinct @this_week_all_issues = @this_week_all_issues.order('created_on desc') From a3f3d3ec18d48261c4e068aa766608e820c2f120 Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 27 May 2025 16:16:51 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=80=BB=E6=95=B0=E4=B8=8D=E8=AE=A1=E5=85=A5=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=BB=84=E5=91=A8=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/api/v1/issues/_simple_detail.json.jbuilder | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/api/v1/issues/_simple_detail.json.jbuilder b/app/views/api/v1/issues/_simple_detail.json.jbuilder index 2c05acf7f..e361d136b 100644 --- a/app/views/api/v1/issues/_simple_detail.json.jbuilder +++ b/app/views/api/v1/issues/_simple_detail.json.jbuilder @@ -30,7 +30,11 @@ json.pm_issue_type issue.pm_issue_type json.pm_sprint_id issue.pm_sprint_id json.pm_project_id issue.pm_project_id json.time_scale issue.time_scale -json.child_count issue.child_count +if params[:pm_issue_types].present? + json.child_count issue.children_issues.where(pm_issue_type: 4).count +else + json.child_count issue.child_count +end json.author do json.partial! "api/v1/users/simple_user", locals: {user: issue.user} From c57482042dde3aae2b7e123987a183a2f18cb995 Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 27 May 2025 16:57:36 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E6=97=B6=E9=97=B4=E4=B8=8D=E5=9C=A8=E8=8C=83=E5=9B=B4?= =?UTF-8?q?=E5=86=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/api/v1/issues/list_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/api/v1/issues/list_service.rb b/app/services/api/v1/issues/list_service.rb index 8075f06f1..0ceac0ee4 100644 --- a/app/services/api/v1/issues/list_service.rb +++ b/app/services/api/v1/issues/list_service.rb @@ -151,7 +151,7 @@ class Api::V1::Issues::ListService < ApplicationService end if update_begin_date&.present? || update_end_date&.present? - issues = issues.where('issues.updated_on between ? and ?', update_begin_date&.present? ? update_begin_date.to_time : Time.now.beginning_of_day, update_end_date&.present? ? update_end_date.to_time.end_of_day : Time.now.end_of_day) + issues = issues.where('issues.updated_on between ? and ?', update_begin_date&.present? ? update_begin_date.to_time.beginning_of_week : Time.now.beginning_of_week, update_end_date&.present? ? update_end_date.to_time.end_of_week : Time.now.end_of_week) end # keyword From 9fbf5920dfe398dcdf277fe66c92ca19f987d640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=B1=E5=91=B1=E5=91=B1?= Date: Thu, 29 May 2025 16:31:07 +0800 Subject: [PATCH 06/10] update sonar --- app/controllers/api/v1/sonarqubes_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/sonarqubes_controller.rb b/app/controllers/api/v1/sonarqubes_controller.rb index c6f718de0..ebac05b29 100644 --- a/app/controllers/api/v1/sonarqubes_controller.rb +++ b/app/controllers/api/v1/sonarqubes_controller.rb @@ -87,7 +87,7 @@ class Api::V1::SonarqubesController < Api::V1::BaseController filepath: 'sonar-project.properties', branch: params[:branch], new_branch: nil, - "content": "sonar.projectKey=#{params[:owner]}-#{@project.id}\nsonar.sources=.\nsonar.java.binaries=.", + "content": "sonar.projectKey=#{params[:owner]}-#{@project.id}\nsonar.projectVersion=1.0\nsonar.sourceEncoding=UTF-8\nsonar.sources=src/java,src/js,src/python,src/c,src/cpp\nsonar.exclusions=**/node_modules/**,**/__pycache__/**,**/dist/**,**/build/**,**/target/**,**/out/**\nsonar.java.binaries=target/classes,build/classes\nsonar.javascript.lcov.reportPaths=coverage/lcov.info\nsonar.python.coverage.reportPaths=coverage.xml\nsonar.cfamily.build-wrapper-output=bw-output", "message": 'Add sonar-project.properties', committer: { email: @owner.mail, From 802e8bb0aa5ec72c1c83195f4891c75c82ed780f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=B1=E5=91=B1=E5=91=B1?= Date: Thu, 29 May 2025 16:41:30 +0800 Subject: [PATCH 07/10] update sonar --- app/controllers/api/v1/sonarqubes_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/sonarqubes_controller.rb b/app/controllers/api/v1/sonarqubes_controller.rb index ebac05b29..316b648ad 100644 --- a/app/controllers/api/v1/sonarqubes_controller.rb +++ b/app/controllers/api/v1/sonarqubes_controller.rb @@ -87,7 +87,7 @@ class Api::V1::SonarqubesController < Api::V1::BaseController filepath: 'sonar-project.properties', branch: params[:branch], new_branch: nil, - "content": "sonar.projectKey=#{params[:owner]}-#{@project.id}\nsonar.projectVersion=1.0\nsonar.sourceEncoding=UTF-8\nsonar.sources=src/java,src/js,src/python,src/c,src/cpp\nsonar.exclusions=**/node_modules/**,**/__pycache__/**,**/dist/**,**/build/**,**/target/**,**/out/**\nsonar.java.binaries=target/classes,build/classes\nsonar.javascript.lcov.reportPaths=coverage/lcov.info\nsonar.python.coverage.reportPaths=coverage.xml\nsonar.cfamily.build-wrapper-output=bw-output", + "content": "sonar.projectKey=#{params[:owner]}-#{@project.id}\nsonar.projectVersion=1.0\nsonar.sourceEncoding=UTF-8\nsonar.sources=.\nsonar.java.binaries=target/classes,build/classes\nsonar.javascript.lcov.reportPaths=coverage/lcov.info\nsonar.python.coverage.reportPaths=coverage.xml\nsonar.cfamily.build-wrapper-output=bw-output", "message": 'Add sonar-project.properties', committer: { email: @owner.mail, From 3c81b924cde1897457c92598dd253045c8609f7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=B1=E5=91=B1=E5=91=B1?= Date: Thu, 29 May 2025 17:09:32 +0800 Subject: [PATCH 08/10] update sonar --- app/controllers/api/v1/sonarqubes_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/sonarqubes_controller.rb b/app/controllers/api/v1/sonarqubes_controller.rb index 316b648ad..2ad2a3d4a 100644 --- a/app/controllers/api/v1/sonarqubes_controller.rb +++ b/app/controllers/api/v1/sonarqubes_controller.rb @@ -87,7 +87,7 @@ class Api::V1::SonarqubesController < Api::V1::BaseController filepath: 'sonar-project.properties', branch: params[:branch], new_branch: nil, - "content": "sonar.projectKey=#{params[:owner]}-#{@project.id}\nsonar.projectVersion=1.0\nsonar.sourceEncoding=UTF-8\nsonar.sources=.\nsonar.java.binaries=target/classes,build/classes\nsonar.javascript.lcov.reportPaths=coverage/lcov.info\nsonar.python.coverage.reportPaths=coverage.xml\nsonar.cfamily.build-wrapper-output=bw-output", + "content": "sonar.projectKey=#{params[:owner]}-#{@project.id}\nsonar.projectVersion=1.0\nsonar.sourceEncoding=UTF-8\nsonar.sources=.\nsonar.java.binaries=target/classes,build/classes\nsonar.javascript.lcov.reportPaths=coverage/lcov.info\nsonar.python.coverage.reportPaths=coverage.xml\nsonar.cxx.file.suffixes=.h,.cpp", "message": 'Add sonar-project.properties', committer: { email: @owner.mail, From 0fa7ce412779f9fdc5736aa47ab80b729d30b5f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=B1=E5=91=B1=E5=91=B1?= Date: Thu, 29 May 2025 17:33:38 +0800 Subject: [PATCH 09/10] add doxygen --- app/controllers/api/v1/sonarqubes_controller.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/sonarqubes_controller.rb b/app/controllers/api/v1/sonarqubes_controller.rb index 2ad2a3d4a..80dd3ba93 100644 --- a/app/controllers/api/v1/sonarqubes_controller.rb +++ b/app/controllers/api/v1/sonarqubes_controller.rb @@ -17,6 +17,7 @@ class Api::V1::SonarqubesController < Api::V1::BaseController def insert_file checkout_url = 'https://gitlink.org.cn/KingChan/checkout@v4' scanner_url = 'https://gitlink.org.cn/KingChan/sonarqube-scan-action@master' + doxygen_url = "https://gitlink.gitlink.net" begin config = Rails.application.config_for(:configuration) sonarqube_config = config.dig('sonarqube') @@ -27,7 +28,9 @@ class Api::V1::SonarqubesController < Api::V1::BaseController if sonarqube_config.present? && sonarqube_config['scanner'].present? scanner_url = sonarqube_config['scanner'] end - + if sonarqube_config.present? && sonarqube_config['doxygen'].present? + doxygen_url = sonarqube_config['doxygen'] + end raise 'sonar config missing' if sonarqube_config.blank? rescue => ex raise ex if Rails.env.production? @@ -61,6 +64,9 @@ class Api::V1::SonarqubesController < Api::V1::BaseController with: # Disabling shallow clones is recommended for improving the relevancy of reporting fetch-depth: 0 + - name: curl doxygen + run: | + curl -X GET #{doxygen_url}/generate?repo=#{@project.repository.url} - name: SonarQube Scan uses: #{scanner_url} env: From a46bec5f0cdc164663425ec6a98bd8a3f521bb4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=B1=E5=91=B1=E5=91=B1?= Date: Thu, 29 May 2025 19:11:43 +0800 Subject: [PATCH 10/10] doxygen url --- app/controllers/api/v1/sonarqubes_controller.rb | 8 ++++++++ config/routes/api.rb | 1 + 2 files changed, 9 insertions(+) diff --git a/app/controllers/api/v1/sonarqubes_controller.rb b/app/controllers/api/v1/sonarqubes_controller.rb index 80dd3ba93..95e41b750 100644 --- a/app/controllers/api/v1/sonarqubes_controller.rb +++ b/app/controllers/api/v1/sonarqubes_controller.rb @@ -154,6 +154,14 @@ class Api::V1::SonarqubesController < Api::V1::BaseController render_ok data end + def doxygen_url + config = Rails.application.config_for(:configuration) + sonarqube_config = config.dig('sonarqube') + doxygen_url = sonarqube_config['doxygen'] + data = {doxygen_url: "#{doxygen_url}/files/#{@project.owner.login}/#{@project.identifier}/html/"} + render_ok data + end + def measures_search_history params_data = { from: params[:form], diff --git a/config/routes/api.rb b/config/routes/api.rb index 09cc2f065..67ff6c5e0 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -118,6 +118,7 @@ defaults format: :json do post :sonar_initialize post :insert_file + get :doxygen_url end end