forked from Trustie/forgeplus
sca update
This commit is contained in:
parent
3492689d9b
commit
8309532b78
|
|
@ -1,26 +1,9 @@
|
|||
class Api::V1::Projects::ScaController < Api::V1::BaseController
|
||||
before_action :require_public_and_member_above, only: [:index, :show]
|
||||
|
||||
def index
|
||||
@result = Api::V1::Projects::Sca::ShowProjectService.call(@project)
|
||||
end
|
||||
def create
|
||||
@result_object = Api::V1::Projects::Sca::CreateProjectService.call(@project)
|
||||
end
|
||||
|
||||
def show
|
||||
@result_object = Api::V1::Projects::Tags::GetService.call(@project, params[:name], current_user&.gitea_token)
|
||||
end
|
||||
|
||||
def policies
|
||||
|
||||
end
|
||||
|
||||
before_action :require_operate_above, only: [:destroy]
|
||||
|
||||
def destroy
|
||||
@result_object = Api::V1::Projects::Tags::DeleteService.call(@project, params[:name], current_user&.gitea_token)
|
||||
if @result_object
|
||||
return render_ok
|
||||
else
|
||||
return render_error('删除标签失败!')
|
||||
end
|
||||
@result = Api::V1::Projects::Sca::CreateProjectService.call(@project)
|
||||
end
|
||||
end
|
||||
|
|
@ -76,6 +76,7 @@ module ProjectsHelper
|
|||
open_portrait: project.open_portrait,
|
||||
ignore_id: project.ignore_id,
|
||||
has_project_visitor: project.project_visitors.find_by(user_id: user.id).present?,
|
||||
sca_project_id: project.sca_project_id
|
||||
}).compact
|
||||
|
||||
render json: tmp_json
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@ class Api::V1::Projects::Sca::CreateProjectService < Api::V1::Projects::Sca::Ba
|
|||
"description": @project.description
|
||||
}
|
||||
data = sca_post_request("projects/", params)
|
||||
@project.update(sca_project_id:data[:json]["id"])
|
||||
if @project.update(sca_project_id:data[:json]["id"])
|
||||
Api::V1::Projects::Sca::ShowProjectService.call(@project)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -5,7 +5,6 @@ class Api::V1::Projects::Sca::ShowProjectService < Api::V1::Projects::Sca::Base
|
|||
|
||||
def call
|
||||
#projects/18748/list-branches/?branch_name_query=&page=1&limit=5
|
||||
#
|
||||
{
|
||||
auth_token:login_token,
|
||||
"url": base_url + "org/#{sca_user_info["default_org"]}/projects/#{@project.sca_project_id}?engine=sca" ,
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
json.data @result
|
||||
|
|
@ -0,0 +1 @@
|
|||
json.data @result
|
||||
|
|
@ -223,6 +223,7 @@ defaults format: :json do
|
|||
end
|
||||
end
|
||||
end
|
||||
resources :sca, only: [:index,:create]
|
||||
resources :pipelines do
|
||||
post :build_yaml, on: :collection
|
||||
post :save_yaml, on: :collection
|
||||
|
|
|
|||
Loading…
Reference in New Issue