Skip to content

Commit a6854a3

Browse files
committed
Merge branch 'dev' into 2.x
2 parents 3c8b321 + aedfc9e commit a6854a3

8 files changed

+483
-881
lines changed

package-lock.json

+199-637
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sealog-client-vehicle",
3-
"version": "2.3.3",
3+
"version": "2.3.4",
44
"license": "MIT",
55
"description": "Sealog Client intended for use with vehicles deployed from research vessels such as ROVs, AUVs and HOVs",
66
"bugs": {
@@ -29,10 +29,10 @@
2929
],
3030
"dependencies": {
3131
"@hapi/nes": "^13.0.1",
32-
"axios": "^1.7.5",
32+
"axios": "^1.7.7",
3333
"bootstrap": "^4.6.2",
3434
"connected-react-router": "^6.9.3",
35-
"filepond": "^4.31.2",
35+
"filepond": "^4.31.3",
3636
"highcharts": "^9.3.3",
3737
"highcharts-react-official": "^3.2.1",
3838
"jquery": "^3.7.1",
@@ -69,23 +69,23 @@
6969
"@babel/preset-env": "^7.25.4",
7070
"@babel/preset-react": "^7.24.7",
7171
"@babel/runtime": "^7.25.6",
72-
"@fontsource/roboto": "^5.0.14",
72+
"@fontsource/roboto": "^5.1.0",
7373
"@fortawesome/fontawesome-common-types": "^6.5.2",
7474
"@fortawesome/fontawesome-free": "^6.6.0",
7575
"@fortawesome/fontawesome-svg-core": "^6.6.0",
7676
"@fortawesome/free-solid-svg-icons": "^6.6.0",
7777
"@fortawesome/react-fontawesome": "^0.2.2",
78-
"babel-loader": "^9.1.3",
78+
"babel-loader": "^9.2.1",
7979
"concurrently": "^8.2.2",
8080
"copy-webpack-plugin": "^12.0.2",
8181
"css-loader": "^7.1.2",
82-
"eslint": "^8.57.0",
82+
"eslint": "^8.57.1",
8383
"eslint-config-prettier": "^9.1.0",
84-
"eslint-plugin-import": "^2.29.1",
84+
"eslint-plugin-import": "^2.30.0",
8585
"eslint-plugin-prettier": "^5.2.1",
86-
"eslint-plugin-react": "^7.35.0",
86+
"eslint-plugin-react": "^7.36.1",
8787
"eslint-plugin-react-hooks": "^4.6.2",
88-
"eslint-plugin-react-redux": "^4.1.0",
88+
"eslint-plugin-react-redux": "^4.2.0",
8989
"html-webpack-plugin": "^5.6.0",
9090
"mini-css-extract-plugin": "^2.9.1",
9191
"prettier": "3.2.5",
@@ -94,6 +94,6 @@
9494
"style-loader": "^4.0.0",
9595
"webpack": "^5.94.0",
9696
"webpack-cli": "^5.1.4",
97-
"webpack-dev-server": "^5.0.4"
97+
"webpack-dev-server": "^5.1.0"
9898
}
9999
}

src/actions/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,7 @@ export const updateLowering = (formProps) => {
908908
let fields = { ...formProps }
909909
delete fields.id
910910
delete fields.lowering_access_list
911+
delete fields.lowering_additional_meta.lowering_files
911912

912913
return async (dispatch) => {
913914
const response = await update_lowering(fields, formProps.id)

src/components/event_templates.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class EventTemplates extends Component {
127127
activeSystemPage: 1
128128
})
129129
} else {
130-
this.setState({ filteredSystemEventTemplates: null })
130+
this.setState({ filteredSystemTemplates: null })
131131
}
132132
this.handlePageSelect(1)
133133
}

src/components/lowering_gallery.js

+22-9
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import LoweringGalleryTab from './lowering_gallery_tab'
88
import LoweringModeDropdown from './lowering_mode_dropdown'
99
import { get_event_aux_data_by_lowering } from '../api'
1010
import { IMAGES_AUX_DATA_SOURCES } from '../client_settings'
11-
import { getImageUrl } from '../utils'
1211
import { _Lowerings_ } from '../vocab'
1312
import * as mapDispatchToProps from '../actions'
1413

