-
Notifications
You must be signed in to change notification settings - Fork 42
adds compound expansion infra mappings UI #395
Conversation
width: 75%; | ||
} | ||
.infra-mapping-item-source { | ||
border: 1px solid black; |
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.
Though I wasn't asked, we'll likely wanta use something from https://github.com/patternfly/patternfly/blob/master/src/less/color-variables.less#L76 for this color
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.
yep... colors t.b.d...thanks!!
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.
Something like...
@import './node_modules/patternfly/dist/sass/patternfly/color-variables';
then $color-pf-blue
I can't for the life of me understand why its so difficult to get to the colors though 🤔 😢
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 used $color-pf-blue-400
after eyeballing this a few times... it was the darkest pf-blue color I could denote any distinction. The other colors do not differentiate enough from the the left-hand black border w/ these 👀 . Please note that... we will need to keep a patternfly or patternfly-react dependency here in v2v plugin to get those imported sass variables in this plugin (from the npm installed package). So my vote is to just keep patternfly-react since it depends on patternfly and we going to continue consuming es6 helpers from PF React in the future)...
HOWEVER - patternfly-react (and other ui-classic common packages) should also still be updated in ui-classic when doing upgrades from now on...
cc: @himdel
ManageIQ/guides#314
another twist on this would be... w/ PF Next (and PF React Next components coming) - we'll be exporting the CSS directly in the ES6 module alongside the React component (so that problem kinda dissipates). You'll also get all the style variables and classes from PF Core transposed/exposed as ES6 object references :) ....More on this in a PR coming upstream soon....but it shouldn't affect us until after GA (when we could even consider PF next components).
lots of tangents but figured it would be good to note this 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.
Interactions look great. Please use the colors we discussed offline.
Are we not concerned with deduping networks for these visualizations? |
@michaelkro i was asking @AparnaKarve the same question... From what it sounds, the dedupe only needs to occur on the creation (in the Mapping Wizard). After creation, they should not be duplicated. I used unique network id's/datastore id's/cluster id's for the target to ensure the UI shows uniqueness. However if those id's aren't unique, then yes we should revisit... @AparnaKarve can you confirm? |
.set('errorClusters', action.payload) | ||
.set('isRejectedClusters', true) | ||
.set('isFetchingClusters', false); | ||
|
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.
tiny nothing, inconsistent spacing between reducer cases 🔍
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.
removed empty lines in that reducer
@priley86 Looking at the Network screenshot above, it does look like a dedupe might be necessary. I think we have 2 options here -
or
Although, from an end user's standpoint, I don't know if we should disclose that there are multiple switch id's involved here |
so you are creating the duplicated mapping for those network IDs? I.e. you are showing them as one unit, but still including both networks in the mapping object. In that case I agree... I assume we'd use the same deduplication logic then... Let's talk about this in standup. |
<small> | ||
{__('Completed: ')} | ||
{moment(mapping.created_at).format( | ||
'MMMM Do YYYY, h:mm a' |
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 do this in infastructuremappinglist.js and planrequestdetailslist... might be time to make a constant 🤔
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.
sure - can add a common helper...
<Icon type="pf" name="network" /> | ||
<div className="mappings-expand-label-group"> | ||
<div className="mappings-expand-label"> | ||
<strong>{sourceLanCount}</strong> |
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.
if we gotta have em, we gotta have em, but if there's a better way than sprinkling
😞
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 still think those are more explicit and we don't really have a standard on this... i.e. "how many spaces am I looking at..."
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 do elsewhere in MIQ?
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.
yeah it happens everywhere in miq... doesn't mean I like it 😏
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.
ok man - you win... my <3 of JSX supersedes my <3 of explicit spaces...
JSX is really HTML6 ... a lotta folks just don't really admit it yet ;)
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.
❤️ ❤️ ❤️ ❤️ ❤️ ❤️
<div className="mappings-expand-label-group"> | ||
<div className="mappings-expand-label"> | ||
<strong>{sourceDatastoreCount}</strong> | ||
{sourceDatastoreCount === 1 |
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.
just an idea for cleaning this up...
sprintf(__('Source Datastore%s'), sourceDatastoreCount > 1? 's':'')
ALTERNATIVELY
we can use the react-intl formatted plural thing
something like this.... (but heck the original was more concise.. though this is more explicit)
<FormattedPlural value={sourceDatastoreCount} one=__('Source Datastore') other=__('Source Datastores') />
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.
oh same comment for where this is done elsewhere
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.
sure - maybe a helper which renders that internally?
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 know we have to be careful about using sprintf
to modify words... not sure about using it for pluralization though
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 current implementation looks OK to me.
In general, to make the translators life easy, whole sentences are preferred.
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.
you talked me into creating a simple pluralize helper... i think the shorthand notation will save us a lot of keystrokes. Hopefully the translators can manage the additional translation (well it's really the same number for these afterall).
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.
otherwise our pluralize formula gets very complex...
<Grid.Col xs={6}> | ||
<b>{__('Source Networks')}</b> | ||
</Grid.Col> | ||
<Grid.Col xs={6} style={{ paddingLeft: 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.
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.
those are unique to these only. I guess I can put them in classes if you really want ;)
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 thought we did this somewhere else... but not finding it.. might not be a bad idea to put em in a class for use elsewhere if/when necessary 🤷♂️
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.
Sass and friends are happy ;)
<React.Fragment> | ||
<Grid.Row> | ||
<Grid.Col xs={6}> | ||
<b>{__('Source Networks')}</b> |
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.
Should this and line 342 be pluralized 🤔 (cuz sometimes there is a single source network - target network)
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 don't think a label should be pluralized.
app/javascript/common/helpers.js
Outdated
@@ -1,3 +1,6 @@ | |||
// todo: expose this from patternfly-react instead? | |||
export const getDisplayName = Component => | |||
Component.displayName || Component.name || 'Component'; | |||
|
|||
export const pluralize = (count, string) => |
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.
Please don't ever use this pluralize
:)
Won't work with i18n at all.
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.
Agree.
Like I mentioned above - whole sentences is what we want for i18n - #395 (comment)
Although looks like pluralize
is not being used anywhere yet?
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.
@priley86 Grammar rules vary from language to language, so what defines 'pluralization' in English (adding an s
or es
in most cases) does not apply to all languages.
To keep it simple, lets just go with -
__('Source Datastore')
for one and
__('Source Datastores')
for many
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 is a SUPER neat idea though! Like this idea... if complete sentences make the world an easier place... we really should just use the react-intl helper thing... (especially since we already have the dep)
we can use the react-intl formatted plural thing
<FormattedPlural value={sourceDatastoreCount} one=__('Source Datastore') other=__('Source Datastores') />
<div className="mappings-expand-label"> | ||
<strong>{sourceLanCount}</strong> | ||
{` `} | ||
{pluralize(sourceLanCount, 'Source Network')} |
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 canonical gettext way of doing this would be n_('Source Network', 'Source Networks', sourceLanCount)
... except it's still not quite right, because the order is not necessarily "# thingies" in all languages.
So... this would end up being sprintf(n_('%d Source Network', '%d Source Networks', sourceLanCount), sourceLanCount)
.
(That, or
n_(`${sourceLanCount} Source Network`, `${sourceLanCount} Source Networks`)
once our i18n tooling supports template strings properly. (Unless it already does @mzazrivec ?))
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 don’t think the other 3rd party libraries are any more reliable than gettext (I’ve seen others mentioned too besides these). My vote is to stay consistent with gettext and if that’s the way this is achieved that’s fine, but it’s not reducing the original solution much. I still think on-Prem translation solutions end up on the translator. There is SaaS offerings for i18n (real time translation APIs) that are very reliable, but it doesn’t look like we’ll be investing in those.
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.
Was just looking for the one off solution for these cases (not pluralizing all)
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 don't want to render the count within the same block (because styling is different around the < strong > tags). So for now, I just renamed the method (I think my original intent was only for these simple scenarios), however I think it could be made more flexible this way...
Happy to revisit this in the future, but I think this is good enough for now.
41a2f3a
to
33c0c1d
Compare
<div className="mappings-expand-label"> | ||
<strong>{sourceLanCount}</strong> | ||
{` `} | ||
{simplePluralize( |
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.
effin elegant 🤗 🏩
</div> | ||
<div className="mappings-expand-label"> | ||
<strong>{targetLanCount}</strong> | ||
{` `} |
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.
's not much different than
but feels better 😌
} | ||
} | ||
|
||
.infra-mapping-header-row { |
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.
maybe one day extracting it out a lil more, but pretty awesome for now 💇♂️
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.
LG2M!!! a very nice bundle of work @priley86 🥇
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.
@priley86 I gotta say this PR has added immense character to the Migration screen :) -- just tested it, and it's just beautiful!
Thank you!!
The Network dedupe can be addressed separately in a smaller PR. |
<div className="mappings-expand-label"> | ||
<strong>{targetLanCount}</strong> | ||
{` `} | ||
{simplePluralize( |
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.
Still problematic, for mostly the same reasons .. (or see the list of plural rules in https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals )
__('Source Networks')
has different translations based on whether there's 2 of them or 5.
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.
Ok - so this is becoming a PF design issue as well I'm afraid. If we need to style the count separately from the label, then we'd need to extract two strings. I think your original suggestion breaks this design. I will follow up on this...
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.
Another option may be to render that count alongside the text and just hide the count in the case we are displaying the label, however I think this would also be confusing to a translator. Has this not come up before? Displaying counts with differing styles?
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.
Will just remove the count styling for now.
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.
@himdel From a Gaprindashvili standpoint, I don't think we can do this (what you suggested above) -
n_(`${sourceLanCount} Source Network`, `${sourceLanCount} Source Networks`)
If the support for enhanced pluralization has been added in ui-classic, it must be pretty new.
@priley86 We can look into enhanced pluralization all throughout the app after the release is out the door.
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.
@AparnaKarve Not really, it was introduced together with the rest, back in December 2015.
(That said, the example is indeed wrong, it must be sprintf(n__('%d Source Network', '%d Source Networks', sourceLanCount), sourceLanCount).
)
ok - thanks, i'll look at this again shortly... |
@michaelkro Yes, we agreed that the Network dedupe could be fixed in a separate PR. |
whoops, my bad guys |
@@ -1,2 +1,3 @@ | |||
@import 'patternfly/dist/sass/patternfly/color-variables'; |
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 breaks gaprindashvili ui-classic travis:
# --- Caused by: ---
# Sass::SyntaxError:
# File to import not found or unreadable: patternfly/dist/sass/patternfly/color-variables.
(https://travis-ci.org/ManageIQ/manageiq-ui-classic/builds/391256750)
There is no patternfly
, since neither v2v nor ui-classic depend on any such package now.
This should be - fixed in #410patternfly-sass/dist/...
@priley86 Is there a BZ that goes with this PR? I can't bacakport unless this change is approved for the next release. |
Looks like this is already in Gaprindashvili branch (rebased from master before I took over the backport), removing the |
Closes #310 #394
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1600635
Screenshots...
Networks
Datastores
Clusters
Associated Plans
Error handling
If we receive any errors loading mappings/clusters/datastores/networks - just display an error. I don't want to overcomplicate this error handling logic if we don't have to. You need these data collections to construct the models. You'd need the mappings and clusters to display all of the visualizations.
GIF of UX