Browse Source

增加流水线节点名称,和标识区分

pull/347/head
xxq250 2 years ago
parent
commit
b96d52a84d
13 changed files with 39 additions and 9 deletions
  1. +2
    -2
      app/controllers/action/nodes_controller.rb
  2. +5
    -0
      app/models/action/node.rb
  3. +3
    -0
      app/models/action/node_input.rb
  4. +3
    -0
      app/models/action/node_select.rb
  5. +3
    -0
      app/models/action/node_type.rb
  6. +3
    -1
      app/models/action/pipeline.rb
  7. +3
    -0
      app/models/action/template.rb
  8. +1
    -1
      app/views/action/node_inputs/edit.html.erb
  9. +2
    -2
      app/views/action/node_inputs/index.json.jbuilder
  10. +5
    -1
      app/views/action/nodes/_form.html.erb
  11. +2
    -0
      app/views/action/nodes/index.html.erb
  12. +2
    -2
      app/views/action/nodes/index.json.jbuilder
  13. +5
    -0
      db/migrate/20240408010103_add_action_nodes_label.rb

+ 2
- 2
app/controllers/action/nodes_controller.rb View File

@@ -61,9 +61,9 @@ class Action::NodesController < ApplicationController

def node_params
if params.require(:action_node)
params.require(:action_node).permit(:name, :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)
else
params.permit(:name, :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)
end
end
end

+ 5
- 0
app/models/action/node.rb View File

@@ -36,6 +36,11 @@ class Action::Node < ApplicationRecord

attr_accessor :cust_name, :run_values, :input_values

validates :name, presence: { message: "不能为空" }
validates :full_name, length: { maximum: 200, too_long: "不能超过200个字符" }
validates :label, length: { maximum: 200, too_long: "不能超过200个字符" }
validates :description, length: { maximum: 65535, too_long: "不能超过65535个字符"}


def content_yaml
"foo".to_yaml


+ 3
- 0
app/models/action/node_input.rb View File

@@ -24,4 +24,7 @@ class Action::NodeInput < ApplicationRecord
default_scope { order(sort_no: :asc) }

belongs_to :action_node, :class_name => 'Action::Node', foreign_key: "action_nodes_id"

validates :name, presence: { message: "不能为空" }
validates :description, length: { maximum: 65535, too_long: "不能超过65535个字符"}
end

+ 3
- 0
app/models/action/node_select.rb View File

@@ -29,6 +29,9 @@ class Action::NodeSelect < ApplicationRecord
belongs_to :action_node, :class_name => 'Action::Node', foreign_key: "action_nodes_id"
belongs_to :user, optional: true

validates :name, presence: { message: "不能为空" }
validates :description, length: { maximum: 65535, too_long: "不能超过65535个字符"}

def value
if self.val_ext.blank?
self.val


+ 3
- 0
app/models/action/node_type.rb View File

@@ -15,4 +15,7 @@ class Action::NodeType < ApplicationRecord
default_scope { order(sort_no: :asc) }

has_many :action_nodes, :class_name => 'Action::Node', foreign_key: "action_node_types_id"

validates :name, presence: { message: "不能为空" }
validates :description, length: { maximum: 65535, too_long: "不能超过65535个字符"}
end

+ 3
- 1
app/models/action/pipeline.rb View File

@@ -33,5 +33,7 @@ class Action::Pipeline < ApplicationRecord
belongs_to :user, optional: true
belongs_to :project


validates :name, presence: { message: "不能为空" }
validates :json, length: { maximum: 65535, too_long: "不能超过65535个字符"}
validates :yaml, length: { maximum: 65535, too_long: "不能超过65535个字符"}
end

+ 3
- 0
app/models/action/template.rb View File

@@ -17,4 +17,7 @@ class Action::Template < ApplicationRecord
self.table_name = 'action_templates'
default_scope { order(sort_no: :asc) }

validates :name, presence: { message: "不能为空" }
validates :description, length: { maximum: 65535, too_long: "不能超过65535个字符"}

end

+ 1
- 1
app/views/action/node_inputs/edit.html.erb View File

@@ -39,7 +39,7 @@

<div class="actions" style="margin-top:10px;">
<!-- <a href="/managements/competition/customize" style="font-size: 28px;">>>前往节点管理页面</a>-->
<%= form.submit("保存赛事") %>
<%= form.submit("保存") %>
</div>
<% end %>



+ 2
- 2
app/views/action/node_inputs/index.json.jbuilder View File

@@ -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, :name, :full_name, :description, :action_node_types_id, :yaml, :sort_no, :use_count
json.extract! node, :id, :label, :name, :full_name, :description, :action_node_types_id, :yaml, :sort_no, :use_count
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, :name, :full_name, :description, :action_node_types_id, :yaml, :sort_no, :use_count
json.extract! node, :id, :label, :name, :full_name, :description, :action_node_types_id, :yaml, :sort_no, :use_count
json.inputs node.action_node_inputs do |node_input|
json.partial! "node_input", locals: { node_input: node_input, node: node }
end


+ 5
- 1
app/views/action/nodes/_form.html.erb View File

@@ -20,7 +20,11 @@
<%= form.text_field :name %>
</div>
<div class="field">
<%= form.label :full_name, "节点全称" %>
<%= form.label :label, "节点标识" %>
<%= form.text_field :label %>
</div>
<div class="field">
<%= form.label :full_name, "节点全名" %>
<%= form.text_field :full_name %>
</div>



+ 2
- 0
app/views/action/nodes/index.html.erb View File

@@ -10,6 +10,7 @@
<tr>
<th>ID</th>
<th width="15%">节点名称</th>
<th width="15%">节点标识</th>
<th width="20%">节点全称</th>
<th width="20%">节点描述</th>
<th width="10%">分类</th>
@@ -27,6 +28,7 @@
<% @nodes.each do |info| %>
<tr>
<td><%= info.id %></td>
<td><%= info.label %></td>
<td><%= info.name %></td>
<td><%= info.full_name %></td>
<td><%= info.description %></td>


+ 2
- 2
app/views/action/nodes/index.json.jbuilder View File

@@ -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, :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
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, :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
json.inputs node.action_node_inputs do |node_input|
json.partial! "node_input", locals: { node_input: node_input, node: node }
end


+ 5
- 0
db/migrate/20240408010103_add_action_nodes_label.rb View File

@@ -0,0 +1,5 @@
class AddActionNodesLabel < ActiveRecord::Migration[5.2]
def change
add_column :action_nodes, :label, :string
end
end

Loading…
Cancel
Save