From 7d7a01270a292eb53b54fe9dcb83cda0a0f370a9 Mon Sep 17 00:00:00 2001 From: Ruslan Galiev Date: Thu, 12 Aug 2021 09:57:52 +0300 Subject: [PATCH 1/2] Issue-208: Fixed error with custom name for Generate and Download --- .../autoFind/autoFindProvider/AutoFindProvider.jsx | 4 ++-- .../contentScripts/contextMenu/contextmenu.js | 4 ++-- src/js/blocks/autoFind/autoFindProvider/pageObject.js | 9 ++++++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/js/blocks/autoFind/autoFindProvider/AutoFindProvider.jsx b/src/js/blocks/autoFind/autoFindProvider/AutoFindProvider.jsx index baf5c30..d35de19 100644 --- a/src/js/blocks/autoFind/autoFindProvider/AutoFindProvider.jsx +++ b/src/js/blocks/autoFind/autoFindProvider/AutoFindProvider.jsx @@ -104,11 +104,11 @@ const AutoFindProvider = inject("mainModel")( }); }; - const changeElementName = (id, name) => { + const changeElementName = ({id, name}) => { setPredictedElements((previousValue) => { const renamed = previousValue.map((el) => { if (el.element_id === id) { - el.jdi_class_name = name; + el.jdi_custom_class_name = name; sendMessage.changeElementName(el); } return el; diff --git a/src/js/blocks/autoFind/autoFindProvider/contentScripts/contextMenu/contextmenu.js b/src/js/blocks/autoFind/autoFindProvider/contentScripts/contextMenu/contextmenu.js index 1a6a180..a021cec 100644 --- a/src/js/blocks/autoFind/autoFindProvider/contentScripts/contextMenu/contextmenu.js +++ b/src/js/blocks/autoFind/autoFindProvider/contentScripts/contextMenu/contextmenu.js @@ -354,11 +354,11 @@ export const runContextMenu = () => { let predictedElement; const menuItems = ( - { jdi_class_name, element_id, skipGeneration }, + { jdi_class_name, jdi_custom_class_name = null, element_id, skipGeneration }, types ) => [ { - text: `Change name: ${jdi_class_name} `, + text: `Change name: ${jdi_custom_class_name ? jdi_custom_class_name : jdi_class_name} `, events: { click: () => changeElementNameModal(element_id, jdi_class_name), }, diff --git a/src/js/blocks/autoFind/autoFindProvider/pageObject.js b/src/js/blocks/autoFind/autoFindProvider/pageObject.js index 720fc14..79a6db0 100644 --- a/src/js/blocks/autoFind/autoFindProvider/pageObject.js +++ b/src/js/blocks/autoFind/autoFindProvider/pageObject.js @@ -26,15 +26,22 @@ export const predictedToConvert = (elements) => { return f.map((e, i) => { let elementName = getElementName(e); let elementTagId = e.predictedAttrId; + let customElementName = e.jdi_custom_class_name; if (uniqueNames.indexOf(elementName) >= 0) elementName += i; if (elementTagId && uniqueNames.indexOf(elementTagId) >= 0) elementTagId += i; uniqueNames.push(elementTagId, elementName); + let name = customElementName + ? customElementName + : elementTagId + ? elementTagId + : elementName; + return { ...e, Locator: e.xpath, - Name: elementTagId ? elementTagId : elementName, + Name: name, Type: getJDILabel(e.predicted_label), parent: null, parentId: null, From ffc8569b6e8acc760912f96aa721c4f43777db49 Mon Sep 17 00:00:00 2001 From: Ruslan Galiev Date: Thu, 12 Aug 2021 10:14:01 +0300 Subject: [PATCH 2/2] Issue-208: Fixed comments and Version Up --- manifest.json | 2 +- package.json | 2 +- src/js/blocks/autoFind/autoFindProvider/pageObject.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index 1c542c7..75c5e00 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "name": "JDN", "description": "", "devtools_page": "index.html", - "version": "3.0.39", + "version": "3.0.40", "permissions": [ "activeTab", "tabs", diff --git a/package.json b/package.json index e9383ce..15353c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jdi-react-extension", - "version": "3.0.39", + "version": "3.0.40", "description": "jdi react extension", "scripts": { "start": "npm run webpack", diff --git a/src/js/blocks/autoFind/autoFindProvider/pageObject.js b/src/js/blocks/autoFind/autoFindProvider/pageObject.js index 79a6db0..78d5fa4 100644 --- a/src/js/blocks/autoFind/autoFindProvider/pageObject.js +++ b/src/js/blocks/autoFind/autoFindProvider/pageObject.js @@ -32,7 +32,7 @@ export const predictedToConvert = (elements) => { if (elementTagId && uniqueNames.indexOf(elementTagId) >= 0) elementTagId += i; uniqueNames.push(elementTagId, elementName); - let name = customElementName + const name = customElementName ? customElementName : elementTagId ? elementTagId