@@ -22,6 +21,8 @@ class LoweringGallery extends Component {
2221
maxImagesPerPage: 16
2322
}
2423

24+
this.formRef = React.createRef() // Reference to the slider
25+
2526
this.handleImageCountChange = this.handleImageCountChange.bind(this)
2627
this.handleLoweringModeSelect = this.handleLoweringModeSelect.bind(this)
2728
}
@@ -64,7 +65,7 @@ class LoweringGallery extends Component {
6465

6566
image_data[data.data_array[i].data_value].images.push({
6667
event_id: data.event_id,
67-
filepath: getImageUrl(data.data_array[i + 1].data_value)
68+
filepath: data.data_array[i + 1].data_value
6869
})
6970
}
7071
})
@@ -74,18 +75,23 @@ class LoweringGallery extends Component {
7475

7576
handleImageCountChange(event) {
7677
this.setState({ maxImagesPerPage: parseInt(event.target.value) })
78+
event.currentTarget.blur()
7779
}
7880

7981
handleLoweringModeSelect(mode) {
80-
if (mode === 'Gallery') {
81-
this.props.gotoLoweringGallery(this.props.match.params.id)
82-
} else if (mode === 'Map') {
82+
if (mode === 'Map') {
8383
this.props.gotoLoweringMap(this.props.match.params.id)
8484
} else if (mode === 'Replay') {
8585
this.props.gotoLoweringReplay(this.props.match.params.id)
8686
}
8787
}
8888

89+
handleTabSelect(key, event) {
90+
if (event) {
91+
event.currentTarget.blur()
92+
}
93+
}
94+
8995
renderGalleries() {
9096
let galleries = []
9197
for (const [key, value] of Object.entries(this.state.aux_data)) {
@@ -97,7 +103,15 @@ class LoweringGallery extends Component {
97103
}
98104

99105
return galleries.length ? (
100-
<Tabs className='category-tab' variant='pills' transition={false} id='galleries' mountOnEnter={true} unmountOnExit={true}>
106+
<Tabs
107+
className='category-tab'
108+
variant='pills'
109+
transition={false}
110+
id='galleries'
111+
mountOnEnter={true}
112+
unmountOnExit={true}
113+
onSelect={this.handleTabSelect}
114+
>
101115
{galleries}
102116
</Tabs>
103117
) : (
@@ -143,9 +157,9 @@ class LoweringGallery extends Component {
143157
<FontAwesomeIcon icon='chevron-right' fixedWidth />
144158
<span className='text-warning'>{this.props.lowering.lowering_id || 'Loading...'}</span>
145159
<FontAwesomeIcon icon='chevron-right' fixedWidth />
146-
<LoweringModeDropdown onClick={this.handleLoweringModeSelect} active_mode={'Gallery'} modes={['Replay', 'Review', 'Map']} />
160+
<LoweringModeDropdown onClick={this.handleLoweringModeSelect} active_mode={'Gallery'} modes={['Replay', 'Map']} />
147161
</ButtonToolbar>
148-
<span className='float-right'>
162+
<span className='float-right' ref={this.formRef}>
149163
<Form style={{ marginTop: '-4px' }} className='float-right' inline>
150164
<Form.Group controlId='selectMaxImagesPerPage'>
151165
<Form.Control size='sm' as='select' onChange={this.handleImageCountChange}>
@@ -170,7 +184,6 @@ LoweringGallery.propTypes = {
170184
event: PropTypes.object.isRequired,
171185
eventUpdateLoweringReplay: PropTypes.func.isRequired,
172186
gotoCruiseMenu: PropTypes.func.isRequired,
173-
gotoLoweringGallery: PropTypes.func.isRequired,
174187
gotoLoweringMap: PropTypes.func.isRequired,
175188
gotoLoweringReplay: PropTypes.func.isRequired,
176189
initLowering: PropTypes.func.isRequired,

src/components/lowering_gallery_tab.js

+43-23
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,67 @@ import PropTypes from 'prop-types'
33
import { connect } from 'react-redux'
44
import { Row, Col, Card, Image } from 'react-bootstrap'
55
import CustomPagination from './custom_pagination'
6-
import { handleMissingImage } from '../utils'
6+
import { getImageUrl, handleMissingImage } from '../utils'
77
import * as mapDispatchToProps from '../actions'
88

99
class LoweringGalleryTab extends Component {
1010
constructor(props) {
1111
super(props)
1212

13-
this.divFocus = null
14-
1513
this.state = {
16-
activePage: 1
14+
activePage: 1,
15+
selectedPage: 1,
16+
paginationTimer: null
1717
}
1818

1919
this.handlePageSelect = this.handlePageSelect.bind(this)
20-
this.handleKeyPress = this.handleKeyPress.bind(this)
20+
this.handleKeyDown = this.handleKeyDown.bind(this)
2121
}
2222

2323
componentDidMount() {
24-
this.divFocus.focus()
24+
document.addEventListener('keydown', this.handleKeyDown)
25+
}
26+
27+
componentDidUpdate(prevProps) {
28+
if (prevProps.maxImagesPerPage !== this.props.maxImagesPerPage) {
29+
const currentFirstImage = (this.state.activePage - 1) * prevProps.maxImagesPerPage + 1
30+
this.handlePageSelect(Math.ceil(currentFirstImage / this.props.maxImagesPerPage))
31+
}
2532
}
2633

27-
handleKeyPress(event) {
34+
componentWillUnmount() {
35+
if (this.state.paginationTimer) {
36+
clearInterval(this.state.paginationTimer)
37+
}
38+
39+
document.removeEventListener('keydown', this.handleKeyDown)
40+
}
41+
42+
handleKeyDown(event) {
43+
if (['INPUT', 'SELECT', 'TEXTAREA'].includes(document.activeElement.tagName)) {
44+
return
45+
}
46+
2847
if (
2948
event.key === 'ArrowRight' &&
30-
this.state.activePage < Math.ceil(this.props.imagesData.images.length / this.props.maxImagesPerPage)
49+
this.state.selectedPage < Math.ceil(this.props.imagesData.images.length / this.props.maxImagesPerPage)
3150
) {
32-
this.handlePageSelect(this.state.activePage + 1)
33-
} else if (event.key === 'ArrowLeft' && this.state.activePage > 1) {
34-
this.handlePageSelect(this.state.activePage - 1)
51+
this.handlePageSelect(this.state.selectedPage + 1)
52+
} else if (event.key === 'ArrowLeft' && this.state.selectedPage > 1) {
53+
this.handlePageSelect(this.state.selectedPage - 1)
3554
}
3655
}
3756

38-
handlePageSelect(eventKey) {
39-
this.setState({ activePage: eventKey })
57+
handlePageSelect(page) {
58+
this.setState({ selectedPage: page })
59+
clearTimeout(this.state.paginationTimer)
60+
this.setState({
61+
paginationTimer: setTimeout(() => {
62+
this.setState({
63+
activePage: this.state.selectedPage
64+
})
65+
}, 250)
66+
})
4067
}
4168

4269
handleEventShowDetailsModal(event_id) {
@@ -49,7 +76,7 @@ class LoweringGalleryTab extends Component {
4976
renderImage(source, filepath, onclickFunc = null) {
5077
return (
5178
<Card className='event-image-data-card' id={`image_${source}`}>
52-
<Image fluid onClick={onclickFunc} onError={handleMissingImage} src={filepath} />
79+
<Image fluid onClick={onclickFunc} onError={handleMissingImage} src={getImageUrl(filepath)} />
5380
</Card>
5481
)
5582
}
@@ -72,20 +99,13 @@ class LoweringGalleryTab extends Component {
7299
render() {
73100
return (
74101
<React.Fragment>
75-
<Row
76-
key={`${this.props.imagesSource}_images`}
77-
tabIndex='-1'
78-
onKeyDown={this.handleKeyPress}
79-
ref={(div) => {
80-
this.divFocus = div
81-
}}
82-
>
102+
<Row key={`${this.props.imagesSource}_images`} tabIndex='-1'>
83103
{this.renderGallery(this.props.imagesSource, this.props.imagesData)}
84104
</Row>
85105
<Row key={`${this.props.imagesSource}_images_pagination`}>
86106
<CustomPagination
87107
className='mt-2'
88-
page={this.state.activePage}
108+
page={this.state.selectedPage}
89109
count={this.props.imagesData.images ? this.props.imagesData.images.length : 0}
90110
pageSelectFunc={this.handlePageSelect}
91111
maxPerPage={this.props.maxImagesPerPage}

0 commit comments

Comments
 (0)