Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #37122 - Update system status chart in job invocations detail page #871

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

kmalyjur
Copy link
Contributor

@kmalyjur kmalyjur commented Jan 30, 2024

Adds system status chart and its legend to the new job invocations detail page.

image
image

You can find the discussion here.
Links for filtering the host table through the legend will be added in a future PR.

Copy link
Contributor

@adamruzicka adamruzicka left a comment

Choose a reason for hiding this comment

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

The popup ends up being in a bit of a weird place
image

Could the legend next to the chart be made clickable?


// přidat mezeru pod chart když je menší obrazovka
// ještě style z index.js
// barva prázdného chart je nějaká čudná
Copy link
Contributor

Choose a reason for hiding this comment

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

Made me smile when I saw this, well done :)

{statuses.success}
{5}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should go back to the way it was I assume

Comment on lines +35 to +50
if (total > 0) return `${succeeded.toString()}/${total}`;
if (totalHosts > 0) return `0/${totalHosts}`;
return '0';
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the difference between total and totalHosts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The total represents the combined count of succeeded, failed, pending, and canceled, whereas totalHosts also includes those currently scheduled in the future.

/>
</FlexItem>
<FlexItem className="chart-legend">
<Text className="legend-title">{__('System status')}</Text>
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if System is a fortunate wording in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you please have any other ideas?

Copy link
Member

Choose a reason for hiding this comment

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

@kmalyjur
Copy link
Contributor Author

kmalyjur commented Feb 2, 2024

@adamruzicka thanks for looking at it!

The popup ends up being in a bit of a weird place

This is the default Patternfly way, but I get that it looks weird. Would it be better if it was on top (when there is only one "color")? Or maybe I could make it follow the mouse?
image

Could the legend next to the chart be made clickable?

For sure! I thought it should filter out the hosts in the main table, so I wanted to make it when I have the table ready. Is there something else it should do?

@kmalyjur kmalyjur force-pushed the job-inv-status-chart branch from 1a314dc to 9da75ee Compare February 5, 2024 10:44
@kmalyjur kmalyjur changed the title WIP: Fixes #37122 - Update system status chart in job invocations detail page Fixes #37122 - Update system status chart in job invocations detail page Feb 5, 2024
@kmalyjur kmalyjur marked this pull request as ready for review February 5, 2024 11:05
@kmalyjur kmalyjur force-pushed the job-inv-status-chart branch from 9da75ee to 41a31a2 Compare February 5, 2024 11:26
@MariaAga
Copy link
Member

MariaAga commented Feb 5, 2024

image
In Progress title is cut off even when there is space

@kmalyjur kmalyjur force-pushed the job-inv-status-chart branch 2 times, most recently from 260e6a9 to d44ac23 Compare February 12, 2024 13:47
@kmalyjur
Copy link
Contributor Author

kmalyjur commented Feb 12, 2024

In Progress title is cut off even when there is space

@MariaAga Fixed, the width of the chart legend is now adjusted dynamically. I hope it's not too over-complicated.
I also made some changes to the CSS we discussed earlier.

@@ -0,0 +1,36 @@
.job-invocation-detail-page-section {
.chart-donut {
height: 105px;
Copy link
Member

Choose a reason for hiding this comment

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

Please put 105px in a variable in this file

<JobInvocationOverview data={items} />
</FlexItem>
<Flex
style={{ height: '105px' }}
Copy link
Member

Choose a reason for hiding this comment

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

Please move to the .scss file

const [legendWidth, setLegendWidth] = useState(270);

useEffect(() => {
const legendContainer = document.querySelector('.chart-legend');
Copy link
Member

Choose a reason for hiding this comment

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

I understand it today, but probably would be best to add a comment on why its needed for future us :)

label: `${d.title} ${d.count} hosts`,
y: d.count,
}))
: [{ label: `Scheduled: ${totalHosts} hosts`, y: 1 }]
Copy link
Member

Choose a reason for hiding this comment

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

Can you use sprintf here?

}))
: [{ label: `Scheduled: ${totalHosts} hosts`, y: 1 }]
}
colorScale={total > 0 ? chartData.map(d => d.color) : ['#8A8D90']}
Copy link
Member

Choose a reason for hiding this comment

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

Please use a pf variable for `#8A8D90``

subTitle={__('Systems')}
subTitleComponent={
<ChartLabel
style={{ fontSize: '12px', fill: canceledColor.value }}
Copy link
Member

Choose a reason for hiding this comment

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

Should be in a css file

Copy link
Contributor Author

@kmalyjur kmalyjur Mar 13, 2024

Choose a reason for hiding this comment

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

Should be in a css file

@MariaAga is the comment // inline style overrides PatternFly default styling enough? If so, could you please merge it?

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 approved it, and have to merge permissions in plugins, only @adamruzicka can merge here:)

Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't want to merge with outstanding comments in case this was still unresolved

<ChartTooltip pointerLength={0} constrainToVisibleArea />
}
title={chartDonutTitle}
titleComponent={<ChartLabel style={{ fontSize: '20px' }} />}
Copy link
Member

Choose a reason for hiding this comment

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

Should be in a css file

@kmalyjur
Copy link
Contributor Author

@MariaAga thank you, I incorporated everything except for some chart CSS styles (I left comments on those).

@kmalyjur kmalyjur requested a review from MariaAga February 14, 2024 14:21
@@ -0,0 +1,42 @@
$chart_size: 105px;
Copy link
Member

Choose a reason for hiding this comment

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

This also should be in .job-invocation-detail-page-section or have unique name

@kmalyjur kmalyjur force-pushed the job-inv-status-chart branch from 9183648 to d11668b Compare February 19, 2024 09:52
@kmalyjur kmalyjur requested a review from MariaAga February 19, 2024 09:53
Copy link
Member

@MariaAga MariaAga left a comment

Choose a reason for hiding this comment

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

Looks good!

@kmalyjur kmalyjur requested a review from adamruzicka February 28, 2024 08:33
@kmalyjur kmalyjur force-pushed the job-inv-status-chart branch 2 times, most recently from 1f7cd15 to 0aa6122 Compare March 4, 2024 10:51
@kmalyjur kmalyjur force-pushed the job-inv-status-chart branch from 0aa6122 to cb8e8ee Compare March 4, 2024 13:22
@pnovotny
Copy link

QA, LGTM.
The chart status tooltips are centered vertically & horizontally.
The status legend titles are fine too, no text trimming or so. Plus it's aligned dynamically when changing the window width w/o any visible distortions.

@pnovotny
Copy link

Also WRT UI automation, the identifiers look sufficient to locate all important items.
The main sections - chart, legend and overview - have static IDs and the inner text labels should be locatable with combination of the widget CSS names and text.

@adamruzicka adamruzicka merged commit 35701a0 into theforeman:master Mar 14, 2024
22 checks passed
@adamruzicka
Copy link
Contributor

Thank you @kmalyjur !

@kmalyjur
Copy link
Contributor Author

Thank you @MariaAga @adamruzicka @pnovotny

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants