Skip to content

Commit 19717e4

Browse files
committed
notification changes
1 parent 5393a94 commit 19717e4

File tree

3 files changed

+43
-29
lines changed

3 files changed

+43
-29
lines changed

src/components/notifications/WebhookConfigModal.tsx

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
getTeamListMin as getProjectListMin,
77
Drawer,
88
copyToClipboard,
9+
CustomInput,
910
} from '@devtron-labs/devtron-fe-common-lib'
1011
import { ViewType } from '../../config/constants';
1112
import { toast } from 'react-toastify';
@@ -18,6 +19,7 @@ import { ReactComponent as Clipboard } from '../../assets/icons/ic-copy.svg'
1819
import CodeEditor from '../CodeEditor/CodeEditor';
1920
import { WebhhookConfigModalState, WebhookConfigModalProps } from './types';
2021
import CreateHeaderDetails from './CreateHeaderDetails';
22+
import { REQUIRED_FIELD_MSG } from '../../config/constantMessaging';
2123

2224
export class WebhookConfigModal extends Component<WebhookConfigModalProps, WebhhookConfigModalState> {
2325

@@ -306,32 +308,37 @@ export class WebhookConfigModal extends Component<WebhookConfigModalProps, Webhh
306308
<div className="flex" style={{ height: 'calc(100vh - 120px' }}>
307309
<div className="w-600 p-20 flex column dc__align-start dc__content-start dc__overflow-scroll" style={{ height: 'calc(100vh - 120px)' }}>
308310
<label className="form__row w-100-imp">
309-
<span className="form__label dc__required-field">Configuration name</span>
310-
<input data-testid="add-webhook-config-name" className="form__input" type="text" name="app-name"
311-
value={this.state.form.configName} onChange={this.handleWebhookConfigNameChange}
311+
<CustomInput
312+
label="Configuration name"
313+
data-testid="add-webhook-config-name"
314+
name="app-name"
315+
value={this.state.form.configName}
316+
onChange={this.handleWebhookConfigNameChange}
312317
data-field="configName"
313-
onBlur={this.onBlur}
314-
placeholder="Enter name" autoFocus={true} tabIndex={1} />
315-
<span className="form__error" data-testid="webhook-config-name-error">
316-
{!this.state.isValid.configName
317-
? <><Error className="form__icon form__icon--error" />This is required field.<br /></>
318-
: null}
319-
</span>
318+
handleOnBlur={this.onBlur}
319+
placeholder="Enter name"
320+
autoFocus={true}
321+
tabIndex={1}
322+
error={!this.state.isValid.configName && REQUIRED_FIELD_MSG}
323+
isRequiredField={true}
324+
/>
320325
</label>
321326
<label className="form__row w-100-imp">
322-
<span className="form__label dc__required-field">Webhook URL
323-
</span>
324-
<input data-testid="add-webhook-url" className="form__input" type="text" name="app-name"
327+
<CustomInput
328+
label="Webhook URL"
329+
type="text"
330+
name="app-name"
325331
value={this.state.form.webhookUrl}
326332
autoFocus={true}
327-
placeholder="Enter Incoming Webhook URL" tabIndex={2} onChange={this.handleWebhookUrlChange}
333+
placeholder="Enter Incoming Webhook URL"
334+
tabIndex={2}
335+
onChange={this.handleWebhookUrlChange}
328336
data-field="webhookUrl"
329-
onBlur={this.onBlur} />
330-
<span className="form__error" data-testid="webhook-url-error">
331-
{!this.state.isValid.webhookUrl
332-
? <><Error className="form__icon form__icon--error" />This is a required field. <br /></>
333-
: null}
334-
</span>
337+
handleOnBlur={this.onBlur}
338+
isRequiredField={true}
339+
error={!this.state.isValid.webhookUrl && REQUIRED_FIELD_MSG}
340+
data-testid="webhook-url-error"
341+
/>
335342
</label>
336343
<div className="form__row w-100-imp" >
337344
<div className="flex ml-0 dc__content-space">

src/components/security/AddCveModal.tsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import React, { Component } from 'react';
2-
import { showError, Progressing, VisibleModal } from '@devtron-labs/devtron-fe-common-lib'
2+
import { showError, Progressing, VisibleModal, CustomInput } from '@devtron-labs/devtron-fe-common-lib'
33
import { getCVEPolicies } from './security.service';
4-
import { ViewType } from '../../config';
4+
import { CVE_ID_NOT_FOUND, ViewType } from '../../config';
55
import { VulnerabilityAction } from './security.types';
6-
import { ReactComponent as Error } from '../../assets/icons/ic-warning.svg';
76
import { ReactComponent as Close } from '../../assets/icons/ic-close.svg';
87
import { ReactComponent as Info } from '../../assets/icons/ic-info-outline.svg';
98

@@ -156,12 +155,19 @@ export class AddCveModal extends Component<AddCveModalProps, AddCveModalState>{
156155
<form className="whitelist-cve" onSubmit={(event) => { event.preventDefault() }}>
157156
<div className="whitelist-cve__cve-id ml-24 mr-24 mb-20">
158157
<label className="dc__block flex-1 mb-5 mr-16 ">
159-
<span className="form__label">CVE ID</span>
160-
<input autoComplete="off" ref={node => this._inputRef = node} type="text" className="form__input" autoFocus tabIndex={1} placeholder="Enter CVE ID" value={this.state.cve} onChange={this.handleCveChange} />
161-
<span className="form__error">
162-
{this.state.cveError ? <><Error className="form__icon form__icon--error" /> CVE ID not found <br /></>
163-
: null}
164-
</span>
158+
<CustomInput
159+
name="cve"
160+
label="CVE ID"
161+
ref={(node) => (this._inputRef = node)}
162+
rootClassName="form__input"
163+
autoFocus
164+
tabIndex={1}
165+
placeholder="Enter CVE ID"
166+
value={this.state.cve}
167+
onChange={this.handleCveChange}
168+
isRequiredField={true}
169+
error={this.state.cveError && CVE_ID_NOT_FOUND}
170+
/>
165171
</label>
166172
{/* <button type="submit" className="cta mb-5" tabIndex={2} onClick={this.searchCVE}>Search</button> */}
167173
</div>

src/config/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,3 +803,4 @@ export const SERVER_ERROR_CODES = {
803803
}
804804

805805
export const ENV_ALREADY_EXIST_ERROR = 'Deployment pipeline already exists for this environment'
806+
export const CVE_ID_NOT_FOUND = "CVE ID not found"

0 commit comments

Comments
 (0)