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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #30633 - Stopped chart doesnt count cancelled #578
Conversation
Could we allow searching for "others" by clicking the number just like with other numbers in the table? Also, why not make it a part of the table? |
Good idea, I'll add it as a filter. because we'll have to add 2 more rows ( 'cancelled' and 'pending') making the card too big, just adding the 'other' made the card bigger |
I meant doing it the same way as it is now, just adding it to the table instead of putting it below it. So you'd add just one row called "other" |
I think that its a bit meaningless to count "Other total" and "other in the last 24 hours" |
Ok 馃憤 |
webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardSelectors.js
Outdated
Show resolved
Hide resolved
...nts/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.js
Outdated
Show resolved
Hide resolved
@LaViro can you take a look? |
Nice work @MariaAga,
I agree with @adamruzicka, thinking about it - should we also add in the future a column for "last week" / "month" / "year" ? should we rename it from "Other" to "unknown" ? since the task is ended but its result is neither "success" / "warning" / "error" |
Thanks @LaViro for the detailed feedback! this design and text is approved by Rox and Melanie.
This PR is for a user wanting to know how many cancelled tasks there are
Because other includes different result types I don't think that a user will get any value from knowing how many 'other' result were there in the last 24h, but I do think the user should know that there are more result types than whats shown in the table.
last week already exists in the table, and I think that the number of tasks in a year for a user will be too big for a dashboard
I don't think we should use unknown because we do know what the result is. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked from the user's pov, looks good
const otherCount = data.other || 0; | ||
delete data.other; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it would be better to send the data correctly from the server, instead of manipulating it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by getting it correctly? I can move the default 0
to the selector/ default props
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the data
object looks something like:
data = { error, success, warning, other }
instead of manipulating it here and later also using calcStoppedOther
helper,
we could return from the server something like:
data = { results: { error, success, warning }, otherCount: 0 }
<table className="table table-bordered table-striped stopped-table"> | ||
<thead> | ||
<tr> | ||
<th /> | ||
<th>{__('Total')}</th> | ||
<th>{getQueryValueText(time)}</th> | ||
</tr> | ||
</thead> | ||
<tbody>{StoppedTable(data, query, time, updateQuery)}</tbody> | ||
</table> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could go into its own component file.
<span> | ||
<OtherInfo /> | ||
<Button | ||
bsStyle="link" | ||
onClick={() => | ||
updateQuery({ | ||
state: TASKS_DASHBOARD_AVAILABLE_QUERY_STATES.STOPPED, | ||
result: TASKS_DASHBOARD_AVAILABLE_QUERY_RESULTS.OTHER, | ||
}) | ||
} | ||
> | ||
{otherCount} | ||
</Button> | ||
</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also could go into its own component file.
export const calcStoppedOther = data => | ||
(data?.cancelled?.total || 0) + (data?.pending?.total || 0); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get this data from the server?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will complicate the server more that this complicated the front end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented about it also here: #578 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this anymore :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you pass it as otherCount from server?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, the server returns {[result]:count} for every result in the DB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a small test for calcStoppedOther
?
After moving the components around this became a bit of a refactor PR as well |
...nts/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.js
Outdated
Show resolved
Hide resolved
export const calcStoppedOther = data => | ||
(data?.cancelled?.total || 0) + (data?.pending?.total || 0); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this anymore :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
Outdated
Show resolved
Hide resolved
export const calcStoppedOther = data => | ||
(data?.cancelled?.total || 0) + (data?.pending?.total || 0); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a small test for calcStoppedOther
?
...Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
Show resolved
Hide resolved
webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardSelectors.test.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all of the work @MariaAga !
Works great :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected, ACK
in tasks dashboard the stopped chart only had counts for 'warning', 'error' and 'success', and was missing 'cancelled' and 'pending' result counts.
Added an 'other' counter for the total of 'cancelled' and 'pending'
Design was approved 馃槃