Skip to content

Commit

Permalink
fix: Make features clickable also when they do not have props to disp…
Browse files Browse the repository at this point in the history
…lay.
  • Loading branch information
felix-mu committed Apr 26, 2024
1 parent ec6ce51 commit 4437597
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Plugin validation
name: Plugin Validation
on:
push:
branches: [ "main" ]
Expand Down
2 changes: 1 addition & 1 deletion provisioning/dashboards/dashboard_e2e.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
},
"timepicker": {},
"timezone": "",
"title": "dashboard_e2e Copy",
"title": "dashboard_e2e",
"uid": "bdjtpgo45296ob",
"version": 5,
"weekStart": ""
Expand Down
10 changes: 6 additions & 4 deletions src/GeomapPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export class GeomapPanel extends Component<Props, State> {
}
let frame = props['frame'];
const thisLayer = layer.getProperties();
if (thisLayer.displayProperties.length > 0 && frame) { // if display properties is empty do not show tooltip
if (frame) { // if display properties is empty do not show tooltip // thisLayer.displayProperties !== undefined && thisLayer.displayProperties.length > 0 &&
for (let thisLayerName of typeof thisLayer.displayProperties !== 'undefined'
? thisLayer.displayProperties
: []) {
Expand All @@ -362,7 +362,7 @@ export class GeomapPanel extends Component<Props, State> {
}
hoverPayload.icon = thisLayer.icon ? thisLayer.icon : '';
hoverPayload.data = ttip.data = frame as DataFrame;
hoverPayload.propsToShow = propsToShow.length > 0 ? propsToShow : frame.fields;
hoverPayload.propsToShow = propsToShow.length > 0 ? propsToShow : undefined; // frame.fields;
hoverPayload.titleField = frame.fields.filter((obj: { name: any }) => {
return obj.name === thisLayer.titleField;
});
Expand All @@ -377,13 +377,15 @@ export class GeomapPanel extends Component<Props, State> {
this.hoverPayload.features = features.length ? features : undefined;

// this.map.getTargetElement().style.cursor = features.length ? 'pointer' : '';
this.map.getTargetElement().style.cursor = features.length && this.hoverPayload.data !== undefined ? 'pointer' : '';
this.map.getTargetElement().style.cursor = features.length ? 'pointer' : ''; // && this.hoverPayload.data !== undefined

this.props.eventBus.publish(this.hoverEvent);

const currentTTip = this.state.ttip;
if (ttip.data !== currentTTip?.data || ttip.rowIndex !== currentTTip?.rowIndex) {
this.setState({ ttip: { ...hoverPayload } });
if (hoverPayload.propsToShow !== undefined || hoverPayload.data === undefined) { // only update/show tooltip if data is not undefined (hovering over feature) or data is undefined (not hovering over feature)
this.setState({ ttip: { ...hoverPayload } });
}
}
};

Expand Down
3 changes: 2 additions & 1 deletion src/editor/CustomWMSBasemapEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ type Props = StandardEditorProps<ConfigUrlLayer>;
export const CustomWMSBasemapEditor = ({ item, value, onChange, context }: Props) => {
// const styles = useStyles2(getStyles);

const [url, setURL] = useState<string | undefined>(context.options.config.wms.url); // ''
const [url, setURL] = useState<string | undefined>(context.options.config.wms === undefined ||
context.options.config.wms.url === undefined ? "" : context.options.config.wms.url); // ''
const [options, setOptions] = useState<Array<SelectableValue<string>>>([]); // SelectableValue
const [selection, setSelection] = useState<Array<SelectableValue<string>>>([]);

Expand Down

0 comments on commit 4437597

Please sign in to comment.