LP1819179 IDL2js includes 'map' attribute data
authorBill Erickson <berickxx@gmail.com>
Fri, 8 Mar 2019 17:30:26 +0000 (12:30 -0500)
committerDan Wells <dbw2@calvin.edu>
Fri, 22 Mar 2019 20:23:36 +0000 (16:23 -0400)
Patch from Mike Rylander to teach the IDL2js generator to include 'map'
attributes, which allow JS clients to step through mapped, linked
fields, particuarly useful for auto-fleshing these fields.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/eg2/src/app/core/pcrud.service.ts
Open-ILS/xsl/fm_IDL2js.xsl

index f023b6d..b3d4288 100644 (file)
@@ -104,8 +104,11 @@ export class PcrudContext {
         }
 
         this.idl.classes[fmClass].fields
-        .filter(f => f.datatype === 'link' && !f.virtual)
-        .forEach(field => {
+        .filter(f => 
+            f.datatype === 'link' && (
+                f.reltype === 'has_a' || f.reltype === 'might_have'    
+            )
+        ).forEach(field => {
             const selector = this.idl.getLinkSelector(fmClass, field.name);
             if (!selector) { return; }
 
index 6c7709f..aeb4573 100644 (file)
@@ -58,7 +58,7 @@ for (var c in _preload_fieldmapper_IDL) {
     <xsl:if test="$f/../../idl:links/idl:link[@field=$f/@name]">type:"link",<xsl:apply-templates select="$f/../../idl:links/idl:link[@field=$f/@name]"></xsl:apply-templates>,</xsl:if>
 </xsl:template>
 
-<xsl:template match="idl:link">key:"<xsl:value-of select="@key"/>","class":"<xsl:value-of select="@class"/>",reltype:"<xsl:value-of select="@reltype"/>"</xsl:template>
+<xsl:template match="idl:link"><xsl:if test="@map != ''">map:"<xsl:value-of select="@map"/>",</xsl:if>key:"<xsl:value-of select="@key"/>","class":"<xsl:value-of select="@class"/>",reltype:"<xsl:value-of select="@reltype"/>"</xsl:template>
 
 <xsl:template name="trueFalse">
     <xsl:param name="tf"/>