Skip to content
Snippets Groups Projects
Commit fec93e8b authored by Richard Haeser's avatar Richard Haeser Committed by Georg Ringer
Browse files

[TASK] Initialise graphs in Dashboard Widgets based on graphConfig

No additional classes are needed anymore to initialise
the graphs in Dashboard Widgets. If a graphConfig is given
the chart will be initialised.

Resolves: #91100
Releases: master
Change-Id: Id25d272e4287a0248d982b600f792e5e32e76445
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64220


Reviewed-by: default avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: default avatarOliver Hader <oliver.hader@typo3.org>
Reviewed-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: default avatarJonas Eberle <flightvision@googlemail.com>
Tested-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
parent 36b4e32f
Branches
Tags
No related merge requests found
...@@ -16,7 +16,7 @@ import RegularEvent = require('TYPO3/CMS/Core/Event/RegularEvent'); ...@@ -16,7 +16,7 @@ import RegularEvent = require('TYPO3/CMS/Core/Event/RegularEvent');
class ChartInitializer { class ChartInitializer {
private readonly selector: string = '.dashboard-item--chart'; private readonly selector: string = '.dashboard-item';
constructor() { constructor() {
this.initialize(); this.initialize();
...@@ -27,7 +27,7 @@ class ChartInitializer { ...@@ -27,7 +27,7 @@ class ChartInitializer {
e.preventDefault(); e.preventDefault();
const config: any = e.detail; const config: any = e.detail;
if (typeof undefined === config.graphConfig) { if (undefined === config || undefined === config.graphConfig) {
return; return;
} }
...@@ -38,7 +38,7 @@ class ChartInitializer { ...@@ -38,7 +38,7 @@ class ChartInitializer {
context = _canvas.getContext('2d'); context = _canvas.getContext('2d');
} }
if (typeof undefined === context) { if (undefined === context) {
return; return;
} }
......
...@@ -91,7 +91,6 @@ services: ...@@ -91,7 +91,6 @@ services:
title: 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.sysLogErrors.title' title: 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.sysLogErrors.title'
description: 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.sysLogErrors.description' description: 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.sysLogErrors.description'
iconIdentifier: 'content-widget-chart-bar' iconIdentifier: 'content-widget-chart-bar'
additionalCssClasses: 'dashboard-item--chart'
height: 'medium' height: 'medium'
width: 'medium' width: 'medium'
...@@ -169,7 +168,6 @@ services: ...@@ -169,7 +168,6 @@ services:
title: 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.typeOfUsers.title' title: 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.typeOfUsers.title'
description: 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.typeOfUsers.description' description: 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.typeOfUsers.description'
iconIdentifier: 'content-widget-chart-pie' iconIdentifier: 'content-widget-chart-pie'
additionalCssClasses: 'dashboard-item--chart'
height: 'medium' height: 'medium'
dashboard.widget.t3securityAdvisories: dashboard.widget.t3securityAdvisories:
......
...@@ -94,7 +94,6 @@ Together with :file:`Services.yaml`: ...@@ -94,7 +94,6 @@ Together with :file:`Services.yaml`:
# … # …
tags: tags:
- name: dashboard.widget - name: dashboard.widget
additionalCssClasses: 'dashboard-item--chart'
The configuration adds necessary CSS classes, as well as the ``dataProvider`` to use. The configuration adds necessary CSS classes, as well as the ``dataProvider`` to use.
The provider implements :php:class:`ChartDataProviderInterface` and could look like the following. The provider implements :php:class:`ChartDataProviderInterface` and could look like the following.
......
...@@ -37,7 +37,6 @@ Example ...@@ -37,7 +37,6 @@ Example
title: 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.sysLogErrors.title' title: 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.sysLogErrors.title'
description: 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.sysLogErrors.description' description: 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.sysLogErrors.description'
iconIdentifier: 'content-widget-chart-bar' iconIdentifier: 'content-widget-chart-bar'
additionalCssClasses: 'dashboard-item--chart'
height: 'medium' height: 'medium'
width: 'medium' width: 'medium'
......
...@@ -33,7 +33,6 @@ Example ...@@ -33,7 +33,6 @@ Example
title: 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.typeOfUsers.title' title: 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.typeOfUsers.title'
description: 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.typeOfUsers.description' description: 'LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widgets.typeOfUsers.description'
iconIdentifier: 'content-widget-chart-pie' iconIdentifier: 'content-widget-chart-pie'
additionalCssClasses: 'dashboard-item--chart'
height: 'medium' height: 'medium'
Options Options
......
...@@ -10,4 +10,4 @@ ...@@ -10,4 +10,4 @@
* *
* The TYPO3 project - inspiring people to share! * The TYPO3 project - inspiring people to share!
*/ */
define(["require","exports","TYPO3/CMS/Dashboard/Contrib/chartjs","TYPO3/CMS/Core/Event/RegularEvent"],(function(e,t,n,i){"use strict";return new class{constructor(){this.selector=".dashboard-item--chart",this.initialize()}initialize(){new i("widgetContentRendered",(function(e){e.preventDefault();const t=e.detail;if("undefined"===t.graphConfig)return;let i,r=this.querySelector("canvas");null!==r&&(i=r.getContext("2d")),"undefined"!==i&&new n(i,t.graphConfig)})).delegateTo(document,this.selector)}}})); define(["require","exports","TYPO3/CMS/Dashboard/Contrib/chartjs","TYPO3/CMS/Core/Event/RegularEvent"],(function(e,t,i,n){"use strict";return new class{constructor(){this.selector=".dashboard-item",this.initialize()}initialize(){new n("widgetContentRendered",(function(e){e.preventDefault();const t=e.detail;if(void 0===t||void 0===t.graphConfig)return;let n,r=this.querySelector("canvas");null!==r&&(n=r.getContext("2d")),void 0!==n&&new i(n,t.graphConfig)})).delegateTo(document,this.selector)}}}));
\ No newline at end of file \ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment