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

mgr/dashboard: Print a blank space between value and unit #22387

Merged
merged 1 commit into from Jun 6, 2018

Conversation

votdev
Copy link
Member

@votdev votdev commented Jun 4, 2018

When displaying values with their unit a blank space must be shown between them, see https://en.wikipedia.org/wiki/Space_(punctuation)#Unit_symbols and point 15 at https://physics.nist.gov/cuu/Units/checklist.html.

auswahl_003

Signed-off-by: Volker Theile vtheile@suse.com

@votdev votdev changed the title mgr/dashboard: Print a blank space between value and unit. mgr/dashboard: Print a blank space between value and unit Jun 4, 2018
Copy link
Contributor

@LenzGr LenzGr left a comment

Choose a reason for hiding this comment

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

Good point - thank you!

@LenzGr
Copy link
Contributor

LenzGr commented Jun 4, 2018

retest this please

@votdev votdev force-pushed the missing_space_value_unit branch 2 times, most recently from e0a0f27 to 3b64a3d Compare June 4, 2018 13:03
Copy link
Contributor

@ricardoasmarques ricardoasmarques left a comment

Choose a reason for hiding this comment

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

lgtm

return '-';
}
let result = truncatedFloat;
if (units[unit] !== '') {
Copy link

Choose a reason for hiding this comment

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

This can only happen if the units array has an empty string in it.
It would be better to check the following:

units[units.length <= unit ? units.length -1 : unit]

if (truncatedFloat === '') {
return '-';
}
let result = truncatedFloat;
Copy link

Choose a reason for hiding this comment

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

Maybe you should rename truncatedFloat to result in line 31 ;)

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 was thinking about this during the implementation phase, but decided not to
name it as you suggested because it is not the result at this stage.

@votdev
Copy link
Member Author

votdev commented Jun 5, 2018

@Devp00l All comments have beem addressed.

@votdev votdev force-pushed the missing_space_value_unit branch 2 times, most recently from 56f7519 to 9eb0b34 Compare June 5, 2018 14:19
Devp00l
Devp00l previously requested changes Jun 5, 2018
if (result === '') {
return '-';
}
if (units[unit] !== '') {
Copy link

Choose a reason for hiding this comment

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

I think you can now remove this line :)
This said how about converting it to a one liner :D

return result === '' ? '-' : `${result} ${units[unit]}`

Copy link
Member Author

@votdev votdev Jun 5, 2018

Choose a reason for hiding this comment

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

We still need that line because the list of units can contain an empty unit string, see https://github.com/ceph/ceph/blob/master/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless.pipe.ts#L12.

When displaying values with their unit a blank space must be shown between them, see #15 at https://physics.nist.gov/cuu/Units/checklist.html.

Signed-off-by: Volker Theile <vtheile@suse.com>
@LenzGr LenzGr dismissed Devp00l’s stale review June 6, 2018 17:18

Concern has been addressed.

@LenzGr LenzGr merged commit 032360d into ceph:master Jun 6, 2018
@votdev votdev deleted the missing_space_value_unit branch June 7, 2018 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants