diff --git a/app/helpers/catalog_helper.rb b/app/helpers/catalog_helper.rb index d6b8568c87d..4560c82c263 100644 --- a/app/helpers/catalog_helper.rb +++ b/app/helpers/catalog_helper.rb @@ -2,6 +2,7 @@ module CatalogHelper include_concern 'TextualSummary' include RequestInfoHelper include Mixins::AutomationMixin + include OrchestrationTemplateHelper def miq_catalog_resource(resources) headers = ["", _("Name"), _("Description"), _("Action Order"), _("Provision Order"), _("Action Start"), _("Action Stop"), _("Delay (mins) Start"), _("Delay (mins) Stop")] diff --git a/app/helpers/catalog_helper/orchestration_template_helper.rb b/app/helpers/catalog_helper/orchestration_template_helper.rb new file mode 100644 index 00000000000..f684553d046 --- /dev/null +++ b/app/helpers/catalog_helper/orchestration_template_helper.rb @@ -0,0 +1,52 @@ +module CatalogHelper::OrchestrationTemplateHelper + private + + def orchestration_template_summary(record) + summary = [ + orchestration_template_basic_info(record), + orchestration_template_tags(record), + orchestration_template_content(record), + ] + safe_join(summary) + end + + def orchestration_template_basic_info(record) + rows = [ + row_data(_('Name'), record.name), + row_data(_('Description'), record.description), + row_data(_('Draft'), record.draft ? _("True") : _("False")), + row_data(_('Read Only'), record.in_use? ? _("True") : _("False")), + row_data(_('Created On'), record.created_at), + row_data(_('Updated On'), record.updated_at), + ] + miq_structured_list({ + :title => _('Basic Information'), + :mode => "orchestration_template_summary", + :rows => rows + }) + end + + def orchestration_template_tags(record) + smart_mgnt = textual_tags_render_data(record) + data = {:title => smart_mgnt[:title], :mode => "orchestration_template_tags"} + rows = [] + smart_mgnt[:items].each do |item| + row = row_data(item[:label], item[:value]) + row[:cells][:icon] = item[:icon] if item[:icon] + rows.push(row) + end + data[:rows] = rows + miq_structured_list(data) + end + + def orchestration_template_content(record) + rows = [ + row_data('', {:input => 'code_mirror', :props => {:mode => 'yaml', :payload => record.content}}) + ] + miq_structured_list({ + :title => _('Content'), + :mode => "method_built_in_data", + :rows => rows + }) + end +end diff --git a/app/views/catalog/_ot_tree_show.html.haml b/app/views/catalog/_ot_tree_show.html.haml index 735e2e54b97..b3837fb59ae 100644 --- a/app/views/catalog/_ot_tree_show.html.haml +++ b/app/views/catalog/_ot_tree_show.html.haml @@ -1,48 +1,2 @@ = render :partial => "layouts/flash_msg" -.form-horizontal - .form-group - %label.col-md-2.control-label - = _('Name') - .col-md-8 - = @record.name - .form-group - %label.col-md-2.control-label - = _('Description') - .col-md-8 - = @record.description - .form-group - %label.col-md-2.control-label - = _('Draft') - .col-md-8 - = @record.draft ? _("True") : _("False") - .form-group - %label.col-md-2.control-label - = _('Read Only') - .col-md-8 - = @record.in_use? ? _("True") : _("False") - .form-group - %label.col-md-2.control-label - = _('Created On') - .col-md-8 - = @record.created_at - .form-group - %label.col-md-2.control-label - = _('Updated On') - .col-md-8 - = @record.updated_at - .form-group - .col-md-10 - #tag_group - :javascript - ManageIQ.component.componentFactory('TagGroup', '#tag_group', #{textual_tags_render_data(@record).to_json}); - -%hr -#form_div - = text_area_tag("template_content", @record.content, :style => "display:none;") - = render :partial => "/layouts/my_code_mirror", - :locals => {:text_area_id => "template_content", - :mode => "yaml", - :line_numbers => true, - :read_only => true} - :javascript - ManageIQ.editor.refresh(); += orchestration_template_summary(@record)