Skip to content

Commit b78ca8b

Browse files
committed
Add comments
1 parent 584824f commit b78ca8b

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

x-pack/legacy/plugins/siem/public/lib/connectors/servicenow.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ export function getActionType(): ActionTypeModel {
8787
const ServiceNowConnectorFields: React.FunctionComponent<ActionConnectorFieldsProps<
8888
ServiceNowActionConnector
8989
>> = ({ action, editActionConfig, editActionSecrets, errors }) => {
90+
/* We do not provide defaults values to the fields (like empty string for apiUrl) intentionally.
91+
* If we do, errors will be shown the first time the flyout is open even though the user did not
92+
* interact with the form. Also, we would like to show errors for empty fields provided by the user.
93+
/*/
9094
const { apiUrl, casesConfiguration: { mapping = [] } = {} } = action.config;
9195
const { username, password } = action.secrets;
9296

@@ -153,7 +157,7 @@ const ServiceNowConnectorFields: React.FunctionComponent<ActionConnectorFieldsPr
153157
fullWidth
154158
isInvalid={isApiUrlInvalid}
155159
name="apiUrl"
156-
value={apiUrl || ''}
160+
value={apiUrl || ''} // Needed to prevent uncontrolled input error when value is undefined
157161
data-test-subj="apiUrlFromInput"
158162
placeholder="https://<instance>.service-now.com"
159163
onChange={handleOnChangeActionConfig.bind(null, 'apiUrl')}
@@ -175,7 +179,7 @@ const ServiceNowConnectorFields: React.FunctionComponent<ActionConnectorFieldsPr
175179
fullWidth
176180
isInvalid={isUsernameInvalid}
177181
name="username"
178-
value={username || ''}
182+
value={username || ''} // Needed to prevent uncontrolled input error when value is undefined
179183
data-test-subj="usernameFromInput"
180184
onChange={handleOnChangeSecretConfig.bind(null, 'username')}
181185
onBlur={handleOnBlurSecretConfig.bind(null, 'username')}
@@ -196,7 +200,7 @@ const ServiceNowConnectorFields: React.FunctionComponent<ActionConnectorFieldsPr
196200
fullWidth
197201
isInvalid={isPasswordInvalid}
198202
name="password"
199-
value={password || ''}
203+
value={password || ''} // Needed to prevent uncontrolled input error when value is undefined
200204
data-test-subj="passwordFromInput"
201205
onChange={handleOnChangeSecretConfig.bind(null, 'password')}
202206
onBlur={handleOnBlurSecretConfig.bind(null, 'password')}

x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ const ConfigureCasesComponent: React.FC = () => {
102102
});
103103
const { loading: isLoadingConnectors, connectors, refetchConnectors } = useConnectors();
104104

105+
// ActionsConnectorsContextProvider reloadConnectors prop expects a Promise<void>.
106+
// TODO: Fix it if reloadConnectors type change.
105107
const reloadConnectors = useCallback(async () => refetchConnectors(), []);
106108
const isLoadingAny = isLoadingConnectors || persistLoading || loadingCaseConfigure;
107109
const updateConnectorDisabled = isLoadingAny || !connectorIsValid || connectorId === 'none';

0 commit comments

Comments
 (0)