Skip to content

Commit 38dd56d

Browse files
authored
Merge branch 'master' into substring-check
2 parents b2895ab + 2896bba commit 38dd56d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1356
-1141
lines changed

.yarn/releases/yarn-4.3.1.cjs

Lines changed: 0 additions & 894 deletions
This file was deleted.

.yarn/releases/yarn-4.5.3.cjs

Lines changed: 934 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ npmAuditExcludePackages:
4141
# pending | moderate | GHSA-fvqr-27wr-82fm | lodash <4.17.5 | 3.10.1 brought in by angular-patternfly@npm:3.26.0
4242
# pending | critical | GHSA-jf85-cpcp-j695 | lodash <4.17.12 | 3.10.1 brought in by angular-patternfly@npm:3.26.0
4343

44-
yarnPath: .yarn/releases/yarn-4.3.1.cjs
44+
yarnPath: .yarn/releases/yarn-4.5.3.cjs

app/controllers/application_controller/automate.rb

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,6 @@ def resolve_button_throw
3333
end
3434
private :resolve_button_throw
3535

36-
# Copy current URI as an automate button
37-
def resolve_button_copy
38-
session[:resolve_object] = copy_hash(@resolve)
39-
head :ok
40-
end
41-
private :resolve_button_copy
42-
43-
# Copy current URI as an automate button
44-
def resolve_button_paste
45-
@resolve = copy_hash(session[:resolve_object])
46-
@edit = session[:edit]
47-
@custom_button = @edit[:custom_button]
48-
@edit[:instance_names] = @resolve[:instance_names]
49-
@edit[:new][:instance_name] = @resolve[:new][:instance_name]
50-
@edit[:new][:object_message] = @resolve[:new][:object_message]
51-
@edit[:new][:object_request] = @resolve[:new][:object_request]
52-
@edit[:new][:attrs] = @resolve[:new][:attrs]
53-
@edit[:new][:target_class] = @resolve[:target_class] = @resolve[:new][:target_class]
54-
@edit[:uri] = @resolve[:uri]
55-
(ApplicationController::AE_MAX_RESOLUTION_FIELDS - @resolve[:new][:attrs].length).times { @edit[:new][:attrs].push([]) }
56-
@changed = (@edit[:new] != @edit[:current])
57-
render :update do |page|
58-
page << javascript_prologue
59-
page.replace_html("main_div", :partial => "shared/buttons/ab_list")
60-
page << javascript_for_miq_button_visibility_changed(@changed)
61-
page << "miqSparkle(false);"
62-
end
63-
end
64-
private :resolve_button_paste
65-
6636
# Copy current URI as an automate button
6737
def resolve_button_simulate
6838
@edit = copy_hash(session[:resolve])
@@ -126,8 +96,6 @@ def resolve
12696

12797
case params[:button]
12898
when "throw", "retry" then resolve_button_throw
129-
when "copy" then resolve_button_copy
130-
when "paste" then resolve_button_paste
13199
when "simulate" then resolve_button_simulate
132100
else resolve_button_reset_or_none
133101
end

app/controllers/ops_controller.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,7 @@ def settings_replace_right_cell(nodetype, presenter)
685685
@edit ? _("Editing Schedule \"%{name}\"") % {:name => @schedule.name} : _("Schedule \"%{name}\"") % {:name => @schedule.name}
686686
end
687687
else
688-
if %w[accordion_select change_tab tree_select].include?(params[:action]) &&
689-
params[:tab_id] != "settings_advanced"
688+
if %w[accordion_select change_tab tree_select].include?(params[:action])
690689
presenter.replace(:ops_tabs, r[:partial => "all_tabs"])
691690
elsif %w[zone_delete].include?(params[:pressed])
692691
presenter.replace(:ops_tabs, r[:partial => "all_tabs"])

