mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-03 09:25:59 +00:00
Fixed the drag & drop zone
This commit is contained in:
@@ -63,13 +63,15 @@ const DropZone = ({
|
|||||||
if (event.target === null || event.target.result === null) return;
|
if (event.target === null || event.target.result === null) return;
|
||||||
// parse function's argument looks like to be ArrayBuffer
|
// parse function's argument looks like to be ArrayBuffer
|
||||||
const keyPairs = parse(event.target.result as Buffer);
|
const keyPairs = parse(event.target.result as Buffer);
|
||||||
const newData = Object.keys(keyPairs).map((key, index) => [
|
const newData = Object.keys(keyPairs).map((key, index) => {
|
||||||
guidGenerator(),
|
return {
|
||||||
numCurrentRows + index,
|
id: guidGenerator(),
|
||||||
key,
|
pos: numCurrentRows + index,
|
||||||
keyPairs[key as keyof typeof keyPairs],
|
key: key,
|
||||||
'shared'
|
value: keyPairs[key as keyof typeof keyPairs],
|
||||||
]);
|
type: 'shared'
|
||||||
|
};
|
||||||
|
});
|
||||||
setData(newData);
|
setData(newData);
|
||||||
setButtonReady(true);
|
setButtonReady(true);
|
||||||
};
|
};
|
||||||
@@ -97,13 +99,15 @@ const DropZone = ({
|
|||||||
if (typeof result === 'string') {
|
if (typeof result === 'string') {
|
||||||
const newData = result
|
const newData = result
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.map((line: string, index: number) => [
|
.map((line: string, index: number) => {
|
||||||
guidGenerator(),
|
return {
|
||||||
numCurrentRows + index,
|
id: guidGenerator(),
|
||||||
line.split('=')[0],
|
pos: numCurrentRows + index,
|
||||||
line.split('=').slice(1, line.split('=').length).join('='),
|
key: line.split('=')[0],
|
||||||
'shared'
|
value: line.split('=').slice(1, line.split('=').length).join('='),
|
||||||
]);
|
type: 'shared'
|
||||||
|
};
|
||||||
|
});
|
||||||
setData(newData);
|
setData(newData);
|
||||||
setButtonReady(true);
|
setButtonReady(true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user