consloe pring
This commit is contained in:
parent
a5f3b304d7
commit
25e77497e7
|
@ -2,7 +2,7 @@ class QualityAnalysisController < ApplicationController
|
||||||
before_filter :find_project_by_project_id#, :except => [:getattachtype]
|
before_filter :find_project_by_project_id#, :except => [:getattachtype]
|
||||||
before_filter :find_quality_analysis, :only => [:edit, :update_jenkins_job]
|
before_filter :find_quality_analysis, :only => [:edit, :update_jenkins_job]
|
||||||
before_filter :authorize
|
before_filter :authorize
|
||||||
before_filter :connect_jenkins, :only => [:create, :edit, :update_jenkins_job]
|
before_filter :connect_jenkins, :only => [:create, :edit, :update_jenkins_job, :index]
|
||||||
layout "base_projects"
|
layout "base_projects"
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
include QualityAnalysisHelper
|
include QualityAnalysisHelper
|
||||||
|
@ -78,7 +78,7 @@ class QualityAnalysisController < ApplicationController
|
||||||
|
|
||||||
d = @client.job.delete("#{job_name}") if jenkins_job == '200' && code != '201'
|
d = @client.job.delete("#{job_name}") if jenkins_job == '200' && code != '201'
|
||||||
logger.error("delete result ==> #{code}")
|
logger.error("delete result ==> #{code}")
|
||||||
if qa.blank? && code == '201'
|
if qa.blank? && @current_build_status == "success"
|
||||||
QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier,
|
QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier,
|
||||||
:sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => "#{user_name}:#{rep_id}")
|
:sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => "#{user_name}:#{rep_id}")
|
||||||
else
|
else
|
||||||
|
@ -89,7 +89,7 @@ class QualityAnalysisController < ApplicationController
|
||||||
puts e
|
puts e
|
||||||
end
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch)}
|
format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch, :current_build_status => @current_build_status, :job_name => job_name)}
|
||||||
# format.js{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch)}
|
# format.js{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -167,6 +167,7 @@ class QualityAnalysisController < ApplicationController
|
||||||
begin
|
begin
|
||||||
@resource_id = params[:resource_id]
|
@resource_id = params[:resource_id]
|
||||||
@sonar_address = Redmine::Configuration['sonar_address']
|
@sonar_address = Redmine::Configuration['sonar_address']
|
||||||
|
@jenkins_address = Redmine::Configuration['jenkins_address']
|
||||||
if params[:resource_id].nil?
|
if params[:resource_id].nil?
|
||||||
@name_flag = true
|
@name_flag = true
|
||||||
projects_date = open(@sonar_address + "/api/projects/index").read
|
projects_date = open(@sonar_address + "/api/projects/index").read
|
||||||
|
@ -174,6 +175,10 @@ class QualityAnalysisController < ApplicationController
|
||||||
@quality_analyses = QualityAnalysis.where(:project_id => @project.id).select{|qa| arr.include?(qa.sonar_name)}
|
@quality_analyses = QualityAnalysis.where(:project_id => @project.id).select{|qa| arr.include?(qa.sonar_name)}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
if params[:current_build_status] == "failure"
|
||||||
|
job_name = params[:job_name]
|
||||||
|
@console_build = @client.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')
|
||||||
|
end
|
||||||
complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,file_line,files,functions,classes,directories").read
|
complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,file_line,files,functions,classes,directories").read
|
||||||
@complexity =JSON.parse(complexity_date).first
|
@complexity =JSON.parse(complexity_date).first
|
||||||
issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read
|
issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<%= javascript_include_tag 'highcharts','highcharts-more' %>
|
||||||
|
<div class="project_r_h">
|
||||||
|
<h2 class="project_h2" style="width:180px;">质量分析</h2>
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
<%= h @console_build.to_json.html_safe %>
|
||||||
|
</p>
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<% if @current_build_status == "success" %>
|
||||||
|
<%= render :partial => "show", :locals => {:branch => params[:branch]} %>
|
||||||
|
<% else %>
|
||||||
|
<% if @build_console_result %>
|
||||||
|
运行结果超时
|
||||||
|
<% else %>
|
||||||
|
<%= render :partial => "console_output" %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
|
@ -1,10 +1,14 @@
|
||||||
<% if @name_flag %>
|
<% if @name_flag %>
|
||||||
<%= render :partial => "result_list" %>
|
<%= render :partial => "result_list" %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% if @build_console_result %>
|
<% if params[:current_build_status].nil? || params[:current_build_status] == "success" %>
|
||||||
运行结果超时
|
|
||||||
<% else %>
|
|
||||||
<%= render :partial => "show", :locals => {:branch => params[:branch]} %>
|
<%= render :partial => "show", :locals => {:branch => params[:branch]} %>
|
||||||
|
<% else %>
|
||||||
|
<% if params[:build_console_result] %>
|
||||||
|
运行结果超时
|
||||||
|
<% else %>
|
||||||
|
<%= render :partial => "console_output" %>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
<a href="<%= @zip_path %>" class="btn_zipdown fr" onclick="">ZIP下载</a>
|
<a href="<%= @zip_path %>" class="btn_zipdown fr" onclick="">ZIP下载</a>
|
||||||
<%# if is_project_manager?(User.current, @project.id) && QualityAnalysis.where(:project_id => @project.id).first.nil? %>
|
<%# if is_project_manager?(User.current, @project.id) && QualityAnalysis.where(:project_id => @project.id).first.nil? %>
|
||||||
<%# if User.current.member_of?(@project) %>
|
<%# if User.current.member_of?(@project) %>
|
||||||
<%# if quality_analysis(User.current.try(:login), @repository.id).nil? && is_project_manager?(User.current.id, @project.id) %>
|
<% if quality_analysis(User.current.try(:login), @repository.id).nil? && is_project_manager?(User.current.id, @project.id) && @project.is_public? %>
|
||||||
<%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch ), :remote => true, :class => "btn_zipdown fr" %>
|
<%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch ), :remote => true, :class => "btn_zipdown fr" %>
|
||||||
<%# end %>
|
<% end %>
|
||||||
<%# end %>
|
<%# end %>
|
||||||
<%# else %>
|
<%# else %>
|
||||||
<%#= link_to "质量分析", project_quality_analysis_path(:project_id => @project.id, :resource_id => @proje), :class => "btn_zipdown fr" %>
|
<%#= link_to "质量分析", project_quality_analysis_path(:project_id => @project.id, :resource_id => @proje), :class => "btn_zipdown fr" %>
|
||||||
|
|
|
@ -792,6 +792,7 @@ RedmineApp::Application.routes.draw do
|
||||||
member do
|
member do
|
||||||
match 'update_jenkins_job'
|
match 'update_jenkins_job'
|
||||||
match 'edit'
|
match 'edit'
|
||||||
|
match 'create'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# resources :files, :only => [:index, :new, :create] do
|
# resources :files, :only => [:index, :new, :create] do
|
||||||
|
|
Loading…
Reference in New Issue