simPod / GrafanaJsonDatasource

Grafana datasource to load JSON data over your arbitrary HTTP backend
https://grafana.com/grafana/plugins/simpod-json-datasource/
MIT License
355 stars 72 forks source link

payload type is multi-select,the UI of the payload is not effective #614

Closed gx19910403 closed 4 months ago

gx19910403 commented 4 months ago

I am using POST /metrics method and setting the type attribute of objects in Payloads to multi select, but the page does not display a checkbox and the checkbox cannot display the selected options.

simPod commented 4 months ago

I don't understand the issue. Provide your payload and screenshots of what's wrong.

gx19910403 commented 4 months ago

I set the payloads' type 'to' multi select ', but the page did not take effect and the selection box was not a multiple-choice box. Here is the code: private PayloadVO getMetricGroupPayload(MetricType metricType) { PayloadVO metricGroupPayload = new PayloadVO(); metricGroupPayload.setLabel(metricType.getRemark()); metricGroupPayload.setName(metricType.getName()); metricGroupPayload.setType("multi-select"); metricGroupPayload.setPlaceholder("请选择指标"); metricGroupPayload.setReloadMetric(Boolean.FALSE); metricGroupPayload.setWidth(80); metricGroupPayload.setOptions(this.getMetricOptions(metricType)); return metricGroupPayload; }

private List getMetricOptions(MetricType metricType) { List metricOptions = new ArrayList<>(); List monitorMetricList = monitorMetricService.getMetricByTypeId(metricType.getUuid()); if (CollUtil.isNotEmpty(monitorMetricList)) { for (MonitorMetric monitorMetric : monitorMetricList) { OptionVO metricOption = new OptionVO(); metricOption.setLabel(monitorMetric.getName()); metricOption.setValue(monitorMetric.getCode()); metricOptions.add(metricOption); } } return metricOptions; }

simPod commented 4 months ago

Please provide what I asked you for.

gx19910403 commented 4 months ago

My problem has been resolved