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

Bug 1807204: Update cursor to show drop status over targets #4486

Merged

Conversation

jeff-phillips-18
Copy link
Member

Fixes:
https://issues.redhat.com/browse/ODC-3028

Analysis / Root cause:
The cursor was not updated during drag operations to indicate drop status.

Solution Description:
Modified the cursor to:

  • Use an SVG for the Add cursor when creating connections
  • Show a tooltip when over a valid add drop target informing the user that dropping will add an application here (after the standard delay without a mouse move)
  • Show an invalid drop cursor when over items where a drop would do nothing

** Sample Screen Shots **
Drag_Cursor_2

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

cc @openshift/team-devconsole-ux

/kind bug

@openshift-ci-robot openshift-ci-robot added kind/bug Categorizes issue or PR as related to a bug. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Feb 25, 2020
@openshift-ci-robot
Copy link
Contributor

@jeff-phillips-18: This pull request references Bugzilla bug 1807204, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

Bug 1807204: Update cursor to show drop status over targets

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. component/dev-console Related to dev-console labels Feb 25, 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.

LGTM! @Veethika can you take a look as well?

@jeff-phillips-18
Copy link
Member Author

/cherry-pick release-4.4

@openshift-cherrypick-robot

@jeff-phillips-18: once the present PR merges, I will cherry-pick it on top of release-4.4 in a new PR and assign it to you.

In response to this:

/cherry-pick release-4.4

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Comment on lines 140 to 147
React.useEffect(() => {
setHover(false);
clearTimeout(unsetHandle.current);
unsetHandle.current = window.setTimeout(() => setHover(true), 2000);
return () => {
clearTimeout(unsetHandle.current);
};
}, [endPoint.x, endPoint.y]);
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 better off going directly into the DefaultCreateConnector.

In dev-console we can supply our own prop to renderConnector which uses DefaultCreateConnector to supply the custom message.

content="Move sink to service"
trigger="manual"
isVisible={dropTarget && canDrop}
tippyProps={{ duration: 0, delay: 0 }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you confirm the behavior with UX? 0 delay will bring up tooltips immediately as you hover your mouse over an intermediate node.

Didn't we try avoid this kind of behavior for label truncation by having a small delay.

Copy link
Member Author

Choose a reason for hiding this comment

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

UX spec specifies For connectors, the tooltip should appear the moment the user hovers over a valid drop target.

collect: (monitor) => {
const dragEditInProgress =
monitor.isDragging() && editOperations.includes(monitor.getOperation());
const dropHints = monitor.getDropHints() || [];
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we should change getDropHints to always return an array (string[])?

@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 Feb 26, 2020
@jeff-phillips-18
Copy link
Member Author

Updated per comments.

Removed the grab cursor when dragging edges over valid drop nodes.

In order to move out the dev-console specific hover treatment for the create connector, I had to refactor a bunch to make the default connector a component rather than a function call that returns a component.

choices: (ConnectorChoice | React.ReactElement)[];
};

export const CreateConnectorWidget: React.FC<CreateConnectorWidgetProps> = observer((props) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Prefer a single default export for component files.

Comment on lines 13 to 14
export const CREATE_CONNECTOR_OPERATION = 'createconnector';
export const CREATE_CONNECTOR_DROP_TYPE = '#createConnector#';
Copy link
Contributor

Choose a reason for hiding this comment

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

Old code but:

Suggested change
export const CREATE_CONNECTOR_OPERATION = 'createconnector';
export const CREATE_CONNECTOR_DROP_TYPE = '#createConnector#';
export const CREATE_CONNECTOR_OPERATION = '#createconnector#';
export const CREATE_CONNECTOR_DROP_TYPE = '#createConnector#';

Comment on lines 28 to 37
export type CreateConnectorRendererProps = {
startPoint: Point;
endPoint: Point;
dragging: boolean;
hints: string[] | undefined;
tipContents?: React.ReactNode;
className?: string;
};

export type CreateConnectorRenderer = React.ComponentType<CreateConnectorRendererProps>;
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't correct. The only required props that are expected of a component used in withCreateConnector are:

  startPoint: Point,
  endPoint: Point,
  hints: string[] | undefined,


const DefaultCreateConnector: React.FC<DefaultCreateConnectorProps> = ({
const DefaultCreateConnector: CreateConnectorRenderer = ({
Copy link
Contributor

Choose a reason for hiding this comment

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

You'll need a new prop type that includes support for tipContents and className.

@@ -5,3 +5,5 @@ export { default as ConnectorArrow } from './ConnectorArrow';
export { default as EdgeConnectorArrow } from './EdgeConnectorArrow';
export { default as GraphComponent } from './GraphComponent';
export { default as VisualizationSurface } from './VisualizationSurface';
export * from './CreateConnectorWidget';
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not expose contents of CreateConnectorWidget as API. This is for internal use only to withCreateConnector. If needed, re-export any specific types from withCreateConnector.

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Feb 26, 2020

@jeff-phillips-18: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/verify 41c16e9 link /test verify

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-bot
Copy link
Contributor

/bugzilla refresh

The requirements for Bugzilla bugs have changed, recalculating validity.

@openshift-ci-robot
Copy link
Contributor

@openshift-bot: This pull request references Bugzilla bug 1807204, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

/bugzilla refresh

The requirements for Bugzilla bugs have changed, recalculating validity.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 26, 2020
@christianvogt
Copy link
Contributor

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christianvogt, jeff-phillips-18, 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-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 27, 2020
@openshift-merge-robot openshift-merge-robot merged commit 3033aeb into openshift:master Feb 27, 2020
@openshift-ci-robot
Copy link
Contributor

@jeff-phillips-18: All pull requests linked via external trackers have merged. Bugzilla bug 1807204 has been moved to the MODIFIED state.

In response to this:

Bug 1807204: Update cursor to show drop status over targets

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-cherrypick-robot

@jeff-phillips-18: new pull request created: #4525

In response to this:

/cherry-pick release-4.4

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@spadgett spadgett added this to the v4.5 milestone Feb 28, 2020
@jeff-phillips-18 jeff-phillips-18 deleted the cursor-updates branch December 2, 2020 13:35
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. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/dev-console Related to dev-console kind/bug Categorizes issue or PR as related to a bug. 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

8 participants