Skip to content

Commit

Permalink
[Tech] fix sonarCloud issues
Browse files Browse the repository at this point in the history
  • Loading branch information
claire2212 committed Nov 29, 2024
1 parent b62e345 commit 1c9cad4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion frontend/src/domain/entities/missions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export type Awareness = {
themeId?: number
}

export type ControlOrSurveillance = EnvActionControl | EnvActionSurveillance
export type ControlOrSurveillance = EnvActionControl | NewEnvActionControl | EnvActionSurveillance

export type EnvActionNote = EnvActionCommonProperties & {
actionType: ActionTypeEnum.NOTE
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/features/missions/Layers/EditingMissionLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function EditingMissionLayer({ currentFeatureOver, map }: BaseMapChildren
zIndex: Layers.MISSION_SELECTED.zIndex
})
) as MutableRefObject<VectorLayerWithName>
;(editingMissionVectorLayerRef.current as VectorLayerWithName).name = Layers.MISSION_SELECTED.code
editingMissionVectorLayerRef.current.name = Layers.MISSION_SELECTED.code

const editingMissionActionsVectorSourceRef = useRef(new VectorSource()) as MutableRefObject<
VectorSource<Feature<Geometry>>
Expand All @@ -66,7 +66,7 @@ export function EditingMissionLayer({ currentFeatureOver, map }: BaseMapChildren
zIndex: Layers.ACTIONS.zIndex
})
) as MutableRefObject<VectorLayerWithName>
;(editingMissionActionsVectorLayerRef.current as VectorLayerWithName).name = Layers.ACTIONS.code
editingMissionActionsVectorLayerRef.current.name = Layers.ACTIONS.code

const feature = editingMissionVectorSourceRef.current.getFeatureById(
`${Layers.MISSION_SELECTED.code}:${activeMissionId}`
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/features/missions/Layers/HoveredMissionLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function HoveredMissionLayer({ currentFeatureOver, map }: BaseMapChildren
zIndex: Layers.HOVERED_MISSION.zIndex
})
) as MutableRefObject<VectorLayerWithName>
;(hoveredMissionVectorLayerRef.current as VectorLayerWithName).name = Layers.HOVERED_MISSION.code
hoveredMissionVectorLayerRef.current.name = Layers.HOVERED_MISSION.code

useEffect(() => {
if (map) {
Expand All @@ -39,7 +39,7 @@ export function HoveredMissionLayer({ currentFeatureOver, map }: BaseMapChildren
useEffect(() => {
hoveredMissionVectorSourceRef.current?.clear(true)
const feature = convertToFeature(currentFeatureOver)
if (feature && feature.getId()?.toString()?.includes(Layers.MISSIONS.code)) {
if (feature?.getId()?.toString()?.includes(Layers.MISSIONS.code)) {
hoveredMissionVectorSourceRef.current?.addFeature(feature)
}
}, [currentFeatureOver])
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/features/missions/Layers/SelectedMissionLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function SelectedMissionLayer({ currentFeatureOver, map }: BaseMapChildre
zIndex: Layers.MISSION_SELECTED.zIndex
})
) as MutableRefObject<VectorLayerWithName>
;(selectedMissionVectorLayerRef.current as VectorLayerWithName).name = Layers.MISSION_SELECTED.code
selectedMissionVectorLayerRef.current.name = Layers.MISSION_SELECTED.code

const selectedMissionActionsVectorSourceRef = useRef(new VectorSource()) as MutableRefObject<
VectorSource<Feature<Geometry>>
Expand All @@ -66,7 +66,7 @@ export function SelectedMissionLayer({ currentFeatureOver, map }: BaseMapChildre
})
) as MutableRefObject<VectorLayerWithName>

;(selectedMissionActionsVectorLayerRef.current as VectorLayerWithName).name = Layers.ACTIONS.code
selectedMissionActionsVectorLayerRef.current.name = Layers.ACTIONS.code

const overlayCoordinates = useAppSelector(state =>
getOverlayCoordinates(state.global, `${Layers.MISSIONS.code}:${selectedMissionIdOnMap}`)
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/features/missions/Layers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export function MissionsLayer({ map, mapClickEvent }: BaseMapChildrenProps) {
zIndex: Layers.MISSIONS.zIndex
})
) as MutableRefObject<VectorLayerWithName>
;(missionVectorLayerRef.current as VectorLayerWithName).name = Layers.MISSIONS.code
missionVectorLayerRef.current.name = Layers.MISSIONS.code

useEffect(() => {
if (map) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
getMissionStatus,
type Mission,
type NewMission,
type NewEnvActionControl
type NewEnvActionControl,
type ControlOrSurveillance
} from '../../../domain/entities/missions'
import { getTotalOfControls, getTotalOfSurveillances } from '../utils'

Expand Down Expand Up @@ -73,7 +74,7 @@ const getActionSurveillanceProperties = (action: EnvActionSurveillance) => {
}
}

const getActionProperties = (action: EnvActionControl | EnvActionSurveillance | NewEnvActionControl) => {
const getActionProperties = (action: ControlOrSurveillance) => {
switch (action.actionType) {
case ActionTypeEnum.CONTROL:
return getActionControlProperties(action)
Expand All @@ -84,7 +85,7 @@ const getActionProperties = (action: EnvActionControl | EnvActionSurveillance |
}

const getActionFeature = (
action: EnvActionControl | EnvActionSurveillance | NewEnvActionControl,
action: ControlOrSurveillance,
missionGeom: Geometry,
isEditingSurveillanceZoneOrControlPoint: boolean
) => {
Expand Down Expand Up @@ -115,7 +116,7 @@ const getActionFeature = (
return feature
}

const isActionControlOrActionSurveillance = (f): f is EnvActionControl | EnvActionSurveillance | NewEnvActionControl =>
const isActionControlOrActionSurveillance = (f): f is ControlOrSurveillance =>
f.actionType === ActionTypeEnum.CONTROL || f.actionType === ActionTypeEnum.SURVEILLANCE

export const getActionsFeatures = (mission, isEditingSurveillanceZoneOrControlPoint = false) => {
Expand Down

0 comments on commit 1c9cad4

Please sign in to comment.