- 
                Notifications
    
You must be signed in to change notification settings  - Fork 412
 
RI-7681: [NEW UI] Connection Settings #5127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
8dc9f70
              cbe6aae
              ef046b1
              9c9197c
              13cb109
              30afe0c
              fea8c35
              290f2d0
              6dea3b7
              497d9b9
              a54287e
              74a938c
              28bb562
              c8ce74d
              9902f3a
              50230f4
              6f67f58
              43c0c9a
              2aa4766
              274308e
              81d3dd2
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,16 +1,24 @@ | ||
| import React, { ComponentProps } from 'react' | ||
| import { FormField as RedisFormField, TooltipProvider } from '@redis-ui/components' | ||
| import { | ||
| FormField as RedisFormField, | ||
| TooltipProvider, | ||
| } from '@redis-ui/components' | ||
| import { InfoIconProps } from '@redis-ui/components/dist/Label/components/InfoIcon/InfoIcon.types' | ||
| 
     | 
||
| export type { InfoIconProps } | ||
| 
     | 
||
| export type RedisFormFieldProps = ComponentProps<typeof RedisFormField> & { | ||
| infoIconProps?: any | ||
| infoIconProps?: InfoIconProps | ||
| } | ||
| 
     | 
||
| export function FormField(props: RedisFormFieldProps) { | ||
| // eslint-disable-next-line react/destructuring-assignment | ||
| if (props.infoIconProps) { | ||
| return <TooltipProvider> | ||
| <RedisFormField {...props} /> | ||
| </TooltipProvider> | ||
| return ( | ||
| <TooltipProvider> | ||
| <RedisFormField {...props} /> | ||
| </TooltipProvider> | ||
| ) | ||
| } | ||
| return <RedisFormField {...props} /> | ||
| } | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import styled from 'styled-components' | ||
| import { Modal } from 'uiSrc/components/base/display/modal' | ||
| 
     | 
||
| export const StyledFormDialogContent = styled(Modal.Content.Compose)` | ||
| width: 900px !important; | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you try removing   | 
||
| height: 700px !important; | ||
| max-width: calc(100vw - 120px) !important; | ||
| max-height: calc(100vh - 120px) !important; | ||
| // Flex the modal content to fill the whole available space | ||
| > [data-role='dialog-hub'] { | ||
| flex: 1; | ||
| } | ||
| ` | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -12,12 +12,16 @@ import { | |
| selectOnFocus, | ||
| validateField, | ||
| } from 'uiSrc/utils' | ||
| import { RiTooltip } from 'uiSrc/components' | ||
| import { DbConnectionInfo } from 'uiSrc/pages/home/interfaces' | ||
| import { FlexItem, Row } from 'uiSrc/components/base/layout/flex' | ||
| import { FormField } from 'uiSrc/components/base/forms/FormField' | ||
| import { NumericInput, PasswordInput, TextInput } from 'uiSrc/components/base/inputs' | ||
| import { RiIcon } from 'uiSrc/components/base/icons/RiIcon' | ||
| import { Col, FlexItem, Row } from 'uiSrc/components/base/layout/flex' | ||
| import { FormField, InfoIconProps } from 'uiSrc/components/base/forms/FormField' | ||
| import { | ||
| NumericInput, | ||
| PasswordInput, | ||
| TextInput, | ||
| } from 'uiSrc/components/base/inputs' | ||
| import { Text } from 'uiSrc/components/base/text' | ||
| import { Spacer } from 'uiSrc/components/base/layout' | ||
| 
     | 
