Feature Don't render the expand button for the actions that have no sub elements
MODIFY
FrontEnd/Sailfish-JS-report/src/components/ExpandablePanel.tsx
FrontEnd/Sailfish-JS-report/src/components/ExpandablePanel.tsx
@@ -26,24 +26,35 @@ interface PanelProps {
isExpanded?: boolean;
onExpand?: (isExpanded: boolean) => void;
children: [React.ReactNode | ((onExpand: () => void) => React.ReactNode), React.ReactNode];
+ isExpandDisabled?: boolean;
}
-export const ExpandablePanel = ({ children, isExpanded, onExpand }: PanelProps) => {
+export const ExpandablePanel = ({ children, isExpanded, onExpand, isExpandDisabled }: PanelProps) => {
+ const rootClass = createStyleSelector(
+ "expandable-panel",
+ isExpandDisabled? "disabled": null
+ )
const iconClass = createStyleSelector(
"expandable-panel__icon",
!isExpanded ? "hidden" : null
);
+ const expand = (isExpanded: boolean) => {
+ if (!isExpandDisabled) {
+ onExpand(isExpanded)
+ }
+ }
+
const [header, body] = children;
return (
- <div className="expandable-panel">
+ <div className={rootClass}>
<div className="expandable-panel__header">
<div className={iconClass}
- onClick={stopPropagationHandler(onExpand, !isExpanded)}/>
+ onClick={stopPropagationHandler(expand, !isExpanded)}/>
{
typeof header == 'function' ?
- header(() => onExpand(!isExpanded)) :
+ header(() => expand(!isExpanded)) :
header
}
</div>

MODIFY
FrontEnd/Sailfish-JS-report/src/components/action/ActionCard.tsx
FrontEnd/Sailfish-JS-report/src/components/action/ActionCard.tsx
@@ -58,6 +58,15 @@ export function ActionCard({ action, children, isSelected, onSelect, isRoot, isT
outcome
} = action;
+ const isEmptyParameters = parameters === null,
+ isSingleEmptyMessage = !isEmptyParameters && parameters.length == 1 && parameters[0].name === "Message" &&
+ parameters[0].value === "" && parameters[0].subParameters.length == 0,
+ showParams = !isEmptyParameters && !isSingleEmptyMessage,
+ isDisbled = !showParams &&
+ !action.isTruncated &&
+ !children.length &&
+ !(action.status.status == StatusType.FAILED && action.status.cause != null)
+
const rootClassName = createStyleSelector(
"action-card",
status.status,
@@ -79,16 +88,12 @@ export function ActionCard({ action, children, isSelected, onSelect, isRoot, isT
const elapsedTime = getSecondsPeriod(startTime, finishTime);
- const isEmptyParameters = parameters === null,
- isSingleEmptyMessage = !isEmptyParameters && parameters.length == 1 && parameters[0].name === "Message" &&
- parameters[0].value === "" && parameters[0].subParameters.length == 0,
- showParams = !isEmptyParameters && !isSingleEmptyMessage
-
return (
<div className={rootClassName}
onClick={stopPropagationHandler(onSelect, action)}
key={action.id}>
<ExpandablePanel
+ isExpandDisabled={isDisbled}
isExpanded={isExpanded}
onExpand={isExpanded => onRootExpand(isExpanded)}>
{
@@ -167,7 +172,8 @@ export function ActionCard({ action, children, isSelected, onSelect, isRoot, isT
}
<div className="ac-body">
- {showParams && <div className={inputParametersClassName}>
+ {showParams &&
+ <div className={inputParametersClassName}>
<SearchExpandablePanel
searchKeyPrefix={keyForAction(id, 'parameters')}
stateKey={keyForAction(id, 'parameters')}>
@@ -182,21 +188,19 @@ export function ActionCard({ action, children, isSelected, onSelect, isRoot, isT
params={parameters}
name={name} />
</SearchExpandablePanel>
- </div>}
-
- {action.isTruncated ? (
+ </div>
+ }
+ {action.isTruncated &&
<div className="ac-body__truncated-warning">
{action.verificationCount - action.subNodes.filter(node => isVerification(node)).length} verifications were truncated
</div>
- ) : null}
-
+ }
{
// rendering inner nodes
children
}
- {
- action.status.status == StatusType.FAILED && action.status.cause != null ? (
+ {action.status.status == StatusType.FAILED && action.status.cause != null &&
<div className="action-card-status">
<RecoverableExpandablePanel
stateKey={keyForAction(id, 'status')}>
@@ -210,7 +214,6 @@ export function ActionCard({ action, children, isSelected, onSelect, isRoot, isT
stateKey={`${keyForAction(id, 'status')}-exception`} />
</RecoverableExpandablePanel>
</div>
- ) : null
}
</div>
</ExpandablePanel>

MODIFY
FrontEnd/Sailfish-JS-report/src/styles/expandablePanel.scss
FrontEnd/Sailfish-JS-report/src/styles/expandablePanel.scss
}
}
}
+
+.disabled .expandable-panel {
+ &__icon {
+ opacity: 0.2;
+ }
+}

Feature #63595. Don't render the expand button for the actions that have no sub elements

Change-Id: I1a35a08e3274823d5eb1b9afc02dea44328ab2af