Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/strapi-admin/admin/src/components/Webhooks/Inputs/ drwxr-xr-x | |
| Viewing file: Select action/file-type: /**
*
* Inputs
*/
import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
import { ErrorMessage, Label } from '@buffetjs/styles';
import { Error } from '@buffetjs/core';
import HeadersInput from '../HeadersInput';
import EventInput from '../EventInput';
import Wrapper from './Wrapper';
function Inputs({
error: inputError,
customError,
label,
name,
onChange,
onClick,
onRemove,
type,
validations,
value,
...rest
}) {
return (
<Wrapper>
<Label htmlFor={name}>{label}</Label>
{type === 'headers' ? (
<>
<HeadersInput
errors={customError}
name={name}
onClick={onClick}
onChange={onChange}
onRemove={onRemove}
value={value}
/>
{Object.keys(customError).length > 0 && (
<ErrorMessage>
<FormattedMessage id="components.Input.error.validation.required" />
</ErrorMessage>
)}
</>
) : (
<Error inputError={inputError} name={name} type="text" validations={validations}>
{({ canCheck, error, dispatch }) => {
const hasError = Boolean(error);
const handleChange = e => {
if (!canCheck) {
dispatch({
type: 'SET_CHECK',
});
}
dispatch({
type: 'SET_ERROR',
error: null,
});
onChange(e);
};
return (
<>
<EventInput
{...rest}
name={name}
onChange={e => {
handleChange(e);
}}
value={value}
/>
{hasError && <ErrorMessage>{error}</ErrorMessage>}
</>
);
}}
</Error>
)}
</Wrapper>
);
}
Inputs.defaultProps = {
error: null,
customError: {},
label: '',
onClick: () => {},
onRemove: () => {},
type: 'text',
validations: {},
value: null,
};
Inputs.propTypes = {
error: PropTypes.string,
customError: PropTypes.object,
label: PropTypes.string,
name: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
onClick: PropTypes.func,
onRemove: PropTypes.func,
type: PropTypes.string,
validations: PropTypes.object,
value: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
};
export default Inputs;
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0058 ]-- |