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

Add the component and utility for helm release grouping #3913

Merged
merged 1 commit into from Jan 22, 2020

Conversation

sahil143
Copy link
Contributor

@sahil143 sahil143 commented Jan 9, 2020

ODC-story: https://issues.redhat.com/browse/ODC-2622

This PR adds the grouping for the helm release nodes

Screenshot from 2020-01-09 23-48-07

updated screentshot
Screenshot from 2020-01-14 12-03-39

[TODO]:

  • Add unit test for the utility
  • Add Helm icon the release group label
  • disable drag-drop for helm- release group.

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. component/dev-console Related to dev-console component/knative Related to knative-plugin labels Jan 9, 2020
@andrewballantyne
Copy link
Contributor

/kind feature

@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 9, 2020
@openshift-ci-robot openshift-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. component/core Related to console core functionality labels Jan 14, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 14, 2020
@sahil143 sahil143 changed the title [WIP] Add the component and utility for helm release grouping Add the component and utility for helm release grouping Jan 14, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 14, 2020
&__label {
cursor: pointer;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

add extra line 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.

fixed

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" role="img" viewBox="-6.49 -6.74 316.49 363.74"><mask id="a" fill="#fff"><path fill-rule="evenodd" d="m0 0h313.303155v159.864865h-313.303155z"/></mask><mask id="b" fill="#fff"><path fill-rule="evenodd" d="m0 0h313.303155v159.864865h-313.303155z"/></mask><g fill="none" fill-rule="evenodd"><path fill="#000" d="m11.6785714 189h19.7858357v26.789h23.9037v-26.789h19.7858358v75.25h-19.7858358v-28.695333h-23.9037v28.695333h-19.7858357zm86.1738429 75.25v-75.25h46.8030427v16.354333h-27.017207v12.240667h23.9037v16.655333h-23.9037v13.846h27.017207v16.153667zm68.4971567 0v-75.25h19.785836v55.384h27.117643v19.866zm77.536372-75.25 30.733328 27.892667 30.632893-27.892667h8.938779v75.25h-19.886272v-38.628333l-19.6854 17.959666-19.785835-17.859333v38.528h-19.886272v-75.25z" transform="translate(-11 -51)"/><g><g fill="#000" mask="url(#a)" transform="matrix(1 0 0 -1 .958 404)"><path d="m203.460676 95.6875425c6.93631 0 12.559301-14.8092194 12.559301-33.0773172s-5.622991-33.0773172-12.559301-33.0773172c-6.936311 0-12.559301 14.8092194-12.559301 33.0773172s5.62299 33.0773172 12.559301 33.0773172z" transform="rotate(35 137.931 151.55)"/><path d="m30.1423223 95.6875425c6.9363104 0 12.559301-14.8092194 12.559301-33.0773172s-5.6229906-33.0773172-12.559301-33.0773172-12.5593009 14.8092194-12.5593009 33.0773172 5.6229905 33.0773172 12.5593009 33.0773172z" transform="scale(-1 1) rotate(35 -104.692 -68.258)"/><path d="m116.732815 66.2752676c6.936311 0 12.559301-14.8092193 12.559301-33.0773172 0-18.2680978-5.62299-33.07731713-12.559301-33.07731713-6.93631 0-12.559301 14.80921933-12.559301 33.07731713 0 18.2680979 5.622991 33.0773172 12.559301 33.0773172z" transform="matrix(-1 0 0 1 272.629 53.67)"/></g><path stroke="#000" stroke-width="20" d="m251.467006 173.099849c-20.230076-33.609969-56.889565-56.067908-98.755776-56.067908-40.720798 0-76.5158766 21.245901-97.0586959 53.334588m2.1981107 129.169534c20.8403036 30.232701 55.5559042 50.026591 94.8605852 50.026591 39.376099 0 74.146424-19.865887 94.974049-50.191495" mask="url(#a)" transform="matrix(1 0 0 -1 .958 404)"/></g><g><g fill="#000" mask="url(#b)" transform="translate(.958 -51)"><path d="m203.460676 95.6875425c6.93631 0 12.559301-14.8092194 12.559301-33.0773172s-5.622991-33.0773172-12.559301-33.0773172c-6.936311 0-12.559301 14.8092194-12.559301 33.0773172s5.62299 33.0773172 12.559301 33.0773172z" transform="rotate(35 141.831 150.32)"/><path d="m30.1423223 95.6875425c6.9363104 0 12.559301-14.8092194 12.559301-33.0773172s-5.6229906-33.0773172-12.559301-33.0773172-12.5593009 14.8092194-12.5593009 33.0773172 5.6229905 33.0773172 12.5593009 33.0773172z" transform="scale(-1 1) rotate(35 -100.792 -69.488)"/><path d="m116.732815 66.2752676c6.936311 0 12.559301-14.8092193 12.559301-33.0773172 0-18.2680978-5.62299-33.07731713-12.559301-33.07731713-6.93631 0-12.559301 14.80921933-12.559301 33.07731713 0 18.2680979 5.622991 33.0773172 12.559301 33.0773172z" transform="matrix(-1 0 0 1 272.629 51.211)"/></g><path stroke="#000" stroke-width="20" d="m251.467006 170.64039c-20.230076-33.609969-56.889565-56.067908-98.755776-56.067908-40.720798 0-76.5158766 21.2459-97.0586959 53.334587m2.1981107 129.169534c20.8403036 30.232702 55.5559042 50.026591 94.8605852 50.026591 39.376099 0 74.146424-19.865886 94.974049-50.191494" mask="url(#b)" transform="translate(.958 -51)"/></g></g></svg>
Copy link
Contributor

Choose a reason for hiding this comment

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

add new line at the end.

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

y={y + height + 20}
paddingX={8}
paddingY={4}
kind="HelmRelease"
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of hard coding HelmRelease can we use element.getData().kind? Or is there a model for Helm release that we can use?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no model or kind for this group.

Comment on lines 469 to 480
if (isHelmReleaseNode(deploymentConfig)) {
groupsData = [
...getTopologyHelmReleaseGroupItem(
deploymentConfig,
topologyGraphAndNodeData.graph.groups,
),
];
} else {
groupsData = [
...getTopologyGroupItems(deploymentConfig, topologyGraphAndNodeData.graph.groups),
];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to move HelmReleaseGroupItem call into getTopologyGroupItems function, we could return different group based on the conditions there. So that later on we can have all group related login in one place rather that adding more if else here. Any thoughts ?

Copy link
Contributor Author

@sahil143 sahil143 Jan 16, 2020

Choose a reason for hiding this comment

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

I agree. fixed

@sahil143 sahil143 force-pushed the helm-grouping branch 2 times, most recently from 834ab91 to 90e1e79 Compare January 16, 2020 05:03
@jeff-phillips-18
Copy link
Member

@openshift/team-devconsole-ux For the type badge, should it be located after the label text as shown above more more inline with what is shown at https://docs.google.com/document/d/1TjzqcUgz6A6_3SiUsqCG1qsHK9z6hAKWMqvEYW7a1ew/edit#heading=h.g319y27ad91p (before the resource badge).

@sahil143
Copy link
Contributor Author

@jeff-phillips-18 there seems to be a different design for the helm group icon. I followed this design which is marked final https://docs.google.com/document/d/1JVDrPC5Ow2Qmxn9mH1BmPuJhukP5op4Kp4z34xZ95qE/edit#heading=h.aaw0sjx7rogf

@@ -123,6 +149,7 @@ class ComponentFactory {
case TYPE_REVISION_TRAFFIC:
return TrafficLink;
case TYPE_WORKLOAD:
console.log('##################33', kind, type);
Copy link
Member

Choose a reason for hiding this comment

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

Please remove

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@karthikjeeyar
Copy link
Contributor

Labels and icons should be blurred out if it does'nt match the filter
Topology · OKD (6)

@sahil143
Copy link
Contributor Author

Labels and icons should be blurred out if it doesn't match the filter

@karthikjeeyar fixed!
Updated screendshot
Screenshot from 2020-01-20 10-32-10

@karthikjeeyar
Copy link
Contributor

@sahil143 As per the final design doc the icon has to be in the front.

Note: if the helm chart doesn't have icon then default it to helm icon

Helm Charts - Final Design - Google Docs

cc: @serenamarie125 @openshift/team-devconsole-ux

const releaseExists = _.some(groups, { name: releaseLabel });
if (!releaseExists) {
groups.push({
id: `group:${releaseLabel}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Your prefix would be better to be helm specific. Perhaps helm-release:

const [badgeSize, badgeRef] = useSize([kind]);
const [labelSize, labelRef] = useSize([children, textSize, badgeSize]);
const iconSpace = kind && badgeSize ? badgeSize.width + paddingX : 0;
const labelSizeWidth = icon ? paddingX * 2 + iconSpace + iconSize / 2 : paddingX * 2 + iconSpace;
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the duplicate parts to before the ternary operation.

<image
x={x + labelSize.width / 2 + paddingX - iconSize / 2 + iconPadding}
y={y + iconPadding}
width={30}
Copy link
Contributor

Choose a reason for hiding this comment

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

Iconsize - iconpadding * 2?

You seem to be doing a lot computed values but this size remains static even though it is as relative value.

const HelmRelease: React.FC<HelmReleaseProps> = ({ element, dragging, filters }) => {
const [hover, hoverRef] = useHover();
const { x, y, width, height } = element.getBounds();
const dragNodeRef = useDragNode()[1];
Copy link
Contributor

Choose a reason for hiding this comment

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

Use deconstructing

// TODO remove with 2.0
onMouseEnter?: React.MouseEventHandler<SVGGElement>;
onMouseLeave?: React.MouseEventHandler<SVGGElement>;
}

const FILTER_ID = 'SvgBoxedTextDropShadowFilterId';
const iconFilterID = 'SVGBoxedTextRectIconFilter';
const iconSize = 36;
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 a computed value of 30 + padding * 2

export const isHelmReleaseNode = (obj: K8sResourceKind): boolean => {
return (
_.get(obj, ['metadata', 'labels', 'heritage'], null) === 'Helm' ||
!!_.get(obj, ['metadata', 'labels', 'chart'], false)
Copy link
Contributor

Choose a reason for hiding this comment

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

Use optional chaining

@sahil143
Copy link
Contributor Author

@karthikjeeyar @christianvogt Since the UX is changed. I have raised a bug to fix the location of the icon the grouping label because same is taken care by @jeff-phillips-18 PR: #3981. Once that PR is merged, We can fix this in a bug.
Any thoughts?

initial implementation

initial implementation

remove styles for selected and fine tune

initial implementation

align the item to UX designs

add tests for utility and update test

use fill attribute istead of styles

update snapshot

add corner radius to helm icon

refactor

disable dnd for helm release node

decrease opacity on filtered items

fix llint error

lint and destructuring
@andrewballantyne
Copy link
Contributor

@karthikjeeyar @christianvogt Since the UX is changed. I have raised a bug to fix the location of the icon the grouping label because same is taken care by @jeff-phillips-18 PR: #3981. Once that PR is merged, We can fix this in a bug.
Any thoughts?

Not really following this conversation - but we can get core functionality in now and shore up the UX differences through the bug afterwards.

@karthikjeeyar
Copy link
Contributor

Verified locally
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 21, 2020
@christianvogt
Copy link
Contributor

/approve

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 22, 2020
Copy link
Contributor

@serenamarie125 serenamarie125 left a comment

Choose a reason for hiding this comment

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

This looks good, thanks for updating the location of the helm icon near the app label. That change was made for topology groupings after the helm chart/release designs were set. Thanks for updating!

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christianvogt, karthikjeeyar, sahil143, serenamarie125

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

The pull request process is described here

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 0e8ff95 into openshift:master Jan 22, 2020
@spadgett spadgett added this to the v4.4 milestone Jan 27, 2020
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/core Related to console core functionality component/dev-console Related to dev-console component/knative Related to knative-plugin kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants