diff --git a/README.md b/README.md index a806d79..abe866c 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ https://corifeus.com/redis-ui --- -# 💿 The p3x-redis-ui-material web interface that connects to the p3x-redis-ui-server via http and socket.io v2024.4.176 +# 💿 The p3x-redis-ui-material web interface that connects to the p3x-redis-ui-server via http and socket.io v2024.4.177 @@ -77,7 +77,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https:// --- -[**P3X-REDIS-UI-MATERIAL**](https://corifeus.com/redis-ui-material) Build v2024.4.176 +[**P3X-REDIS-UI-MATERIAL**](https://corifeus.com/redis-ui-material) Build v2024.4.177 [![NPM](https://img.shields.io/npm/v/p3x-redis-ui-material.svg)](https://www.npmjs.com/package/p3x-redis-ui-material) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) diff --git a/package.json b/package.json index a8caa90..5b96ca3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "p3x-redis-ui-material", - "version": "2024.4.176", + "version": "2024.4.177", "description": "💿 The p3x-redis-ui-material web interface that connects to the p3x-redis-ui-server via http and socket.io", "corifeus": { "icon": "fas fa-database", diff --git a/src/angular/dialog/p3xr-dialog-connection.js b/src/angular/dialog/p3xr-dialog-connection.js index 52fb190..e251103 100644 --- a/src/angular/dialog/p3xr-dialog-connection.js +++ b/src/angular/dialog/p3xr-dialog-connection.js @@ -231,10 +231,12 @@ p3xr.ng.factory('p3xrDialogConnection', function (p3xrCommon, $mdDialog, p3xrSoc try { + const saveModel = p3xr.clone($scope.model) + //console.log('saveModel', saveModel) const response = await p3xrSocket.request({ action: 'connection-save', payload: { - model: global.p3xr.clone($scope.model) + model: saveModel }, }) p3xrCommon.toast({ diff --git a/src/core/clone.js b/src/core/clone.js index 658b8e3..c54942c 100644 --- a/src/core/clone.js +++ b/src/core/clone.js @@ -1,20 +1,18 @@ -const cloneDeepWith = require('lodash/cloneDeepWith') const isObject = require('lodash/isObject') const transform = require('lodash/transform') -function customizer(value) { - if (isObject(value)) { - // Remove keys that start with '$' - return transform(value, (result, val, key) => { - if (key !== '$$hashKey') { - result[key] = val; - } - }); - } - // For other types, no custom behavior -} +function removeHashKeys(data) { + return transform(data, (result, value, key) => { + // Exclude $$hashKey from the transformation + if (key !== '$$hashKey') { + // Recursively apply transformation for objects and arrays, else assign value directly + result[key] = isObject(value) ? removeHashKeys(value) : value; + } + }); + } + p3xr.clone = (value) => { //console.warn('clone, executed', value) - return cloneDeepWith(value, customizer) + return removeHashKeys(value) } \ No newline at end of file