diff --git a/conda/js/package-lock.json b/conda/js/package-lock.json index 9664648edc44f60db64b4560faf3b8fc65e1a69e..368b8a9d828a657570a02bbf845864853f1f462a 100644 --- a/conda/js/package-lock.json +++ b/conda/js/package-lock.json @@ -5661,6 +5661,11 @@ "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", "dev": true }, + "fast-copy": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/fast-copy/-/fast-copy-1.2.2.tgz", + "integrity": "sha512-qgk7WyVVFNvUzEV/RRQfI7Y6SEjHI+SfmHpkSzzoMUpd4+uXQaeGxhz52/FjnaaNGWxuWXr5l4/kRPD8GPecGA==" + }, "fast-deep-equal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", diff --git a/conda/js/package.json b/conda/js/package.json index 120457a889e0db8f9ba44eddd606b4d19b8bcc6f..01ee1093209379241d06247f948cc992021f8ee6 100644 --- a/conda/js/package.json +++ b/conda/js/package.json @@ -84,6 +84,7 @@ "bootstrap": "^4.1.3", "classnames": "^2.2.6", "d3": "^5.5.0", + "fast-copy": "^1.2.2", "fast-levenshtein": "^2.0.6", "fuse.js": "^3.2.1", "prop-types": "^15.6.2", diff --git a/conda/js/src/components/EntityTemplateGenerationButton.jsx b/conda/js/src/components/EntityTemplateGenerationButton.jsx index 306e96771943e626fee066fd420bb424f605de20..217ccb57e5f1071fc7d4b3c04fe372870ff71d7d 100644 --- a/conda/js/src/components/EntityTemplateGenerationButton.jsx +++ b/conda/js/src/components/EntityTemplateGenerationButton.jsx @@ -11,7 +11,7 @@ import { generateAlgorithmTemplate, generateLibraryTemplate, } from '@helpers/api'; -import { jsonClone } from '@helpers'; +import { copyObj } from '@helpers'; import type { BeatEntity, BeatObject } from '@helpers/beat'; import { pluralize } from '@helpers/beat'; @@ -58,12 +58,12 @@ export default class EntityTemplateGenerationButton extends React.Component 0; - uses = jsonClone(this.props.data.contents.uses); + uses = copyObj(this.props.data.contents.uses); res = generateAlgorithmTemplate(this.props.data.name, hasParameters, uses); break; case('library'): // find the used libraries - uses = jsonClone(this.props.data.contents.uses); + uses = copyObj(this.props.data.contents.uses); res = generateLibraryTemplate(this.props.data.name, uses); break; default: diff --git a/conda/js/src/components/algorithm/AlgorithmEditor.jsx b/conda/js/src/components/algorithm/AlgorithmEditor.jsx index d8d1900d157226b847bc8e66b1c5f827fd6bde25..4b7832063be6901946065e46ed0336993178fcae 100644 --- a/conda/js/src/components/algorithm/AlgorithmEditor.jsx +++ b/conda/js/src/components/algorithm/AlgorithmEditor.jsx @@ -17,7 +17,7 @@ import { connect } from 'react-redux'; import cn from 'classnames'; -import { changeObjFieldName, generateNewKey, jsonClone } from '@helpers'; +import { changeObjFieldName, generateNewKey, copyObj } from '@helpers'; import { algorithmValidator, BUILTIN_TYPES, ANALYZER_RESULT_TYPES, getValidAlgorithmObj as getValidObj } from '@helpers/beat'; import type { AlgorithmValidatorObject, BeatObject } from '@helpers/beat'; @@ -131,7 +131,7 @@ export class AlgorithmEditor extends React.Component { // updates an old group object to a new group object updateGroup = (oldGroup: Group, newGroup: Group) => { const gIdx = this.props.data.contents.groups.findIndex(g => JSON.stringify(g) === JSON.stringify(oldGroup)); - const newGroups = jsonClone(this.props.data.contents.groups); + const newGroups = copyObj(this.props.data.contents.groups); newGroups[gIdx] = newGroup; this.changeContentsVal('groups', newGroups); } @@ -142,7 +142,7 @@ export class AlgorithmEditor extends React.Component { // renames a parameter (provide name & value & the old name) // deletes a parameter (provide null as name, value is optional, the name) updateParameter = (name: null | string, value: any, oldName: ?string) => { - const params = jsonClone(this.props.data.contents.parameters); + const params = copyObj(this.props.data.contents.parameters); if(oldName) delete params[oldName]; if(name !== null) @@ -159,7 +159,7 @@ export class AlgorithmEditor extends React.Component { // toggles the algorithm to an analyzer algorithm changeToAnalyzer = () => { - const contents = jsonClone(this.props.data.contents); + const contents = copyObj(this.props.data.contents); contents.groups = contents.groups.map(g => { delete g['outputs']; return g; @@ -177,7 +177,7 @@ export class AlgorithmEditor extends React.Component { // toggles the algorithm to a normal algorithm changeToNormal = () => { - const contents = jsonClone(this.props.data.contents); + const contents = copyObj(this.props.data.contents); delete contents.results; if(contents.groups.length > 0) contents.groups[0].outputs = {}; diff --git a/conda/js/src/components/database/DatabaseEditor.jsx b/conda/js/src/components/database/DatabaseEditor.jsx index 02d3b9ad65de1b44b37176dd249866ca6eea5cdc..b7f506e88fb082a6d2ed431411ec39429537682b 100644 --- a/conda/js/src/components/database/DatabaseEditor.jsx +++ b/conda/js/src/components/database/DatabaseEditor.jsx @@ -29,7 +29,7 @@ import { connect } from 'react-redux'; import './DatabaseEditor.css'; -import { changeObjFieldName, jsonClone } from '@helpers'; +import { changeObjFieldName, copyObj } from '@helpers'; import { getValidDatabaseObj as getValidObj } from '@helpers/beat'; import type { BeatObject } from '@helpers/beat'; @@ -209,7 +209,7 @@ export class DatabaseEditor extends React.Component {