Skip to content

Commit

Permalink
Merge branch 'master' of github.com:openforis/arena into feature/expr…
Browse files Browse the repository at this point in the history
…ession-editor-functions
  • Loading branch information
SteRiccio committed Sep 6, 2024
2 parents 1afd4da + 1bdeb37 commit 9305af0
Show file tree
Hide file tree
Showing 103 changed files with 765 additions and 1,120 deletions.
4 changes: 4 additions & 0 deletions core/i18n/resources/en/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Please check also the Spam/Junk mail folder.`,
By confirming, all changes will be lost.
Do you want to proceed?`,
local: 'Local',
loading: 'Loading...',
max: 'Maximum',
med: 'Median',
manage: 'Manage',
Expand Down Expand Up @@ -176,6 +177,7 @@ Do you want to proceed?`,
unique: 'Unique',
upload: 'Upload',
value: 'Value',
uploadingFile: 'Uploading file ({{progressPercent}}%)',
view: 'View',
warning: 'Warning',
warning_plural: 'Warnings',
Expand Down Expand Up @@ -820,6 +822,8 @@ Merge cannot be performed.`,
},
selectedPeriod: 'Selected period',
whisp: 'Whisp',
whispEarthMap: 'Whisp Earth Map',
whispCsv: 'Whisp CSV',
},

