🔥 refactor(keypairListComponent): remove commented out code and unused imports for cleaner code
🐛 fix(reactflowUtils.ts): add space before key in flattenedObject to prevent ordering when adding new keys to the object
This commit is contained in:
parent
55513a34a3
commit
321024fd4c
2 changed files with 2 additions and 38 deletions
|
|
@ -19,42 +19,6 @@ export default function KeypairListComponent({
|
||||||
}
|
}
|
||||||
}, [disabled]);
|
}, [disabled]);
|
||||||
|
|
||||||
//when this feature is available, this code below must be in the parent component
|
|
||||||
// const [errorDuplicateKey, setErrorDuplicateKey] = useState(false);
|
|
||||||
// const [dict, setDict] = useState({
|
|
||||||
// key1: "value1",
|
|
||||||
// key2: "value2",
|
|
||||||
// key3: "value3",
|
|
||||||
// key4: "value4",
|
|
||||||
// key5: "value5",
|
|
||||||
// key6: "value6",
|
|
||||||
// } as {});
|
|
||||||
// const [dictArr, setDictArr] = useState([] as string[]);
|
|
||||||
|
|
||||||
// useEffect(() => {
|
|
||||||
// setDictArr(convertObjToArray(dict));
|
|
||||||
// }, [dict]);
|
|
||||||
|
|
||||||
// left === true && type === "keypairlist" ? (
|
|
||||||
// <div className="mt-2 w-full">
|
|
||||||
// <KeypairListComponent
|
|
||||||
// disabled={disabled}
|
|
||||||
// editNode={false}
|
|
||||||
// value={dictArr}
|
|
||||||
// duplicateKey={errorDuplicateKey}
|
|
||||||
// onChange={(newValue: string[]) => {
|
|
||||||
// setErrorDuplicateKey(hasDuplicateKeys(newValue));
|
|
||||||
// if(hasDuplicateKeys(newValue)){
|
|
||||||
// setDictArr(newValue);
|
|
||||||
// }
|
|
||||||
// else{
|
|
||||||
// setDict(convertArrayToObj(newValue));
|
|
||||||
// }
|
|
||||||
// }}
|
|
||||||
// />
|
|
||||||
// </div>
|
|
||||||
// )
|
|
||||||
|
|
||||||
const handleChangeKey = (event, idx) => {
|
const handleChangeKey = (event, idx) => {
|
||||||
const newInputList = _.cloneDeep(value);
|
const newInputList = _.cloneDeep(value);
|
||||||
const oldKey = Object.keys(newInputList[idx])[0];
|
const oldKey = Object.keys(newInputList[idx])[0];
|
||||||
|
|
@ -83,7 +47,7 @@ export default function KeypairListComponent({
|
||||||
<div key={idx} className="flex w-full gap-3">
|
<div key={idx} className="flex w-full gap-3">
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
value={key}
|
value={key.trim()}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
editNode ? "input-edit-node" : "",
|
editNode ? "input-edit-node" : "",
|
||||||
duplicateKey ? "input-invalid" : ""
|
duplicateKey ? "input-invalid" : ""
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,7 @@ export function convertArrayToObj(newValue) {
|
||||||
for (const obj of newValue) {
|
for (const obj of newValue) {
|
||||||
for (const key in obj) {
|
for (const key in obj) {
|
||||||
if (obj.hasOwnProperty(key)) {
|
if (obj.hasOwnProperty(key)) {
|
||||||
flattenedObject[key] = obj[key];
|
flattenedObject[' ' + key] = obj[key]; //added space to dont order when add new keys to object
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue