Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2913_Filter_SIDC_should_not_an_edit_field #2989

Merged
merged 15 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const IconRenderer: React.FC<IconRendererProps> = ({ feature, checked, color, on
const health = feature.properties?.health

const healthColor = calculateHealthColor(health)

return <div className={styles['asset-icon']}>
{get(feature, 'properties._type') === RENDERER_CORE
? <FontAwesomeIcon icon={faShapes} color={color} fontSize={25} />
Expand Down
10 changes: 8 additions & 2 deletions client/src/Components/local/atoms/mapping-panel/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable complexity */
import { faArrowAltCircleLeft, faWindowMaximize, faWindowMinimize } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { Checkbox, FormControlLabel } from '@material-ui/core'
Expand Down Expand Up @@ -339,6 +340,11 @@ export const MappingPanel: React.FC<MappingPanelProps> = ({ onClose, features, r
let filteringValue: any[] = [] // Explicitly type as an array of any[]
if (Array.isArray(propertyValue)) {
itemPropValue = propertyValue
} else if (filterKey === 'sidc') {
const { success, sidc } = handleSidcValue(propertyValue)
if (success) {
itemPropValue.push(sidc)
}
} else {
itemPropValue.push(propertyValue)
}
Expand All @@ -352,13 +358,13 @@ export const MappingPanel: React.FC<MappingPanelProps> = ({ onClose, features, r
orFoundKey[filterKey] = (filteringValueStr.includes(itemValueStr) || itemValueStr.includes(filteringValueStr)) && !!itemValueStr
}
})

return Object.values(orFoundKey).every(f => f)
})
const isSelectedFeatureFilterOut = cloneFeature.features.some(f => get(f, 'properties.id', '') === get(selectedFeature, 'properties.id', ''))
if (!isSelectedFeatureFilterOut) {
clearSelectedFeature()
}
}
setFilterFeatureIds(getAllFeatureIds(cloneFeature))
setFilteredFeatures(cloneFeature)
}, [features, selectedFiltersProps])
Expand Down
10 changes: 8 additions & 2 deletions client/src/Components/local/molecules/sidc-generator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'leaflet/dist/leaflet.css'
import renderDropdown from './helpers/renderDeopdown'
import useStyles from './helpers/SidcGeneratorStyles'
import PropsTypes from './PropsTypes/types'
import { CUSTOM_SIDC } from 'src/config'
import replaceNumber from './helpers/replace-number'
import { dropdownOptions } from './helpers/SharedData'

Expand All @@ -26,8 +27,13 @@ const SIDCGenerator: React.FC<PropsTypes> = (props) => {
}, [originalNumber])

useEffect(() => {
setSymbolCode(sidcValue[4] + sidcValue[5])
setOriginalNumber(sidcValue)
if (sidcValue && sidcValue.length >= 6) {
setSymbolCode(sidcValue[4] + sidcValue[5])
} else {
console.warn('sidcValue is either undefined or too short')
setSymbolCode('')
}
setOriginalNumber(sidcValue || CUSTOM_SIDC)
}, [sidcValue])

const handleSave = () => {
Expand Down
Loading