samplingPolygonOptions: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export default class RecordsImportJob extends Job {

if (this.total == 0) return

const userUuid = User.getUuid(this.user)

// use a batch persister to persist nodes in batch
const nodesBatchPersister = new BatchPersister(
async (nodes) =>
Expand All @@ -51,11 +53,16 @@ export default class RecordsImportJob extends Job {
// insert record
let record = await ArenaSurveyFileZip.getRecord(arenaSurveyFileZip, recordUuid)

const ownerUuid = includingUsers
? // user uuid in the db could be different by the one being imported (see UsersImportJob)
newUserUuidByOldUuid[Record.getOwnerUuid(record)]
: // ignore owner in imported file; consider current user as owner
User.getUuid(this.user)
let ownerUuid = null
if (includingUsers) {
// user uuid in the db could be different by the one being imported (see UsersImportJob);
ownerUuid = newUserUuidByOldUuid[Record.getOwnerUuid(record)]
}
if (!ownerUuid) {
// admin users are not exported (new owner uuid could be null); associate record to current user in that case
// ignore owner in imported file; consider current user as owner
ownerUuid = userUuid
}
record = Record.assocOwnerUuid(ownerUuid)(record)

await this.insertOrSkipRecord({ record, nodesBatchPersister })
Expand Down
6 changes: 0 additions & 6 deletions webapp/components/ImageProgressive/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,4 @@ ImageProgressive.propTypes = {
src: PropTypes.string.isRequired,
}

ImageProgressive.defaultProps = {
alt: undefined,
altSrc: undefined,
className: undefined,
}

export default ImageProgressive
12 changes: 1 addition & 11 deletions webapp/components/Map/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ L.Marker.prototype.options.icon = L.icon({
const INITIAL_ZOOM_LEVEL = 3

export const Map = (props) => {
const { editable, layers, markerPoint, markerTitle, showOptions } = props
const { editable = false, layers = [], markerPoint, markerTitle, showOptions = true } = props
const { centerPositionLatLon, markerPointUpdated, markerPointUpdatedToString, onMarkerPointUpdated, onSaveClick } =
useMap(props)

Expand Down Expand Up @@ -91,13 +91,3 @@ Map.propTypes = {
onMarkerPointChange: PropTypes.func,
showOptions: PropTypes.bool,
}

Map.defaultProps = {
centerPoint: null,
editable: false,
layers: [],
markerPoint: null,
markerTitle: null,
onMarkerPointChange: null,
showOptions: true,
}
6 changes: 1 addition & 5 deletions webapp/components/Map/MapLayersControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useMapContext } from './MapContext'
import { WmtsComponent } from './WmtsComponent'

export const MapLayersControl = (props) => {
const { layers } = props
const { layers = [] } = props

const user = useUser()
const surveyId = useSurveyId()
Expand Down Expand Up @@ -66,7 +66,3 @@ export const MapLayersControl = (props) => {
MapLayersControl.propTypes = {
layers: PropTypes.array,
}

MapLayersControl.defaultProps = {
layers: [],
}
9 changes: 1 addition & 8 deletions webapp/components/PanelRight/PanelRight.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { TestId } from '@webapp/utils/testId'
import { Button, ButtonIconClose } from '../buttons'

const PanelRight = (props) => {
const { children, className, header, onClose, showFooter, width } = props
const { children, className, header = '', onClose, showFooter = false, width = '500px' } = props

return ReactDOM.createPortal(
<div
Expand Down Expand Up @@ -41,11 +41,4 @@ PanelRight.propTypes = {
width: PropTypes.string, // width of the panel (e.g. '1000px' or '90vw')
}

PanelRight.defaultProps = {
className: null,
header: '',
showFooter: false,
width: '500px',
}

export default PanelRight
23 changes: 16 additions & 7 deletions webapp/components/ResizableModal/ResizableModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import './ResizableModal.scss'
import React, { useEffect, useRef } from 'react'
import ReactModal from 'react-modal-resizable-draggable'
import classNames from 'classnames'
import PropTypes from 'prop-types'

import { useI18n } from '@webapp/store/system'
import { Button, ButtonIconClose } from '../buttons'
Expand All @@ -12,9 +13,9 @@ export const ResizableModal = (props) => {
children,
className,
header: headerProp,
initHeight,
initWidth,
isOpen,
initHeight = 400,
initWidth = 600,
isOpen = true,
left,
onClose,
onDetach,
Expand Down Expand Up @@ -57,8 +58,16 @@ export const ResizableModal = (props) => {
)
}

ResizableModal.defaultProps = {
initHeight: 400,
initWidth: 600,
isOpen: true,
ResizableModal.propTypes = {
children: PropTypes.node,
className: PropTypes.string,
header: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
initHeight: PropTypes.number,
initWidth: PropTypes.number,
isOpen: PropTypes.bool,
left: PropTypes.number,
onClose: PropTypes.func,
onDetach: PropTypes.func,
onRequestClose: PropTypes.func,
top: PropTypes.number,
}
18 changes: 10 additions & 8 deletions webapp/components/ScriptEditor/ScriptEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@ const { snippetCompleter, textCompleter, keyWordCompleter } = aceLangTools
const defaultCompleters = [snippetCompleter, textCompleter, keyWordCompleter]

export const ScriptEditor = (props) => {
const { name, mode, script, completer, height, width, onChange, readOnly } = props
const {
completer = null,
height = '200px',
mode,
name,
onChange,
readOnly = false,
script,
width = 'inherit',
} = props

const editorRef = useRef()

Expand Down Expand Up @@ -72,10 +81,3 @@ ScriptEditor.propTypes = {
onChange: PropTypes.func.isRequired,
readOnly: PropTypes.bool,
}

ScriptEditor.defaultProps = {
completer: null,
height: '200px',
width: 'inherit',
readOnly: false,
}
8 changes: 1 addition & 7 deletions webapp/components/Slider/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Slider.propTypes = {
id: PropTypes.string.isRequired,
max: PropTypes.number,
min: PropTypes.number,
name: PropTypes.string,
onChange: PropTypes.func,
onMouseDown: PropTypes.func,
onMouseUp: PropTypes.func,
Expand All @@ -51,10 +52,3 @@ Slider.propTypes = {
step: PropTypes.number,
value: PropTypes.number,
}

Slider.defaultProps = {
onChange: null,
onMouseDown: null,
onMouseUp: null,
options: null,
}
34 changes: 10 additions & 24 deletions webapp/components/Table/Content/Content.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@ const Content = (props) => {
const {
cellProps,
columns,
expandableRows,
expandableRows = false,
gridTemplateColumns: gridTemplateColumnsParam,
keyExtractor,
handleSortBy,
keyExtractor,
list,
loading,
loading = false,
maxRows,
module,
noItemsLabelKey,
noItemsLabelForSearchKey,
offset,
onRowClick,
onRowDoubleClick,
totalCount,
rowHeaderComponent: rowHeaderComponentParam,
onRowClick = null,
onRowDoubleClick = null,
rowExpandedComponent = null,
rowComponent: rowComponentParam,
rowExpandedComponent,
rowProps,
selectedItems,
rowHeaderComponent: rowHeaderComponentParam,
rowProps = {},
selectedItems = [],
sort,
totalCount = undefined,
} = props

const i18n = useI18n()
Expand Down Expand Up @@ -150,18 +150,4 @@ Content.propTypes = {
totalCount: PropTypes.number,
}

Content.defaultProps = {
columns: null,
expandableRows: false,
isRowActive: null,
onRowClick: null,
onRowDoubleClick: null,
initData: null,
loading: false,
rowExpandedComponent: null,
rowProps: {},
selectedItems: [],
totalCount: undefined,
}

export default Content
6 changes: 1 addition & 5 deletions webapp/components/Table/Content/ContentRowCells.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ContentRowCell } from './ContentRowCell'
export const ContentRowCells = (props) => {
const {
active,
cellProps,
cellProps = {},
cellTestIdExtractor,
columns,
expandableRows,
Expand Down Expand Up @@ -64,7 +64,3 @@ ContentRowCells.propTypes = {
onRowExpandToggle: PropTypes.func.isRequired,
rowExpanded: PropTypes.bool,
}

ContentRowCells.defaultProps = {
cellProps: {},
}
9 changes: 2 additions & 7 deletions webapp/components/Table/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ const Header = (props) => {
const {
columns,
headerLeftComponent,
headerProps,
headerProps = {},
onVisibleColumnsChange,
totalCount,
visibleColumnsSelectionEnabled,
visibleColumnsSelectionEnabled = false,
visibleColumnKeys,
} = props

Expand Down Expand Up @@ -42,9 +42,4 @@ Header.propTypes = {
visibleColumnKeys: PropTypes.array.isRequired,
}

Header.defaultProps = {
headerProps: {},
visibleColumnsSelectionEnabled: false,
}

export default Header
Loading

0 comments on commit 9305af0

Please sign in to comment.