Continued work to implement deep subscreen access
Showing
3 changed files
with
11 additions
and
19 deletions
| ... | @@ -1186,27 +1186,17 @@ try { | ... | @@ -1186,27 +1186,17 @@ try { |
| 1186 | // Try to construct a reasonable path based on CURRENT screen being processed (not always the original parent) | 1186 | // Try to construct a reasonable path based on CURRENT screen being processed (not always the original parent) |
| 1187 | def currentScreenPath = screenPath // This is the current screen whose subscreens we're processing | 1187 | def currentScreenPath = screenPath // This is the current screen whose subscreens we're processing |
| 1188 | 1188 | ||
| 1189 | if (currentScreenPath.contains("Catalog/Product.xml")) { | 1189 | // Generic fallback: construct based on current screen path |
| 1190 | // We're processing Product.xml's subscreens | 1190 | def lastSlash = currentScreenPath.lastIndexOf('/') |
| 1191 | actualSubScreenPath = "component://SimpleScreens/screen/SimpleScreens/Catalog/Product/${subscreenName}.xml" | 1191 | if (lastSlash > 0) { |
| 1192 | } else if (currentScreenPath.contains("Catalog.xml")) { | 1192 | def basePath = currentScreenPath.substring(0, lastSlash + 1) |
| 1193 | // We're processing Catalog.xml's subscreens | 1193 | actualSubScreenPath = basePath + subscreenName + ".xml" |
| 1194 | actualSubScreenPath = "component://SimpleScreens/screen/SimpleScreens/Catalog/${subscreenName}.xml" | ||
| 1195 | } else if (currentScreenPath.contains("PopCommerceAdmin")) { | ||
| 1196 | actualSubScreenPath = currentScreenPath.replace(".xml", "/${subscreenName}.xml") | ||
| 1197 | } else { | ||
| 1198 | // Generic fallback: construct based on current screen path | ||
| 1199 | def lastSlash = currentScreenPath.lastIndexOf('/') | ||
| 1200 | if (lastSlash > 0) { | ||
| 1201 | def basePath = currentScreenPath.substring(0, lastSlash + 1) | ||
| 1202 | actualSubScreenPath = basePath + subscreenName + ".xml" | ||
| 1203 | } | ||
| 1204 | } | 1194 | } |
| 1205 | ec.logger.info("MCP Screen Discovery: Constructed fallback subscreen location for ${subScreenEntry.key}: ${actualSubScreenPath}") | 1195 | ec.logger.info("MCP Screen Discovery: Constructed fallback subscreen location for ${subScreenEntry.key}: ${actualSubScreenPath}") |
| 1206 | } | 1196 | } |
| 1207 | 1197 | ||
| 1208 | if (actualSubScreenPath && !processedScreens.contains(actualSubScreenPath)) { | 1198 | if (actualSubScreenPath && !processedScreens.contains(actualSubScreenPath)) { |
| 1209 | ec.logger.info("MCP Screen Discovery: Processing subscreen path: ${actualSubScreenPath}") | 1199 | ec.logger.info("MCP Screen Discovery: Processing subscreen path: ${actualSubScreenPath} ${screenPath}") |
| 1210 | processScreenWithSubscreens(actualSubScreenPath, screenPath, processedScreens, toolsAccumulator, toolName, level + 1) | 1200 | processScreenWithSubscreens(actualSubScreenPath, screenPath, processedScreens, toolsAccumulator, toolName, level + 1) |
| 1211 | } else if (!actualSubScreenPath) { | 1201 | } else if (!actualSubScreenPath) { |
| 1212 | ec.logger.info("MCP Screen Discovery: Subscreen entry ${subScreenEntry.key} has no location, skipping") | 1202 | ec.logger.info("MCP Screen Discovery: Subscreen entry ${subScreenEntry.key} has no location, skipping") |
| ... | @@ -1615,7 +1605,7 @@ def startTime = System.currentTimeMillis() | ... | @@ -1615,7 +1605,7 @@ def startTime = System.currentTimeMillis() |
| 1615 | // Regular screen rendering with timeout for subscreen | 1605 | // Regular screen rendering with timeout for subscreen |
| 1616 | 1606 | ||
| 1617 | try { | 1607 | try { |
| 1618 | ec.logger.info("TESTRENDER ${subscreenPathParts} ${renderParams}") | 1608 | ec.logger.info("TESTRENDER ${subscreenName.replaceAll('_','/')} ${renderParams}") |
| 1619 | // For subscreens, the path should be relative to the parent screen that's already set as root | 1609 | // For subscreens, the path should be relative to the parent screen that's already set as root |
| 1620 | // Since we're using the parent screen as root, we only need the subscreen name part | 1610 | // Since we're using the parent screen as root, we only need the subscreen name part |
| 1621 | def testRender = screenTest.render(subscreenName.replaceAll('_','/'), renderParams, "POST") | 1611 | def testRender = screenTest.render(subscreenName.replaceAll('_','/'), renderParams, "POST") | ... | ... |
| ... | @@ -273,7 +273,7 @@ class CustomScreenTestImpl implements McpScreenTest { | ... | @@ -273,7 +273,7 @@ class CustomScreenTestImpl implements McpScreenTest { |
| 273 | // rootScreenDef is the parent screen, screenPath is the subscreen path | 273 | // rootScreenDef is the parent screen, screenPath is the subscreen path |
| 274 | screenPathList = new ArrayList<>() | 274 | screenPathList = new ArrayList<>() |
| 275 | // Add root screen path (already a full component:// path) | 275 | // Add root screen path (already a full component:// path) |
| 276 | screenPathList.add(csti.rootScreenDef.location) | 276 | //screenPathList.add(csti.rootScreenDef.location) |
| 277 | // Add subscreen path segments | 277 | // Add subscreen path segments |
| 278 | String[] pathSegments = stri.screenPath.split('/') | 278 | String[] pathSegments = stri.screenPath.split('/') |
| 279 | for (String segment in pathSegments) { | 279 | for (String segment in pathSegments) { |
| ... | @@ -316,7 +316,7 @@ class CustomScreenTestImpl implements McpScreenTest { | ... | @@ -316,7 +316,7 @@ class CustomScreenTestImpl implements McpScreenTest { |
| 316 | 316 | ||
| 317 | // do the render | 317 | // do the render |
| 318 | try { | 318 | try { |
| 319 | logger.info("Starting render for ${stri.screenPath} with root ${csti.rootScreenLocation}") | 319 | logger.info("Starting render for ${screenPathList} with root ${csti.rootScreenLocation}") |
| 320 | screenRender.render(wfs.getRequest(), wfs.getResponse()) | 320 | screenRender.render(wfs.getRequest(), wfs.getResponse()) |
| 321 | // get the response text from the WebFacadeStub | 321 | // get the response text from the WebFacadeStub |
| 322 | stri.outputString = wfs.getResponseText() | 322 | stri.outputString = wfs.getResponseText() | ... | ... |
| ... | @@ -67,6 +67,8 @@ | ... | @@ -67,6 +67,8 @@ |
| 67 | <screen-facade boundary-comments="false"> | 67 | <screen-facade boundary-comments="false"> |
| 68 | <screen-text-output type="html" mime-type="text/html" | 68 | <screen-text-output type="html" mime-type="text/html" |
| 69 | macro-template-location="template/screen-macro/ScreenHtmlMacros.ftl"/> | 69 | macro-template-location="template/screen-macro/ScreenHtmlMacros.ftl"/> |
| 70 | <screen-text-output type="markdown" mime-type="text/markdown" | ||
| 71 | macro-template-location="template/screen-macro/DefaultScreenMacros.markdown.ftl"/> | ||
| 70 | </screen-facade> | 72 | </screen-facade> |
| 71 | 73 | ||
| 72 | <!-- Test entity facade with in-memory database --> | 74 | <!-- Test entity facade with in-memory database --> | ... | ... |
-
Please register or sign in to post a comment