Merge pull request 'project 新增sonar_url ,且新增回调接口,新增调试工具' (#220) from gua2048/forgeplus:mulanoss_server into mulanoss_server
This commit is contained in:
commit
1822ade2db
1
Gemfile
1
Gemfile
|
@ -63,6 +63,7 @@ end
|
|||
|
||||
group :development do
|
||||
gem 'prettier'
|
||||
gem 'pry-rails', '~> 0.3.9'
|
||||
gem 'rubocop', '~> 0.52.0'
|
||||
gem 'solargraph', '~> 0.38.0'
|
||||
gem 'awesome_print'
|
||||
|
|
|
@ -99,6 +99,7 @@ GEM
|
|||
archive-zip (~> 0.10)
|
||||
nokogiri (~> 1.8)
|
||||
chunky_png (1.3.11)
|
||||
coderay (1.1.3)
|
||||
concurrent-ruby (1.1.6)
|
||||
connection_pool (2.2.2)
|
||||
crass (1.0.6)
|
||||
|
@ -217,6 +218,11 @@ GEM
|
|||
popper_js (1.16.0)
|
||||
powerpack (0.1.2)
|
||||
prettier (0.18.2)
|
||||
pry (0.12.2)
|
||||
coderay (~> 1.1.0)
|
||||
method_source (~> 0.9.0)
|
||||
pry-rails (0.3.9)
|
||||
pry (>= 0.10.4)
|
||||
public_suffix (4.0.3)
|
||||
puma (3.12.2)
|
||||
raabro (1.4.0)
|
||||
|
@ -469,6 +475,7 @@ DEPENDENCIES
|
|||
parallel (~> 1.19, >= 1.19.1)
|
||||
pdfkit
|
||||
prettier
|
||||
pry-rails (~> 0.3.9)
|
||||
puma (~> 3.11)
|
||||
rack-cors
|
||||
rack-mini-profiler
|
||||
|
|
|
@ -4,7 +4,7 @@ class ProjectsController < ApplicationController
|
|||
include ProjectsHelper
|
||||
include Acceleratorable
|
||||
|
||||
before_action :require_login, except: %i[index branches branches_slice group_type_list simple show fork_users praise_users watch_users recommend about menu_list]
|
||||
before_action :require_login, except: %i[index branches branches_slice group_type_list simple show fork_users praise_users watch_users recommend about menu_list sonar_url]
|
||||
before_action :require_profile_completed, only: [:create, :migrate]
|
||||
before_action :load_repository, except: %i[index group_type_list migrate create recommend]
|
||||
before_action :authorizate_user_can_edit_project!, only: %i[update]
|
||||
|
@ -225,6 +225,14 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def sonar_url
|
||||
token = request.headers["HTTP_SONAR_TOKEN"]
|
||||
playod = JWT.decode(token,EducoderOauth.client_id)[0]
|
||||
data = HashWithIndifferentAccess.new playod
|
||||
return normal_status(-1, "sonar_url不能为空") if data["sonar_url"].blank?
|
||||
@project.update(sonar_url:data["sonar_url"])
|
||||
render :json => { status: 0, message: "更新成功"}
|
||||
end
|
||||
|
||||
private
|
||||
def project_params
|
||||
|
|
|
@ -54,6 +54,7 @@ module ProjectsHelper
|
|||
tmp_json = tmp_json.merge({
|
||||
identifier: render_identifier(project),
|
||||
name: project.name,
|
||||
sonar_url: project.sonar_url,
|
||||
platform: project.platform,
|
||||
id: project.id,
|
||||
repo_id: repo.id,
|
||||
|
|
|
@ -422,6 +422,7 @@ Rails.application.routes.draw do
|
|||
get :branches
|
||||
get :branches_slice
|
||||
get :simple
|
||||
post :sonar_url
|
||||
get :watchers, to: 'projects#watch_users'
|
||||
get :stargazers, to: 'projects#praise_users'
|
||||
get :members, to: 'projects#fork_users'
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddSonarUrlToProjects < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :projects, :sonar_url, :string
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue