PromucFlow_constructor/app/client/src/components/formControls/InputTextControl.tsx

223 lines
5.2 KiB
TypeScript
Raw Normal View History

import React from "react";
import BaseControl, { ControlProps } from "./BaseControl";
import { ControlType } from "constants/PropertyControlConstants";
feat: Migrate design system components import to design-system repo - I (#15562) * Icon component deleted and changed the imports in refrence places * design system package version changed * import changes * Delete TextInput.tsx * Change imports * Change single named import * Update package * Update package * Delete ScrollIndicator.tsx * Change imports * Icon import completed * Event type added * Changed Button component imports * import change button * Button onclick type fix * Label with Tooltip import changes * Changed breadcrumbs import * EmojiPicker and Emoji Reaction import changes * AppIcon import change * import bug fix * Menu Item import chnages * Icon selector imports changed * Delete LabelWithTooltip.tsx * Change imports across the app * Update package version * Update version number for design-system * Delete Checkbox.tsx * Remove the exports * Add lock file for ds package update * Change imports * default import -> named * Update release version * Make arg type explicit * Updated design-system to latest release * Missing file mysteriously comes back and is updated accordingly * changes design-system package version * Add types to arguments in the onChange for text input * onBlur type fix * Search component in property pane * WDS button changes reverted * package version bumped * conflict fix * Remove Dropdown, change imports * Category import fix * fix: table icon size import * Bump version of design system package * Yarn lock Co-authored-by: Tanvi Bhakta <tanvibhakta@gmail.com>
2022-08-22 05:09:39 +00:00
import { TextInput } from "design-system";
fix: secret saved indicator on ui for datasource forms (#18531) ## Description Secret saved indicator on ui exists if the datasource field has a `valueExistPath` and server sends back the boolean value for the specific field in `secretExists` key. The UI would appear as follows : #### When the password is saved and there exists a key `valueExistPath` for `Password` field and the value in `secretExists` is true then - When password field is not focused. An overlay indicating the password shows up. <img width="575" alt="Screenshot 2022-11-28 at 8 58 44 PM" src="https://user-images.githubusercontent.com/7565635/204317024-be22127b-adf4-4914-9180-804ebe6b482a.png"> - When the password field is focused. The overlay goes away. <img width="588" alt="Screenshot 2022-11-28 at 8 58 51 PM" src="https://user-images.githubusercontent.com/7565635/204317400-9d601230-5493-40c0-ac66-21112d0d98ca.png"> TL;DR Fixes #14783 Media [Loom Video of 4 sec](https://www.loom.com/share/ba30b9674d754bf4a0c2704eef69008d) ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2023-01-20 14:03:42 +00:00
import { AppState } from "@appsmith/reducers";
2020-10-27 05:02:32 +00:00
import { Colors } from "constants/Colors";
import styled from "styled-components";
import { InputType } from "components/constants";
import {
Field,
WrappedFieldMetaProps,
WrappedFieldInputProps,
fix: secret saved indicator on ui for datasource forms (#18531) ## Description Secret saved indicator on ui exists if the datasource field has a `valueExistPath` and server sends back the boolean value for the specific field in `secretExists` key. The UI would appear as follows : #### When the password is saved and there exists a key `valueExistPath` for `Password` field and the value in `secretExists` is true then - When password field is not focused. An overlay indicating the password shows up. <img width="575" alt="Screenshot 2022-11-28 at 8 58 44 PM" src="https://user-images.githubusercontent.com/7565635/204317024-be22127b-adf4-4914-9180-804ebe6b482a.png"> - When the password field is focused. The overlay goes away. <img width="588" alt="Screenshot 2022-11-28 at 8 58 51 PM" src="https://user-images.githubusercontent.com/7565635/204317400-9d601230-5493-40c0-ac66-21112d0d98ca.png"> TL;DR Fixes #14783 Media [Loom Video of 4 sec](https://www.loom.com/share/ba30b9674d754bf4a0c2704eef69008d) ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2023-01-20 14:03:42 +00:00
formValueSelector,
} from "redux-form";
fix: secret saved indicator on ui for datasource forms (#18531) ## Description Secret saved indicator on ui exists if the datasource field has a `valueExistPath` and server sends back the boolean value for the specific field in `secretExists` key. The UI would appear as follows : #### When the password is saved and there exists a key `valueExistPath` for `Password` field and the value in `secretExists` is true then - When password field is not focused. An overlay indicating the password shows up. <img width="575" alt="Screenshot 2022-11-28 at 8 58 44 PM" src="https://user-images.githubusercontent.com/7565635/204317024-be22127b-adf4-4914-9180-804ebe6b482a.png"> - When the password field is focused. The overlay goes away. <img width="588" alt="Screenshot 2022-11-28 at 8 58 51 PM" src="https://user-images.githubusercontent.com/7565635/204317400-9d601230-5493-40c0-ac66-21112d0d98ca.png"> TL;DR Fixes #14783 Media [Loom Video of 4 sec](https://www.loom.com/share/ba30b9674d754bf4a0c2704eef69008d) ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2023-01-20 14:03:42 +00:00
import { connect } from "react-redux";
2020-10-27 05:02:32 +00:00
export const StyledInfo = styled.span`
2020-10-27 05:02:32 +00:00
font-weight: normal;
line-height: normal;
color: ${Colors.DOVE_GRAY};
2020-10-27 05:02:32 +00:00
font-size: 12px;
margin-left: 1px;
`;
fix: secret saved indicator on ui for datasource forms (#18531) ## Description Secret saved indicator on ui exists if the datasource field has a `valueExistPath` and server sends back the boolean value for the specific field in `secretExists` key. The UI would appear as follows : #### When the password is saved and there exists a key `valueExistPath` for `Password` field and the value in `secretExists` is true then - When password field is not focused. An overlay indicating the password shows up. <img width="575" alt="Screenshot 2022-11-28 at 8 58 44 PM" src="https://user-images.githubusercontent.com/7565635/204317024-be22127b-adf4-4914-9180-804ebe6b482a.png"> - When the password field is focused. The overlay goes away. <img width="588" alt="Screenshot 2022-11-28 at 8 58 51 PM" src="https://user-images.githubusercontent.com/7565635/204317400-9d601230-5493-40c0-ac66-21112d0d98ca.png"> TL;DR Fixes #14783 Media [Loom Video of 4 sec](https://www.loom.com/share/ba30b9674d754bf4a0c2704eef69008d) ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2023-01-20 14:03:42 +00:00
const FieldWrapper = styled.div`
width: 35vw;
position: relative;
`;
fix: secret saved indicator on ui for datasource forms (#18531) ## Description Secret saved indicator on ui exists if the datasource field has a `valueExistPath` and server sends back the boolean value for the specific field in `secretExists` key. The UI would appear as follows : #### When the password is saved and there exists a key `valueExistPath` for `Password` field and the value in `secretExists` is true then - When password field is not focused. An overlay indicating the password shows up. <img width="575" alt="Screenshot 2022-11-28 at 8 58 44 PM" src="https://user-images.githubusercontent.com/7565635/204317024-be22127b-adf4-4914-9180-804ebe6b482a.png"> - When the password field is focused. The overlay goes away. <img width="588" alt="Screenshot 2022-11-28 at 8 58 51 PM" src="https://user-images.githubusercontent.com/7565635/204317400-9d601230-5493-40c0-ac66-21112d0d98ca.png"> TL;DR Fixes #14783 Media [Loom Video of 4 sec](https://www.loom.com/share/ba30b9674d754bf4a0c2704eef69008d) ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2023-01-20 14:03:42 +00:00
const SecretDisplayIndicator = styled.input`
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
padding: 0px var(--ads-spaces-6);
z-index: 1;
cursor: text;
border: none;
background: none;
`;
const PASSWORD_EXISTS_INDICATOR = "······";
function renderComponent(
props: {
placeholder: string;
dataType?: InputType;
disabled?: boolean;
fix: secret saved indicator on ui for datasource forms (#18531) ## Description Secret saved indicator on ui exists if the datasource field has a `valueExistPath` and server sends back the boolean value for the specific field in `secretExists` key. The UI would appear as follows : #### When the password is saved and there exists a key `valueExistPath` for `Password` field and the value in `secretExists` is true then - When password field is not focused. An overlay indicating the password shows up. <img width="575" alt="Screenshot 2022-11-28 at 8 58 44 PM" src="https://user-images.githubusercontent.com/7565635/204317024-be22127b-adf4-4914-9180-804ebe6b482a.png"> - When the password field is focused. The overlay goes away. <img width="588" alt="Screenshot 2022-11-28 at 8 58 51 PM" src="https://user-images.githubusercontent.com/7565635/204317400-9d601230-5493-40c0-ac66-21112d0d98ca.png"> TL;DR Fixes #14783 Media [Loom Video of 4 sec](https://www.loom.com/share/ba30b9674d754bf4a0c2704eef69008d) ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2023-01-20 14:03:42 +00:00
reference: any;
validator?: (value: string) => { isValid: boolean; message: string };
} & {
meta: Partial<WrappedFieldMetaProps>;
input: Partial<WrappedFieldInputProps>;
},
) {
return (
<TextInput
dataType={props.dataType}
disabled={props.disabled || false}
name={props.input?.name}
onChange={props.input.onChange}
placeholder={props.placeholder}
fix: secret saved indicator on ui for datasource forms (#18531) ## Description Secret saved indicator on ui exists if the datasource field has a `valueExistPath` and server sends back the boolean value for the specific field in `secretExists` key. The UI would appear as follows : #### When the password is saved and there exists a key `valueExistPath` for `Password` field and the value in `secretExists` is true then - When password field is not focused. An overlay indicating the password shows up. <img width="575" alt="Screenshot 2022-11-28 at 8 58 44 PM" src="https://user-images.githubusercontent.com/7565635/204317024-be22127b-adf4-4914-9180-804ebe6b482a.png"> - When the password field is focused. The overlay goes away. <img width="588" alt="Screenshot 2022-11-28 at 8 58 51 PM" src="https://user-images.githubusercontent.com/7565635/204317400-9d601230-5493-40c0-ac66-21112d0d98ca.png"> TL;DR Fixes #14783 Media [Loom Video of 4 sec](https://www.loom.com/share/ba30b9674d754bf4a0c2704eef69008d) ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2023-01-20 14:03:42 +00:00
ref={props.reference}
value={props.input.value}
{...props.input}
validator={props.validator}
width="100%"
/>
);
}
fix: secret saved indicator on ui for datasource forms (#18531) ## Description Secret saved indicator on ui exists if the datasource field has a `valueExistPath` and server sends back the boolean value for the specific field in `secretExists` key. The UI would appear as follows : #### When the password is saved and there exists a key `valueExistPath` for `Password` field and the value in `secretExists` is true then - When password field is not focused. An overlay indicating the password shows up. <img width="575" alt="Screenshot 2022-11-28 at 8 58 44 PM" src="https://user-images.githubusercontent.com/7565635/204317024-be22127b-adf4-4914-9180-804ebe6b482a.png"> - When the password field is focused. The overlay goes away. <img width="588" alt="Screenshot 2022-11-28 at 8 58 51 PM" src="https://user-images.githubusercontent.com/7565635/204317400-9d601230-5493-40c0-ac66-21112d0d98ca.png"> TL;DR Fixes #14783 Media [Loom Video of 4 sec](https://www.loom.com/share/ba30b9674d754bf4a0c2704eef69008d) ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2023-01-20 14:03:42 +00:00
class InputTextControl extends BaseControl<InputControlProps> {
fix: secret saved indicator on ui for datasource forms (#18531) ## Description Secret saved indicator on ui exists if the datasource field has a `valueExistPath` and server sends back the boolean value for the specific field in `secretExists` key. The UI would appear as follows : #### When the password is saved and there exists a key `valueExistPath` for `Password` field and the value in `secretExists` is true then - When password field is not focused. An overlay indicating the password shows up. <img width="575" alt="Screenshot 2022-11-28 at 8 58 44 PM" src="https://user-images.githubusercontent.com/7565635/204317024-be22127b-adf4-4914-9180-804ebe6b482a.png"> - When the password field is focused. The overlay goes away. <img width="588" alt="Screenshot 2022-11-28 at 8 58 51 PM" src="https://user-images.githubusercontent.com/7565635/204317400-9d601230-5493-40c0-ac66-21112d0d98ca.png"> TL;DR Fixes #14783 Media [Loom Video of 4 sec](https://www.loom.com/share/ba30b9674d754bf4a0c2704eef69008d) ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2023-01-20 14:03:42 +00:00
fieldRef: any;
state = {
secretDisplayVisible: false,
};
constructor(props: InputControlProps) {
super(props);
this.fieldRef = React.createRef();
}
onClickSecretDisplayIndicator = () => {
if (!this.state.secretDisplayVisible) return;
this.setState({
secretDisplayVisible: false,
});
if (this.fieldRef.current) this.fieldRef.current?.focus();
};
checkForSecretOverlayIndicator = () => {
return (
this.props.dataType === "PASSWORD" &&
this.props.isSecretExistsPath &&
this.props.isSecretExistsData
);
};
onBlur = () => {
if (
this.checkForSecretOverlayIndicator() &&
this.fieldRef.current?.value?.length === 0
) {
this.setState({
secretDisplayVisible: true,
});
}
};
componentDidMount() {
if (this.checkForSecretOverlayIndicator()) {
this.setState({
secretDisplayVisible: true,
});
}
}
render() {
const {
configProperty,
fix: secret saved indicator on ui for datasource forms (#18531) ## Description Secret saved indicator on ui exists if the datasource field has a `valueExistPath` and server sends back the boolean value for the specific field in `secretExists` key. The UI would appear as follows : #### When the password is saved and there exists a key `valueExistPath` for `Password` field and the value in `secretExists` is true then - When password field is not focused. An overlay indicating the password shows up. <img width="575" alt="Screenshot 2022-11-28 at 8 58 44 PM" src="https://user-images.githubusercontent.com/7565635/204317024-be22127b-adf4-4914-9180-804ebe6b482a.png"> - When the password field is focused. The overlay goes away. <img width="588" alt="Screenshot 2022-11-28 at 8 58 51 PM" src="https://user-images.githubusercontent.com/7565635/204317400-9d601230-5493-40c0-ac66-21112d0d98ca.png"> TL;DR Fixes #14783 Media [Loom Video of 4 sec](https://www.loom.com/share/ba30b9674d754bf4a0c2704eef69008d) ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2023-01-20 14:03:42 +00:00
customStyles,
dataType,
disabled,
encrypted,
isValid,
label,
placeholderText,
propertyValue,
subtitle,
validationMessage,
validator,
} = this.props;
return (
fix: secret saved indicator on ui for datasource forms (#18531) ## Description Secret saved indicator on ui exists if the datasource field has a `valueExistPath` and server sends back the boolean value for the specific field in `secretExists` key. The UI would appear as follows : #### When the password is saved and there exists a key `valueExistPath` for `Password` field and the value in `secretExists` is true then - When password field is not focused. An overlay indicating the password shows up. <img width="575" alt="Screenshot 2022-11-28 at 8 58 44 PM" src="https://user-images.githubusercontent.com/7565635/204317024-be22127b-adf4-4914-9180-804ebe6b482a.png"> - When the password field is focused. The overlay goes away. <img width="588" alt="Screenshot 2022-11-28 at 8 58 51 PM" src="https://user-images.githubusercontent.com/7565635/204317400-9d601230-5493-40c0-ac66-21112d0d98ca.png"> TL;DR Fixes #14783 Media [Loom Video of 4 sec](https://www.loom.com/share/ba30b9674d754bf4a0c2704eef69008d) ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2023-01-20 14:03:42 +00:00
<FieldWrapper data-cy={configProperty} style={customStyles || {}}>
{this.state.secretDisplayVisible && (
<SecretDisplayIndicator
onClick={this.onClickSecretDisplayIndicator}
onFocus={this.onClickSecretDisplayIndicator}
type="password"
value={PASSWORD_EXISTS_INDICATOR}
/>
)}
<Field
asyncControl
component={renderComponent}
dataType={this.getType(dataType)}
disabled={disabled || false}
encrypted={encrypted}
isValid={isValid}
label={label}
name={configProperty}
onBlur={this.onBlur}
onFocus={this.onClickSecretDisplayIndicator}
placeholder={this.state.secretDisplayVisible ? "" : placeholderText}
reference={this.fieldRef}
subtitle={subtitle}
validationMessage={validationMessage}
validator={validator}
value={propertyValue}
/>
</FieldWrapper>
);
}
isNumberType(): boolean {
const { inputType } = this.props;
switch (inputType) {
case "CURRENCY":
case "INTEGER":
case "NUMBER":
case "PHONE_NUMBER":
return true;
default:
return false;
}
}
getType(dataType: InputType | undefined) {
switch (dataType) {
case "PASSWORD":
return "password";
case "NUMBER":
return "number";
default:
return "text";
}
}
getControlType(): ControlType {
return "INPUT_TEXT";
}
}
export interface InputControlProps extends ControlProps {
placeholderText: string;
inputType?: InputType;
dataType?: InputType;
subtitle?: string;
2020-10-27 05:02:32 +00:00
encrypted?: boolean;
disabled?: boolean;
validator?: (value: string) => { isValid: boolean; message: string };
fix: secret saved indicator on ui for datasource forms (#18531) ## Description Secret saved indicator on ui exists if the datasource field has a `valueExistPath` and server sends back the boolean value for the specific field in `secretExists` key. The UI would appear as follows : #### When the password is saved and there exists a key `valueExistPath` for `Password` field and the value in `secretExists` is true then - When password field is not focused. An overlay indicating the password shows up. <img width="575" alt="Screenshot 2022-11-28 at 8 58 44 PM" src="https://user-images.githubusercontent.com/7565635/204317024-be22127b-adf4-4914-9180-804ebe6b482a.png"> - When the password field is focused. The overlay goes away. <img width="588" alt="Screenshot 2022-11-28 at 8 58 51 PM" src="https://user-images.githubusercontent.com/7565635/204317400-9d601230-5493-40c0-ac66-21112d0d98ca.png"> TL;DR Fixes #14783 Media [Loom Video of 4 sec](https://www.loom.com/share/ba30b9674d754bf4a0c2704eef69008d) ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2023-01-20 14:03:42 +00:00
isSecretExistsData?: boolean;
}
fix: secret saved indicator on ui for datasource forms (#18531) ## Description Secret saved indicator on ui exists if the datasource field has a `valueExistPath` and server sends back the boolean value for the specific field in `secretExists` key. The UI would appear as follows : #### When the password is saved and there exists a key `valueExistPath` for `Password` field and the value in `secretExists` is true then - When password field is not focused. An overlay indicating the password shows up. <img width="575" alt="Screenshot 2022-11-28 at 8 58 44 PM" src="https://user-images.githubusercontent.com/7565635/204317024-be22127b-adf4-4914-9180-804ebe6b482a.png"> - When the password field is focused. The overlay goes away. <img width="588" alt="Screenshot 2022-11-28 at 8 58 51 PM" src="https://user-images.githubusercontent.com/7565635/204317400-9d601230-5493-40c0-ac66-21112d0d98ca.png"> TL;DR Fixes #14783 Media [Loom Video of 4 sec](https://www.loom.com/share/ba30b9674d754bf4a0c2704eef69008d) ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2023-01-20 14:03:42 +00:00
const mapStateToProps = (state: AppState, props: InputControlProps) => {
const valueSelector = formValueSelector(props.formName);
let isSecretExistsData;
if (props.isSecretExistsPath) {
isSecretExistsData = valueSelector(state, props.isSecretExistsPath);
}
return {
isSecretExistsData,
};
};
export default connect(mapStateToProps)(InputTextControl);