forked from extern/bruno
feat: using single line editors instead of input boxes
This commit is contained in:
parent
1627f65bd7
commit
9c14941c15
@ -4,6 +4,8 @@ import cloneDeep from 'lodash/cloneDeep';
|
|||||||
import { IconTrash } from '@tabler/icons';
|
import { IconTrash } from '@tabler/icons';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import { addMultipartFormParam, updateMultipartFormParam, deleteMultipartFormParam } from 'providers/ReduxStore/slices/collections';
|
import { addMultipartFormParam, updateMultipartFormParam, deleteMultipartFormParam } from 'providers/ReduxStore/slices/collections';
|
||||||
|
import SingleLineEditor from 'components/SingleLineEditor';
|
||||||
|
import { sendRequest } from 'providers/ReduxStore/slices/collections/actions';
|
||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
|
||||||
const MultipartFormParams = ({ item, collection }) => {
|
const MultipartFormParams = ({ item, collection }) => {
|
||||||
@ -19,6 +21,7 @@ const MultipartFormParams = ({ item, collection }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleRun = () => dispatch(sendRequest(item, collection.uid));
|
||||||
const handleParamChange = (e, _param, type) => {
|
const handleParamChange = (e, _param, type) => {
|
||||||
const param = cloneDeep(_param);
|
const param = cloneDeep(_param);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -82,15 +85,15 @@ const MultipartFormParams = ({ item, collection }) => {
|
|||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<SingleLineEditor
|
||||||
type="text"
|
|
||||||
autoComplete="off"
|
|
||||||
autoCorrect="off"
|
|
||||||
autoCapitalize="off"
|
|
||||||
spellCheck="false"
|
|
||||||
value={param.value}
|
value={param.value}
|
||||||
className="mousetrap"
|
onChange={(newValue) => handleParamChange({
|
||||||
onChange={(e) => handleParamChange(e, param, 'value')}
|
target: {
|
||||||
|
value: newValue
|
||||||
|
}
|
||||||
|
}, param, 'value')}
|
||||||
|
onRun={handleRun}
|
||||||
|
collection={collection}
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -4,6 +4,8 @@ import cloneDeep from 'lodash/cloneDeep';
|
|||||||
import { IconTrash } from '@tabler/icons';
|
import { IconTrash } from '@tabler/icons';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import { addQueryParam, updateQueryParam, deleteQueryParam } from 'providers/ReduxStore/slices/collections';
|
import { addQueryParam, updateQueryParam, deleteQueryParam } from 'providers/ReduxStore/slices/collections';
|
||||||
|
import SingleLineEditor from 'components/SingleLineEditor';
|
||||||
|
import { sendRequest } from 'providers/ReduxStore/slices/collections/actions';
|
||||||
|
|
||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
|
||||||
@ -20,6 +22,7 @@ const QueryParams = ({ item, collection }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleRun = () => dispatch(sendRequest(item, collection.uid));
|
||||||
const handleParamChange = (e, _param, type) => {
|
const handleParamChange = (e, _param, type) => {
|
||||||
const param = cloneDeep(_param);
|
const param = cloneDeep(_param);
|
||||||
|
|
||||||
@ -85,15 +88,15 @@ const QueryParams = ({ item, collection }) => {
|
|||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<SingleLineEditor
|
||||||
type="text"
|
|
||||||
autoComplete="off"
|
|
||||||
autoCorrect="off"
|
|
||||||
autoCapitalize="off"
|
|
||||||
spellCheck="false"
|
|
||||||
value={param.value}
|
value={param.value}
|
||||||
className="mousetrap"
|
onChange={(newValue) => handleParamChange({
|
||||||
onChange={(e) => handleParamChange(e, param, 'value')}
|
target: {
|
||||||
|
value: newValue
|
||||||
|
}
|
||||||
|
}, param, 'value')}
|
||||||
|
onRun={handleRun}
|
||||||
|
collection={collection}
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
Loading…
Reference in New Issue
Block a user