Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/javascript/components/miq-data-table/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export const rowData = (headerKeys, rows, hasCheckbox) => {
const rowItems = [];
const mergedStatus = [];
rows.forEach(({
cells, id, clickable, clickId,
cells, id, clickable, clickId, disabled,
}) => {
const requiredCells = hasCheckbox ? (cells.filter((c) => !c.is_checkbox)) : cells;
const { mergedCells, merged } = mergeIcons(requiredCells);
Expand All @@ -143,6 +143,7 @@ export const rowData = (headerKeys, rows, hasCheckbox) => {
result.id = id;
if (clickId) result.clickId = clickId;
result.clickable = clickable;
if (disabled !== undefined) result.disabled = disabled;
return result;
}, {});
rowItems.push(reducedItems);
Expand Down
3 changes: 2 additions & 1 deletion app/javascript/components/miq-data-table/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ const MiqDataTable = ({
/** Function to identify if the row is clickable or not and the returns a class name */
const classNameRow = (item) => {
if (item) {
const { clickable, id } = item;
const { clickable, id, disabled } = item;
if (disabled) return 'disabled-row';
if (clickable === false) return 'simple-row';
if (clickable === true || clickable === null) {
return (gridChecks.includes(id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ const MiqTableCell = ({
const alignClass = longText ? 'vertical_align_top' : '';
const longerTextClass = veryLongText ? 'truncate_longer_text' : '';

const cellTitle = cell.data.title ? cell.data.title : cell.value;
const truncateText = (
<span title={cell.value} className={classNames('bx--front-line', wrapClass, longerTextClass)}>
<span title={cellTitle} className={classNames('bx--front-line', wrapClass, longerTextClass)}>
Comment on lines +28 to +30
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, so this is the change that caused the snapshot mismatch
@agrare @Fryguy

I made this change to modify the hover text for Invalid workflows
#9708 (comment)

{cell.value}
</span>
);
Expand Down
27 changes: 20 additions & 7 deletions app/javascript/components/workflows/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,30 @@ const entryPointsHeaderInfo = () => [
];

/** Function to return the cell data for a row item. */
const cellInfo = (workflow) => [
{ text: workflow.configuration_script_source ? workflow.configuration_script_source.name : '' },
{ text: workflow.name },
];
const cellInfo = (workflow) => {
const isValid = workflow.payload_valid;
const workflowNameTitle = !isValid ? `${workflow.name} (${__('Invalid Workflow')})` : workflow.name;

return [
{ text: workflow.configuration_script_source ? workflow.configuration_script_source.name : '' },
{ text: workflow.name, title: workflowNameTitle },
];
};

/** Function to return the row information for the list */
const rowInfo = (headers, response) => {
const headerKeys = headers.map((item) => item.key);
const rows = response.resources.filter((item) => item.payload).map((workflow) => ({
id: workflow.id.toString(), cells: cellInfo(workflow), clickable: true,
}));
const rows = response.resources.map((workflow) => {
const isValid = workflow.payload_valid;
return {
id: workflow.id.toString(),
name: workflow.name,
cells: cellInfo(workflow),
clickable: isValid,
disabled: !isValid,
};
});

const miqRows = rowData(headerKeys, rows, false);
return miqRows.rowItems;
};
Expand Down
19 changes: 18 additions & 1 deletion app/javascript/components/workflows/workflow-entry-points.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ const WorkflowEntryPoints = ({

/** Function to handle a row's click event. */
const onSelect = (selectedItemId) => {
// Find the row to check if it's disabled
const selectedRow = data.list.rows.find((row) => row.id === selectedItemId);

// Don't allow selection of disabled rows
if (selectedRow && selectedRow.disabled) {
return;
}

setData({
...data,
selectedItemId: (data.selectedItemId === selectedItemId) ? undefined : selectedItemId,
Expand All @@ -110,6 +118,15 @@ const WorkflowEntryPoints = ({
http.post('/catalog/ae_tree_select_toggle?button=cancel', {}, { headers: {}, skipJsonParsing: true });
}
};
/** Function to check if a valid workflow is selected */
const isValidSelection = () => {
if (!data.selectedItemId) {
return false;
}
const selectedRow = data.list.rows.find((row) => row.id === data.selectedItemId);
return selectedRow && !selectedRow.disabled;
};

/** Function to handle the modal box apply button click event. */
const onApply = () => {
const seletedItem = data.list.rows.find((item) => item.id === data.selectedItemId);
Expand Down Expand Up @@ -138,7 +155,7 @@ const WorkflowEntryPoints = ({
open
modalHeading={sprintf(__('Select Embedded Workflow - %s Entry Point'), workflowTypes[type])}
primaryButtonText={__('Apply')}
primaryButtonDisabled={!data.selectedItemId}
primaryButtonDisabled={!isValidSelection()}
secondaryButtonText={__('Cancel')}
onRequestSubmit={onApply}
onRequestClose={onCloseModal}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2458,7 +2458,7 @@ exports[`SettingsCompanyCategories component should render a SettingsCompanyCate
</span>
<span
className="bx--front-line"
title="Delete"
title="Category cannot be deleted"
>
Delete
</span>
Expand Down Expand Up @@ -3617,7 +3617,7 @@ exports[`SettingsCompanyCategories component should render a SettingsCompanyCate
</span>
<span
className="bx--front-line"
title="Delete"
title="Click to delete this category"
>
Delete
</span>
Expand Down Expand Up @@ -4776,7 +4776,7 @@ exports[`SettingsCompanyCategories component should render a SettingsCompanyCate
</span>
<span
className="bx--front-line"
title="Delete"
title="Click to delete this category"
>
Delete
</span>
Expand Down Expand Up @@ -5935,7 +5935,7 @@ exports[`SettingsCompanyCategories component should render a SettingsCompanyCate
</span>
<span
className="bx--front-line"
title="Delete"
title="Click to delete this category"
>
Delete
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1373,7 +1373,7 @@ exports[`SettingsLabelTagMapping component should render a SettingsLabelTagMappi
</span>
<span
className="bx--front-line"
title="Delete"
title="Click to delete this mapping"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @elsamaryv I just noticed this, this doesn't look related to the invalid embedded workflows change was this added accidentally?

Copy link
Contributor Author

@elsamaryv elsamaryv Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests were failing due to outdated snapshots, which were unrelated to the current task. Would it have been better to update them in a separate PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that's fine - strange they were broken though - I would have thought that would break master.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually - can you verify these are broken on master and maybe move into a separate PR? It makes me think something in this PR is changing these.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was thinking this might have been from the updated ui-components, in which case should be fixed in a separate PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohhh I hadn't thought of that - good point.

>
Delete
</span>
Expand Down Expand Up @@ -1887,7 +1887,7 @@ exports[`SettingsLabelTagMapping component should render a SettingsLabelTagMappi
</span>
<span
className="bx--front-line"
title="Delete"
title="Click to delete this mapping"
>
Delete
</span>
Expand Down Expand Up @@ -2401,7 +2401,7 @@ exports[`SettingsLabelTagMapping component should render a SettingsLabelTagMappi
</span>
<span
className="bx--front-line"
title="Delete"
title="Click to delete this mapping"
>
Delete
</span>
Expand Down Expand Up @@ -2915,7 +2915,7 @@ exports[`SettingsLabelTagMapping component should render a SettingsLabelTagMappi
</span>
<span
className="bx--front-line"
title="Delete"
title="Click to delete this mapping"
>
Delete
</span>
Expand Down Expand Up @@ -4292,7 +4292,7 @@ exports[`SettingsLabelTagMapping component should render a SettingsLabelTagMappi
</span>
<span
className="bx--front-line"
title="Delete"
title="Click to delete this mapping"
>
Delete
</span>
Expand Down Expand Up @@ -4806,7 +4806,7 @@ exports[`SettingsLabelTagMapping component should render a SettingsLabelTagMappi
</span>
<span
className="bx--front-line"
title="Delete"
title="Click to delete this mapping"
>
Delete
</span>
Expand Down Expand Up @@ -5320,7 +5320,7 @@ exports[`SettingsLabelTagMapping component should render a SettingsLabelTagMappi
</span>
<span
className="bx--front-line"
title="Delete"
title="Click to delete this mapping"
>
Delete
</span>
Expand Down Expand Up @@ -5834,7 +5834,7 @@ exports[`SettingsLabelTagMapping component should render a SettingsLabelTagMappi
</span>
<span
className="bx--front-line"
title="Delete"
title="Click to delete this mapping"
>
Delete
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ exports[`Tenant Quota Form Component should render the manage quotas form for a
labelText={
<span
className="bx--front-line"
title=""
title="Enforce a Value"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with these

>

</span>
Expand All @@ -830,7 +830,7 @@ exports[`Tenant Quota Form Component should render the manage quotas form for a
labelText={
<span
className="bx--front-line"
title=""
title="Enforce a Value"
>

</span>
Expand Down Expand Up @@ -859,7 +859,7 @@ exports[`Tenant Quota Form Component should render the manage quotas form for a
>
<span
className="bx--front-line"
title=""
title="Enforce a Value"
/>
<span
className="bx--toggle__switch"
Expand Down Expand Up @@ -1493,7 +1493,7 @@ exports[`Tenant Quota Form Component should render the manage quotas form for a
labelText={
<span
className="bx--front-line"
title=""
title="Enforce a Value"
>

</span>
Expand All @@ -1511,7 +1511,7 @@ exports[`Tenant Quota Form Component should render the manage quotas form for a
labelText={
<span
className="bx--front-line"
title=""
title="Enforce a Value"
>

</span>
Expand Down Expand Up @@ -1540,7 +1540,7 @@ exports[`Tenant Quota Form Component should render the manage quotas form for a
>
<span
className="bx--front-line"
title=""
title="Enforce a Value"
/>
<span
className="bx--toggle__switch"
Expand Down Expand Up @@ -2945,7 +2945,7 @@ exports[`Tenant Quota Form Component should render the manage quotas form for a
labelText={
<span
className="bx--front-line"
title=""
title="Enforce a Value"
>

</span>
Expand All @@ -2963,7 +2963,7 @@ exports[`Tenant Quota Form Component should render the manage quotas form for a
labelText={
<span
className="bx--front-line"
title=""
title="Enforce a Value"
>

</span>
Expand Down Expand Up @@ -2992,7 +2992,7 @@ exports[`Tenant Quota Form Component should render the manage quotas form for a
>
<span
className="bx--front-line"
title=""
title="Enforce a Value"
/>
<span
className="bx--toggle__switch"
Expand Down Expand Up @@ -3597,7 +3597,7 @@ exports[`Tenant Quota Form Component should render the manage quotas form for a
labelText={
<span
className="bx--front-line"
title=""
title="Enforce a Value"
>

</span>
Expand All @@ -3615,7 +3615,7 @@ exports[`Tenant Quota Form Component should render the manage quotas form for a
labelText={
<span
className="bx--front-line"
title=""
title="Enforce a Value"
>

</span>
Expand Down Expand Up @@ -3644,7 +3644,7 @@ exports[`Tenant Quota Form Component should render the manage quotas form for a
>
<span
className="bx--front-line"
title=""
title="Enforce a Value"
/>
<span
className="bx--toggle__switch"
Expand Down
17 changes: 16 additions & 1 deletion app/stylesheet/miq-data-table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,21 @@ table.miq_preview {
.workflows-entry-point-modal-body {
.miq-data-table {
margin-top: 0px;

tbody tr.disabled-row {
opacity: 0.5 !important;
cursor: not-allowed !important;
color: #8d8d8d !important;
background-color: #f4f4f4 !important;

&:hover {
background-color: #f4f4f4 !important;
}

td {
color: #8d8d8d !important;
}
}
}
}
}
Expand Down Expand Up @@ -424,4 +439,4 @@ table.miq_preview {
width: 50px;
padding-left: 24px;
}
}
}