Skip to content

Commit

Permalink
Beta Release 3.14.0 (#226)
Browse files Browse the repository at this point in the history
* Amend feedback links - FSR-310 (#217)

* FSR-310: Amend feedback survey links.

* FSR-310: Only display feedback link fo active warnings/alerts.

Co-authored-by: John Shields <[email protected]>

* Feature/error test (#218)

* Adding test error route

* sonarcloud

* slightly updating error logic for joi validations

* sonarcloud

* test for getError in server

* spliting error log between log and error files

* removing detail from log error

* Fix json for mocked external location search. (#221)

Co-authored-by: John Shields <[email protected]>

* Feature/fsr 332 (#219)

* added route and service data in broswer

* added data for FFOI stations

* fixed linting issues

* sorted array of values

* fine tuning

* added unit tests and size of file on html

* Sonar.....Cloud

* made changes based on feedback from show and tell

* removed unneeded npm package

* removed code smells

* Feature/fsr 333 fix (#222)

* removed forecast values not shown on the map

* csv now only has data shown on the graph

* fixed failing unit-tests

* fixed failing unit tests again

* refactor for sonar cloud

* refactored

* Feature/fsr 333 (#223)

* Accessibility amendments following from DAC review

https://eaflood.atlassian.net/browse/FSR-333

* DAC-1 - Aside fix

* DAC-2 Form label

* DAC-4 - Visual headings

* DAC-9 - Alt text removed

* DAC-12 - Bleed through

* DAC-16 - Title removed

* DAC-18 - Visual only

* OL-1 - Heading hidden and empty p tag removed

* LST 1-4 - Predictable inpout and status message

* LST 5-6 - Aria controls and urlencode

* ST-4-7 - Station page

* DAC-16 - mAOD fix

* OL-1 - Empty p tag fix

* NAV-3 - Repeatable content

* DAC-1 - Aside fix

* DAC-2 Form label

* DAC-4 - Visual headings

* DAC-9 - Alt text removed

* DAC-12 - Bleed through

* DAC-16 - Title removed

* DAC-18 - Visual only

* OL-1 - Heading hidden and empty p tag removed

* LST 1-4 - Predictable inpout and status message

* LST 5-6 - Aria controls and urlencode

* ST-4-7 - Station page

* DAC-16 - mAOD fix

* OL-1 - Empty p tag fix

* NAV-3 - Repeatable content

* removal of back button

* removed CS script casuing 404

* trying to stop sonar cloud seeing duplication

* removing text in alt tag

* removed duplicate block out to a partial

* replaced partial with different part of page

* added partial to second page to cut duplication

* Changes to address testing feedback

* updated unit test to look for historic river levels button

* linting

* added line at the end of file

Co-authored-by: danleech-defra <[email protected]>
Co-authored-by: John Shields <[email protected]>

* Release 3.14.0 prep (#225)

* Release 3.14.0 prep

* Update version number in release doc.

Co-authored-by: John Shields <[email protected]>

Co-authored-by: John Shields <[email protected]>
Co-authored-by: Tedd <[email protected]>
Co-authored-by: nikiwycherley <[email protected]>
Co-authored-by: danleech-defra <[email protected]>
  • Loading branch information
5 people authored Aug 6, 2021
1 parent f902066 commit 4ec15aa
Show file tree
Hide file tree
Showing 59 changed files with 2,388 additions and 471 deletions.
16 changes: 11 additions & 5 deletions mock/location/find.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
{
"name": "London",
"center": [ -0.12623600661754608, 51.500152587890625 ],
"bbox": [
-1.0282469032939199,
51.1557550552987,
0.8240108759451693,
51.880039887087904
"bbox2k": [
-1.03198533837149,
51.1534935075975,
0.8275523144418941,
51.88222730734423
],
"bbox10k": [
-1.1484905162767916,
51.0815544369866,
0.9440574923471953,
51.9541663063661
],
"address": "London, London",
"isEngland": { "is_england": true },
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flood-app",
"version": "3.13.0",
"version": "3.14.0",
"description": "Flood risk app",
"main": "index.js",
"repository": "github:defra/flood-app",
Expand Down
39 changes: 39 additions & 0 deletions release-docs/beta-3.14.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Service refresh release 3.14.0 Tuesday 10th August 2021

# Tickets

https://eaflood.atlassian.net/projects/FSR/versions/15493/tab/release-report-all-issues


## Release notes taken from Jira

# Release notes - FIS Service Refresh - Version Release 7

### Bug

[FSR-397] (https://eaflood.atlassian.net/browse/FSR-397) Prod issue - share links not working in live as expected

### Story

[FSR-310] (https://eaflood.atlassian.net/browse/FSR-310) Amendments to surveys on Beta service

[FSR-332] (https://eaflood.atlassian.net/browse/FSR-332) Ability to download .csv output for river/sea/groundwater page

[FSR-333] (https://eaflood.atlassian.net/browse/FSR-333) Accessibility amendments following from DAC review

[FSR-334] (https://eaflood.atlassian.net/browse/FSR-334) Amendments to river/coastal/groundwater station page to meet accessibility

[FSR-335] (https://eaflood.atlassian.net/browse/FSR-335) Amendments to river/sea/groundwater list page to meet accessibility

[FSR-352] (https://eaflood.atlassian.net/browse/FSR-352) Amendments to navigation links on Beta service

[FSR-353] (https://eaflood.atlassian.net/browse/FSR-353) Amendment to Outlook regional view

[FSR-399] (https://eaflood.atlassian.net/browse/FSR-399) Accessibility - removing back button logic from the Beta


# Webops Instructions

Execute job: LFW_{stage}_04_UPDATE_FLOOD_APP_AND_SERVICE_PIPELINE

Confirm with developers that deployment was successful.
5 changes: 5 additions & 0 deletions server/models/views/find-location.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ class ViewModel {

this.locationInput = {
label: {
text: 'Where do you want to check?',
classes: 'govuk-label--l',
isPageHeading: true
},
hint: {
text: 'Town, city or postcode in England'
},
id: 'location',
Expand Down
2 changes: 1 addition & 1 deletion server/models/views/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ViewModel {
metaDescription: `Nearby flood alerts and warnings; latest river and sea levels and flood risk advice for residents living in the ${title} area.`,
floodFisUrl,
dateFormatted: 'Up to date as of ' + moment.tz('Europe/London').format('h:mma') + ' on ' + moment.tz('Europe/London').format('D MMMM YYYY'),
feedback: true,
feedback: false,
dataError
})

Expand Down
2 changes: 1 addition & 1 deletion server/models/views/national.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ViewModel {
highestSeverityId: floods.highestSeverityId,
dateFormatted: `${moment().tz(tz).format('h:mma')} on ${moment().tz(tz).format('D MMMM YYYY')}`,
dateUTC: moment().tz(tz).format(),
feedback: true,
feedback: false,
hasWarningsRemoved: floods._groups[3].name === 4 && floods._groups[3].count > 0,
bingMaps: bingKeyMaps,
outlookTimestamp: `${formatDate(outlook._timestampOutlook, 'h:mma')} on ${formatDate(outlook._timestampOutlook, 'D MMMM YYYY')}`,
Expand Down
2 changes: 1 addition & 1 deletion server/models/views/station.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ViewModel {
*/

Object.assign(this, {
feedback: true,
feedback: false,
bingMaps: config.bingKeyMaps
})
// Group warnings/alerts by severity level
Expand Down
2 changes: 1 addition & 1 deletion server/models/views/target-area.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ViewModel {
parentAreaAlert: parentAreaAlert,
areaDescription: areaDescription,
targetArea: area.code,
feedback: true,
feedback: false,
mapTitle,
bingMaps: bingKeyMaps
}, options)
Expand Down
9 changes: 6 additions & 3 deletions server/plugins/error-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@ module.exports = {
return h.view('404').code(404)
}

// gets captured in pm2 log file, details sent to error file below
request.log('error', {
statusCode: statusCode,
data: response.data,
situation: response.message
})

// Normally a joi request query param validation error
if (statusCode === 400) {
// gets captured in pm2 error file
console.error(response)

// 400 && params input is joi error
if (statusCode === 400 && response.message === 'Invalid request params input') {
return h.view('404').code(404)
}

Expand Down
4 changes: 3 additions & 1 deletion server/plugins/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ const routes = [].concat(
require('../routes/privacy-notice'),
require('../routes/status'),
require('../routes/stations-overview'),
require('../routes/about-levels')
require('../routes/about-levels'),
require('../routes/error'),
require('../routes/station-csv')
)

module.exports = {
Expand Down
7 changes: 7 additions & 0 deletions server/routes/error.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const floodService = require('../services/flood')

module.exports = {
method: 'GET',
path: '/error',
handler: () => floodService.getError()
}
98 changes: 98 additions & 0 deletions server/routes/station-csv.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
const floodService = require('../services/flood')
const moment = require('moment-timezone')

module.exports = {
method: 'GET',
path: '/station-csv/{id}/{direction?}',
handler: async (request, h) => {
const { id } = request.params
let { direction } = request.params

direction = direction === 'downstream' ? 'd' : 'u'

const station = await floodService.getStationById(id, direction)

const stationName = station.external_name.replace(/\s/g, '-')

const [telemetry, thresholds] = await Promise.all([
floodService.getStationTelemetry(id, direction),
floodService.getStationForecastThresholds(id)
])

this.telemetry = telemetry

this.telemetry.forEach(function (item) {
item.type = 'observed'
item.ts = moment.utc(item.ts).format()
})

// Forecast station
if (thresholds.length) {
const values = await floodService.getStationForecastData(station.wiski_id)

const forecast = values.SetofValues[0].Value

const forecastData = forecast.map(item => {
const itemDate = item.$.date
const itemTime = item.$.time
const date = moment(`${itemDate} ${itemTime}`).format('YYYY-MM-DDTHH:mm') + 'Z'
return { ts: date, _: item._, type: 'forecast' }
})

// Truncate forecast data to be 36 hours from forecast creation
const forecastStart = moment(this.telemetry[0].ts)

this.truncateDate = moment(forecastStart).add(36, 'hours')

forecastData.forEach(function (value) {
value.ts = moment(value.ts)

if (value.ts.isBefore(forecastStart) || value.ts.isAfter(this.truncateDate)) {
return
}
value.ts = moment.utc(value.ts).format()

this.telemetry.push(value)
}, this)
}

this.telemetry.sort(function (a, b) {
return new Date(a.ts) - new Date(b.ts)
})

if (thresholds.length) {
this.csvString = [
[
'Timestamp (UTC)',
'Height (m)',
'Type(observed/forecast)'
],
...this.telemetry.map(item => [
item.ts,
item._,
item.type
])
]
.map(e => e.join(','))
.join('\n')
} else {
this.csvString = [
[
'Timestamp (UTC)',
'Height (m)'
],
...this.telemetry.map(item => [
item.ts,
item._
])
]
.map(e => e.join(','))
.join('\n')
}

const response = h.response(this.csvString)
response.type('text/csv')
response.header('Content-disposition', `attachment; filename=${stationName}-height-data.csv`)
return response
}
}
4 changes: 4 additions & 0 deletions server/services/flood.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,9 @@ module.exports = {
getStationsByRadius (x, y, rad) {
const param3 = rad ? `/${rad}` : ''
return util.getJson(`${serviceUrl}/stations-by-radius/${x}/${y}${param3}`)
},

getError () {
return util.getJson(`${serviceUrl}/error`)
}
}
1 change: 0 additions & 1 deletion server/src/js/components/toggle-list-display.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const ToggleListDisplay = (container, options) => {
const toggleDisplay = () => {
// Toggle Button
button.innerText = `${isExpanded ? 'Hide' : 'Show'} ${options.btnText}`
button.setAttribute('aria-expanded', isExpanded)
// Toggle list
forEach(items, (item) => {
item.style.display = isExpanded ? 'block' : 'none'
Expand Down
22 changes: 8 additions & 14 deletions server/src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,14 @@ window.flood = {
const v = window.location.search.match(new RegExp('(?:[?&]' + name + '=)([^&]+)'))
return v ? v[1] : null
},
addBrowserBackButton: () => {
const container = document.getElementById('browserBackContainer')
if (container) {
const hyperlink = document.createElement('a')
hyperlink.href = document.referrer
hyperlink.href = hyperlink.pathname + hyperlink.search
hyperlink.innerText = 'Back'
hyperlink.className = 'govuk-back-link govuk-!-margin-bottom-7 govuk-!-margin-right-2'
hyperlink.addEventListener('click', function (e) {
e.preventDefault()
window.history.back()
})
container.appendChild(hyperlink)
}
getCookie: (name) => {
const v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)')
return v ? v[2] : null
},
setCookie: (name, value, days) => {
const d = new Date()
d.setTime(d.getTime() + 24 * 60 * 60 * 1000 * days)
document.cookie = name + '=' + value + ';path=/;expires=' + d.toGMTString()
}
}
}
3 changes: 0 additions & 3 deletions server/src/js/pages/alerts-and-warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import '../components/map/layers'
import '../components/map/container'
import '../components/map/live'

// Add browser back button
window.flood.utils.addBrowserBackButton()

if (document.getElementById('map')) {
// Create LiveMap
window.flood.maps.createLiveMap('map', {
Expand Down
2 changes: 0 additions & 2 deletions server/src/js/pages/find-location.js

This file was deleted.

3 changes: 0 additions & 3 deletions server/src/js/pages/impacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@ import '../components/map/styles'
import '../components/map/layers'
import '../components/map/container'
import '../components/map/live'

// Add browser back button
window.flood.utils.addBrowserBackButton()
3 changes: 0 additions & 3 deletions server/src/js/pages/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ import '../components/map/container'
import '../components/map/live'
import '../components/map/outlook'

// Add browser back button
window.flood.utils.addBrowserBackButton()

// Create LiveMap
if (document.getElementById('map')) {
window.flood.maps.createLiveMap('map', {
Expand Down
3 changes: 0 additions & 3 deletions server/src/js/pages/river-and-sea-levels.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import '../components/map/live'
import '../components/filter'
import '../components/top-link'

// Add browser back button
window.flood.utils.addBrowserBackButton()

// Create LiveMap
if (document.getElementById('map')) {
window.flood.maps.createLiveMap('map', {
Expand Down
5 changes: 2 additions & 3 deletions server/src/js/pages/station.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import '../components/map/layers'
import '../components/map/container'
import '../components/map/live'
import '../components/toggle-list-display'
// Add browser back button
window.flood.utils.addBrowserBackButton()

// Create LiveMap
window.flood.maps.createLiveMap('map', {
btnText: 'View map',
Expand Down Expand Up @@ -61,7 +60,7 @@ if (chart) {
// Add threshold buttons
Array.from(document.querySelectorAll('.defra-flood-impact-list__value')).forEach(value => {
const button = document.createElement('button')
button.innerHTML = 'Show on chart'
button.innerHTML = 'Show on chart<span class="govuk-visually-hidden"> (Visual only)</span>'
button.className = 'defra-button-text-s'
button.addEventListener('click', function (e) {
lineChart.addThreshold({
Expand Down
3 changes: 0 additions & 3 deletions server/src/js/pages/target-area.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import '../components/map/layers'
import '../components/map/container'
import '../components/map/live'

// Add browser back button
window.flood.utils.addBrowserBackButton()

// Create LiveMap
window.flood.maps.createLiveMap('map', {
btnText: `View map of the flood ${window.flood.model.area.code.slice(4, 5).toLowerCase() === 'w' ? 'warning' : 'alert'} area`,
Expand Down
1 change: 1 addition & 0 deletions server/src/sass/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ $govuk-breakpoints: (
@import "components/context-footer";
@import "components/feedback";
@import "components/top-link";
@import "components/flood-location-link";
@import "components/toggle-list-display";
@import "components/social";

Expand Down
Loading

0 comments on commit 4ec15aa

Please sign in to comment.