Skip to content

Commit 2227223

Browse files
authored
Merge branch 'develop' into feat/bulk-trigger-deployment
2 parents d68c35f + aadeb7f commit 2227223

36 files changed

+2337
-2409
lines changed

.eslintignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,15 +314,9 @@ src/components/material/MaterialList.tsx
314314
src/components/material/MaterialView.tsx
315315
src/components/material/UpdateMaterial.tsx
316316
src/components/notifications/AddNotification.tsx
317-
src/components/notifications/ConfigurationTab.tsx
318-
src/components/notifications/CreateHeaderDetails.tsx
319317
src/components/notifications/ModifyRecipientsModal.tsx
320318
src/components/notifications/NotificationTab.tsx
321319
src/components/notifications/Notifications.tsx
322-
src/components/notifications/SESConfigModal.tsx
323-
src/components/notifications/SMTPConfigModal.tsx
324-
src/components/notifications/SlackConfigModal.tsx
325-
src/components/notifications/WebhookConfigModal.tsx
326320
src/components/notifications/notifications.service.ts
327321
src/components/notifications/notifications.util.tsx
328322
src/components/onboardingGuide/GuideCommonHeader.tsx
File renamed without changes.

src/assets/img/ses-empty.png

3.44 KB
Loading

src/assets/img/slack-empty.png

4 KB
Loading

src/assets/img/smtp-empty.png

3 KB
Loading

src/assets/img/webhook-empty.png

4.5 KB
Loading

src/components/globalConfigurations/GlobalConfiguration.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { lazy, useState, useEffect, Suspense, isValidElement } from 'react'
17+
import { lazy, useState, useEffect, Suspense, isValidElement, useRef } from 'react'
1818
import { Route, NavLink, Router, Switch, Redirect, useHistory, useLocation } from 'react-router-dom'
1919
import {
2020
showError,
@@ -852,7 +852,19 @@ export const ProtectedInput = ({
852852
dataTestid = '',
853853
onBlur = (e) => { },
854854
isRequiredField = false,
855+
autoFocus = false,
855856
}: ProtectedInputType) => {
857+
const inputRef = useRef<HTMLInputElement>()
858+
859+
useEffect(() => {
860+
setTimeout(() => {
861+
// Added timeout to ensure the autofocus code is executed post the re-renders
862+
if (inputRef.current && autoFocus) {
863+
inputRef.current.focus()
864+
}
865+
}, 100)
866+
}, [autoFocus])
867+
856868
const [shown, toggleShown] = useState(false)
857869
useEffect(() => {
858870
toggleShown(!hidden)
@@ -871,7 +883,7 @@ export const ProtectedInput = ({
871883
data-testid={dataTestid}
872884
type={shown ? 'text' : 'password'}
873885
tabIndex={tabIndex}
874-
className={error ? 'form__input form__input--error pl-42' : 'form__input pl-42'}
886+
className={error ? 'form__input form__input--error pl-42' : 'form__input pl-42 fs-13'}
875887
name={name}
876888
placeholder={placeholder}
877889
onChange={(e) => {
@@ -881,6 +893,8 @@ export const ProtectedInput = ({
881893
value={value}
882894
disabled={disabled}
883895
onBlur={onBlur}
896+
autoFocus={autoFocus}
897+
ref={inputRef}
884898
/>
885899
<ShowHide
886900
className="protected-input__toggle"

src/components/globalConfigurations/globalConfiguration.type.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ export interface ProtectedInputType {
4747
dataTestid: string
4848
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void
4949
isRequiredField?: boolean
50+
autoFocus?: boolean
5051
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { Button, ButtonVariantType, ComponentSizeType, useSearchString } from '@devtron-labs/devtron-fe-common-lib'
2+
import { useHistory } from 'react-router-dom'
3+
import { ReactComponent as Add } from '@Icons/ic-add.svg'
4+
import { getTabText } from './notifications.util'
5+
import { AddConfigurationButtonProps } from './types'
6+
7+
export const AddConfigurationButton = ({ activeTab }: AddConfigurationButtonProps) => {
8+
const { searchParams } = useSearchString()
9+
const history = useHistory()
10+
11+
const handleAddClick = () => {
12+
const newParams = {
13+
...searchParams,
14+
modal: activeTab,
15+
configId: '0',
16+
}
17+
history.push({
18+
search: new URLSearchParams(newParams).toString(),
19+
})
20+
}
21+
22+
return (
23+
<Button
24+
onClick={handleAddClick}
25+
variant={ButtonVariantType.primary}
26+
size={ComponentSizeType.small}
27+
dataTestId={`${activeTab}-add-button`}
28+
startIcon={<Add />}
29+
text={`Add ${getTabText(activeTab)}`}
30+
/>
31+
)
32+
}

src/components/notifications/AddNotification.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ import { RouteComponentProps, Link } from 'react-router-dom'
3535
import { components } from 'react-select'
3636
import Tippy from '@tippyjs/react'
3737
import CreatableSelect from 'react-select/creatable'
38-
import { SESConfigModal } from './SESConfigModal'
38+
import SESConfigModal from './SESConfigModal'
3939
import { SlackConfigModal } from './SlackConfigModal'
4040
import { Select, validateEmail, ErrorBoundary } from '../common'
41-
import { ReactComponent as Slack } from '../../assets/img/slack-logo.svg'
41+
import { ReactComponent as Slack } from '../../assets/icons/slack-logo.svg'
4242
import { ReactComponent as Add } from '../../assets/icons/ic-add.svg'
4343
import { ReactComponent as Filter } from '../../assets/icons/ic-filter.svg'
4444
import { ReactComponent as Folder } from '../../assets/icons/img-folder-empty.svg'
@@ -967,6 +967,14 @@ export class AddNotification extends Component<AddNotificationsProps, AddNotific
967967
)
968968
}
969969

970+
onClickCloseSESModal = () => {
971+
this.setState({ showSESConfigModal: false })
972+
}
973+
974+
onClickCloseSMTPModal = () => {
975+
this.setState({ showSMTPConfigModal: false })
976+
}
977+
970978
renderSESConfigModal() {
971979
if (this.state.showSESConfigModal) {
972980
return (
@@ -985,9 +993,7 @@ export class AddNotification extends Component<AddNotificationsProps, AddNotific
985993
showError(error)
986994
})
987995
}}
988-
closeSESConfigModal={(event) => {
989-
this.setState({ showSESConfigModal: false })
990-
}}
996+
closeSESConfigModal={this.onClickCloseSESModal}
991997
/>
992998
)
993999
}
@@ -1011,9 +1017,7 @@ export class AddNotification extends Component<AddNotificationsProps, AddNotific
10111017
showError(error)
10121018
})
10131019
}}
1014-
closeSMTPConfigModal={(event) => {
1015-
this.setState({ showSMTPConfigModal: false })
1016-
}}
1020+
closeSMTPConfigModal={this.onClickCloseSMTPModal}
10171021
/>
10181022
)
10191023
}

0 commit comments

Comments
 (0)