Merge branch 'pre_trustie_server' into trustie_server

This commit is contained in:
2025-03-13 14:08:12 +08:00
16 changed files with 107 additions and 34 deletions

View File

@@ -67,9 +67,9 @@ class Action::NodeInputsController < ApplicationController
def node_input_params
if params.require(:action_node_input)
params.require(:action_node_input).permit(:name, :input_type, :description, :is_required, :sort_no)
params.require(:action_node_input).permit(:name, :input_type, :description, :is_required, :sort_no, :default_value)
else
params.permit(:name, :input_type, :description, :is_required, :sort_no)
params.permit(:name, :input_type, :description, :is_required, :sort_no, :default_value)
end
end
end

View File

@@ -47,6 +47,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
interactor = sha.present? ? Gitea::UpdateFileInteractor.call(current_user.gitea_token, @owner.login, content_params("update").merge(sha: sha)) : Gitea::CreateFileInteractor.call(current_user.gitea_token, @owner.login, content_params("create"))
tip_exception(interactor.error) unless interactor.success?
file = interactor.result
@pipeline.save
render_ok({ pipeline_yaml: pipeline_yaml, pipeline_name: params[:pipeline_name], file_name: @pipeline.file_name, sha: sha.present? ? sha : file['content']['sha'] })
end
@@ -79,8 +80,8 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
def destroy
@pipeline = Action::Pipeline.find(params[:id])
if pipeline
interactor = Gitea::DeleteFileInteractor.call(current_user.gitea_token, @owner.login, content_params("update"))
if @pipeline
interactor = Gitea::DeleteFileInteractor.call(current_user.gitea_token, @owner.login, del_content_params.merge(identifier: @project.identifier))
tip_exception(interactor.error) unless interactor.success?
@pipeline.destroy!
end
@@ -114,7 +115,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
def show
@pipeline = Action::Pipeline.find_by(id: params[:id])
@pipeline = Action::Pipeline.new(id: 0, pipeline_name: "test-ss", yaml: build_test_yaml) if @pipeline.blank?
# @pipeline = Action::Pipeline.new(id: 0, pipeline_name: "test-ss", yaml: build_test_yaml) if @pipeline.blank?
end
def build_pipeline_yaml_new(pipeline_name, pipeline_json)
@@ -172,6 +173,15 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
}
end
def del_content_params(opt)
{
filepath: ".gitea/workflows/#{@pipeline.pipeline_name}.yml",
base64_filepath: Base64.encode64(".gitea/workflows/#{@pipeline.pipeline_name}.yml").gsub(/\n/, ''),
branch: @pipeline.branch,
sha: get_pipeline_file_sha(@pipeline.file_name, @pipeline.branch)
}
end
def build_nodes(params_nodes)
steps_nodes = []
params_nodes.each do |input_node|

View File

@@ -4,4 +4,8 @@ class LicensesController < ApplicationController
q = License.ransack(name_cont: params[:name])
@licenses = q.result(distinct: true)
end
def show
@license = License.find(params[:id])
end
end

View File

@@ -263,7 +263,7 @@ class UsersController < ApplicationController
begin
@user = current_user
begin
result = Notice::Read::CountService.call(current_user.id)
result = EduSetting.get("notice_disable").to_s == "true" ? nil : Notice::Read::CountService.call(current_user.id)
@message_unread_total = result.nil? ? 0 : result[2]["unread_notification"]
rescue
@message_unread_total = 0

View File

@@ -33,7 +33,7 @@ class Action::Pipeline < ApplicationRecord
belongs_to :user, optional: true
belongs_to :project
validates :name, presence: { message: "不能为空" }
validates :pipeline_name, presence: { message: "不能为空" }
validates :json, length: { maximum: 65535, too_long: "不能超过65535个字符"}
validates :yaml, length: { maximum: 65535, too_long: "不能超过65535个字符"}
end

View File

@@ -23,6 +23,10 @@
<%= form.label :description, "描述" %>
<%= form.text_area :description, rows: 5, :style => 'width:800px;' %>
</div>
<div class="field">
<%= form.label :default_value, "默认值" %>
<%= form.text_field :default_value %>
</div>
<div class="field">
<%= form.label :is_required, "是否必填项" %>
<%= form.check_box("is_required", {}, "true", "false") %>

View File

@@ -1,4 +1,4 @@
json.extract! node_input, :id, :name, :input_type, :description
json.extract! node_input, :id, :name, :input_type, :description, :is_required, :default_value
if node_input.input_type.to_s == "select"
json.select node.action_node_selects do |node_select|
json.partial! "node_select", locals: { node_select: node_select, node: node }

View File

@@ -27,6 +27,10 @@
<%= form.label :description, "描述" %>
<%= form.text_area :description, rows: 5, :style => 'width:800px;' %>
</div>
<div class="field">
<%= form.label :default_value, "默认值" %>
<%= form.text_field :default_value %>
</div>
<div class="field">
<%= form.label :is_required, "是否必填项" %>
<%= form.check_box("is_required", {}, "true", "false") %>

View File

@@ -1,4 +1,4 @@
json.extract! node_input, :id, :name, :input_type, :description, :is_required
json.extract! node_input, :id, :name, :input_type, :description, :is_required, :default_value
if node_input.input_type.to_s == "select"
json.select node.action_node_selects do |node_select|
json.partial! "node_select", locals: { node_select: node_select, node: node }

View File

@@ -30,7 +30,7 @@
<li><%= sidebar_item(admins_project_ignores_path, '忽略文件', icon: 'git', controller: 'admins-project_ignores', has_permission: current_user.admin?) %></li>
<% end %>
</li>
<!-- <li><%#= sidebar_item(admins_laboratories_path, '导航栏配置', icon: 'cloud', controller: 'admins-laboratories', has_permission: current_user.admin?) %></li>-->
<li><%= sidebar_item(admins_laboratories_path, '导航栏配置', icon: 'cloud', controller: 'admins-laboratories', has_permission: current_user.admin?)%></li>
<li>
<%= sidebar_item_group('#setting-system', '开发者配置', icon: 'wrench', has_permission: current_user.admin?) do %>
<li><%= sidebar_item(admins_sites_path, 'setting接口配置', icon: 'deaf', controller: 'admins-sites', has_permission: current_user.admin?) %></li>

View File

@@ -0,0 +1,3 @@
json.id @license.id
json.name @license.name
json.content @license.content

View File

@@ -10,6 +10,7 @@ json.projects @projects do |project|
json.praises_count project.praises_count.to_i
json.forked_count project.forked_count.to_i
json.is_public project.is_public
json.license_id project.license_id
json.mirror_url project.repository&.mirror_url
json.type project&.numerical_for_project_type
json.last_update_time render_unix_time(project.updated_on)
@@ -50,7 +51,7 @@ json.projects @projects do |project|
json.name project.project_language.name
end
end
json.topics project.project_topics.each do |topic|
json.topics project.project_topics.each do |topic|
json.(topic, :id, :name)
end
end

View File

@@ -66,6 +66,7 @@ else
json.private !@project.is_public
end
json.license_name @project.license_name
json.license_id @project.license_id
json.branches_count @result[:branch_tag_total_count].present? ? (@result[:branch_tag_total_count]['branch_count'] || 0) : 0
json.tags_count @result[:branch_tag_total_count].present? ? (@result[:branch_tag_total_count]['tag_count'] || 0) : 0
# json.contributors do