app/controllers/ops_controller/settings/common.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,8 @@ def settings_get_info(nodetype = x_node)
859859
nodes = nodetype.downcase.split("-")
860860
case nodes[0]
861861
when "root"
862+
@settings_tab, @settings_tab_length = settings_tab_index_by_name(@sb[:active_tab])
863+
@subtab = settings_tags_tab_index_by_name(@sb[:active_subtab])
862864
@right_cell_text = _("%{product} Region \"%{name}\"") %
863865
{:name => "#{MiqRegion.my_region.description} [#{MiqRegion.my_region.region}]",
864866
:product => Vmdb::Appliance.PRODUCT_NAME}
@@ -870,9 +872,9 @@ def settings_get_info(nodetype = x_node)
870872
@in_a_form = true
871873
when "settings_tags"
872874
case @sb[:active_subtab]
873-
when "settings_co_categories"
875+
when "settings_my_company_categories"
874876
category_get_all
875-
when "settings_co_tags"
877+
when "settings_my_company_tags"
876878
# dont hide the disabled categories, so user can remove tags from the disabled ones
877879
cats = Classification.categories.sort_by(&:description) # Get the categories, sort by name
878880
@cats = {} # Classifications array for first chooser
@@ -887,15 +889,15 @@ def settings_get_info(nodetype = x_node)
887889
@edit[:key] = "#{@sb[:active_tab]}_edit__#{@sb[:selected_server_id]}"
888890
add_flash(_("Locate and upload a file to start the import process"), :info)
889891
@in_a_form = true
890-
when "settings_import" # Import tab
892+
when "settings_import_variables" # Import tab
891893
@edit = {}
892894
@edit[:new] = {}
893895
@edit[:key] = "#{@sb[:active_tab]}_edit__#{@sb[:selected_server_id]}"
894896
@edit[:new][:upload_type] = nil
895897
@sb[:good] = nil unless @sb[:show_button]
896898
add_flash(_("Choose the type of custom variables to be imported"), :info)
897899
@in_a_form = true
898-
when "settings_label_tag_mapping"
900+
when "settings_map_tags"
899901
label_tag_mapping_get_all
900902
end
901903
when "settings_help_menu"

app/controllers/ops_controller/settings/upload.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def upload_form_field_changed
6060
@sb[:good] = nil
6161
render :update do |page|
6262
page << javascript_prologue
63-
page.replace_html("settings_import", :partial => "settings_import_tab")
63+
page.replace_html("import_variables", :partial => "settings_import_tab")
6464
end
6565
end
6666

app/helpers/application_helper/button/ae_copy_simulate.rb

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,2 @@
11
class ApplicationHelper::Toolbar::MiqAeToolsSimulateCenter < ApplicationHelper::Toolbar::Basic
2-
button_group('miq_ae_tools_vmdb', [
3-
button(
4-
:ae_copy_simulate,
5-
'fa fa-files-o fa-lg',
6-
N_('Copy object details for use in a Button'),
7-
N_('Copy'),
8-
:url => "resolve",
9-
:url_parms => "?button=copy",
10-
:klass => ApplicationHelper::Button::AeCopySimulate),
11-
])
122
end

app/helpers/ops_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ module OpsHelper
99
include SettingsLabelTagMappingHelper
1010
include SettingsScheduleHelper
1111
include SettingsServerDescHelper
12+
include SettingsTabsHelper
13+
include SettingsTagsHelper
1214
include SettingsUsersHelper
1315
include SettingsZoneHelper
1416
include SettingsRbacTagHelper

app/helpers/settings_tabs_helper.rb

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
module SettingsTabsHelper
2+
SETTINGS_TAB_IDS = %w[
3+
settings_details
4+
settings_cu_collection
5+
settings_tags
6+
settings_replication
7+
settings_help_menu
8+
settings_advanced
9+
]
10+
11+
def settings_tab_configuration
12+
[:details, :cu_collection, :tags, :replication, :help_menu, :advanced]
13+
end
14+
15+
def settings_tab_content(key_name, &block)
16+
if settings_tabs_types[key_name]
17+
tag.div(:id => "settings_#{key_name}", :class => 'tab_content', &block)
18+
end
19+
end
20+
21+
def settings_tab_index_by_name(name)
22+
[SETTINGS_TAB_IDS.index(name) || -1, SETTINGS_TAB_IDS.length]
23+
end
24+
25+
private
26+
27+
def settings_tabs_types
28+
{
29+
:details => _('Details'),
30+
:cu_collection => _('C & U Collection'),
31+
:tags => _('Tags'),
32+
:replication => _('Replication'),
33+
:help_menu => _('Help Menu'),
34+
:advanced => _('Advanced'),
35+
}
36+
end
37+
end

