X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Flibraries%2Futils.js;fp=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Flibraries%2Futils.js;h=ec69bc41fda83a7aeeadde5b3e6120bc563a3148;hp=01e6675b6907e6f205ca0f6860048d98d5efdd8a;hb=25ceeb3e3d86705229fad71f9b6738b97ead7e36;hpb=a758451f12322559c48dd107f985742d36cec217 diff --git a/skyquake/plugins/composer/src/src/libraries/utils.js b/skyquake/plugins/composer/src/src/libraries/utils.js index 01e6675b6..ec69bc41f 100644 --- a/skyquake/plugins/composer/src/src/libraries/utils.js +++ b/skyquake/plugins/composer/src/src/libraries/utils.js @@ -1,5 +1,5 @@ /* - * + * * Copyright 2016 RIFT.IO Inc * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -71,7 +71,7 @@ export default { }, obj); resolvedObj[name] = value; }, - updatePathValue(obj, path, value) { + updatePathValue(obj, path, value, isCase) { // todo: replace implementation of assignPathValue with this impl and // remove updatePathValue (only need one function, not both) // same as assignPathValue except removes property if value is undefined @@ -92,18 +92,27 @@ export default { if (isArray) { r[p] = r[p].filter((d, i) => i !== index); } else { - delete r[p][name]; + if(isCase) { + delete r[name]; + } else { + delete r[p][name]; + } } } - return r[p]; + if(isCase) { + return r; + } else { + return r[p]; + } + }, obj); if (!isRemove) { resolvedObj[name] = value; } }, - removePathValue(obj, path) { + removePathValue(obj, path, isCase) { // note updatePathValue removes value if third argument is undefined - return this.updatePathValue(obj, path); + return this.updatePathValue(obj, path, undefined, isCase); }, suffixAsInteger: (field) => {