Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Tags to PxeServer and its items #6509

Merged
merged 8 commits into from
Jan 16, 2020
4 changes: 2 additions & 2 deletions app/controllers/application_controller/tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ def configuration_manager_provider_tag
alias storage_tag tagging_edit
alias infra_networking_tag tagging_edit

private ############################

def get_tag_items
record_ids = find_records_with_rbac(
@tagging.instance_of?(String) ? @tagging.safe_constantize : @tagging,
Expand All @@ -52,6 +50,8 @@ def get_tag_items
session[:assigned_filters] = assigned_filters
end

private ############################

def tagging_edit_tags_reset
get_tag_items if @explorer
@object_ids = session[:tag_items]
Expand Down
25 changes: 25 additions & 0 deletions app/controllers/pxe_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ class PxeController < ApplicationController
'pxe_image_type_new' => :pxe_image_type_new,
'pxe_image_type_edit' => :pxe_image_type_edit,
'pxe_image_type_delete' => :pxe_image_type_delete,
'pxe_image_tag' => :pxe_image_tags_edit,
'pxe_server_new' => :pxe_server_new,
'pxe_server_edit' => :pxe_server_edit,
'pxe_server_delete' => :pxe_server_delete,
'pxe_server_refresh' => :pxe_server_refresh,
'pxe_server_tag' => :pxe_server_tags_edit,
'pxe_wimg_edit' => :pxe_wimg_edit,
'iso_datastore_new' => :iso_datastore_new,
'iso_datastore_refresh' => :iso_datastore_refresh,
'iso_datastore_delete' => :iso_datastore_delete,
'windows_image_tag' => :windows_image_tags_edit,
'iso_image_edit' => :iso_image_edit,
'customization_template_new' => :customization_template_new,
'customization_template_delete' => :customization_template_delete,
Expand All @@ -37,6 +40,28 @@ def x_button
generic_x_button(PXE_X_BUTTON_ALLOWED_ACTIONS)
end

def pxe_server_tags_edit
tag("PxeServer")
end

def windows_image_tags_edit
tag("WindowsImage")
end

def pxe_image_tags_edit
tag("PxeImage")
end

def previous_breadcrumb_url
action = @lastaction == "pxe_server_list" ? "explorer" : @lastaction
url_for_only_path(:action => action)
end

def tagging_edit_tags_reset
@gtl_type = 'list'
super
end

def accordion_select
super(true)
end
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/pxe_controller/pxe_servers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,18 @@ def pxe_server_get_node_info(treenodeid)
if (nodes[0] == "ps" && nodes.length == 2) || (%w[pxe_xx win_xx].include?(nodes[1]) && nodes.length == 3)
# on pxe server node OR folder node is selected
@record = @ps = PxeServer.find(nodes.last)
session[:tag_db] = "PxeServer"
@right_cell_text = _("PXE Server \"%{name}\"") % {:name => @ps.name}
elsif nodes[0] == "pi"
@record = @img = PxeImage.find(nodes.last)
session[:tag_db] = "PxeImage"
@right_cell_text = _("PXE Image \"%{name}\"") % {:name => @img.name}
elsif nodes[0] == "wi"
@record = @wimg = WindowsImage.find(nodes[1])
session[:tag_db] = "WindowsImage"
@right_cell_text = _("Windows Image \"%{name}\"") % {:name => @wimg.name}
end
get_tagdata(@record)
end
end
end
15 changes: 15 additions & 0 deletions app/helpers/application_helper/toolbar/pxe_image_center.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,19 @@ class ApplicationHelper::Toolbar::PxeImageCenter < ApplicationHelper::Toolbar::B
]
),
])
button_group('pxe_image_policy', [
select(
:pxe_image_policy_choice,
nil,
t = N_('Policy'),
t,
:items => [
button(
:pxe_image_tag,
'pficon pficon-edit fa-lg',
N_('Edit Tags for this Pxe Image'),
N_('Edit Tags')),
]
),
])
end
15 changes: 15 additions & 0 deletions app/helpers/application_helper/toolbar/pxe_server_center.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,19 @@ class ApplicationHelper::Toolbar::PxeServerCenter < ApplicationHelper::Toolbar::
]
),
])
button_group('pxe_server_policy', [
select(
:pxe_server_policy_choice,
nil,
t = N_('Policy'),
t,
:items => [
button(
:pxe_server_tag,
'pficon pficon-edit fa-lg',
N_('Edit Tags for this Pxe Server'),
N_('Edit Tags')),
]
),
])
end
18 changes: 18 additions & 0 deletions app/helpers/application_helper/toolbar/pxe_servers_center.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,22 @@ class ApplicationHelper::Toolbar::PxeServersCenter < ApplicationHelper::Toolbar:
]
),
])
button_group('pxe_server_policy', [
select(
:pxe_server_policy_choice,
nil,
t = N_('Policy'),
t,
:items => [
button(
:pxe_server_tag,
'pficon pficon-edit fa-lg',
N_('Edit Tags selected Pxe Servers'),
N_('Edit Tags'),
:send_checked => true,
:enabled => false,
:onwhen => "1+"),
]
),
])
end
15 changes: 15 additions & 0 deletions app/helpers/application_helper/toolbar/windows_image_center.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,19 @@ class ApplicationHelper::Toolbar::WindowsImageCenter < ApplicationHelper::Toolba
]
),
])
button_group('windows_image_policy', [
select(
:windows_image_policy_choice,
nil,
t = N_('Policy'),
t,
:items => [
button(
:windows_image_tag,
'pficon pficon-edit fa-lg',
N_('Edit Tags for this Windows Image'),
N_('Edit Tags')),
]
),
])
end
4 changes: 4 additions & 0 deletions app/helpers/pxe_helper/textual_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def textual_last_refreshed_on
{:label => _("Last Refreshed On"), :value => @ps.last_refresh_on.to_s}
end

