1010 /organisations/{{ organisation.organisation | urlencode }}/{{ dataset.dataset | urlencode }}/endpoint-error/{{ endpoint.endpoint | urlencode }}
1111{% endmacro %}
1212
13- {% macro lastAccessedInfo (organisation, dataset, endpoint) %}
14- {{ endpoint.lastAccessed | govukDateTime}}
15- < br >
13+ {% macro endpointUrlWithError (organisation, dataset, endpoint) %}
14+ < a style =" {{ urlStyle}} " href =" {{ endpoint.endpoint_url }} " > {{ endpoint.endpoint_url }} </ a >
15+
1616 < p class ="govuk-error-message ">
17- < a href =" {{ datasetUrl(organisation, dataset, endpoint) }} " > {{ endpointErrorMessage(endpoint) }}</ a >
17+ {{ endpointErrorMessage(endpoint) }}
1818 </ p >
19- < p class =" app-inset-text__error " > </ p >
19+
2020{% endmacro %}
2121
2222{% from "govuk/components/breadcrumbs/macro.njk" import govukBreadcrumbs %}
6666{% set rows = [
6767 {
6868 key: {
69- text: "Number of records"
69+ text: "Number of records supplied "
7070 },
7171 value: {
7272 text: stats.numberOfRecords | default(0)
103103 {% endif %}
104104 {% set _ = rows.push(alternateSourcesRow) %}
105105{% endif %}
106-
107106{% if authority !== 'some' %}
108107 {% set licenceRow = {
109108 key: {
114113 }
115114 } %}
116115 {{ rows.push(licenceRow) }}
116+ {% endif %}
117117
118+ {% set endpointCount = 0 %}
119+ {% set endpointSummaryCards = [] %}
120+ {% if authority !== 'some' %}
121+ {% set endpointCount = stats.endpoints | length %}
118122 {% for endpoint in stats.endpoints %}
119- {% set endpointRow = {
120- key: {
121- text: 'Endpoint URL',
122- classes: 'padding-top'
123- },
124- value: {
125- html: '< a style ="'+urlStyle+' " href ="'+endpoint.endpoint_url+' "> '+endpoint.endpoint_url+'</ a > '
126- },
127- classes: 'padding-top'
128- } %}
129- {{ rows.push(endpointRow) }}
130-
131- {% if endpoint.documentation_url %}
132- {% set documentationRow = {
133- key: {
134- text: 'Documentation URL'
135- },
136- value: {
137- html: '< a style ="'+urlStyle+' " href ="'+endpoint.documentation_url+' "> '+endpoint.documentation_url+'</ a > '
138- }
139- } %}
140- {{ rows.push(documentationRow) }}
141- {% endif %}
142-
123+ {% set endpointRows = [] %}
143124 {% if endpoint.error %}
144- {% set lastAccessedRow = {
145- key: {
146- text: 'Endpoint URL last accessed',
147- classes: 'app-inset-text---error'
148- },
149- value: {
150- html: lastAccessedInfo(organisation, dataset, endpoint)
151- }
152- } %}
125+ {% set _ = endpointRows.push({
126+ key: { text: "Endpoint URL" },
127+ value: { html: endpointUrlWithError(organisation, dataset, endpoint) },
128+ classes: 'app-inset-text---error dl-summary-card-list__row--error'
129+ }) %}
153130 {% else %}
154- {% set lastAccessedRow = {
155- key: {
156- text: 'Endpoint URL last accessed'
157- },
158- value: {
159- text: endpoint.lastAccessed | govukDateTime
160- }
161- } %}
131+ {% set endpointUrlHtml %}
132+ < a style ="{{ urlStyle }} " href ="{{ endpoint.endpoint_url }} "> {{ endpoint.endpoint_url }}</ a >
133+ {% endset %}
134+ {% set _ = endpointRows.push({
135+ key: { text: "Endpoint URL" },
136+ value: { html: endpointUrlHtml }
137+ }) %}
162138 {% endif %}
163139
140+ {% if not endpoint.documentation_url %}
141+ {% set _ = endpointRows.push({
142+ key: { text: "Webpage URL" },
143+ value: { html: '< p class ="govuk-error-message " > Documentation URL missing</ p > ' },
144+ classes: 'app-inset-text---error dl-summary-card-list__row--error'
145+ }) %}
146+ {% else %}
147+ {% set documentationUrlHtml %}
148+ < a style ="{{ urlStyle }} " href ="{{ endpoint.documentation_url }} "> {{ endpoint.documentation_url }}</ a >
149+ {% endset %}
150+ {% set _ = endpointRows.push({
151+ key: { text: "Webpage URL" },
152+ value: { html: documentationUrlHtml }
153+ }) %}
154+ {% endif %}
164155
165- {{ rows.push(lastAccessedRow) }}
166-
167- {% set lastUpdatedRow = {
168- key: {
169- text: 'Endpoint URL last updated'
170- },
171- value: {
172- text: endpoint.lastUpdated and ( endpoint.lastUpdated | govukDateTime )
173- }
174- } %}
175- {{ rows.push(lastUpdatedRow) }}
156+ {% set _ = endpointRows.push({
157+ key: { text: "Date added" },
158+ value: { text: endpoint.entryDate and (endpoint.entryDate | govukDateTime) }
159+ }) %}
160+ {% set _ = endpointRows.push({
161+ key: { text: "Endpoint last accessed" },
162+ value: { text: endpoint.lastAccessed and (endpoint.lastAccessed | govukDateTime) }
163+ }) %}
164+ {% set _ = endpointRows.push({
165+ key: { text: "Endpoint last updated" },
166+ value: { text: endpoint.lastUpdated and (endpoint.lastUpdated | govukDateTime) }
167+ }) %}
176168
177- {% set entryDateRow = {
178- key: {
179- text: 'Endpoint entry date'
169+ {% set endpointDisplayIndex = endpointCount - loop.index0 %}
170+ {% set _ = endpointSummaryCards.push({
171+ card: {
172+ title: { text: "Endpoint " ~ endpointDisplayIndex }
180173 },
181- value: {
182- text: endpoint.entryDate and ( endpoint.entryDate | govukDateTime )
183- }
184- } %}
185- {{ rows.push(entryDateRow) }}
186-
174+ rows: endpointRows
175+ }) %}
187176 {% endfor %}
188177{% endif %}
189178
@@ -218,6 +207,15 @@ <h2 class="govuk-heading-m govuk-visually-hidden">Map of dataset</h2>
218207 < h2 class ="govuk-heading-m "> Dataset details</ h2 >
219208 {{ govukSummaryList({ rows: rows }) }}
220209 </ section >
210+ {% if authority !== 'some' %}
211+ < section >
212+ < h2 class ="govuk-heading-m "> Active endpoints</ h2 >
213+ < p class ="govuk-body "> You have {{ endpointCount }} endpoint{% if endpointCount != 1 %}s{% endif %} we are currently checking for data.</ p >
214+ {% for endpointSummaryCard in endpointSummaryCards %}
215+ {{ govukSummaryList(endpointSummaryCard) }}
216+ {% endfor %}
217+ </ section >
218+ {% endif %}
221219 {% if authority === "some" %}
222220 {{ alternativeSourceNotice(organisation, dataset, downloadUrl, alternateSources) }}
223221 {% endif %}
@@ -266,4 +264,4 @@ <h2 class="govuk-heading-m">Dataset actions</h2>
266264 </ script >
267265 < script src ="/public/js/map.bundle.js "> </ script >
268266 {% endif %}
269- {% endblock %}
267+ {% endblock %}
0 commit comments