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

Add ES6 Modules Support #312

Merged
merged 11 commits into from
Jun 5, 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@

- Requires Grafana 10 and Grafana 11
- Removed non-context code parameters. Please update parameters to use `context`.
- Removed external scripts deprecated in Grafana 11. Use import instead.

### Features / Enhancements

- Added plugin e2e tests and remove cypress (#301)
- Updated name to Business Text Panel (#304)
- Prepared for Grafana 11 (#304)
- Added ES6 Modules Support (#312)

## 4.5.0 (2024-03-13)

Expand Down
195 changes: 23 additions & 172 deletions provisioning/dashboards/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 4,
"links": [],
"liveNow": false,
"panels": [
Expand Down Expand Up @@ -61,14 +60,17 @@
"height": 200,
"language": "markdown"
},
"editors": ["afterRender"],
"everyRow": true,
"editors": [
"afterRender"
],
"externalScripts": [],
"externalStyles": [],
"helpers": "",
"renderMode": "everyRow",
"styles": "",
"wrap": true
},
"pluginVersion": "5.0.0",
"title": "Panel Title",
"type": "marcusolsson-dynamictext-panel"
},
Expand Down Expand Up @@ -96,93 +98,11 @@
"overrides": []
},
"gridPos": {
"h": 13,
"h": 8,
"w": 12,
"x": 12,
"y": 0
},
"id": 2,
"links": [
{
"title": "https://www.chartjs.org/docs/latest/getting-started/",
"url": "https://www.chartjs.org/docs/latest/getting-started/"
}
],
"options": {
"afterRender": "const ctx = document.getElementById('myChart');\n\nnew Chart(ctx, {\n type: 'bar',\n data: {\n labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],\n datasets: [{\n label: '# of Votes',\n data: [12, 19, 3, 5, 2, 3],\n borderWidth: 1\n }]\n },\n options: {\n scales: {\n y: {\n beginAtZero: true\n }\n }\n }\n});",
"content": "<canvas id=\"myChart\"></canvas>",
"defaultContent": "The query didn't return any results.",
"editor": {
"format": "auto",
"height": 436,
"language": "markdown"
},
"editors": ["afterRender"],
"everyRow": false,
"externalScripts": [
{
"id": "03972fe9-6f7b-49cd-92e5-3fd0e6e998e0",
"url": "https://cdn.jsdelivr.net/npm/chart.js"
}
],
"externalStyles": [],
"helpers": "",
"styles": "",
"wrap": true
},
"targets": [
{
"datasource": {
"type": "marcusolsson-static-datasource",
"uid": "U0HP2Rv4z"
},
"frame": {
"fields": [
{
"config": {},
"name": "test",
"type": "string",
"values": ["test"]
}
],
"meta": {},
"name": "Test"
},
"refId": "A"
}
],
"title": "Chart.js",
"type": "marcusolsson-dynamictext-panel"
},
{
"datasource": {
"type": "marcusolsson-static-datasource",
"uid": "U0HP2Rv4z"
},
"fieldConfig": {
"defaults": {
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 8
},
"id": 1,
"options": {
"afterRender": "/**\n * Form Element\n */\nconst form = document.querySelector('#myForm');\n\n/**\n * Handle Submit\n */\nconst handleSubmit = (event) => {\n /**\n * Prevent Default submition\n */\n event.preventDefault();\n\n const formData = new FormData(event.target);\n const data = Object.fromEntries(formData);\n\n console.log(data);\n /**\n * Result: { firstName: '', lastName: '' }\n */\n\n /**\n * Your request to send form\n */\n fetch('url', {\n method: 'POST',\n body: JSON.stringify(data)\n })\n}\n\nform.addEventListener('submit', handleSubmit)\n\nreturn () => {\n form.removeEventListener('submit', handleSubmit)\n}",
Expand All @@ -193,14 +113,17 @@
"height": 200,
"language": "markdown"
},
"editors": ["afterRender"],
"everyRow": false,
"editors": [
"afterRender"
],
"externalScripts": [],
"externalStyles": [],
"helpers": "",
"renderMode": "allRows",
"styles": "",
"wrap": true
},
"pluginVersion": "5.0.0",
"targets": [
{
"datasource": {
Expand All @@ -213,7 +136,9 @@
"config": {},
"name": "test",
"type": "string",
"values": ["test"]
"values": [
"test"
]
}
],
"meta": {},
Expand All @@ -225,83 +150,6 @@
"title": "Dynamic Form",
"type": "marcusolsson-dynamictext-panel"
},
{
"datasource": {
"type": "marcusolsson-static-datasource",
"uid": "U0HP2Rv4z"
},
"fieldConfig": {
"defaults": {
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 13,
"w": 12,
"x": 12,
"y": 13
},
"id": 3,
"links": [],
"options": {
"afterRender": "mermaid.initialize({ startOnLoad: true });\n\nmermaid.run({\n querySelector: '.mermaid',\n suppressErrors: false,\n});",
"content": "<pre class=\"mermaid\">\n graph LR\n A --- B\n B-->C[fa:fa-ban {{data.0.test}}]\n B-->D(fa:fa-spinner);\n</pre>",
"defaultContent": "The query didn't return any results.",
"editor": {
"format": "auto",
"height": 436,
"language": "markdown"
},
"editors": ["afterRender"],
"everyRow": false,
"externalScripts": [
{
"id": "5d5a88bf-6198-453a-bc73-1071319a8f3a",
"url": "https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.min.js"
}
],
"externalStyles": [],
"helpers": "",
"styles": "",
"wrap": true
},
"targets": [
{
"datasource": {
"type": "marcusolsson-static-datasource",
"uid": "U0HP2Rv4z"
},
"frame": {
"fields": [
{
"config": {},
"name": "test",
"type": "string",
"values": ["test"]
}
],
"meta": {},
"name": "Test"
},
"refId": "A"
}
],
"title": "Mermaid",
"type": "marcusolsson-dynamictext-panel"
},
{
"datasource": {
"type": "grafana",
Expand Down Expand Up @@ -329,7 +177,7 @@
"h": 18,
"w": 12,
"x": 0,
"y": 16
"y": 8
},
"id": 4,
"options": {
Expand All @@ -341,14 +189,17 @@
"height": 200,
"language": "markdown"
},
"editors": ["styles"],
"everyRow": true,
"editors": [
"styles"
],
"externalScripts": [],
"externalStyles": [],
"helpers": "",
"renderMode": "everyRow",
"styles": ".container {\n display: flex;\n justify-content: center;\n font-size: 1rem;\n list-style-type: none;\n display: flex;\n gap: 20px;\n}\n\n/* <!-- Using the custom property `--i` to calculate the animation duration. --> */\nli {\n animation-name: falling;\n animation-duration: calc(var(--i) * 1s);\n}\n\n/* keyframes */\n@keyframes falling {\n 0% {\n opacity: 0;\n transform: translateY(-100px);\n }\n\n 70% {\n opacity: 1;\n }\n\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n}",
"wrap": true
},
"pluginVersion": "5.0.0",
"targets": [
{
"datasource": {
Expand All @@ -364,8 +215,7 @@
}
],
"refresh": "",
"schemaVersion": 38,
"style": "dark",
"schemaVersion": 39,
"tags": [],
"templating": {
"list": []
Expand All @@ -374,10 +224,11 @@
"from": "now-6h",
"to": "now"
},
"timeRangeUpdatedDuringEditOrView": false,
"timepicker": {},
"timezone": "",
"title": "Dynamic Text 4.2.0",
"uid": "fc33aa7b-d57e-4623-886a-4c55f46bf604",
"version": 14,
"version": 1,
"weekStart": ""
}
Loading
Loading