From: Bill Erickson <berickxx@gmail.com> Date: Fri, 8 Mar 2019 17:30:26 +0000 (-0500) Subject: LP1819179 IDL2js includes 'map' attribute data X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d26ece239b3e0b703b44bc0f6b23711d4daf9fb4;p=evergreen%2Fjoelewis.git LP1819179 IDL2js includes 'map' attribute data 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> --- diff --git a/Open-ILS/src/eg2/src/app/core/pcrud.service.ts b/Open-ILS/src/eg2/src/app/core/pcrud.service.ts index f023b6d2f5..b3d4288a53 100644 --- a/Open-ILS/src/eg2/src/app/core/pcrud.service.ts +++ b/Open-ILS/src/eg2/src/app/core/pcrud.service.ts @@ -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; } diff --git a/Open-ILS/xsl/fm_IDL2js.xsl b/Open-ILS/xsl/fm_IDL2js.xsl index 6c7709f811..aeb4573f48 100644 --- a/Open-ILS/xsl/fm_IDL2js.xsl +++ b/Open-ILS/xsl/fm_IDL2js.xsl @@ -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"/>