diff --git a/app/client/src/components/designSystems/blueprint/DatePickerComponent.tsx b/app/client/src/components/designSystems/blueprint/DatePickerComponent.tsx index 430ba234bb..df55f28537 100644 --- a/app/client/src/components/designSystems/blueprint/DatePickerComponent.tsx +++ b/app/client/src/components/designSystems/blueprint/DatePickerComponent.tsx @@ -46,18 +46,18 @@ class DatePickerComponent extends React.Component { } formatDate = (date: Date): string => { - if (this.props.defaultTimezone) { + if (this.props.timezone) { return moment(date) - .tz(this.props.defaultTimezone) + .tz(this.props.timezone) .format(this.props.dateFormat); } return moment(date).format(this.props.dateFormat); }; parseDate = (dateStr: string): Date => { - if (this.props.defaultTimezone) { + if (this.props.timezone) { return moment(dateStr) - .tz(this.props.defaultTimezone) + .tz(this.props.timezone) .toDate(); } return moment(dateStr).toDate(); @@ -76,7 +76,7 @@ export interface DatePickerComponentProps extends ComponentProps { selectedDate?: Date; minDate?: Date; maxDate?: Date; - defaultTimezone?: string; + timezone?: string; datePickerType: DatePickerType; onDateSelected: (date: Date) => void; } diff --git a/app/client/src/components/propertyControls/ActionSelector.tsx b/app/client/src/components/propertyControls/ActionSelector.tsx index 17f4c121e4..a54283a2d4 100644 --- a/app/client/src/components/propertyControls/ActionSelector.tsx +++ b/app/client/src/components/propertyControls/ActionSelector.tsx @@ -28,10 +28,10 @@ function getActions( onSuccessAction: ActionPayload | undefined; onErrorAction: ActionPayload | undefined; } { - let action: ActionPayload | undefined = actionPayloads && actionPayloads[0]; - let onSuccessAction: ActionPayload | undefined = + const action: ActionPayload | undefined = actionPayloads && actionPayloads[0]; + const onSuccessAction: ActionPayload | undefined = action && action.onSuccess && action.onSuccess[0]; - let onErrorAction: ActionPayload | undefined = + const onErrorAction: ActionPayload | undefined = action && action.onError && action.onError[0]; return { action, @@ -181,7 +181,7 @@ class ActionSelectorControl extends BaseControl< break; } - let onActionSelect = this.onActionSelect; + const onActionSelect = this.onActionSelect; switch (actionResolutionType) { case ACTION_RESOLUTION_TYPE.SUCCESS: onTypeSelect = this.onSuccessActionSelect; @@ -223,7 +223,7 @@ class ActionSelectorControl extends BaseControl< const actionPayloads: ActionPayload[] = this.props.propertyValue ? this.props.propertyValue.slice() : []; - let actionPayload = actionPayloads[0]; + const actionPayload = actionPayloads[0]; if (actionPayload && actionPayload.actionType !== item.value) { actionPayload.actionId = ""; @@ -240,12 +240,12 @@ class ActionSelectorControl extends BaseControl< const actionPayloads: ActionPayload[] = this.props.propertyValue ? this.props.propertyValue.slice() : []; - let actionPayload = actionPayloads[0]; + const actionPayload = actionPayloads[0]; if (actionPayload) { const successActionPayloads: ActionPayload[] = actionPayload.onSuccess || []; - let successActionPayload = successActionPayloads[0]; + const successActionPayload = successActionPayloads[0]; if (successActionPayload) { successActionPayload.actionId = ""; successActionPayload.actionType = item.value as ActionType; @@ -263,11 +263,11 @@ class ActionSelectorControl extends BaseControl< const actionPayloads: ActionPayload[] = this.props.propertyValue ? this.props.propertyValue.slice() : []; - let actionPayload = actionPayloads[0]; + const actionPayload = actionPayloads[0]; if (actionPayload) { const errorActionPayloads: ActionPayload[] = actionPayload.onError || []; - let errorActionPayload = errorActionPayloads[0]; + const errorActionPayload = errorActionPayloads[0]; if (errorActionPayload) { errorActionPayload.actionId = ""; errorActionPayload.actionType = item.value as ActionType; diff --git a/app/client/src/components/propertyControls/TimezoneControl.tsx b/app/client/src/components/propertyControls/TimezoneControl.tsx index 3d80b5f38d..368148705a 100644 --- a/app/client/src/components/propertyControls/TimezoneControl.tsx +++ b/app/client/src/components/propertyControls/TimezoneControl.tsx @@ -21,7 +21,6 @@ class TimeZoneControl extends BaseControl { } onTimeZoneSelected = (timezone: string): void => { - console.log(timezone); this.updateProperty(this.props.propertyName, timezone); }; diff --git a/app/client/src/constants/ReduxActionConstants.tsx b/app/client/src/constants/ReduxActionConstants.tsx index 1b33f6a58b..47049c1d14 100644 --- a/app/client/src/constants/ReduxActionConstants.tsx +++ b/app/client/src/constants/ReduxActionConstants.tsx @@ -26,7 +26,8 @@ export const ReduxActionTypes: { [key: string]: string } = { LOAD_API_RESPONSE: "LOAD_API_RESPONSE", LOAD_QUERY_RESPONSE: "LOAD_QUERY_RESPONSE", EXECUTE_ACTION: "EXECUTE_ACTION", - EXECUTE_ACTION_SUCCESS: "EXECUTE_ACTION", + EXECUTE_ACTION_SUCCESS: "EXECUTE_ACTION_SUCCESS", + EXECUTE_ACTION_ERROR: "EXECUTE_ACTION_ERROR", LOAD_CANVAS_ACTIONS: "LOAD_CANVAS_ACTIONS", SAVE_PAGE_INIT: "SAVE_PAGE_INIT", SAVE_PAGE_SUCCESS: "SAVE_PAGE_SUCCESS", diff --git a/app/client/src/mockResponses/PropertyPaneConfigResponse.tsx b/app/client/src/mockResponses/PropertyPaneConfigResponse.tsx index 08e4735b98..98bc964273 100644 --- a/app/client/src/mockResponses/PropertyPaneConfigResponse.tsx +++ b/app/client/src/mockResponses/PropertyPaneConfigResponse.tsx @@ -315,7 +315,7 @@ const PropertyPaneConfigResponse: PropertyPaneConfigState = { id: "9.5", label: "Timezone", placeholderText: "Select Timezone", - propertyName: "defaultTimezone", + propertyName: "timezone", controlType: "TIMEZONE_PICKER", }, { @@ -392,12 +392,6 @@ const PropertyPaneConfigResponse: PropertyPaneConfigState = { label: "Visible", controlType: "SWITCH", }, - { - id: "11.6", - propertyName: "tableData", - label: "Enter data array", - controlType: "INPUT_TEXT", - }, ], }, { diff --git a/app/client/src/sagas/ActionSagas.ts b/app/client/src/sagas/ActionSagas.ts index 08a838e849..9627a3b606 100644 --- a/app/client/src/sagas/ActionSagas.ts +++ b/app/client/src/sagas/ActionSagas.ts @@ -14,10 +14,10 @@ import { } from "redux-saga/effects"; import { ActionPayload, PageAction } from "../constants/ActionConstants"; import ActionAPI, { - ActionApiResponse, ActionCreateUpdateResponse, ExecuteActionRequest, RestAction, + ActionApiResponse, } from "../api/ActionAPI"; import { AppState, DataTree } from "../reducers"; import _ from "lodash"; @@ -33,6 +33,7 @@ import { API_EDITOR_ID_URL, API_EDITOR_URL } from "../constants/routes"; import { getDynamicBoundValue } from "../utils/DynamicBindingUtils"; import history from "../utils/history"; import { createUpdateBindingsMap } from "../actions/bindingActions"; +/* eslint-disable no-use-before-define */ const getDataTree = (state: AppState): DataTree => { return state.entities; @@ -81,17 +82,27 @@ export function* executeAPIQueryActionSaga(apiAction: ActionPayload) { ...response, }; if (apiAction.onError) { - yield call(executeActionSaga, apiAction.onError); + yield put({ + type: ReduxActionTypes.EXECUTE_ACTION, + payload: apiAction.onError, + }); } + yield put({ + type: ReduxActionTypes.EXECUTE_ACTION_ERROR, + payload: { [apiAction.actionId]: payload }, + }); } else { if (apiAction.onSuccess) { - yield call(executeActionSaga, apiAction.onSuccess); + yield put({ + type: ReduxActionTypes.EXECUTE_ACTION, + payload: apiAction.onSuccess, + }); } + yield put({ + type: ReduxActionTypes.EXECUTE_ACTION_SUCCESS, + payload: { [apiAction.actionId]: payload }, + }); } - yield put({ - type: ReduxActionTypes.EXECUTE_ACTION_SUCCESS, - payload: { [apiAction.actionId]: payload }, - }); return response; } diff --git a/app/client/src/widgets/DatePickerWidget.tsx b/app/client/src/widgets/DatePickerWidget.tsx index c9cd69e50c..380a2a750f 100644 --- a/app/client/src/widgets/DatePickerWidget.tsx +++ b/app/client/src/widgets/DatePickerWidget.tsx @@ -12,7 +12,7 @@ class DatePickerWidget extends BaseWidget { dateFormat={this.props.dateFormat} style={this.getPositionStyle()} widgetId={this.props.widgetId} - defaultTimezone={this.props.defaultTimezone} + timezone={this.props.timezone} enableTimePicker={this.props.enableTimePicker} defaultDate={this.props.defaultDate} datePickerType={"DATE_PICKER"} @@ -41,7 +41,7 @@ export type DatePickerType = "DATE_PICKER" | "DATE_RANGE_PICKER"; export interface DatePickerWidgetProps extends WidgetProps { defaultDate?: Date; selectedDate: Date; - defaultTimezone?: string; + timezone?: string; enableTimePicker: boolean; dateFormat: string; label: string; diff --git a/app/client/src/widgets/InputWidget.tsx b/app/client/src/widgets/InputWidget.tsx index 98c0aefaff..365b2bd296 100644 --- a/app/client/src/widgets/InputWidget.tsx +++ b/app/client/src/widgets/InputWidget.tsx @@ -91,7 +91,7 @@ export interface InputWidgetProps extends WidgetProps { maxChars?: number; minNum?: number; maxNum?: number; - onTextChanged: ActionPayload[]; + onTextChanged?: ActionPayload[]; label: string; inputValidators: InputValidator[]; focusIndex?: number;