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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #30633 - Stopped chart doesnt count cancelled #578

Merged
merged 1 commit into from Sep 15, 2020

Conversation

MariaAga
Copy link
Member

@MariaAga MariaAga commented Aug 11, 2020

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'
Screenshot from 2020-08-11 16-45-20
Design was approved 馃槃

@adamruzicka
Copy link
Contributor

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?

@MariaAga
Copy link
Member Author

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

@adamruzicka
Copy link
Contributor

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"

@MariaAga
Copy link
Member Author

I think that its a bit meaningless to count "Other total" and "other in the last 24 hours"

@adamruzicka
Copy link
Contributor

I think that its a bit meaningless

Ok 馃憤

@MariaAga
Copy link
Member Author

@LaViro can you take a look?

@Ron-Lavi
Copy link
Member

Nice work @MariaAga,

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 agree with @adamruzicka,
it would fit in more logically to the table.
Also I think that the users don't really want to know about the all history of "other" stopped tasks,
IMO it would be more relevant to show them also the 24th column.

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"
for me it "unknown" sounds a bit better.

@MariaAga
Copy link
Member Author

Thanks @LaViro for the detailed feedback! this design and text is approved by Rox and Melanie.

Also I think that the users don't really want to know about the all history of "other" stopped tasks

This PR is for a user wanting to know how many cancelled tasks there are

IMO it would be more relevant to show them also the 24th column.

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.

thinking about it - should we also add in the future a column for "last week" / "month" / "year" ?

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

should we rename it from "Other" to "unknown" ? since the task is ended but its result is neither "success" / "warning" / "error"
for me it "unknown" sounds a bit better.

I don't think we should use unknown because we do know what the result is.

Copy link

@pondrejk pondrejk left a 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

Comment on lines 30 to 31
const otherCount = data.other || 0;
delete data.other;
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

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 }

Comment on lines 51 to 60
<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>
Copy link
Member

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.

Comment on lines 61 to 74
<span>
<OtherInfo />
<Button
bsStyle="link"
onClick={() =>
updateQuery({
state: TASKS_DASHBOARD_AVAILABLE_QUERY_STATES.STOPPED,
result: TASKS_DASHBOARD_AVAILABLE_QUERY_RESULTS.OTHER,
})
}
>
{otherCount}
</Button>
</span>
Copy link
Member

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.

Comment on lines +15 to +17
export const calcStoppedOther = data =>
(data?.cancelled?.total || 0) + (data?.pending?.total || 0);

Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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)

Copy link
Member

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 :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Why not?

Copy link
Member

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?

Copy link
Member Author

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

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 add a small test for calcStoppedOther?

@MariaAga
Copy link
Member Author

After moving the components around this became a bit of a refactor PR as well

Comment on lines +15 to +17
export const calcStoppedOther = data =>
(data?.cancelled?.total || 0) + (data?.pending?.total || 0);

Copy link
Member

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 :)

Copy link
Member

@Ron-Lavi Ron-Lavi left a comment

Choose a reason for hiding this comment

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

Almost there !

Left some inline comments,
also, looks like the font is not on the same size?
Screenshot (6)

while at it, can you add a bit margin near the rest of the results icons?
to have the same space between the icon and the text as in others:

Screenshot (5)

Comment on lines +15 to +17
export const calcStoppedOther = data =>
(data?.cancelled?.total || 0) + (data?.pending?.total || 0);

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 add a small test for calcStoppedOther?

@MariaAga
Copy link
Member Author

MariaAga commented Sep 2, 2020

  • Font is 12px in both.
  • Added margin to the icons
  • Added test for calcStoppedOther
    Screenshot from 2020-09-02 16-42-28

@MariaAga
Copy link
Member Author

MariaAga commented Sep 3, 2020

Same font for everyone 馃帀
Screenshot from 2020-09-03 13-16-41

Copy link
Member

@Ron-Lavi Ron-Lavi left a 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 :)

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.

Works as expected, ACK

@adamruzicka adamruzicka merged commit 05dbdb2 into theforeman:master Sep 15, 2020
@adamruzicka
Copy link
Contributor

Thank you @MariaAga & @LaViro !

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