||
| interface IShowFields { | ||
| alias: boolean | ||
| 
        
          
        
         | 
    @@ -26,6 +30,38 @@ interface IShowFields { | |
| timeout: boolean | ||
| } | ||
| 
     | 
||
| const infoIcon: InfoIconProps = { | ||
| content: ( | ||
| <div className="homePage_tooltip"> | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if this class actually does something, it is better to extract a component and not use the class  | 
||
| <div> | ||
| <Text variant="semiBold"> | ||
| Pasting a connection URL auto fills the database details. | ||
| </Text> | ||
| <Spacer size="s" /> | ||
| <Text variant="semiBold"> | ||
| The following connection URLs are supported: | ||
| </Text> | ||
| </div> | ||
| <ul className="homePage_toolTipUl"> | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same  | 
||
| <li> | ||
| <span className="dot" /> | ||
| redis://[[username]:[password]]@host:port | ||
| </li> | ||
| <li> | ||
| <span className="dot" /> | ||
| rediss://[[username]:[password]]@host:port | ||
| </li> | ||
| <li> | ||
| <span className="dot" /> | ||
| host:port | ||
| </li> | ||
| </ul> | ||
| </div> | ||
| ), | ||
| placement: 'right', | ||
| maxWidth: '100%', | ||
| } | ||
| 
     | 
||
| export interface Props { | ||
| formik: FormikProps<DbConnectionInfo> | ||
| onHostNamePaste: (content: string) => boolean | ||
| 
        
          
        
         | 
    @@ -45,52 +81,16 @@ const DatabaseForm = (props: Props) => { | |
| 
     | 
||
| const { server } = useSelector(appInfoSelector) | ||
| 
     | 
||
| const AppendHostName = () => ( | ||
| <RiTooltip | ||
| title={ | ||
| <div> | ||
| <p> | ||
| <b>Pasting a connection URL auto fills the database details.</b> | ||
| </p> | ||
| <p style={{ margin: 0, paddingTop: '10px' }}> | ||
| The following connection URLs are supported: | ||
| </p> | ||
| </div> | ||
| } | ||
| className="homePage_tooltip" | ||
| anchorClassName="inputAppendIcon" | ||
| position="right" | ||
| content={ | ||
| <ul className="homePage_toolTipUl"> | ||
| <li> | ||
| <span className="dot" /> | ||
| redis://[[username]:[password]]@host:port | ||
| </li> | ||
| <li> | ||
| <span className="dot" /> | ||
| rediss://[[username]:[password]]@host:port | ||
| </li> | ||
| <li> | ||
| <span className="dot" /> | ||
| host:port | ||
| </li> | ||
| </ul> | ||
| } | ||
| > | ||
| <RiIcon type="InfoIcon" style={{ cursor: 'pointer' }} /> | ||
| </RiTooltip> | ||
| ) | ||
| 
     | 
||
| const isShowPort = | ||
| server?.buildType !== BuildType.RedisStack && showFields.port | ||
| const isFieldDisabled = (name: string) => readyOnlyFields.includes(name) | ||
| 
     | 
||
| return ( | ||
| <> | ||
| <Col gap="l"> | ||
| {showFields.alias && ( | ||
| <Row gap="m"> | ||
| <FlexItem grow> | ||
| <FormField label="Database Alias*"> | ||
| <FormField label="Database alias" required> | ||
| <TextInput | ||
| name="name" | ||
| id="name" | ||
| 
        
          
        
         | 
    @@ -106,15 +106,11 @@ const DatabaseForm = (props: Props) => { | |
| </FlexItem> | ||
| </Row> | ||
| )} | ||
| 
     | 
||
| {(showFields.host || isShowPort) && ( | ||
| <Row gap="m"> | ||
| {showFields.host && ( | ||
| <FlexItem grow={4}> | ||
| <FormField | ||
| label="Host*" | ||
| additionalText={<AppendHostName />} | ||
| > | ||
| <FormField label="Host" required infoIconProps={infoIcon}> | ||
| <TextInput | ||
| autoFocus={autoFocus} | ||
| name="ip" | ||
| 
        
          
        
         | 
    @@ -124,11 +120,8 @@ const DatabaseForm = (props: Props) => { | |
| maxLength={200} | ||
| placeholder="Enter Hostname / IP address / Connection URL" | ||
| value={formik.values.host ?? ''} | ||
| onChange={value => { | ||
| formik.setFieldValue( | ||
| 'host', | ||
| validateField(value.trim()), | ||
| ) | ||
| onChange={(value) => { | ||
| formik.setFieldValue('host', validateField(value.trim())) | ||
| }} | ||
| onPaste={(event: React.ClipboardEvent<HTMLInputElement>) => | ||
| handlePasteHostName(onHostNamePaste, event) | ||
| 
        
          
        
         | 
    @@ -141,10 +134,7 @@ const DatabaseForm = (props: Props) => { | |
| )} | ||
| {isShowPort && ( | ||
| <FlexItem grow={2}> | ||
| <FormField | ||
| label="Port*" | ||
| additionalText={`Should not exceed ${MAX_PORT_NUMBER}.`} | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we just discard the info text? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I discussed this with @ViktarStarastsenka - seems like since we have the constraint there is no need for this.  | 
||
| > | ||
| <FormField label="Port" required> | ||
| <NumericInput | ||
| autoValidate | ||
| name="port" | ||
| 
          
            
          
           | 
    @@ -228,7 +218,7 @@ const DatabaseForm = (props: Props) => { | |
| <FlexItem grow /> | ||
| </Row> | ||
| )} | ||
| </> | ||
| </Col> | ||
| ) | ||
| } | ||
| 
     | 
||
| 
          
            
          
           | 
    ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about this import. It reaches into
distfolder???