fix: remove the image binding step in guided tour (#15161)

This commit is contained in:
akash-codemonk 2022-07-14 16:21:24 +05:30 committed by GitHub
parent 41c3446f5b
commit c76c052d36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 85 deletions

View File

@ -44,9 +44,6 @@ describe("Guided Tour", function() {
cy.get(".t--entity-name") cy.get(".t--entity-name")
.contains("DisplayImage") .contains("DisplayImage")
.click({ force: true }); .click({ force: true });
// cy.SearchEntityandOpen("ImageWidget");
// cy.get(commonlocators.editWidgetName).contains("CountryInput");
cy.testJsontext("image", "{{CustomersTable.selectedRow.image}}");
cy.get(guidedTourLocators.successButton).click(); cy.get(guidedTourLocators.successButton).click();
// Step 6: Drag and drop a widget // Step 6: Drag and drop a widget
cy.dragAndDropToCanvas("buttonwidget", { cy.dragAndDropToCanvas("buttonwidget", {

View File

@ -12,6 +12,7 @@ import lottie, { AnimationItem } from "lottie-web";
import indicator from "assets/lottie/guided-tour-tick-mark.json"; import indicator from "assets/lottie/guided-tour-tick-mark.json";
import { import {
getCurrentStep, getCurrentStep,
getQueryAction,
isExploringSelector, isExploringSelector,
loading, loading,
showInfoMessageSelector, showInfoMessageSelector,
@ -241,6 +242,7 @@ const SuccessMessageWrapper = styled.div`
function InitialContent() { function InitialContent() {
const dispatch = useDispatch(); const dispatch = useDispatch();
const isLoading = useSelector(loading); const isLoading = useSelector(loading);
const queryAction = useSelector(getQueryAction);
const setupFirstStep = () => { const setupFirstStep = () => {
dispatch(toggleLoader(true)); dispatch(toggleLoader(true));
@ -257,6 +259,7 @@ function InitialContent() {
<GuideButton <GuideButton
className="t--start-building" className="t--start-building"
isLoading={isLoading} isLoading={isLoading}
isVisible={!queryAction?.isLoading && !!queryAction?.data}
onClick={setupFirstStep} onClick={setupFirstStep}
tag="button" tag="button"
text={createMessage(BUTTON_TEXT)} text={createMessage(BUTTON_TEXT)}

View File

@ -910,6 +910,7 @@
"parentRowSpace": 10.0, "parentRowSpace": 10.0,
"isSortable": true, "isSortable": true,
"type": "TABLE_WIDGET", "type": "TABLE_WIDGET",
"animateLoading": true,
"defaultSelectedRow": "0", "defaultSelectedRow": "0",
"hideCard": false, "hideCard": false,
"parentColumnSpace": 17.28125, "parentColumnSpace": 17.28125,

View File

@ -1,7 +1,6 @@
import React from "react"; import React from "react";
import { ReactNode } from "react"; import { ReactNode } from "react";
import { Dispatch } from "redux"; import { Dispatch } from "redux";
import styled from "styled-components";
import TableData from "assets/gifs/table_data.gif"; import TableData from "assets/gifs/table_data.gif";
import DefaultText from "assets/gifs/default_text.gif"; import DefaultText from "assets/gifs/default_text.gif";
import { import {
@ -39,7 +38,6 @@ import {
STEP_THREE_TITLE, STEP_THREE_TITLE,
STEP_TWO_TITLE, STEP_TWO_TITLE,
} from "@appsmith/constants/messages"; } from "@appsmith/constants/messages";
import { getTypographyByKey } from "constants/DefaultTheme";
export const Classes = { export const Classes = {
GUIDED_TOUR_BORDER: "guided-tour-border", GUIDED_TOUR_BORDER: "guided-tour-border",
@ -115,6 +113,8 @@ export const onboardingContainerBlueprint = {
imageShape: "RECTANGLE", imageShape: "RECTANGLE",
defaultImage: "https://assets.appsmith.com/widgets/default.png", defaultImage: "https://assets.appsmith.com/widgets/default.png",
objectFit: "contain", objectFit: "contain",
image: "{{CustomersTable.selectedRow.image}}",
dynamicBindingPathList: [{ key: "image" }],
}, },
}, },
{ {
@ -254,15 +254,6 @@ type Step = {
}; };
type StepsType = Record<number, Step>; type StepsType = Record<number, Step>;
const RunButton = styled.div`
background-color: ${(props) => props.theme.colors.guidedTour.runButton};
padding: ${(props) => props.theme.spaces[1] + 1}px
${(props) => props.theme.spaces[6] + 1}px;
color: white;
${(props) => getTypographyByKey(props, "btnMedium")}
display: inline-block;
`;
export const Steps: StepsType = { export const Steps: StepsType = {
[GUIDED_TOUR_STEPS.RUN_QUERY]: { [GUIDED_TOUR_STEPS.RUN_QUERY]: {
title: createMessage(STEP_ONE_TITLE), title: createMessage(STEP_ONE_TITLE),
@ -271,8 +262,8 @@ export const Steps: StepsType = {
{ {
text: ( text: (
<> <>
This command will fetch the first 10 items in the user_data This command will fetch the first 20 items in the user_data
database. Hit <RunButton>RUN</RunButton> to see the response. database. Hit <b>RUN</b> to see the response.
</> </>
), ),
}, },
@ -444,13 +435,6 @@ export const Steps: StepsType = {
&#123;&#123;CustomersTable.selectedRow.country&#125;&#125; &#123;&#123;CustomersTable.selectedRow.country&#125;&#125;
</code> </code>
</>, </>,
<>
Connect <b>{GuidedTourEntityNames.DISPLAY_IMAGE}</b>
{"'"}s Image Property to{" "}
<code>
&#123;&#123;CustomersTable.selectedRow.image&#125;&#125;
</code>
</>,
], ],
}, },
], ],

View File

@ -21,12 +21,10 @@ import {
isNameInputBoundSelector, isNameInputBoundSelector,
isCountryInputBound, isCountryInputBound,
isEmailInputBound, isEmailInputBound,
isImageWidgetBound,
isButtonWidgetPresent, isButtonWidgetPresent,
buttonWidgetHasOnClickBinding, buttonWidgetHasOnClickBinding,
buttonWidgetHasOnSuccessBinding, buttonWidgetHasOnSuccessBinding,
countryInputSelector, countryInputSelector,
imageWidgetSelector,
} from "selectors/onboardingSelectors"; } from "selectors/onboardingSelectors";
import { getBaseWidgetClassName } from "constants/componentClassNameConstants"; import { getBaseWidgetClassName } from "constants/componentClassNameConstants";
import { GUIDED_TOUR_STEPS, Steps } from "./constants"; import { GUIDED_TOUR_STEPS, Steps } from "./constants";
@ -56,9 +54,7 @@ function useComputeCurrentStep(showInfoMessage: boolean) {
// 5 // 5
const countryInputBound = useSelector(isCountryInputBound); const countryInputBound = useSelector(isCountryInputBound);
const isCountryInputSelected = useSelector(countryInputSelector); const isCountryInputSelected = useSelector(countryInputSelector);
const isImageWidgetSelected = useSelector(imageWidgetSelector);
const emailInputBound = useSelector(isEmailInputBound); const emailInputBound = useSelector(isEmailInputBound);
const imageWidgetBound = useSelector(isImageWidgetBound);
// 6 // 6
const buttonWidgetPresent = useSelector(isButtonWidgetPresent); const buttonWidgetPresent = useSelector(isButtonWidgetPresent);
// 7 // 7
@ -117,12 +113,9 @@ function useComputeCurrentStep(showInfoMessage: boolean) {
if (countryInputBound) { if (countryInputBound) {
meta.completedSubSteps.push(1); meta.completedSubSteps.push(1);
} }
if (imageWidgetBound) {
meta.completedSubSteps.push(2);
}
// Once all three widgets are bound this step is complete // Once all three widgets are bound this step is complete
if ( if (
meta.completedSubSteps.length === 3 && meta.completedSubSteps.length === 2 &&
hadReachedStep > GUIDED_TOUR_STEPS.BIND_OTHER_FORM_WIDGETS hadReachedStep > GUIDED_TOUR_STEPS.BIND_OTHER_FORM_WIDGETS
) { ) {
step = GUIDED_TOUR_STEPS.ADD_BUTTON_WIDGET; step = GUIDED_TOUR_STEPS.ADD_BUTTON_WIDGET;
@ -274,24 +267,7 @@ function useComputeCurrentStep(showInfoMessage: boolean) {
} }
} }
}, [step, hadReachedStep, countryInputBound, isCountryInputSelected]); }, [step, hadReachedStep, countryInputBound, isCountryInputSelected]);
// Show indicator alongside the image property in property pane
useEffect(() => {
if (
step === GUIDED_TOUR_STEPS.BIND_OTHER_FORM_WIDGETS &&
hadReachedStep <= GUIDED_TOUR_STEPS.BIND_OTHER_FORM_WIDGETS
) {
if (isImageWidgetSelected) {
if (!imageWidgetBound) {
showIndicator(`[data-guided-tour-iid='image']`, "top", {
top: 20,
left: 0,
});
} else {
hideIndicator();
}
}
}
}, [step, hadReachedStep, imageWidgetBound, isImageWidgetSelected]);
// Show success message // Show success message
useEffect(() => { useEffect(() => {
if ( if (
@ -301,7 +277,7 @@ function useComputeCurrentStep(showInfoMessage: boolean) {
if (meta.completedSubSteps.length === 1) { if (meta.completedSubSteps.length === 1) {
hideIndicator(); hideIndicator();
} }
if (meta.completedSubSteps.length === 3) { if (meta.completedSubSteps.length === 2) {
dispatch(markStepComplete()); dispatch(markStepComplete());
} }
} }

View File

@ -209,19 +209,6 @@ export const countryInputSelector = createSelector(
return countryInput ? countryInput.widgetId === selectedWidgetId : false; return countryInput ? countryInput.widgetId === selectedWidgetId : false;
}, },
); );
// Check if ImageWidget is selected
export const imageWidgetSelector = createSelector(
getWidgets,
getSelectedWidget,
(widgets, selectedWidgetId) => {
const widgetValues = Object.values(widgets);
const imageWidget = widgetValues.find((widget) => {
return widget.widgetName === GuidedTourEntityNames.DISPLAY_IMAGE;
});
return imageWidget ? imageWidget.widgetId === selectedWidgetId : false;
},
);
export const isCountryInputBound = createSelector( export const isCountryInputBound = createSelector(
getTableWidget, getTableWidget,
@ -270,28 +257,6 @@ export const isEmailInputBound = createSelector(
}, },
); );
export const isImageWidgetBound = createSelector(
getTableWidget,
getWidgets,
(tableWidget, widgets) => {
if (tableWidget) {
const widgetValues = Object.values(widgets);
const imageWidget = widgetValues.find((widget) => {
if (widget.widgetName === GuidedTourEntityNames.DISPLAY_IMAGE) {
return (
widget.image === `{{${tableWidget.widgetName}.selectedRow.image}}`
);
}
return false;
});
if (imageWidget) return true;
}
return false;
},
);
export const isButtonWidgetPresent = createSelector(getWidgets, (widgets) => { export const isButtonWidgetPresent = createSelector(getWidgets, (widgets) => {
const widgetValues = Object.values(widgets); const widgetValues = Object.values(widgets);
const buttonWidget = widgetValues.find((widget) => { const buttonWidget = widgetValues.find((widget) => {