Skip to content

Commit

Permalink
Fix styles for control action summary and form pages
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffibm committed Feb 26, 2024
1 parent 9d906b9 commit b0d4f4a
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 18 deletions.
2 changes: 1 addition & 1 deletion app/controllers/miq_action_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def validate_playbook_options(options)
end

def get_session_data
@action = MiqAction.find_by(:id => params[:miq_grid_checks])
@action = MiqAction.find_by(:id => params[:id] || params[:miq_grid_checks])
@title = if @action.present?
_("Editing Action \"%{name}\"") % {:name => @action.description}
else
Expand Down
37 changes: 26 additions & 11 deletions app/helpers/miq_action_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
module MiqActionHelper
def control_action_summary(record, alert_guids, cats, action_policies)
safe_join([
miq_summary_action_info(record),
miq_summary_action_type(record, alert_guids, cats),
miq_summary_attribute_value_pair(record),
miq_summary_action_policies(action_policies)
])
end

private

def miq_summary_action_info(record)
data = {:title => _("Basic Information"), :mode => "miq_action_info"}
rows = []
Expand All @@ -25,17 +36,6 @@ def miq_summary_action_type(record, alert_guids, cats)
rows.push({:cells => {:label => _('Starting Message'), :value => record_options[:ae_message]}})
rows.push({:cells => {:label => _('Request'), :value => record_options[:ae_request]}})

value_pair = []
if record_options[:ae_hash].present?
record_options[:ae_hash].each do |k, v|
value_pair.push({:label => k})
value_pair.push({:label => v})
end
else
value_pair.push({:label => _('No Attribute/Value Pairs found')})
end
rows.push({:cells => {:label => _('Attribute/Value Pairs'), :value => value_pair}})

when "email"
data[:title] = _('E-mail Settings')
rows.push({:cells => {:label => _('From E-mail Address'), :value => record_options[:from]}})
Expand Down Expand Up @@ -129,6 +129,21 @@ def miq_summary_action_type(record, alert_guids, cats)
end
end

def miq_summary_attribute_value_pair(record)
record_options = record.options
rows = []
if record_options[:ae_hash].present?
record_options[:ae_hash].each do |k, v|
rows.push({:cells => [{:value => k}, {:value => v}]})
end
end
miq_structured_list(
:title => _('Attribute/Value Pairs'),
:mode => "control_action_attribute_value_pairs",
:rows => rows
)
end

def miq_summary_action_policies(action_policies)
rows = []
data = {:title => _("Assigned to Policies"), :mode => "miq_action"}
Expand Down
3 changes: 3 additions & 0 deletions app/javascript/components/action-form/action-form.schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ function createSchema(recordId, promise, inheritTags, evaluateAlert, tags, ansib
id: 'subform-7',
name: 'subform-7',
title: __('Attribute/Value Pairs'),
className: 'attribute_value_pair_wrapper',
condition: {
when: 'action_type',
is: 'custom_automation',
Expand All @@ -190,6 +191,7 @@ function createSchema(recordId, promise, inheritTags, evaluateAlert, tags, ansib
fields: [
{
component: componentTypes.TEXT_FIELD,
className: 'attribute_value_field_wrapper',
name: 'attribute',
id: 'attribute',
label: 'attribute',
Expand All @@ -198,6 +200,7 @@ function createSchema(recordId, promise, inheritTags, evaluateAlert, tags, ansib
},
{
component: componentTypes.TEXT_FIELD,
className: 'attribute_value_field_wrapper',
name: 'value',
id: 'value',
label: 'value',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import classNames from 'classnames';
import { StructuredListCell } from 'carbon-components-react';
import MiqStructuredListConditionalTag from '../value-tags/miq-structured-list-conditional-tag';

/** Usage eg: Automation / Embeded Automate / Generic Objects / item
/** Usage eg: Automation / Embedded Automate / Generic Objects / item
* Properties has no links & Relationships have links */
const MiqStructuredListObject = ({ row, clickEvents, onClick }) => {
const isContent = row.label || (row.value && row.value.input);
Expand Down

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions app/stylesheet/ddf_override.scss
Original file line number Diff line number Diff line change
Expand Up @@ -466,3 +466,28 @@
margin-top: 3rem;
margin-left: 15rem;
}


.attribute_value_pair_wrapper fieldset {
.bx--form-item {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 5px;

label {
margin-bottom: 0;
}
}

div > div {
display: flex;
flex-direction: row;
gap: 20px;
align-items: center;

.attribute_value_field_wrapper {
flex-grow: 1;
}
}
}
3 changes: 3 additions & 0 deletions app/stylesheet/miq-structured-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
}

.content_value {
&.array_item:first-child {
width: 250px;
}
.content {
display: flex;
flex-direction: row;
Expand Down
6 changes: 1 addition & 5 deletions app/views/miq_action/show.html.haml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#action-details-div

= render :partial => "layouts/flash_msg"

= miq_summary_action_info(@record)

= miq_summary_action_type(@record, @alert_guids, @cats)

= miq_summary_action_policies(@action_policies)
= control_action_summary(@record, @alert_guids, @cats, @action_policies)

0 comments on commit b0d4f4a

Please sign in to comment.