Skip to content

Commit

Permalink
Merge pull request #535 from digital-land/531-display-brownfield-land…
Browse files Browse the repository at this point in the history
…-datasets-as-an-option-on-the-lpa-dashboard-page

531 display brownfield land datasets as an option on the lpa dashboard page
  • Loading branch information
DilwoarH authored Oct 15, 2024
2 parents 611cc56 + fa25f97 commit dbd776c
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 27 deletions.
3 changes: 2 additions & 1 deletion config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ validations: {
datasetsFilter: [
'article-4-direction',
'article-4-direction-area',
'brownfield-land',
'conservation-area',
'conservation-area-document',
'tree-preservation-order',
'tree-preservation-zone',
'tree',
'listed-building',
'listed-building-outline'
'listed-building-outline'
]
29 changes: 22 additions & 7 deletions src/assets/js/map.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import parse from 'wellknown'
import maplibregl from 'maplibre-gl'

const fillColor = '#008'
const lineColor = '#000000'
const fillColor = '#008'
const fillOpacity = 0.4
const boundaryLineColor = '#f00'
const boundaryLineOpacity = 1
const opacity = 0.4
const pointOpacity = 0.8
const pointRadius = 5
const pointColor = '#008'

/**
* Creates a Map instance.
Expand Down Expand Up @@ -97,7 +100,7 @@ class Map {
layout: {},
paint: {
'fill-color': fillColor,
'fill-opacity': opacity
'fill-opacity': fillOpacity
}
}, this.firstMapLayerId)

Expand All @@ -117,9 +120,9 @@ class Map {
type: 'circle',
source: name,
paint: {
'circle-radius': 10,
'circle-color': fillColor,
'circle-opacity': opacity
'circle-radius': pointRadius,
'circle-color': pointColor,
'circle-opacity': pointOpacity
}
}, this.firstMapLayerId)
}
Expand All @@ -143,10 +146,22 @@ class Map {
layout: {},
paint: {
'fill-color': fillColor,
'fill-opacity': opacity
'fill-opacity': fillOpacity
}
}, this.firstMapLayerId)

this.map.addLayer({
id: `${name}-point`,
type: 'circle',
source: name,
paint: {
'circle-radius': pointRadius,
'circle-color': pointColor,
'circle-opacity': pointOpacity
},
filter: ['==', '$type', 'Point']
}, this.firstMapLayerId)

this.map.addLayer({
id: `${name}-border`,
type: 'line',
Expand Down
10 changes: 4 additions & 6 deletions src/middleware/datasetOverview.middleware.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fetchDatasetInfo, fetchLatestResource, fetchLpaDatasetIssues, fetchOrgInfo, isResourceAccessible, isResourceIdInParams, logPageError, takeResourceIdFromParams } from './common.middleware.js'
import { fetchOne, fetchIf, fetchMany, parallel, renderTemplate, FetchOptions } from './middleware.builders.js'
import { fetchOne, fetchIf, fetchMany, renderTemplate, FetchOptions } from './middleware.builders.js'
import { fetchResourceStatus } from './datasetTaskList.middleware.js'
import performanceDbApi from '../services/performanceDbApi.js'

Expand Down Expand Up @@ -173,11 +173,9 @@ const getDatasetOverview = renderTemplate(
export default [
fetchOrgInfo,
fetchDatasetInfo,
parallel([
fetchColumnSummary,
fetchResourceStatus,
fetchIf(isResourceIdInParams, fetchLatestResource, takeResourceIdFromParams)
]),
fetchColumnSummary,
fetchResourceStatus,
fetchIf(isResourceIdInParams, fetchLatestResource, takeResourceIdFromParams),
fetchIf(isResourceAccessible, fetchLpaDatasetIssues),
fetchSpecification,
pullOutDatasetSpecification,
Expand Down
8 changes: 3 additions & 5 deletions src/middleware/datasetTaskList.middleware.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fetchDatasetInfo, isResourceAccessible, isResourceNotAccessible, fetchLatestResource, fetchEntityCount, logPageError, fetchLpaDatasetIssues } from './common.middleware.js'
import { parallel, fetchOne, fetchIf, onlyIf, renderTemplate } from './middleware.builders.js'
import { fetchOne, fetchIf, onlyIf, renderTemplate } from './middleware.builders.js'
import performanceDbApi from '../services/performanceDbApi.js'
import { statusToTagClass } from '../filters/filters.js'

Expand Down Expand Up @@ -116,10 +116,8 @@ export default [
fetchOrgInfoWithStatGeo,
fetchDatasetInfo,
fetchIf(isResourceAccessible, fetchLatestResource),
parallel([
fetchIf(isResourceAccessible, fetchLpaDatasetIssues),
fetchIf(isResourceAccessible, fetchEntityCount)
]),
fetchIf(isResourceAccessible, fetchLpaDatasetIssues),
fetchIf(isResourceAccessible, fetchEntityCount),
onlyIf(isResourceAccessible, prepareDatasetTaskListTemplateParams),
onlyIf(isResourceAccessible, getDatasetTaskList),

Expand Down
10 changes: 4 additions & 6 deletions src/middleware/issueDetails.middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import performanceDbApi from '../services/performanceDbApi.js'
import logger from '../utils/logger.js'
import { types } from '../utils/logging.js'
import { fetchDatasetInfo, fetchEntityCount, fetchLatestResource, fetchOrgInfo, isResourceIdInParams, logPageError, takeResourceIdFromParams, validateQueryParams } from './common.middleware.js'
import { fetchIf, parallel, renderTemplate } from './middleware.builders.js'
import { fetchIf, renderTemplate } from './middleware.builders.js'
import * as v from 'valibot'
import { pagination } from '../utils/pagination.js'

Expand Down Expand Up @@ -291,11 +291,9 @@ export default [
fetchIf(isResourceIdInParams, fetchLatestResource, takeResourceIdFromParams),
fetchIssues,
reformatIssuesToBeByEntryNumber,
parallel([
fetchEntry,
fetchEntityCount,
fetchIssueEntitiesCount
]),
fetchEntry,
fetchEntityCount,
fetchIssueEntitiesCount,
prepareIssueDetailsTemplateParams,
getIssueDetails,
logPageError
Expand Down
15 changes: 15 additions & 0 deletions src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ export const dataSubjects = {
}
]
},
'brownfield-land': {
available: true,
dataSets: [
{
value: 'brownfield-land',
text: 'Brownfield land',
available: true
},
{
value: 'brownfield-site',
text: 'Brownfield site',
available: false
}
]
},
'conservation-area': {
available: true,
dataSets: [
Expand Down
5 changes: 3 additions & 2 deletions src/views/organisations/dataset-overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

{% set showMap = [
"article-4-direction-area",
"brownfield-land",
"conservation-area",
"listed-building",
"listed-building-outline",
Expand Down Expand Up @@ -75,9 +76,9 @@
text: "Licence"
},
value: {
text: "Open Government Licence"
text: "Open Government Licence"
}
}
}
] %}

{% for endpoint in stats.endpoints %}
Expand Down

0 comments on commit dbd776c

Please sign in to comment.