PromucFlow_constructor/app/client/src/components/formControls/DynamicInputTextControl.tsx
Nidhi 6b31aa333b
Introducing Google Sheets Plugin (#3517)
* cherry pick -make new

* revert to enable fix from release

* attempt to hook into existing datasource editor

* gSheets plugin skeleton from Rest API

* Changes for database migration

* fix for auth code

* separate it out

* action page loads!

* add to explorer

* create action from datasource

* Editor JSON WIP

* working query form

* Editor JSON WIP

* import to

* fix toast message

* redirect from datasource and editor pages

* fix onboarding

* fix imports and constants

* refactor form out

* refactor queryForm

* Merge branch 'release' into feature/google-sheets

* Merge branch 'release' into feature/google-sheets

* initial values from settings, editor and form

* Check

* remove dangling code around lightTheme

* Safety net

* remove class

* try mouseover solve

* force click

* changes from review

* fix action form name on import

* Merge branch 'release' into feature/google-sheets

* minor cleanup

* Merge branch 'release' into feature/google-sheets

* WIP

* Google sheets changes

* Merge conflicts

* Merging and fixes, needs refactoring

* Check

* Merge branch 'release' into feature/google-sheets

* Fixed tests

* Add cloud services env variable

* Clean up saga

* Clean up

* Refactoring

* Deleted svg file

* Minor fixes

* Modified design to allow behaviour in google sheets methods (#3486)

* Modified design to allow behaviour in google sheets methods

* Review changes

* Removed sysout

* Added handling of edge cases with table data

* Merge branch 'release' into feature/google-sheets

* Fixes

* Fixes

* Added validations

* Improved tests

* Removed extraneous injected bean

* Review changes

* Fixed bug with method

* Changes to Google sheets plugin's request and response structures (#3692)

* Method changes

* Removed logging

* Renaming options

* Reverting pom version

* Modified type of collection variables, fixed errors

* Converted row offset field to one that supports dynamic bindings

* Review changes

* List SAAS plugin type actions under lightning menu apis (#3820)

* list saas plugin type actions under lightning menu apis

* combine saas plugin type actions in the other sub menu of lightning menu

Co-authored-by: Hetu Nandu <hetunandu@gmail.com>

* Fix merge issues

* Prettified query editor and a few fixes w/ ux

* Test fixes

* Reformatting request

* code for REST added (#3876)


Co-authored-by: hetunandu <hetu@appsmith.com>

* Renamed body to row object

* Renamed placeholder for range

* Renamed range heading

* Modifications to handle range semantics

* Use spreadsheet Url instead of id

* Ordering of methods

* Removed logging

* Add tests for Dynamic text controls

* Add tests for url helpers

* Fix coverage config

* Nevermind

* Interface changes

* There is no body here

* Yay to hints

* Delete row field is separately handled as row index

* placeholder support (#4001)

* Fixed tests, typos and creating new sheets with random rows

* Switched to using 'rowIndex' throughout

* binding path added for query input field (#4016)

* - Fixed QA bugs (#4032)

- Split delete sheet into two
- Removed dynamic query input types from hidden keys

* Proper exceptions

* Removed extra logging

* Throw exception if update method does not match any of the columns

* Same for bulk update

* Zero-indexed delete row

* I'm a space bound rocket ship

* Logic to register installations with cs (#4062)

* Logic to register installations with cs

* Clean up

* Casting to string

* Checking to see if this makes the test pass

* Added an extra null check

Co-authored-by: Piyush <piyush@codeitout.com>
Co-authored-by: hetunandu <hetu@appsmith.com>
Co-authored-by: Hetu Nandu <hetunandu@gmail.com>
Co-authored-by: Apeksha Bhosale <7846888+ApekshaBhosale@users.noreply.github.com>
2021-04-22 09:00:09 +05:30

72 lines
2.0 KiB
TypeScript

import React from "react";
import BaseControl, { ControlProps } from "./BaseControl";
import { ControlType } from "constants/PropertyControlConstants";
import FormLabel from "components/editorComponents/FormLabel";
import DynamicTextField from "components/editorComponents/form/fields/DynamicTextField";
import { AppState } from "reducers";
import { formValueSelector } from "redux-form";
import { QUERY_EDITOR_FORM_NAME } from "constants/forms";
import { connect } from "react-redux";
import { actionPathFromName } from "components/formControls/utils";
export function InputText(props: {
label: string;
placeholder?: string;
isRequired?: boolean;
name: string;
actionName: string;
}) {
const { actionName, name, placeholder, label, isRequired } = props;
const dataTreePath = actionPathFromName(actionName, name);
return (
<div style={{ width: "50vh", height: "55px" }}>
<FormLabel>
{label} {isRequired && "*"}
</FormLabel>
<DynamicTextField
name={name}
placeholder={placeholder}
showLightningMenu={false}
dataTreePath={dataTreePath}
/>
</div>
);
}
class DynamicInputTextControl extends BaseControl<DynamicInputControlProps> {
render() {
const { label, placeholderText, configProperty, actionName } = this.props;
return (
<InputText
name={configProperty}
label={label}
placeholder={placeholderText}
actionName={actionName}
/>
);
}
getControlType(): ControlType {
return "QUERY_DYNAMIC_INPUT_TEXT";
}
}
export interface DynamicInputControlProps extends ControlProps {
placeholderText: string;
actionName: string;
}
const mapStateToProps = (state: AppState, props: DynamicInputControlProps) => {
const valueSelector = formValueSelector(
props.formName || QUERY_EDITOR_FORM_NAME,
);
const actionName = valueSelector(state, "name");
return {
actionName: actionName,
};
};
export default connect(mapStateToProps)(DynamicInputTextControl);