diff --git a/app/client/src/components/editorComponents/actioncreator/TreeDropdown.tsx b/app/client/src/components/editorComponents/actioncreator/TreeDropdown.tsx index 8306520bbb..91bdfd1d7d 100644 --- a/app/client/src/components/editorComponents/actioncreator/TreeDropdown.tsx +++ b/app/client/src/components/editorComponents/actioncreator/TreeDropdown.tsx @@ -28,6 +28,7 @@ type TreeDropdownProps = { defaultText: string; onSelect: (value: TreeDropdownOption, defaultVal?: string) => void; selectedLabelModifier?: (option: TreeDropdownOption) => string; + toggle?: React.ReactNode; }; function getSelectedOption( @@ -64,6 +65,7 @@ export default function TreeDropdown(props: TreeDropdownProps) { onSelect, getDefaults, selectedLabelModifier, + toggle, } = props; const selectedOption = getSelectedOption( selectedValue, @@ -90,6 +92,7 @@ export default function TreeDropdown(props: TreeDropdownProps) { icon={option.id === "create" ? "plus" : undefined} onClick={option.children ? _.noop : () => handleSelect(option)} text={option.label} + intent={option.intent} popoverProps={{ minimal: true, interactionKind: PopoverInteractionKind.CLICK, @@ -103,19 +106,27 @@ export default function TreeDropdown(props: TreeDropdownProps) { const list = optionTree.map(renderTreeOption); const menuItems = {list}; - return ( + const defaultToggle = ( - - - + ); + return ( + + {toggle ? toggle : defaultToggle} + + ); } diff --git a/app/client/src/components/propertyControls/StyledControls.tsx b/app/client/src/components/propertyControls/StyledControls.tsx index 92c30505dc..4ea7e5b22c 100644 --- a/app/client/src/components/propertyControls/StyledControls.tsx +++ b/app/client/src/components/propertyControls/StyledControls.tsx @@ -154,6 +154,9 @@ export const StyledDropDown = styled(DropDown)` `; export const StyledPopover = styled(Popover)` + .${Classes.POPOVER_TARGET} { + display: flex; + } div { flex: 1 1 auto; } @@ -188,6 +191,9 @@ export const StyledMenuItem = styled(MenuItem)` border-radius: ${props => props.theme.radii[1]}px; &:hover { background: ${Colors.POLAR}; + &&&.bp3-menu-item.bp3-intent-danger:hover { + background: ${props => props.theme.colors.error}; + } } &.${Classes.ACTIVE} { background: ${Colors.POLAR}; diff --git a/app/client/src/pages/Editor/ApiSidebar.tsx b/app/client/src/pages/Editor/ApiSidebar.tsx index c8c689fe23..e89f04229d 100644 --- a/app/client/src/pages/Editor/ApiSidebar.tsx +++ b/app/client/src/pages/Editor/ApiSidebar.tsx @@ -37,6 +37,8 @@ const HTTPMethod = styled.span<{ method?: string }>` return "#F7C75B"; case "PUT": return "#30A5E0"; + case "PATCH": + return "#8E8E8E"; case "DELETE": return "#CE4257"; default: diff --git a/app/client/src/pages/Editor/EditorSidebar.tsx b/app/client/src/pages/Editor/EditorSidebar.tsx index bc871d490d..1bf41b395e 100644 --- a/app/client/src/pages/Editor/EditorSidebar.tsx +++ b/app/client/src/pages/Editor/EditorSidebar.tsx @@ -17,9 +17,10 @@ import { DropResult, } from "react-beautiful-dnd"; import { PageListPayload } from "constants/ReduxActionConstants"; -import ContextDropdown from "components/editorComponents/ContextDropdown"; +import TreeDropdown from "components/editorComponents/actioncreator/TreeDropdown"; import { theme } from "constants/DefaultTheme"; import { Colors } from "constants/Colors"; +import { ControlIcons } from "icons/ControlIcons"; const LoadingContainer = styled(CenteredWrapper)` height: 50%; @@ -411,8 +412,13 @@ class EditorSidebar extends React.Component { draftIds.indexOf(item.id) === -1 } /> - { + return null; + }} + selectedValue="" + optionTree={[ { value: "copy", onSelect: () => null, @@ -461,12 +467,12 @@ class EditorSidebar extends React.Component { intent: "danger", }, ]} - toggle={{ - type: "icon", - icon: "MORE_HORIZONTAL_CONTROL", - iconSize: theme.fontSizes[4], - }} - className="more" + toggle={ + + } /> )} diff --git a/app/client/src/reducers/entityReducers/actionsReducer.tsx b/app/client/src/reducers/entityReducers/actionsReducer.tsx index 4132a7a159..436dfd014e 100644 --- a/app/client/src/reducers/entityReducers/actionsReducer.tsx +++ b/app/client/src/reducers/entityReducers/actionsReducer.tsx @@ -49,7 +49,12 @@ const actionsReducer = createReducer(initialState, { state: ActionDataState, action: ReduxAction, ): ActionDataState => - state.concat([{ config: action.payload, isLoading: false }]), + state.concat([ + { + config: { ...action.payload, id: action.payload.name }, + isLoading: false, + }, + ]), [ReduxActionTypes.CREATE_ACTION_SUCCESS]: ( state: ActionDataState, action: ReduxAction, @@ -57,7 +62,7 @@ const actionsReducer = createReducer(initialState, { state.map(a => { if ( a.config.pageId === action.payload.pageId && - a.config.name === action.payload.name + a.config.id === action.payload.name ) { return { ...a, config: action.payload }; } @@ -70,7 +75,7 @@ const actionsReducer = createReducer(initialState, { state.filter( a => a.config.name !== action.payload.name && - a.config.pageId !== action.payload.pageId, + a.config.id !== action.payload.name, ), [ReduxActionTypes.UPDATE_ACTION_SUCCESS]: ( state: ActionDataState, diff --git a/app/client/src/sagas/ActionSagas.ts b/app/client/src/sagas/ActionSagas.ts index d380b28cb7..dd6a738b73 100644 --- a/app/client/src/sagas/ActionSagas.ts +++ b/app/client/src/sagas/ActionSagas.ts @@ -701,7 +701,7 @@ export function* watchActionSagas() { takeEvery(ReduxActionTypes.FETCH_ACTIONS_INIT, fetchActionsSaga), takeEvery(ReduxActionTypes.EXECUTE_ACTION, executeAppAction), takeLatest(ReduxActionTypes.RUN_API_REQUEST, runApiActionSaga), - takeLatest(ReduxActionTypes.CREATE_ACTION_INIT, createActionSaga), + takeEvery(ReduxActionTypes.CREATE_ACTION_INIT, createActionSaga), takeLatest(ReduxActionTypes.UPDATE_ACTION_INIT, updateActionSaga), takeLatest(ReduxActionTypes.DELETE_ACTION_INIT, deleteActionSaga), takeLatest( diff --git a/app/client/src/widgets/DropdownWidget.tsx b/app/client/src/widgets/DropdownWidget.tsx index d2c127bbcf..60926de192 100644 --- a/app/client/src/widgets/DropdownWidget.tsx +++ b/app/client/src/widgets/DropdownWidget.tsx @@ -12,6 +12,7 @@ import { VALIDATION_TYPES } from "constants/WidgetValidation"; import { TriggerPropertiesMap } from "utils/WidgetFactory"; import { VALIDATORS } from "utils/Validators"; import { DataTree } from "entities/DataTree/dataTreeFactory"; +import { Intent as BlueprintIntent } from "@blueprintjs/core"; class DropdownWidget extends BaseWidget { static getPropertyValidationMap(): WidgetPropertyValidationType { @@ -181,6 +182,7 @@ export interface DropdownOption { id?: string; onSelect?: (option: DropdownOption) => void; children?: DropdownOption[]; + intent?: BlueprintIntent; } export interface DropdownWidgetProps extends WidgetProps {