forked from ManageIQ/manageiq-ui-classic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Orchestration template summary conversion from HAML to React
- Loading branch information
1 parent
325850d
commit 0e56024
Showing
3 changed files
with
57 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
app/helpers/catalog_helper/orchestration_template_helper.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |