Onboarding flow revamp for first time admin users. Uses the new ADS2.0 Components. Shows telemetry popup. zeplin: https://app.zeplin.io/project/642f9f61af65ec6928659130/screen/64476316d729f744cb695232 #### PR fixes following issue(s) Fixes #https://github.com/appsmithorg/cloud-services/issues/673 #### Type of change > Please delete options that are not relevant. - Breaking change (fix or feature that would cause existing functionality to not work as expected) - This change requires a documentation update > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [x] Manual - [ ] Jest - [x] Cypress > > #### Test Plan > > https://github.com/appsmithorg/TestSmith/issues/2401 > #### 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 - [x] 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: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Test-plan-implementation#speedbreaker-features-to-consider-for-every-change) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans/_edit#areas-of-interest) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
124 lines
3.0 KiB
TypeScript
124 lines
3.0 KiB
TypeScript
import React from "react";
|
|
import { FormGroup as StyledFormGroup } from "design-system-old";
|
|
import type { FormTextFieldProps } from "components/utils/ReduxFormTextField";
|
|
import type { WrappedFieldInputProps, WrappedFieldMetaProps } from "redux-form";
|
|
import styled from "styled-components";
|
|
import type { OptionType } from "./constants";
|
|
import { Select, Option } from "design-system";
|
|
|
|
export const FormHeaderLabel = styled.h5`
|
|
width: 100%;
|
|
font-size: 20px;
|
|
font-weight: 500;
|
|
color: var(--ads-v2-color-fg-emphasis);
|
|
`;
|
|
|
|
export const FormHeaderIndex = styled.h5`
|
|
font-size: 20px;
|
|
font-weight: 500;
|
|
`;
|
|
|
|
export const FormBodyWrapper = styled.div`
|
|
padding: ${(prop) => prop.theme.spaces[10]}px 0px;
|
|
`;
|
|
|
|
export const FormHeaderSubtext = styled.p`
|
|
color: var(--ads-v2-color-fg);
|
|
`;
|
|
|
|
export const ControlWrapper = styled.div`
|
|
margin: ${(prop) => prop.theme.spaces[6]}px 0px;
|
|
`;
|
|
|
|
export const Label = styled.label`
|
|
display: inline-block;
|
|
margin-bottom: 10px;
|
|
`;
|
|
|
|
export const ButtonWrapper = styled.div`
|
|
margin: ${(prop) => prop.theme.spaces[17] * 2}px 0px 0px;
|
|
`;
|
|
|
|
export const AllowToggleWrapper = styled.div`
|
|
display: block;
|
|
`;
|
|
|
|
export const AllowToggle = styled.div``;
|
|
|
|
export const AllowToggleLabel = styled.p`
|
|
margin-bottom: 0px;
|
|
margin-top: 2px;
|
|
`;
|
|
|
|
export const StyledLink = styled.a`
|
|
&,
|
|
&:hover {
|
|
color: ${(props) => props.theme.colors.link};
|
|
text-decoration: none;
|
|
}
|
|
`;
|
|
|
|
const DROPDOWN_CLASSNAME = "setup-dropdown";
|
|
export const DropdownWrapper = styled(StyledFormGroup)`
|
|
&& .cs-text {
|
|
width: 100%;
|
|
}
|
|
|
|
&& > .bp3-label {
|
|
color: var(--ads-v2-color-fg);
|
|
}
|
|
|
|
.dropdown-errorMsg {
|
|
font-size: 12px;
|
|
color: var(--ads-v2-color-fg-error);
|
|
}
|
|
`;
|
|
|
|
export const Center = styled.div`
|
|
height: 100vh;
|
|
width: 100%;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
position: absolute;
|
|
`;
|
|
|
|
export function withDropdown(options: OptionType[]) {
|
|
return function DropdownField(
|
|
componentProps: FormTextFieldProps & {
|
|
meta: Partial<WrappedFieldMetaProps>;
|
|
input: Partial<WrappedFieldInputProps>;
|
|
},
|
|
) {
|
|
function onSelect(value?: string) {
|
|
componentProps.input.onChange && componentProps.input.onChange(value);
|
|
componentProps.input.onBlur && componentProps.input.onBlur(value);
|
|
}
|
|
|
|
const selected = options.find(
|
|
(option) => option.value == componentProps.input.value,
|
|
) || { label: componentProps.placeholder };
|
|
const hasError = componentProps.meta.invalid && componentProps.meta.touched;
|
|
|
|
return (
|
|
<>
|
|
<Select
|
|
className={DROPDOWN_CLASSNAME}
|
|
defaultValue={selected}
|
|
isValid={!hasError}
|
|
onSelect={onSelect}
|
|
>
|
|
{options.map((role, index) => (
|
|
<Option key={index} value={role.value}>
|
|
{role.label}
|
|
</Option>
|
|
))}
|
|
</Select>
|
|
{hasError && (
|
|
<div className="dropdown-errorMsg">{componentProps.meta.error}</div>
|
|
)}
|
|
</>
|
|
);
|
|
};
|
|
}
|