Skip to content

Commit

Permalink
updating snapshots
Browse files Browse the repository at this point in the history
soft reset
  • Loading branch information
jeffibm committed Nov 24, 2023
1 parent 3b7e6e6 commit bda4e94
Show file tree
Hide file tree
Showing 41 changed files with 184 additions and 183 deletions.
14 changes: 9 additions & 5 deletions app/controllers/service_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def button
service_retire
when 'service_retire_now'
service_retire_now
when 'service_reconfigure'
javascript_redirect(:action => 'service_reconfigure', :id => params[:id])
when "custom_button"
@display == 'generic_objects' ? generic_object_custom_buttons : custom_buttons
else
Expand Down Expand Up @@ -74,16 +76,18 @@ def edit
checked[0] = params[:id] if checked.blank? && params[:id]
@service = find_record_with_rbac(Service, checked[0])
@in_a_form = true
drop_breadcrumb(:name => _("Edit Service\"%{name}\"") % {:name => @service.name}, :url => "/service/edit/#{@service.id}")
drop_breadcrumb(:name => _("Edit Service \"%{name}\"") % {:name => @service.name}, :url => "/service/edit/#{@service.id}")
end

def service_reconfigure
service = Service.find_by(:id => params[:id])
assert_privileges('service_reconfigure')

service = find_record_with_rbac(Service, params[:id])
service_template = service.service_template
resource_action = service_template.resource_actions.find_by(:action => 'Reconfigure') if service_template

@right_cell_text = _("Reconfigure Service \"%{name}\"") % {:name => service.name}
dialog_locals = {:resource_action_id => resource_action.id, :target_id => service.id}
@dialog_locals = {:resource_action_id => resource_action.id, :target_id => service.id}
@in_a_form = true
drop_breadcrumb(:name => _("Reconfigure Service \"%{name}\"") % {:name => service.name}, :url => "/service/service_reconfigure/#{service.id}")
end

def service_form_fields
Expand Down
11 changes: 11 additions & 0 deletions app/helpers/miq_ae_class_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,17 @@ def method_details(ae_method, sb_data)
})
end

def method_built_in_data(ae_method)
rows = [
row_data('', {:input => 'code_mirror', :props => {:mode => 'ruby', :payload => ae_method.data}})
]
miq_structured_list({
:title => _('Data'),
:mode => "method_built_in_data",
:rows => rows
})
end

private

def row_data(label, value)
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/components/miq-structured-list/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export const InputTypes = {
CHECKBOX: 'checkbox',
COMPONENT: 'component',
DROPDOWN: 'dropdown',
CODEMIRROR: 'code_mirror',
MARKDOWN: 'markdown',
};

export const DynamicReactComponents = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Checkbox, TextArea, Dropdown } from 'carbon-components-react';
import { Controlled as CodeMirror } from 'react-codemirror2';
import ReactMarkdown from 'react-markdown';
import { DynamicReactComponents, InputTypes } from '../../helpers';

/** Component to render textarea / checkbox / react components */
Expand Down Expand Up @@ -34,6 +36,30 @@ const MiqStructuredListInputs = ({ value, action }) => {
/>
);

/** Function to render the code mirror component. */
const renderCodeMirrorComponent = ({ props: { mode, payload } }) => (
<CodeMirror
className="miq-codemirror miq-structured-list-code-mirror"
options={{
mode,
lineNumbers: true,
matchBrackets: true,
theme: 'eclipse',
readOnly: 'nocursor',
viewportMargin: Infinity,
}}
value={payload}
/>
);
/** Function to render the MarkDown component.
* eg: Service / Catalogs / Catalog Items / [Item] / Details tab.
*/
const renderMarkdown = ({ props: { content } }) => (
<ReactMarkdown className="miq-react-markdown">
{content}
</ReactMarkdown>
);

switch (value.input) {
case InputTypes.TEXTAREA:
return renderTextArea(value);
Expand All @@ -43,6 +69,10 @@ const MiqStructuredListInputs = ({ value, action }) => {
return renderDynamicComponent(value);
case InputTypes.DROPDOWN:
return renderDropDownComponent(value);
case InputTypes.CODEMIRROR:
return renderCodeMirrorComponent(value);
case InputTypes.MARKDOWN:
return renderMarkdown(value);
default:
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,24 @@ import MiqStructuredListConditionalTag from '../value-tags/miq-structured-list-c

/** Usage eg: Automation / Embeded Automate / Generic Objects / item
* Properties has no links & Relationships have links */
const MiqStructuredListObject = ({ row, clickEvents, onClick }) => (
<StructuredListCell
className={classNames(row.label ? 'content_value' : 'label_header', 'object_item')}
title={row && row.title !== undefined ? row.title : ''}
>
<MiqStructuredListConditionalTag row={row} onClick={onClick} clickEvents={clickEvents} />
</StructuredListCell>
);
const MiqStructuredListObject = ({ row, clickEvents, onClick }) => {
const isContent = row.label || (row.value && row.value.input);
return ((
<StructuredListCell
className={classNames(isContent ? 'content_value' : 'label_header', 'object_item')}
title={row && row.title !== undefined ? row.title : ''}
>
<MiqStructuredListConditionalTag row={row} onClick={onClick} clickEvents={clickEvents} />
</StructuredListCell>
));
};

export default MiqStructuredListObject;

MiqStructuredListObject.propTypes = {
row: PropTypes.shape({
label: PropTypes.string,
value: PropTypes.oneOfType([PropTypes.any]),
title: PropTypes.string,
}),
clickEvents: PropTypes.bool.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8411,7 +8411,6 @@ exports[`Action Form Component should render adding a new action 1`] = `
>
<Select
SelectComponent={[Function]}
compareValues={[Function]}
id="action_type"
invalid={false}
invalidText=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,6 @@ exports[`Ansible Credential Form Component should render adding a new credential
>
<Select
SelectComponent={[Function]}
compareValues={[Function]}
disabled={false}
id="type"
invalid={false}
Expand Down Expand Up @@ -2495,7 +2494,6 @@ exports[`Ansible Credential Form Component should render editing a credential 1`
>
<Select
SelectComponent={[Function]}
compareValues={[Function]}
disabled={true}
id="type"
invalid={false}
Expand Down
Loading

0 comments on commit bda4e94

Please sign in to comment.