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

Improve UI #135

Merged
merged 5 commits into from
Jun 30, 2024
Merged

Improve UI #135

merged 5 commits into from
Jun 30, 2024

Conversation

smortex
Copy link
Member

@smortex smortex commented Oct 28, 2022

  • Fix extra attributes table markup
  • Respect inline and block elements logic
  • Display description using a monospaced font
  • Improve attributes display consistency
  • Make rounding more consistent
Before After
Output of ps(1) is hard to read because of the non-monospaced font, custom attribute (customer, user) are not display like the usual ones (ttl, tags) More readable ps(1) output, all attributes are displayed the same way
Before After
Some floating points number have a single digit after the decimal place (2.4) Floating-points numbers always have 2 digits after the decimal place
Before After

The code produced invalid table markup:

```
<table></table>
<tr><td>...</td><td>...</td></tr>
<tr><td>...</td><td>...</td></tr>
```

Build the complete table HTML fragment as a string and only then
attempt to append it to create the expected markup.
Instead of using block tags (DIV) and applying CSS to make them behave
like inline tags, use SPAN tags.

Wrap the first line of items in their
own DIV tag to ensure the following content is not impacted.  Make the
description float so that the exta attributes can be side by side with
it.
Some metrics can contain multiple lines of output generated by a CLI
program that aligned information for bettear readibility (e.g. ps(1)
output of the cpu metric from riemann-health).

Swicth to a PRE tag to display this content preserving spacing.
Use the same color for extra attribute names than for existing ttl and
tags label. While here, remove extra colon after tags to match the other
labels.
Copy link

@faxm0dem faxm0dem left a comment

Choose a reason for hiding this comment

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

LGTM !

@smortex smortex changed the title ui improvements Improve UI Nov 30, 2022
When formatting a value like 7.897 with a precision of 2 digits the code
was:
  * muliplying the value by 100 (10^precision) => 789.7;
  * rouding the value => 790;
  * dividing the value by 100 => 7.9

This is inconsistent with other float values displayed with 2 decimal
digits.  Prefer the toFixed method which returns a string, "7.90" in the
above exapmle.

Since we also have integer values, and because JS is a joke that only
knows about floats, attempt to guess if the value is an integer and do
not display decimals in this case to keep the previous behavor in this
case.
@smortex
Copy link
Member Author

smortex commented Dec 1, 2022

Added another minor fix for rounding inconsistencies.

@jamtur01 jamtur01 merged commit 2d479c6 into riemann:main Jun 30, 2024
2 of 3 checks passed
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.

3 participants