app/helpers/settings_tags_helper.rb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
module SettingsTagsHelper
2+
3+
SETTINGS_TAGS_TABS_IDS = %w[
4+
settings_my_company_categories
5+
settings_my_company_tags
6+
settings_import_tags
7+
settings_import_variables
8+
settings_map_tags
9+
]
10+
11+
def settings_tags_configuration
12+
[:my_company_categories, :my_company_tags, :import_tags, :import_variables, :map_tags]
13+
end
14+
15+
def settings_tags_content(key_name, &block)
16+
if settings_tags_types[key_name]
17+
tag.div(:id => key_name, :class => 'tab_content', &block)
18+
end
19+
end
20+
21+
def settings_tags_tab_index_by_name(name)
22+
SETTINGS_TAGS_TABS_IDS.index(name) || -1
23+
end
24+
25+
private
26+
27+
def settings_tags_types
28+
{
29+
:my_company_categories => _('My Company Categories'),
30+
:my_company_tags => _('My Company Tags'),
31+
:import_tags => _('Import Tags'),
32+
:import_variables => _('Import Variables'),
33+
:map_tags => _('Map Tags'),
34+
}
35+
end
36+
end

app/javascript/components/miq-custom-tab/helper.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,33 @@ const requestInfo = {
2828
network: __('Network'),
2929
};
3030

31+
/** Tab labels used for settings in application settings page. */
32+
const settings = {
33+
details: __('Details'),
34+
cu_collection: __('C & U Collection'),
35+
tags: __('Tags'),
36+
replication: __('Replication'),
37+
help_menu: __('Help'),
38+
advanced: __('Advanced'),
39+
};
40+
41+
const settingsTags = {
42+
my_company_categories: __('My Company Categories'),
43+
my_company_tags: __('My Company Tags'),
44+
import_tags: ('Import Tags'),
45+
import_variables: __('Import Variables'),
46+
map_tags: __('Map Tags'),
47+
};
48+
3149
/** Function to select the tab labels. */
3250
export const labelConfig = (type) => {
3351
const configMap = {
3452
CATALOG_SUMMARY: catalog,
3553
CATALOG_EDIT: catalog,
3654
UTILIZATION: utilization,
3755
CATALOG_REQUEST_INFO: requestInfo,
56+
SETTINGS: settings,
57+
SETTINGS_TAGS: settingsTags,
3858
};
3959

4060
return configMap[type];

app/javascript/components/miq-custom-tab/index.jsx

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
import React, { useState } from 'react';
1+
import React, { useState, useEffect } from 'react';
22
import PropTypes from 'prop-types';
33
import { Tabs, Tab } from 'carbon-components-react';
44
import { useDispatch } from 'react-redux';
55
import { miqCustomTabActions } from '../../miq-redux/actions/miq-custom-tab-actions';
66
import { labelConfig, tabText } from './helper';
77

8-
const MiqCustomTab = ({ containerId, tabLabels, type }) => {
8+
const MiqCustomTab = ({
9+
containerId, tabLabels, type, activeTab, subtab, tabLength,
10+
}) => {
911
const dispatch = useDispatch();
1012
const [data, setData] = useState({ loading: false });
13+
const activeTabClassName = 'bx--tabs--scrollable__nav-item--selected';
14+
const selectedClassName = 'bx--tabs__nav-item--selected';
1115

1216
/** Labels used for a Tab found from the 'type'. */
1317
const selectedLabels = labelConfig(type);
@@ -23,6 +27,13 @@ const MiqCustomTab = ({ containerId, tabLabels, type }) => {
2327
{ type: 'CATALOG_EDIT', js: () => name === 'detail' && dispatch(miqCustomTabActions.incrementClickCount()) },
2428
{ type: 'CATALOG_REQUEST_INFO', url: `/miq_request/prov_field_changed?tab_id=${name}&edit_mode=true` },
2529
{ type: 'UTILIZATION' },
30+
{
31+
type: 'SETTINGS',
32+
url: name === 'tags'
33+
? `/ops/change_tab?tab_id=settings_my_company_categories&parent_tab_id=settings_${name}`
34+
: `/ops/change_tab?tab_id=settings_${name}`,
35+
},
36+
{ type: 'SETTINGS_TAGS', url: `/ops/change_tab?parent_tab_id=settings_tags&tab_id=settings_${name}` },
2637
];
2738

2839
const configuration = (name) => tabConfigurations(name).find((item) => item.type === type);
@@ -78,6 +89,7 @@ const MiqCustomTab = ({ containerId, tabLabels, type }) => {
7889

7990
/** Function to handle tab click events. */
8091
const onTabSelect = (name) => {
92+
setData(true);
8193
if (!data.loading) {
8294
miqSparkleOn();
8395
const config = configuration(name);
@@ -91,6 +103,23 @@ const MiqCustomTab = ({ containerId, tabLabels, type }) => {
91103
<Tab key={`tab${label}`} label={`${tabText(selectedLabels, label)}`} onClick={() => onTabSelect(label)} />
92104
));
93105

106+
useEffect(() => {
107+
if (activeTab) {
108+
let elements = document.getElementsByClassName('bx--tabs--scrollable__nav-item');
109+
elements.forEach((element) => {
110+
element.classList.remove(activeTabClassName);
111+
element.classList.remove(selectedClassName);
112+
});
113+
if (subtab !== undefined && subtab !== -1) {
114+
elements[tabLength].classList.remove(activeTabClassName);
115+
elements[subtab + tabLength].classList.add(activeTabClassName);
116+
}
117+
elements[activeTab].classList.add(activeTabClassName);
118+
119+
elements = document.getElementsByClassName('bx--tabs--scrollable__nav-item');
120+
}
121+
}, [data.loading]);
122+
94123
return (
95124
<Tabs className="miq_custom_tabs" id={tabIdentifier('')}>
96125
{renderTabs()}
@@ -104,4 +133,13 @@ MiqCustomTab.propTypes = {
104133
containerId: PropTypes.string.isRequired,
105134
tabLabels: PropTypes.arrayOf(PropTypes.string).isRequired,
106135
type: PropTypes.string.isRequired,
136+
activeTab: PropTypes.number,
137+
subtab: PropTypes.number,
138+
tabLength: PropTypes.number,
139+
};
140+
141+
MiqCustomTab.defaultProps = {
142+
activeTab: undefined,
143+
subtab: undefined,
144+
tabLength: undefined,
107145
};

app/javascript/components/miq-data-table/index.jsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,11 @@ const MiqDataTable = ({
100100
isSortable={isSortable}
101101
isSortHeader={sortHeader}
102102
sortDirection={sortDirection}
103-
className={
104-
classNames('miq-data-table-header', (header.contentButton ? 'header-button' : ''), (header.actionCell ? 'action-cell-holder' : ''))
105-
}
103+
className={classNames(
104+
'miq-data-table-header',
105+
header.contentButton ? 'header-button' : '',
106+
header.actionCell ? 'action-cell-holder' : ''
107+
)}
106108
>
107109
{headerLabel(header.header)}
108110
</TableHeader>
@@ -148,15 +150,17 @@ const MiqDataTable = ({
148150
stickyHeader={stickyHeader}
149151
>
150152
{({
151-
rows, getTableProps, getHeaderProps, getRowProps, getSelectionProps,
153+
rows, headers, getTableProps, getHeaderProps, getRowProps, getSelectionProps,
152154
}) => (
153155
<Table {...getTableProps()}>
154-
<TableHead>
155-
<TableRow>
156-
{rowCheckBox && selectAll(getSelectionProps)}
157-
{renderHeaders(getHeaderProps)}
158-
</TableRow>
159-
</TableHead>
156+
{headers[0] && headers[0].header !== '' ? (
157+
<TableHead>
158+
<TableRow>
159+
{rowCheckBox && selectAll(getSelectionProps)}
160+
{renderHeaders(getHeaderProps)}
161+
</TableRow>
162+
</TableHead>
163+
) : undefined}
160164
<TableBody>
161165
{sortableRows(rows).map((row, index) => {
162166
const item = propRows[index];

app/javascript/components/miq-structured-list/miq-structured-list-body/value-tags/miq-structured-list-text.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ import classNames from 'classnames';
44

55
/** Component to print the text value inside a cell. */
66
const MiqStructuredListText = ({ value }) => {
7-
const text = (value === null || value === undefined ? '' : String(value));
8-
7+
let text;
8+
if (Array.isArray(value)) {
9+
text = value.join('\n');
10+
} else {
11+
text = (value === null || value === undefined ? '' : String(value));
12+
}
913
return (
1014
<div className={classNames(text ? 'expand' : '', 'wrap_text')}>
1115
{text}

0 commit comments

Comments
 (0)