Skip to content

Commit 0eea073

Browse files
committed
Refactored error promise functions
1 parent b3a4e5c commit 0eea073

4 files changed

Lines changed: 31 additions & 30 deletions

File tree

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/block/view.xsl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ exclude-result-prefixes="#all"
9292
ixsl:then(ldh:rethread-response($context, ?)) =>
9393
ixsl:then(ldh:handle-response#1) =>
9494
ixsl:then(ldh:view-query-load#1)"
95-
on-failure="ldh:form-horizontal-submit-error#1"/>
95+
on-failure="ldh:promise-failure#1"/>
9696
</xsl:template>
9797

9898
<!-- hide type control -->
@@ -257,7 +257,7 @@ exclude-result-prefixes="#all"
257257
ixsl:then(ldh:rethread-response($context, ?)) =>
258258
ixsl:then(ldh:handle-response#1) =>
259259
ixsl:then(ldh:result-count-results-load#1)"
260-
on-failure="ldh:form-horizontal-submit-error#1"/>
260+
on-failure="ldh:promise-failure#1"/>
261261
</xsl:template>
262262

263263
<!-- order by -->
@@ -459,7 +459,7 @@ exclude-result-prefixes="#all"
459459
ixsl:then(ldh:rethread-response($context, ?)) =>
460460
ixsl:then(ldh:handle-response#1) =>
461461
ixsl:then(ldh:container-results-response#1)"
462-
on-failure="ldh:form-horizontal-submit-error#1"/>
462+
on-failure="ldh:promise-failure#1"/>
463463
</xsl:template>
464464

465465
<!-- $container here is the inner result container, not the content container! -->
@@ -666,7 +666,7 @@ exclude-result-prefixes="#all"
666666
ixsl:then(ldh:rethread-response($context, ?)) =>
667667
ixsl:then(ldh:handle-response#1) =>
668668
ixsl:then(ldh:facet-filter-results-load#1)"
669-
on-failure="ldh:form-horizontal-submit-error#1"/>
669+
on-failure="ldh:promise-failure#1"/>
670670
</xsl:if>
671671
</xsl:for-each>
672672
</xsl:if>
@@ -890,7 +890,7 @@ exclude-result-prefixes="#all"
890890
ixsl:then(ldh:rethread-response($context, ?)) =>
891891
ixsl:then(ldh:handle-response#1) =>
892892
ixsl:then(ldh:parallax-results-load#1)"
893-
on-failure="ldh:form-horizontal-submit-error#1"/>
893+
on-failure="ldh:promise-failure#1"/>
894894
</xsl:if>
895895
</xsl:template>
896896

@@ -963,7 +963,7 @@ exclude-result-prefixes="#all"
963963
ixsl:then(ldh:rethread-response($context, ?)) =>
964964
ixsl:then(ldh:handle-response#1) =>
965965
ixsl:then(ldh:container-object-metadata-results-load#1)"
966-
on-failure="ldh:form-horizontal-submit-error#1"/>
966+
on-failure="ldh:promise-failure#1"/>
967967
</xsl:template>
968968

969969
<!-- pager prev links -->
@@ -1205,7 +1205,7 @@ exclude-result-prefixes="#all"
12051205
ixsl:then(ldh:rethread-response($context, ?)) =>
12061206
ixsl:then(ldh:handle-response#1) =>
12071207
ixsl:then(ldh:facet-value-results-load#1)"
1208-
on-failure="ldh:form-horizontal-submit-error#1"/>
1208+
on-failure="ldh:promise-failure#1"/>
12091209
</xsl:for-each>
12101210
</xsl:when>
12111211
<xsl:otherwise>
@@ -1565,7 +1565,7 @@ exclude-result-prefixes="#all"
15651565
ixsl:then(ldh:rethread-response($context, ?)) =>
15661566
ixsl:then(ldh:handle-response#1) =>
15671567
ixsl:then(ldh:order-by-results-load#1)"
1568-
on-failure="ldh:form-horizontal-submit-error#1"/>
1568+
on-failure="ldh:promise-failure#1"/>
15691569
</xsl:if>
15701570
</xsl:for-each>
15711571
</xsl:if>
@@ -1590,7 +1590,7 @@ exclude-result-prefixes="#all"
15901590
ixsl:then(ldh:rethread-response($context, ?)) =>
15911591
ixsl:then(ldh:handle-response#1) =>
15921592
ixsl:then(ldh:container-object-metadata-results-load#1)"
1593-
on-failure="ldh:form-horizontal-submit-error#1"/>
1593+
on-failure="ldh:promise-failure#1"/>
15941594

15951595
<!-- hide progress bar -->
15961596
<xsl:for-each select="$container//div[@class = 'progress-bar']">
@@ -1704,7 +1704,7 @@ exclude-result-prefixes="#all"
17041704
ixsl:then(ldh:rethread-response($context, ?)) =>
17051705
ixsl:then(ldh:handle-response#1) =>
17061706
ixsl:then(ldh:parallax-property-load#1)"
1707-
on-failure="ldh:form-horizontal-submit-error#1"/>
1707+
on-failure="ldh:promise-failure#1"/>
17081708
</xsl:for-each-group>
17091709
</xsl:for-each>
17101710
</xsl:when>
@@ -1832,7 +1832,7 @@ exclude-result-prefixes="#all"
18321832
ixsl:then(ldh:rethread-response($context, ?)) =>
18331833
ixsl:then(ldh:handle-response#1) =>
18341834
ixsl:then(ldh:facet-value-type-load#1)"
1835-
on-failure="ldh:form-horizontal-submit-error#1"/>
1835+
on-failure="ldh:promise-failure#1"/>
18361836
</xsl:for-each>
18371837
</xsl:when>
18381838
<xsl:otherwise>

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/form.xsl

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ WHERE
696696
=> ixsl:then(ldh:rethread-response($context, ?)) (: Step 2: attach response to context :)
697697
=> ixsl:then(ldh:handle-response#1) (: Step 3: handle 429s, etc. :)
698698
=> ixsl:then(ldh:modal-form-patch-response#1)
699-
" on-failure="ldh:form-horizontal-submit-error#1"/>
699+
" on-failure="ldh:promise-failure#1"/>
700700
</xsl:template>
701701

702702
<!-- submit instance update block-form using PATCH -->
@@ -832,7 +832,7 @@ WHERE
832832
<xsl:sequence select="ldh:modal-form-submit-violation($context)"/>
833833
</xsl:when>
834834
<xsl:otherwise>
835-
<xsl:sequence select="ldh:form-horizontal-submit-error($context)"/>
835+
<xsl:sequence select="ldh:error-response-alert($context)"/>
836836
</xsl:otherwise>
837837
</xsl:choose>
838838
</xsl:function>
@@ -853,7 +853,7 @@ WHERE
853853
<xsl:sequence select="ldh:row-form-submit-violation($context)"/>
854854
</xsl:when>
855855
<xsl:otherwise>
856-
<xsl:sequence select="ldh:form-horizontal-submit-error($context)"/>
856+
<xsl:sequence select="ldh:error-response-alert($context)"/>
857857
</xsl:otherwise>
858858
</xsl:choose>
859859
</xsl:function>
@@ -878,7 +878,7 @@ WHERE
878878
<xsl:sequence select="ldh:modal-form-submit-violation($context)"/>
879879
</xsl:when>
880880
<xsl:otherwise>
881-
<xsl:sequence select="ldh:form-horizontal-submit-error($context)"/>
881+
<xsl:sequence select="ldh:error-response-alert($context)"/>
882882
</xsl:otherwise>
883883
</xsl:choose>
884884
</xsl:function>
@@ -1146,20 +1146,6 @@ WHERE
11461146

11471147
<xsl:sequence select="$context"/>
11481148
</xsl:function>
1149-
1150-
<xsl:function name="ldh:form-horizontal-submit-error" as="map(*)" ixsl:updating="yes">
1151-
<xsl:param name="context" as="map(*)"/>
1152-
<xsl:variable name="response" select="$context('response')" as="map(*)?"/>
1153-
1154-
<xsl:message>ldh:form-horizontal-submit-error <xsl:value-of select="serialize($context, map{ 'method': 'json' })"/></xsl:message>
1155-
1156-
<xsl:for-each select="$response">
1157-
<ixsl:set-style name="cursor" select="'default'" object="ixsl:page()//body"/>
1158-
<xsl:sequence select="ixsl:call(ixsl:window(), 'alert', [ ?message ])"/>
1159-
</xsl:for-each>
1160-
1161-
<xsl:sequence select="$context"/>
1162-
</xsl:function>
11631149

11641150
<xsl:function name="ldh:replace-content" as="map(*)" ixsl:updating="yes">
11651151
<xsl:param name="context" as="map(*)"/>

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/functions.xsl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,4 +503,19 @@ exclude-result-prefixes="#all"
503503
"/>
504504
</xsl:function>
505505

506+
<xsl:function name="ldh:promise-failure" ixsl:updating="yes">
507+
<xsl:param name="error" as="map(*)"/>
508+
509+
<ixsl:set-style name="cursor" select="'default'" object="ixsl:page()//body"/>
510+
<xsl:sequence select="ixsl:call(ixsl:window(), 'alert', [ $error?message ])"/>
511+
</xsl:function>
512+
513+
<xsl:function name="ldh:error-response-alert" ixsl:updating="yes">
514+
<xsl:param name="context" as="map(*)"/>
515+
<xsl:variable name="response" select="$context('response')" as="map(*)?"/>
516+
517+
<ixsl:set-style name="cursor" select="'default'" object="ixsl:page()//body"/>
518+
<xsl:sequence select="ixsl:call(ixsl:window(), 'alert', [ $response?message ])"/>
519+
</xsl:function>
520+
506521
</xsl:stylesheet>

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/map.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ exclude-result-prefixes="#all"
148148
ixsl:then(ldh:rethread-response($context, ?)) =>
149149
ixsl:then(ldh:handle-response#1) =>
150150
ixsl:then(ldh:geo-results-response#1)"
151-
on-failure="ldh:form-horizontal-submit-error#1"/>
151+
on-failure="ldh:promise-failure#1"/>
152152
</xsl:template>
153153

154154
<!-- create and render OpenLayers map -->

0 commit comments

Comments
 (0)