diff --git a/app/controllers/action/nodes_controller.rb b/app/controllers/action/nodes_controller.rb index d85a6094a..ebccf8efe 100644 --- a/app/controllers/action/nodes_controller.rb +++ b/app/controllers/action/nodes_controller.rb @@ -61,9 +61,11 @@ class Action::NodesController < ApplicationController def node_params if params.require(:action_node) - params.require(:action_node).permit(:name, :label, :full_name, :description, :icon, :action_node_types_id, :is_local, :local_url, :yaml, :sort_no) + params.require(:action_node).permit(:name, :label, :full_name, :description, :icon, :action_node_types_id, + :is_local, :local_url, :yaml, :sort_no, :type, :is_mutil_link, :link_type) else - params.permit(:name, :label, :full_name, :description, :icon, :action_node_types_id, :is_local, :local_url, :yaml, :sort_no) + params.permit(:name, :label, :full_name, :description, :icon, :action_node_types_id, :is_local, :local_url, + :yaml, :sort_no, :type, :is_mutil_link, :link_type) end end end diff --git a/app/controllers/site_pages_controller.rb b/app/controllers/site_pages_controller.rb index 085f1b027..408add73a 100644 --- a/app/controllers/site_pages_controller.rb +++ b/app/controllers/site_pages_controller.rb @@ -54,9 +54,9 @@ class SitePagesController < ApplicationController user = User.find_by_login params[:repository][:owner][:login] return normal_status(-1, '你还未开通Page服务,无法进行部署') unless user.website_permission - project = Project.where(identifier: params[:repository][:name],user_id: user.id) - return normal_status(-1, '你没有权限操作') if project.owner?(user) - return normal_status(-1, '该仓库还未开通Page服务,无法进行部署') if Page.exists?(user: user, project: project) + project = Project.find_by(identifier: params[:repository][:name],user_id: user.id) + return normal_status(-1, '项目不存在') if project.nil? + return normal_status(-1, '该仓库还未开通Page服务,无法进行部署') unless Page.exists?(user: user, project: project) @page = Page.find_by(user: user, project: project) response_str = @page.deploy_page(branch) diff --git a/app/models/action/node.rb b/app/models/action/node.rb index 79c54293d..290d302bd 100644 --- a/app/models/action/node.rb +++ b/app/models/action/node.rb @@ -23,7 +23,7 @@ # index_action_nodes_on_action_node_types_id (action_node_types_id) # index_action_nodes_on_user_id (user_id) # - +# node_type 0: 触发器 1: 任务作业, 2: 步骤 class Action::Node < ApplicationRecord self.table_name = 'action_nodes' default_scope { order(sort_no: :asc) } @@ -34,7 +34,7 @@ class Action::Node < ApplicationRecord belongs_to :user, optional: true - attr_accessor :cust_name, :run_values, :input_values + attr_accessor :cust_name, :run_values, :input_values, :next_step_nodes validates :name, presence: { message: "不能为空" } validates :full_name, length: { maximum: 200, too_long: "不能超过200个字符" } @@ -42,6 +42,7 @@ class Action::Node < ApplicationRecord validates :description, length: { maximum: 65535, too_long: "不能超过65535个字符"} + def content_yaml "foo".to_yaml <<~YAML diff --git a/app/views/action/nodes/index.json.jbuilder b/app/views/action/nodes/index.json.jbuilder index fc8a38505..835c7f145 100644 --- a/app/views/action/nodes/index.json.jbuilder +++ b/app/views/action/nodes/index.json.jbuilder @@ -2,7 +2,7 @@ json.types @node_types.each do |node_type| if node_type.name.to_s == "未分类" json.extract! node_type, :id, :name json.nodes @no_type_nodes do |node| - json.extract! node, :id, :label, :name, :full_name, :description, :icon, :action_node_types_id, :yaml, :sort_no, :use_count + json.extract! node, :id, :label, :name, :full_name, :description, :icon, :action_node_types_id, :yaml, :sort_no, :use_count, :node_type, :is_mutil_link, :link_type json.inputs node.action_node_inputs do |node_input| json.partial! "node_input", locals: { node_input: node_input, node: node } end @@ -10,7 +10,7 @@ json.types @node_types.each do |node_type| else json.extract! node_type, :id, :name json.nodes node_type.action_nodes do |node| - json.extract! node, :id, :label, :name, :full_name, :description, :icon, :action_node_types_id, :yaml, :sort_no, :use_count + json.extract! node, :id, :label, :name, :full_name, :description, :icon, :action_node_types_id, :yaml, :sort_no, :use_count, :node_type, :is_mutil_link, :link_type json.inputs node.action_node_inputs do |node_input| json.partial! "node_input", locals: { node_input: node_input, node: node } end diff --git a/db/migrate/202412030203041_add_action_nodes_type.rb b/db/migrate/202412030203041_add_action_nodes_type.rb new file mode 100644 index 000000000..bc7d77f4f --- /dev/null +++ b/db/migrate/202412030203041_add_action_nodes_type.rb @@ -0,0 +1,7 @@ +class AddActionNodesType < ActiveRecord::Migration[5.2] + def change + add_column :action_nodes, :node_type, :string + add_column :action_nodes, :is_mutil_link, :boolean + add_column :action_nodes, :link_type, :string + end +end