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 1881659: fix guided tour alert to not show up if skipped once #6714

Merged

Conversation

nemesis09
Copy link
Contributor

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

Analysis / Root cause:
Even though the user chooses to skip the guided tour of the dev perspective, the system will nag them again if they happen to follow these steps.

Solution Description:
User should not see guided tour if they have previously skipped or completed it.

Screens:
Before
guided-tour-before

After
guided-tour

Test Coverage
Screenshot from 2020-09-23 01-55-18

Browser Conformance

  • Firefox
  • Chrome
  • Safari
  • Edge

@openshift-ci-robot openshift-ci-robot added the bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. label Sep 22, 2020
@openshift-ci-robot
Copy link
Contributor

@nemesis09: This pull request references Bugzilla bug 1881659, which is invalid:

  • expected the bug to target the "4.6.0" release, but it targets "---" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

Bug 1881659: fix guided tour alert to not show up if skipped once

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 bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. component/core Related to console core functionality labels Sep 22, 2020
@nemesis09
Copy link
Contributor Author

/bugzilla refresh

@openshift-ci-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Sep 22, 2020
@openshift-ci-robot
Copy link
Contributor

@nemesis09: This pull request references Bugzilla bug 1881659, which is valid. The bug has been moved to the POST state.

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

In response to this:

/bugzilla refresh

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 removed the bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. label Sep 22, 2020
@@ -39,7 +46,7 @@ export const tourReducer = (state: TourState, action: TourActions) => {
}
};

type TourReducer = Reducer<TourState, TourActions>;
type TourReducer = Reducer<TourState, { type: TourActions; payload?: boolean }>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably introduce a new for action say

type TourStateAction = { type: TourActions; payload?: { completed?: boolean }}
Suggested change
type TourReducer = Reducer<TourState, { type: TourActions; payload?: boolean }>;
type TourReducer = Reducer<TourState, TourStateAction>;

would be better to make payload an object and with a completed prop. So it's more readable and we know what we are sending in the payload. In future we might need to send some other data inside payload.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

switch (action) {
switch (action.type) {
case TourActions.initialize:
return initializeState(action.payload);
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to declare a method here. just set the state directly here

Suggested change
return initializeState(action.payload);
return {
completedTour: completed,
stepNumber: 0,
startTour: !completed,
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -84,11 +91,16 @@ export const useTourValuesForContext = (): TourContextType => {
setTourCompletionLocalStorageDataForPerspective(activePerspective, true);
}
};
const activePerspectiveRef = useRef(activePerspective);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const activePerspectiveRef = useRef(activePerspective);
const activePerspectiveRef = useRef<string>(activePerspective);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines 100 to 103
if (activePerspective !== activePerspectiveRef.current) {
tourDispatch({ type: TourActions.initialize, payload: { completed } });
activePerspectiveRef.current = activePerspective;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You should execute side effects inside useEffect

Suggested change
if (activePerspective !== activePerspectiveRef.current) {
tourDispatch({ type: TourActions.initialize, payload: { completed } });
activePerspectiveRef.current = activePerspective;
}
React.useEffect(() => {
tourDispatch({ type: TourActions.initialize, payload: { completed } });
setPerspective(activePerspective);
}, [activePerspective, completed]);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

used useEffect for initializing state on perspective change

@@ -84,11 +91,16 @@ export const useTourValuesForContext = (): TourContextType => {
setTourCompletionLocalStorageDataForPerspective(activePerspective, true);
}
};
const activePerspectiveRef = useRef<string>(activePerspective);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const activePerspectiveRef = useRef<string>(activePerspective);
const perspective = React.useState(activePerspective);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

useEffect(() => {
tourDispatch({ type: TourActions.initialize, payload: { completed } });
setPerspective(activePerspective);
}, [activePerspective, completed]);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to run the effect on completed. We want to only run the effect when the perspective change so that the tour state can be initialized.

Suggested change
}, [activePerspective, completed]);
}, [activePerspective]);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated dependency and disabled es lint rules for the line

Copy link
Contributor

@sahil143 sahil143 left a comment

Choose a reason for hiding this comment

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

/lgtm

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

Going from admin -> dev perspective when the dev perspective tour has already been completed still shows the tour.
/lgtm cancel

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Sep 24, 2020
@nemesis09
Copy link
Contributor Author

Going from admin -> dev perspective when the dev perspective tour has already been completed still shows the tour.
/lgtm cancel

@christianvogt pushed changes addressing the issue. please take a look

@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 Sep 28, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Sep 28, 2020
@openshift-merge-robot openshift-merge-robot merged commit 1f26ca5 into openshift:master Sep 28, 2020
@openshift-ci-robot
Copy link
Contributor

@nemesis09: All pull requests linked via external trackers have merged:

Bugzilla bug 1881659 has been moved to the MODIFIED state.

In response to this:

Bug 1881659: fix guided tour alert to not show up if skipped once

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.6 milestone Sep 30, 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. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/core Related to console core functionality lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants