diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000..a59975c --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,16 @@ + +# Installing the Nullify Grafana Plugin + +The Nullify Grafana Plugin allows customers of Nullify to visualize their Nullify scan results and trends in Grafana. + +Note: This plugin can only be installed on local/on-prem instances on Grafana. Grafana Cloud is NOT currently supported. + +To install this plugin: +1. Install the plugin into your server instance following these instructions: https://grafana.com/docs/grafana/latest/administration/plugin-management/#install-plugin-on-local-grafana +2. Add a new Nullify data source. Instructions on adding a data source: https://grafana.com/docs/grafana/latest/administration/data-source-management/ +3. Follow instructions on the Nullify API Settings page to setup your Nullify API integration. +4. Import the attached dashboard JSON configuration to get started visualizing your Nullify data. Instructions on importing dashboards: https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/import-dashboards/ + +For any questions, feel free to reach out on Slack. + +Thanks for integrating with Nullify. diff --git a/example/Nullify Demo Dashboard-1707705909093.json b/example/Nullify Demo Dashboard-1707705909093.json new file mode 100644 index 0000000..f250b59 --- /dev/null +++ b/example/Nullify Demo Dashboard-1707705909093.json @@ -0,0 +1,1260 @@ +{ + "__inputs": [ + { + "name": "DS_NUL.DEV.NULLIFY.AI", + "label": "nul.dev.nullify.ai", + "description": "", + "type": "datasource", + "pluginId": "nullify-grafana-datasource", + "pluginName": "Nullify" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "panel", + "id": "barchart", + "name": "Bar chart", + "version": "" + }, + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "10.1.0" + }, + { + "type": "datasource", + "id": "nullify-grafana-datasource", + "name": "Nullify", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + } + ], + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "nullify-grafana-datasource", + "uid": "${DS_NUL.DEV.NULLIFY.AI}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "scaleDistribution": { + "type": "linear" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "S1 - CRITICAL" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-red", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "S2 - HIGH" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-orange", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "S3 - MEDIUM" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-yellow", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "S4 - LOW" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "UNKNOWN" + }, + "properties": [ + { + "id": "color", + "value": { + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Total" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "hidden" + }, + { + "id": "custom.hideFrom", + "value": { + "legend": true, + "tooltip": false, + "viz": true + } + } + ] + } + ] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 2, + "options": { + "barRadius": 0, + "barWidth": 0.97, + "fullHighlight": true, + "groupWidth": 0.7, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "orientation": "auto", + "showValue": "never", + "stacking": "normal", + "text": { + "valueSize": 12 + }, + "tooltip": { + "mode": "single", + "sort": "none" + }, + "xTickLabelRotation": 45, + "xTickLabelSpacing": 0 + }, + "targets": [ + { + "datasource": { + "type": "nullify-grafana-datasource", + "uid": "${DS_NUL.DEV.NULLIFY.AI}" + }, + "endpoint": "sast/summary", + "queryParameters": {}, + "refId": "A" + } + ], + "title": "SAST - By Language and Severity", + "transformations": [ + { + "id": "groupBy", + "options": { + "fields": { + "formatted_severity": { + "aggregations": [], + "operation": "groupby" + }, + "id": { + "aggregations": [ + "count" + ], + "operation": "aggregate" + }, + "language": { + "aggregations": [], + "operation": "groupby" + } + } + } + }, + { + "id": "groupingToMatrix", + "options": { + "columnField": "formatted_severity", + "emptyValue": "null", + "rowField": "language", + "valueField": "id (count)" + } + }, + { + "id": "calculateField", + "options": { + "mode": "reduceRow", + "reduce": { + "include": [ + "S3 - MEDIUM", + "S2 - HIGH", + "S4 - LOW", + "UNKNOWN", + "S1 - CRITICAL" + ], + "reducer": "sum" + }, + "replaceFields": false + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Total": false + }, + "indexByName": { + "S1 - CRITICAL": 6, + "S2 - HIGH": 5, + "S3 - MEDIUM": 4, + "S4 - LOW": 3, + "Total": 0, + "UNKNOWN": 2, + "language\\formatted_severity": 1 + }, + "renameByName": { + "S4 - LOW": "", + "UNKNOWN": "", + "language\\formatted_severity": "Language" + } + } + } + ], + "type": "barchart" + }, + { + "datasource": { + "type": "nullify-grafana-datasource", + "uid": "${DS_NUL.DEV.NULLIFY.AI}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 6, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "10.3.1", + "targets": [ + { + "datasource": { + "type": "nullify-grafana-datasource", + "uid": "${DS_NUL.DEV.NULLIFY.AI}" + }, + "endpoint": "secrets/events", + "queryParameters": {}, + "refId": "A" + } + ], + "title": "Secrets Detection - First committed last 7 days", + "transformations": [ + { + "id": "filterByValue", + "options": { + "filters": [ + { + "config": { + "id": "greater", + "options": { + "value": 0 + } + }, + "fieldName": "finding_firstCommitTimestamp" + } + ], + "match": "any", + "type": "include" + } + }, + { + "id": "groupBy", + "options": { + "fields": { + "finding_firstCommitTimestamp": { + "aggregations": [], + "operation": "groupby" + }, + "finding_timeStamp": { + "aggregations": [] + }, + "id": { + "aggregations": [ + "count" + ], + "operation": "aggregate" + } + } + } + } + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "nullify-grafana-datasource", + "uid": "${DS_NUL.DEV.NULLIFY.AI}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "scaleDistribution": { + "type": "linear" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 10 + }, + "id": 1, + "options": { + "barRadius": 0, + "barWidth": 0.97, + "fullHighlight": false, + "groupWidth": 0.7, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "orientation": "auto", + "showValue": "auto", + "stacking": "none", + "tooltip": { + "mode": "single", + "sort": "none" + }, + "xTickLabelRotation": 45, + "xTickLabelSpacing": 0 + }, + "pluginVersion": "10.0.3", + "targets": [ + { + "constant": 6.5, + "datasource": { + "type": "nullify-grafana-datasource", + "uid": "${DS_NUL.DEV.NULLIFY.AI}" + }, + "endpoint": "sast/summary", + "queryParameters": {}, + "refId": "A" + } + ], + "title": "SAST - By Severity", + "transformations": [ + { + "id": "groupBy", + "options": { + "fields": { + "formatted_severity": { + "aggregations": [], + "operation": "groupby" + }, + "id": { + "aggregations": [ + "count" + ], + "operation": "aggregate" + }, + "severity": { + "aggregations": [] + } + } + } + }, + { + "id": "sortBy", + "options": { + "fields": {}, + "sort": [ + { + "field": "formatted_severity" + } + ] + } + } + ], + "type": "barchart" + }, + { + "datasource": { + "type": "nullify-grafana-datasource", + "uid": "${DS_NUL.DEV.NULLIFY.AI}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 10 + }, + "id": 8, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "10.3.1", + "targets": [ + { + "datasource": { + "type": "nullify-grafana-datasource", + "uid": "${DS_NUL.DEV.NULLIFY.AI}" + }, + "endpoint": "secrets/events", + "queryParameters": {}, + "refId": "A" + } + ], + "title": "Secrets Detection - Detections last 7 days", + "transformations": [ + { + "id": "filterByValue", + "options": { + "filters": [ + { + "config": { + "id": "greater", + "options": { + "value": 0 + } + }, + "fieldName": "finding_timeStamp" + } + ], + "match": "any", + "type": "include" + } + }, + { + "id": "groupBy", + "options": { + "fields": { + "finding_firstCommitTimestamp": { + "aggregations": [] + }, + "finding_timeStamp": { + "aggregations": [], + "operation": "groupby" + }, + "id": { + "aggregations": [ + "count" + ], + "operation": "aggregate" + } + } + } + } + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "nullify-grafana-datasource", + "uid": "${DS_NUL.DEV.NULLIFY.AI}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "scaleDistribution": { + "type": "linear" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 0, + "y": 19 + }, + "id": 3, + "options": { + "barRadius": 0, + "barWidth": 0.97, + "fullHighlight": false, + "groupWidth": 0.7, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "orientation": "auto", + "showValue": "auto", + "stacking": "none", + "tooltip": { + "mode": "single", + "sort": "none" + }, + "xTickLabelMaxLength": 200, + "xTickLabelRotation": 45, + "xTickLabelSpacing": 0 + }, + "targets": [ + { + "datasource": { + "type": "nullify-grafana-datasource", + "uid": "${DS_NUL.DEV.NULLIFY.AI}" + }, + "endpoint": "sast/summary", + "queryParameters": {}, + "refId": "A" + } + ], + "title": "SAST - By CWE", + "transformations": [ + { + "id": "groupBy", + "options": { + "fields": { + "cwe": { + "aggregations": [], + "operation": "groupby" + }, + "filePath": { + "aggregations": [] + }, + "id": { + "aggregations": [ + "count" + ], + "operation": "aggregate" + } + } + } + }, + { + "id": "sortBy", + "options": { + "fields": {}, + "sort": [ + { + "field": "cwe" + } + ] + } + }, + { + "id": "convertFieldType", + "options": { + "conversions": [ + { + "destinationType": "string", + "targetField": "cwe" + } + ], + "fields": {} + } + } + ], + "type": "barchart" + }, + { + "datasource": { + "type": "nullify-grafana-datasource", + "uid": "${DS_NUL.DEV.NULLIFY.AI}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "scaleDistribution": { + "type": "linear" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 12, + "y": 19 + }, + "id": 5, + "options": { + "barRadius": 0, + "barWidth": 0.97, + "fullHighlight": false, + "groupWidth": 0.7, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "orientation": "auto", + "showValue": "auto", + "stacking": "none", + "tooltip": { + "mode": "single", + "sort": "none" + }, + "xTickLabelRotation": 45, + "xTickLabelSpacing": 0 + }, + "targets": [ + { + "datasource": { + "type": "nullify-grafana-datasource", + "uid": "${DS_NUL.DEV.NULLIFY.AI}" + }, + "endpoint": "secrets/summary", + "queryParameters": {}, + "refId": "A" + } + ], + "title": "Secret Detection - By Secret Type", + "transformations": [ + { + "id": "groupBy", + "options": { + "fields": { + "id": { + "aggregations": [ + "distinctCount" + ], + "operation": "aggregate" + }, + "secretType": { + "aggregations": [], + "operation": "groupby" + } + } + } + } + ], + "type": "barchart" + }, + { + "datasource": { + "type": "nullify-grafana-datasource", + "uid": "${DS_NUL.DEV.NULLIFY.AI}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 0, + "y": 29 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "nullify-grafana-datasource", + "uid": "${DS_NUL.DEV.NULLIFY.AI}" + }, + "endpoint": "sast/events", + "queryParameters": {}, + "refId": "A" + } + ], + "title": "SAST - Findings over time", + "type": "timeseries" + }, + { + "datasource": { + "type": "nullify-grafana-datasource", + "uid": "${DS_NUL.DEV.NULLIFY.AI}" + }, + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "text", + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "scaleDistribution": { + "type": "linear" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "numLow (sum)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "numCritical (sum)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "red", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "numMedium (sum)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "yellow", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "numHigh (sum)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "orange", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 12, + "y": 29 + }, + "id": 9, + "options": { + "barRadius": 0, + "barWidth": 0.97, + "fullHighlight": false, + "groupWidth": 0.7, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "orientation": "auto", + "showValue": "auto", + "stacking": "normal", + "tooltip": { + "mode": "single", + "sort": "none" + }, + "xTickLabelRotation": 45, + "xTickLabelSpacing": 0 + }, + "pluginVersion": "10.3.1", + "targets": [ + { + "datasource": { + "type": "nullify-grafana-datasource", + "uid": "${DS_NUL.DEV.NULLIFY.AI}" + }, + "endpoint": "sca/summary", + "queryParameters": {}, + "refId": "A" + } + ], + "title": "SCA - Open vulns by package", + "transformations": [ + { + "id": "groupBy", + "options": { + "fields": { + "numCritical": { + "aggregations": [ + "sum" + ], + "operation": "aggregate" + }, + "numHigh": { + "aggregations": [ + "sum" + ], + "operation": "aggregate" + }, + "numLow": { + "aggregations": [ + "sum" + ], + "operation": "aggregate" + }, + "numMedium": { + "aggregations": [ + "sum" + ], + "operation": "aggregate" + }, + "numVulnerabilities": { + "aggregations": [], + "operation": "aggregate" + }, + "package": { + "aggregations": [], + "operation": "groupby" + } + } + } + }, + { + "id": "organize", + "options": { + "excludeByName": {}, + "includeByName": {}, + "indexByName": { + "numCritical (sum)": 4, + "numHigh (sum)": 3, + "numLow (sum)": 1, + "numMedium (sum)": 2, + "package": 0 + }, + "renameByName": {} + } + } + ], + "type": "barchart" + } + ], + "refresh": "", + "schemaVersion": 38, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-7d", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Nullify Demo Dashboard", + "uid": "ecf0f5c8-bf81-479a-b72f-94b5c2855d04", + "version": 6, + "weekStart": "" +} \ No newline at end of file diff --git a/package.json b/package.json index cfd0ef1..1935426 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "Grafana datasource for the Nullify API", "scripts": { - "build": "webpack -c ./.config/webpack/webpack.config.ts --env production", - "dev": "webpack -w -c ./.config/webpack/webpack.config.ts --env development", + "build": "webpack -c ./webpack.config.ts --env production", + "dev": "webpack -w -c ./webpack.config.ts --env development", "test": "jest --watch --onlyChanged", "test:ci": "jest --passWithNoTests --maxWorkers 4", "typecheck": "tsc --noEmit", diff --git a/src/components/ConfigEditor.tsx b/src/components/ConfigEditor.tsx index 3b5bd59..5134a70 100644 --- a/src/components/ConfigEditor.tsx +++ b/src/components/ConfigEditor.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { DataSourceHttpSettings, Field, FieldSet, InlineField, Input, SecretInput, SecretTextArea } from '@grafana/ui'; +import { Field, FieldSet, Input, SecretTextArea } from '@grafana/ui'; import type { NullifyDataSourceOptions } from '../types'; import { DataSourcePluginOptionsEditorProps } from '@grafana/data'; import { useChangeOptions } from '../useChangeOptions'; @@ -20,23 +20,23 @@ export const ConfigEditor: React.FC = (props: any) => {
- + \ No newline at end of file diff --git a/src/img/nullify-icon-logo-classic.svg b/src/img/nullify-icon-logo-classic.svg new file mode 100644 index 0000000..2b6a6ec --- /dev/null +++ b/src/img/nullify-icon-logo-classic.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/plugin.json b/src/plugin.json index 930bc77..c30c5c4 100644 --- a/src/plugin.json +++ b/src/plugin.json @@ -1,7 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/grafana/grafana/main/docs/sources/developers/plugins/plugin.schema.json", "type": "datasource", - "name": "Nullify Grafana Datasource", + "name": "Nullify", "id": "nullify-grafana-datasource", "metrics": true, "info": { @@ -9,10 +9,10 @@ "author": { "name": "Nullify" }, - "keywords": ["datasource"], + "keywords": ["nullify"], "logos": { - "small": "img/logo.svg", - "large": "img/logo.svg" + "small": "img/nullify-icon-logo-classic.svg", + "large": "img/nullify-icon-logo-classic.svg" }, "links": [], "screenshots": [], diff --git a/src/useChangeSecureOptions.tsx b/src/useChangeSecureOptions.tsx index 6b6e939..c29cfe3 100644 --- a/src/useChangeSecureOptions.tsx +++ b/src/useChangeSecureOptions.tsx @@ -13,7 +13,7 @@ export function useChangeSecureOptions(props: DataSourcePluginOptionsEditorProps ...options, secureJsonData: { ...options.secureJsonData, - [propertyName]: event.target.value, + [propertyName]: event.target.value.trim(), }, }); }, diff --git a/webpack.config.ts b/webpack.config.ts new file mode 100644 index 0000000..1ca9fbb --- /dev/null +++ b/webpack.config.ts @@ -0,0 +1,25 @@ +// Extended webpack config from Grafana base webpack config +// https://grafana.com/developers/plugin-tools/create-a-plugin/extend-a-plugin/extend-configurations#extend-the-webpack-config + +import type { Configuration } from 'webpack'; +import { merge } from 'webpack-merge'; +import CopyWebpackPlugin from 'copy-webpack-plugin'; +import grafanaConfig from './.config/webpack/webpack.config'; + +const config = async (env): Promise => { + const baseConfig = await grafanaConfig(env); + + return merge(baseConfig, { + // Add custom config here... + plugins: [ + new CopyWebpackPlugin({ + patterns: [ + // Add your new patterns here + { from: '../INSTALL.md', to: '.', force: true }, + ], + }), + ], + }); +}; + +export default config;