def textual_group_smart_management
TextualTags.new(_('Smart Management'), %i[tags])
end

def textual_group_pxe_image_menus
%i[filename]
end
Expand Down
3 changes: 3 additions & 0 deletions app/views/pxe/_pxe_server_details.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
= h(i.path)
%td
= h(i.index)
= react 'TagGroup', expand_generic_group(textual_group_smart_management, @record)

-# PXE Image is selected
- if @img
Expand All @@ -61,6 +62,7 @@
- else
= render(:partial => "layouts/flash_msg")
= react 'GenericGroupWrapper', expand_generic_group(TextualGroup.new(_('Basic Information'), textual_pxe_img_basicinfo), @record)
= react 'TagGroup', expand_generic_group(textual_group_smart_management, @record)

-# Windows Image is selected
- if @wimg
Expand All @@ -70,3 +72,4 @@
- else
= render(:partial => "layouts/flash_msg")
= react 'GenericGroupWrapper', expand_generic_group(TextualGroup.new(_('Basic Information'), textual_win_img_basicinfo), @record)
= react 'TagGroup', expand_generic_group(textual_group_smart_management, @record)
3 changes: 3 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2702,6 +2702,7 @@
:pxe => {
:get => %w(
explorer
tagging_edit
),
:post => %w(
accordion_select
Expand All @@ -2722,6 +2723,8 @@
pxe_wimg_edit
pxe_wimg_form_field_changed
reload
tag_edit_form_field_changed
tagging_edit
template_create_update
template_form_field_changed
template_list
Expand Down
63 changes: 63 additions & 0 deletions product/views/PxeImage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#
# This is an MIQ Report configuration file
# Single value parameters are specified as:
# single_value_parm: value
# Multiple value parameters are specified as:
# multi_value_parm:
# - value 1
# - value 2
#

# Report title
title: Pxe Image

# Menu name
name: Pxe Image

# Main DB table report is based on
db: PxeImage

# Columns to fetch from the main table
cols:
- name

# Included tables (joined, has_one, has_many) and columns
include:

# Order of columns (from all tables)
col_order:
- name

# Column titles, in order
headers:
- Name

# Condition(s) string for the SQL query
conditions:

# Order string for the SQL query
order: Ascending

# Columns to sort the report on, in order
sortby:
- name

# Group rows (y=yes,n=no,c=count)
group: n

# Graph type
# Bar
# Column
# ColumnThreed
# ParallelThreedColumn
# Pie
# PieThreed
# StackedBar
# StackedColumn
# StackedThreedColumn

graph:

# Dimensions of graph (1 or 2)
# Note: specifying 2 for a single dimension graph may not return expected results
dims:
63 changes: 63 additions & 0 deletions product/views/WindowsImage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#
# This is an MIQ Report configuration file
# Single value parameters are specified as:
# single_value_parm: value
# Multiple value parameters are specified as:
# multi_value_parm:
# - value 1
# - value 2
#

# Report title
title: Windows Image

# Menu name
name: Windows Image

# Main DB table report is based on
db: WindowsImage

# Columns to fetch from the main table
cols:
- name

# Included tables (joined, has_one, has_many) and columns
include:

# Order of columns (from all tables)
col_order:
- name

# Column titles, in order
headers:
- Name

# Condition(s) string for the SQL query
conditions:

# Order string for the SQL query
order: Ascending

# Columns to sort the report on, in order
sortby:
- name

# Group rows (y=yes,n=no,c=count)
group: n

# Graph type
# Bar
# Column
# ColumnThreed
# ParallelThreedColumn
# Pie
# PieThreed
# StackedBar
# StackedColumn
# StackedThreedColumn

graph:

# Dimensions of graph (1 or 2)
# Note: specifying 2 for a single dimension graph may not return expected results
dims: