Skip to content

Conversation

@rawagner
Copy link
Contributor

@rawagner rawagner commented Sep 5, 2019

  • every item shows maximum of 3 most important statuses
  • item title is link to resource page
  • use skeleton loading

inventory_loading

@openshift-ci-robot openshift-ci-robot added component/core Related to console core functionality component/kubevirt Related to kubevirt-plugin component/metal3 Related to metal3-plugin component/sdk Related to console-plugin-sdk size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 5, 2019
@rawagner
Copy link
Contributor Author

rawagner commented Sep 5, 2019

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 5, 2019
@andybraren
Copy link
Contributor

Nice, looks great! 🎉

@rawagner rawagner force-pushed the 4.3-inventory branch 2 times, most recently from 247309c to 1eac0d1 Compare September 17, 2019 10:19
@openshift-ci-robot openshift-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 17, 2019
@rawagner
Copy link
Contributor Author

Added ability to expand inventory item
43inventory
43inventory_expanded

@mareklibra
Copy link
Contributor

lgtm, blocked on missing 4.3 branch

@openshift-ci-robot openshift-ci-robot added component/ceph Related to ceph-storage-plugin component/dashboard Related to dashboard component/dev-console Related to dev-console component/monitoring Related to monitoring component/noobaa Related to noobaa-storage-plugin size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. component/olm Related to OLM and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 21, 2019
@rawagner rawagner changed the base branch from master to master-4.3 September 21, 2019 07:03
@openshift-ci-robot openshift-ci-robot removed the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 21, 2019
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Sep 26, 2019
@rawagner rawagner force-pushed the 4.3-inventory branch 3 times, most recently from 27981b1 to ee7a63d Compare September 26, 2019 14:02
@@ -13,3 +16,7 @@ export const getRouteStatusGroups: StatusGroupMapper = (resources) => ({
export const DemoGroupIcon: React.FC<{}> = () => (
<AddressBookIcon className="co-inventory-card__status-icon co-inventory-card__status-icon--warn" />
);

export const ExpandedRoutes: React.FC<ExpandedComponentProps> = ({ resource }) => (
<div>additional content for {resource.length} routes</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: shouldn't we capitalize the word "additional" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Capitalized :)

@@ -118,6 +121,8 @@ namespace ExtensionProperties {

/** Function which will map various statuses to groups. */
mapper: StatusGroupMapper;

expandedComponentLoader?: LazyLoader<ExpandedComponentProps>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please avoid the Loader suffix.

The way how React components are referenced from extension's properties object shouldn't affect the property name. Let's keep things short and simple.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, removed

@@ -126,6 +131,9 @@ namespace ExtensionProperties {

/** React component representing status group icon. */
icon: React.ReactElement;

/** Priority of inventory group */
Copy link
Contributor

Choose a reason for hiding this comment

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

Please document the practical impact of this property, e.g. groups with higher prio are rendered before groups with lower prio. This is especially important in case of non-optional extension properties.

Also, does it make sense to have priority optional here? We should keep the mandatory set of extension properties small and use reasonable defaults whenever possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, i guess this is not really needed. I removed the whole priority thing.
The ordering of statuses are as follows:
error, warning, progress, ...whatever is defined by plugin, unknown

display: flex;
font-size: 1rem;
justify-content: space-between;
padding: 1em var(--pf-c-card--child--PaddingRight) 1em var(--pf-c-card--child--PaddingLeft);
line-height: 1.5rem;
padding: 1rem var(--pf-c-card--child--PaddingRight) 1rem var(--pf-c-card--child--PaddingLeft);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, the var(x) expression is the standard CSS way of handling variables, equivalent to Sass $x expressions? If so, we should favor the new CSS way to handle variables, right?

Also, what is the rationale behind var(--pf-x) instead of non-prefixed var(pf-x) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldnt find variable in scss form that I could use. Also patternfly-react is using these in same way.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, so I guess $pf-stuff comes from PF3 (Sass) and var(--pf-stuff) comes from PF4, is that right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, correct

&::after {
background-repeat: no-repeat;
content:"";
display:block;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: missing space after : in lines above, and possibly on other places too.

Since we don't use Stylelint (yet) we can't check this in an automated way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

flags = {},
ExpandedComponent,
}) => {
const TitleComponent = React.useCallback((props) => (
Copy link
Contributor

Choose a reason for hiding this comment

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

This is interesting, why React.useCallback and not React.memo here?

Is it because of explicit dependency control declared through array [kind, namespace] ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can define dependencies for React.memo too. But React.memo returns value of memoized function, React.useCallback returns memoized function (not its value)

Copy link
Contributor

Choose a reason for hiding this comment

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

Great, thanks for explaining this.

export type StatusGroupMapper = (
resources: K8sResourceKind[],
additionalResources?: {[key: string]: K8sResourceKind[]},
) => {[key in InventoryStatusGroup | string]: {filterType?: string, statusIDs: string[], count: number}};
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: please extract return type into separate type declaration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

count: number;
children?: React.ReactNode;
error: boolean;
TitleComponent?: React.ComponentType<any>;
ExpandedComponent?: React.ComponentType<any>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: ComponentType<P = {}> has fallback to {} so do we really need an explicit any type parameter?

I think that {} is a better (more sensible) type fallback than any when it comes to React component props.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, i wasnt sure which is better..using ComponentType<{}>

}

export const inventoryStatusGroupPriority = {
Copy link
Contributor

Choose a reason for hiding this comment

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

When specifying priority value in the plugin, can we import this and do something like

inventoryStatusGroupPriority[InventoryStatusGroup.PROGRESS] + some_offset

instead of hard-coded numbers everywhere? This also creates a link to base priority values and therefore improves the understanding of extension's impact.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good, using offest values now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

since I removed at at the end..this is irrelevant now

const pvcsLoadError = _.get(resources.pvcs, 'loadError');
const pvcsData = _.get(resources.pvcs, 'data', []) as K8sResourceKind[];
const ExpandedComponent = React.useCallback(() =>
<AsyncComponent loader={expandedComponentLoader} resource={resourceData} additionalResources={additionalResourcesData} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: the line seems too long, please split the JSX expression onto multiple lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 30, 2019
@rawagner rawagner force-pushed the 4.3-inventory branch 3 times, most recently from f417d56 to 48b3a2f Compare September 30, 2019 08:18
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 30, 2019
@@ -118,6 +121,8 @@ namespace ExtensionProperties {

/** Function which will map various statuses to groups. */
mapper: StatusGroupMapper;

expandedComponent?: LazyLoader<ExpandedComponentProps>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a brief description here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

display: flex;
font-size: 1rem;
justify-content: space-between;
padding: 1em var(--pf-c-card--child--PaddingRight) 1em var(--pf-c-card--child--PaddingLeft);
line-height: 1.5rem;
padding: 1rem var(--pf-c-card--child--PaddingRight) 1rem var(--pf-c-card--child--PaddingLeft);
Copy link
Contributor

Choose a reason for hiding this comment

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

OK, so I guess $pf-stuff comes from PF3 (Sass) and var(--pf-stuff) comes from PF4, is that right?

@vojtechszocs
Copy link
Contributor

/lgtm
/approve

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 30, 2019
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@spadgett
Copy link
Member

/hold
for #2865 (sorry)

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 30, 2019
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Sep 30, 2019
 - every item shows maximum of 3 most important statuses
 - item title is link to resource page
 - use skeleton loading
 - item can be expanded
@spadgett
Copy link
Member

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 30, 2019
@mareklibra
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 1, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mareklibra, rawagner, vojtechszocs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 5310054 into openshift:master Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/ceph Related to ceph-storage-plugin component/core Related to console core functionality component/dashboard Related to dashboard component/dev-console Related to dev-console component/kubevirt Related to kubevirt-plugin component/metal3 Related to metal3-plugin component/monitoring Related to monitoring component/noobaa Related to noobaa-storage-plugin component/olm Related to OLM component/sdk Related to console-plugin-sdk lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants