新增:node_input的参数所属类型

This commit is contained in:
yystopf 2025-10-13 14:35:31 +08:00
parent 125d7dd032
commit 22bf3db41b
9 changed files with 95 additions and 5 deletions

View File

@ -70,9 +70,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, :default_value)
params.require(:action_node_input).permit(:name, :type, :input_type, :description, :is_required, :sort_no, :default_value)
else
params.permit(:name, :input_type, :description, :is_required, :sort_no, :default_value)
params.permit(:name, :type, :input_type, :description, :is_required, :sort_no, :default_value)
end
end
end

View File

@ -0,0 +1,25 @@
# == Schema Information
#
# Table name: action_node_inputs
#
# id :integer not null, primary key
# action_nodes_id :integer
# name :string(255)
# input_type :string(255)
# description :string(255)
# is_required :boolean default("0")
# sort_no :integer default("0")
# user_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# default_value :string(255)
# type :string(255) default("Action::NodeInputs::With")
#
# Indexes
#
# index_action_node_inputs_on_action_nodes_id (action_nodes_id)
# index_action_node_inputs_on_user_id (user_id)
#
class Action::NodeInputs::Env < Action::NodeInput
end

View File

@ -0,0 +1,25 @@
# == Schema Information
#
# Table name: action_node_inputs
#
# id :integer not null, primary key
# action_nodes_id :integer
# name :string(255)
# input_type :string(255)
# description :string(255)
# is_required :boolean default("0")
# sort_no :integer default("0")
# user_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# default_value :string(255)
# type :string(255) default("Action::NodeInputs::With")
#
# Indexes
#
# index_action_node_inputs_on_action_nodes_id (action_nodes_id)
# index_action_node_inputs_on_user_id (user_id)
#
class Action::NodeInputs::Other < Action::NodeInput
end

View File

@ -0,0 +1,25 @@
# == Schema Information
#
# Table name: action_node_inputs
#
# id :integer not null, primary key
# action_nodes_id :integer
# name :string(255)
# input_type :string(255)
# description :string(255)
# is_required :boolean default("0")
# sort_no :integer default("0")
# user_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# default_value :string(255)
# type :string(255) default("Action::NodeInputs::With")
#
# Indexes
#
# index_action_node_inputs_on_action_nodes_id (action_nodes_id)
# index_action_node_inputs_on_user_id (user_id)
#
class Action::NodeInputs::With < Action::NodeInput
end

View File

@ -16,7 +16,11 @@
<%= form.text_field :name %>
</div>
<div class="field">
<%= form.label :input_type, "参数类型" %>
<%= form.label :type, "参数所属类型" %>
<%= form.text_field :type %>
</div>
<div class="field">
<%= form.label :input_type, "参数输入类型" %>
<%= form.text_field :input_type %>
</div>
<div class="field">

View File

@ -1,4 +1,4 @@
json.extract! node_input, :id, :name, :input_type, :description, :is_required, :default_value
json.extract! node_input, :id, :name, :type, :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

@ -20,7 +20,11 @@
<%= form.text_field :name %>
</div>
<div class="field">
<%= form.label :input_type, "参数类型" %>
<%= form.label :type, "参数所属类型" %>
<%= form.text_field :type %>
</div>
<div class="field">
<%= form.label :input_type, "参数输入类型" %>
<%= form.text_field :input_type %>
</div>
<div class="field">

View File

@ -10,6 +10,7 @@
<tr>
<th>ID</th>
<th width="20%">参数名称</th>
<th width="25%">参数所属类型</th>
<th width="25%">参数输入类型</th>
<th width="20%">参数描述</th>
<th>是否必填项</th>
@ -24,6 +25,7 @@
<tr>
<td><%= info.id %></td>
<td><%= info.name %></td>
<td><%= info.type %></td>
<td><%= info.input_type %>
<% if info.input_type == "select" %>
<%= select_tag(:version, options_for_select(@node.action_node_selects.map(&:value)), class: 'form-control') %>

View File

@ -0,0 +1,5 @@
class AddTypeToActionNodeInputs < ActiveRecord::Migration[5.2]
def change
add_column :action_node_inputs, :type, :string, default: 'Action::NodeInputs::With'
end
end