diff options
author | dizzy <diosmosis@users.noreply.github.com> | 2021-12-13 17:00:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-13 17:00:50 +0300 |
commit | ae5d20834cec4dffccb669661a45ffe459878452 (patch) | |
tree | f117d2b261a656213bf10f9eff213c27e3280214 /plugins/CoreHome/angularjs | |
parent | 9c83ceff60b8eddd39f54d95145adff481bbdd46 (diff) |
[Vue] migrate piwik-widget and related directives (#18429)
* more fixes
* even more fixes
* another ui test fix
* more type fixes
* rebuilt vue JS
* couple more fixes
* undo debugging
* do not convert undefined to bool
* update screenshot
* another bool checking fix
* rebuild vue files
* more fixes
* initial site value in field is assumed to be encoded
* file headers and custom field component support
* get custom component field code to work
* rebuild vue
* allow using angularjs templateFile for custom field (for BC)
* get angularjs template embedding to work for rollupreporting at least
* deal with some in source TODO items
* fix a couple more issues
* Use separate div in modals to display notifications otherwise Vue will erase modal content when initializing NotificationGroup component.
* build again
* refactor some code and fix an issue with checkbox array field handling in angularjs
* more fixes
* another fix
* even more fixes
* remove more todo
* hopefully the last changes
* update vue files
* update submodule
* revert debugging change + fix issue
* built vue files
* fix another select issue
* rebuild vue files
* fix broken refactor
* update two screenshots
* add some more timeouts and update screenshots
* initial conversion, loading w/o error
* tweaks
* get period selector work in UI
* fix site selector model binding
* rebuild vue
* fix viewDate not being kept in sync
* rebuild CoreHome
* [Vue] fix modal notification placement (#18377)
* Use separate div in modals to display notifications otherwise Vue will erase modal content when initializing NotificationGroup component.
* built vue files
* two fixes
* couple UI test fixes
* rebuild vue
* update files
* sidenav start
* make getRef a utility method
* tweak
* add return type
* finish converting side-nav directive
* starting on reporting menu conversion
* remove unused properties
* convert reporting pages service
* migrate report metadata store
* remove angularjs files
* migrating reporting pages store
* make store adapters more immutable
* get service adapters to work
* fix a UI test
* another html fix
* migrate most of reporting menu directive and model
* Use themed font family for input forms to override materialize.css styling
* rebuild vue
* add a missing div
* ui test fixes
* update styling
* get to build
* get to load in the UI w/o error
* clone result of functions
* fix compile issue
* migrate widget loader and get to load in UI
* rebuild vue
* migrate widgetcontainer
* migrate widget bydimension container
* migrate widget + add tooltips directive
* quick fix
* Updating version to 4.6.0
* loading in page
* update expected screenshot
* add wait just in case travis is slow
* fix ordering bug
* add another wait
* rebuild vue
* css tweak
* fix some bugs and tests
* undo screenshot changes
* Menus test passing locally
* [Vue] date picker viewDate property is not kept up to date (#18385)
* viewDate ref is not kept up to date
* rebuild corehome
* reporting menu subcategory items are meant to be normal links
* update some screenshots
* use innerText instead of text() since angularjs maintains newlines in HTML that vue does not add
* trigger angularjs digest after ajaxhelper request
* rebuild vue
* update screenshots, fix bug in link generation in reporting menu and allow syncing multiple screenshot regexes at a time
* undo box-shadow change for UI tests
* fix more issues & update more tests
* update some screenshots
* fix some tests
* rebuild CoreHome
* quick fix
* built vue files
* fix angularjs issue
* add comment
* update umd files
* 4.6.1-rc1
* 4.6.1
* fix field array title
* apply some pr feedback
* apply more pr feedback
* another fix
* tweak
* fix ng-change not executed before ng-model
* fix another set of issues
* fix another issue
* rebuild vue
* better ng-change/ng-model fix
* update some screenshots
* rebuild vue
* remove some TODOs
* initiate initial ng-change ONLY for site selectors where this behavior applies
* emit/broadcast on correct scope in wrapper
* rebuild vue
* fix some issues
* couple more fixes
* fix another title issue
* rebuild vue
* do not report on ajax errors in notifications if not logged in
* fix a bunch of bugs
* fix another widget bug
* built vue files
* fix function signature
* fix vue warning
* fix ajax request race condition
* rebuild vue
* add new notification type "help" so the help notification is not cleared when clearing transient notifications
* fix some bugs and tests
* update screenshot
* update screenshot & fix a test
* allow using unminified jquery ui + fix bug in last fix
* fix error when enrichedheadline is used in modal
* add polyfill min.js
* remove two todos
* fix widget url logic
* update some screenshots and fix sanitization/escape issue
* update screenshots
* rebuild vue
* fix url location updating regression in MatomoUrl.updateLocation use
* submodule
* update screenshots and fix possible error in json parse
* built vue files
* Merge branch 'vue-period-selector-regression' into vue-reporting-menu
* rebuild vue
* use correct variable
* rebuild vue
* fix widget url logic
* segment parameter can be undefined now for some reason
* fix ngmodel binding in siteselector adapter (for last time hopefully)
* the original site selector only set the first site to the first site in the initial sites query if there was only one site in the entire matomo instance
* fix sitesmanager ui test failure
* fix usersettings test failure
* rebuild vue
* more siteselector tweaks.
* build CoreHome
* more siteselector tweaks.
* another siteselector issue
* update screenshots
* update screenshot and try to fix random failure
* fix some issues in widget.vue when containerid is specified
* fix couple tests
* fix several test failures
* fix test failure
* extra change
* fix last change and random failure
* fix last fix
* real fix this time
* fix stray request
* Update plugins/CoreHome/stylesheets/layout.less
Co-authored-by: Stefan Giehl <stefan@matomo.org>
* remove return; in test
* updates expected UI files
* improve tests stability
Co-authored-by: Justin Velluppillai <justin@innocraft.com>
Co-authored-by: justinvelluppillai <justinvelluppillai@users.noreply.github.com>
Co-authored-by: Matthieu Aubry <mattab@users.noreply.github.com>
Co-authored-by: Stefan Giehl <stefan@matomo.org>
Diffstat (limited to 'plugins/CoreHome/angularjs')
7 files changed, 0 insertions, 363 deletions
diff --git a/plugins/CoreHome/angularjs/widget-bydimension-container/widget-bydimension-container.directive.html b/plugins/CoreHome/angularjs/widget-bydimension-container/widget-bydimension-container.directive.html deleted file mode 100644 index 502cdaf723..0000000000 --- a/plugins/CoreHome/angularjs/widget-bydimension-container/widget-bydimension-container.directive.html +++ /dev/null @@ -1,23 +0,0 @@ -<div class="reportsByDimensionView"> - - <div class="entityList"> - <div class='dimensionCategory' ng-repeat="category in widgetsByCategory"> - {{ category.name }} - <ul class='listCircle'> - <li ng-repeat="widget in category.widgets" - class="reportDimension" - ng-class="{activeDimension: (selectedWidget.uniqueId===widget.uniqueId)}" - ng-click="selectWidget(widget)"> - <span class='dimension'>{{widget.name}}</span> - </li> - </ul> - </div> - </div> - - <div class="reportContainer"> - <div ng-if="selectedWidget.parameters" class="dimensionReport" - piwik-widget-loader="selectedWidget.parameters"></div> - </div> - <div class="clear"></div> - -</div>
\ No newline at end of file diff --git a/plugins/CoreHome/angularjs/widget-bydimension-container/widget-bydimension-container.directive.js b/plugins/CoreHome/angularjs/widget-bydimension-container/widget-bydimension-container.directive.js deleted file mode 100644 index 0219b4795e..0000000000 --- a/plugins/CoreHome/angularjs/widget-bydimension-container/widget-bydimension-container.directive.js +++ /dev/null @@ -1,67 +0,0 @@ -/*! - * Matomo - free/libre analytics platform - * - * @link https://matomo.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */ - -/** - * Renders a widget that is a container widget having the layout "ByDimension". - * - * The "ByDimension" layout shows a menu on the left letting you choose any widgets within this container. The - * currently selected widget is shown on the right. - * - * @param {Object} piwikWidgetByDimensionContainer a widget object as returned by the WidgetMetadata API. - * - * Example: - * <div piwik-widget-by-dimension-container="containerWidget"></div> - */ -(function () { - angular.module('piwikApp').directive('piwikWidgetByDimensionContainer', piwikWidgetContainer); - - piwikWidgetContainer.$inject = ['piwik', '$filter']; - - function piwikWidgetContainer(piwik, $filter){ - return { - restrict: 'A', - scope: { - container: '=piwikWidgetByDimensionContainer' - }, - templateUrl: 'plugins/CoreHome/angularjs/widget-bydimension-container/widget-bydimension-container.directive.html?cb=' + piwik.cacheBuster, - compile: function (element, attrs) { - - return function (scope, element, attrs, ngModel) { - - var widgetsSorted = $filter('orderBy')(scope.container.widgets, 'order'); - var widgetsByCategory = {}; - - angular.forEach(widgetsSorted, function (widget) { - var category = widget.subcategory.name; - - if (!widgetsByCategory[category]) { - widgetsByCategory[category] = {name: category, order: widget.order, widgets: []}; - } - - widgetsByCategory[category].widgets.push(widget); - }); - - // only an array can be sorted - var finalWidgetsByCategory = []; - angular.forEach(widgetsByCategory, function (category) { - finalWidgetsByCategory.push(category); - }); - - scope.widgetsByCategory = $filter('orderBy')(finalWidgetsByCategory, 'order'); - - scope.selectWidget = function (widget) { - scope.selectedWidget = angular.copy(widget); // we copy to force rerender - }; - - if (widgetsSorted && widgetsSorted.length) { - scope.selectWidget(widgetsSorted[0]); - } - }; - } - }; - } -})();
\ No newline at end of file diff --git a/plugins/CoreHome/angularjs/widget-bydimension-container/widget-bydimension-container.directive.less b/plugins/CoreHome/angularjs/widget-bydimension-container/widget-bydimension-container.directive.less deleted file mode 100644 index 9f8f6cce9c..0000000000 --- a/plugins/CoreHome/angularjs/widget-bydimension-container/widget-bydimension-container.directive.less +++ /dev/null @@ -1,72 +0,0 @@ -.reportsByDimensionView { - - float: left; - width: 100%; - - .dimensionCategory { - color: @theme-color-text-contrast; - } - - .reportContainer { - padding-left: 230px; - width: 100%; - - .dimensionReport { - float: left; - min-width: 500px; - max-width: 100%; - } - - table.dataTable tr td.label { - max-width: 380px; - } - } -} - -.entityList { - - ul { - li { - margin: 4px 0; - padding: 0 0 0 16px; - line-height: 22px; - border-left: 2px solid @theme-color-background-base; - - :hover { - opacity: 0.8; - } - &:hover:not(.activeDimension) { - border-color: @theme-color-header-background; - border-left-width: 1px; - padding-left: 17px; - } - - &.activeDimension { - border-color: @theme-color-header-background; - - .dimension { - font-weight: bold; - } - } - - .dimension { - cursor: pointer; - border-bottom: 1px solid #d0d0d0; - color: @theme-color-text-contrast; - border: 0; - } - } - - &.listCircle { - font-weight: normal; - list-style: none; - padding: 4px 0; - margin-top: 8px; - } - &.listCircle li a { - color: #000; - } - - } - -}
\ No newline at end of file diff --git a/plugins/CoreHome/angularjs/widget-container/widgetcontainer.directive.html b/plugins/CoreHome/angularjs/widget-container/widgetcontainer.directive.html deleted file mode 100644 index 21ebd3d0cd..0000000000 --- a/plugins/CoreHome/angularjs/widget-container/widgetcontainer.directive.html +++ /dev/null @@ -1,10 +0,0 @@ -<div> - <!-- custom template prevents recursion --> - <script id="mywidget.html" type="text/ng-template"> - <div piwik-widget="widget"></div> - </script> - - <div ng-repeat="widget in container.widgets"> - <div ng-include src="'mywidget.html'"/> - </div> -</div>
\ No newline at end of file diff --git a/plugins/CoreHome/angularjs/widget-container/widgetcontainer.directive.js b/plugins/CoreHome/angularjs/widget-container/widgetcontainer.directive.js deleted file mode 100644 index eb0721f3d5..0000000000 --- a/plugins/CoreHome/angularjs/widget-container/widgetcontainer.directive.js +++ /dev/null @@ -1,48 +0,0 @@ -/*! - * Matomo - free/libre analytics platform - * - * @link https://matomo.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */ - -/** - * Renders a widget that is a container widget having no specific layout (which is the default). - * - * It shows all widgets vertically aligned one widget after another. - * - * @param {Object} piwikWidgetContainer a widget object as returned by the WidgetMetadata API. - * - * Example: - * <div piwik-widget-container="containerWidget"></div> - */ -(function () { - angular.module('piwikApp').directive('piwikWidgetContainer', piwikWidgetContainer); - - piwikWidgetContainer.$inject = ['piwik']; - - function piwikWidgetContainer(piwik){ - return { - restrict: 'A', - scope: { - container: '=piwikWidgetContainer' - }, - templateUrl: 'plugins/CoreHome/angularjs/widget-container/widgetcontainer.directive.html?cb=' + piwik.cacheBuster, - compile: function (element, attrs) { - - return function (scope, element, attrs, ngModel) { - scope.$watch('container', function (container) { - if (container && container.widgets && container.widgets[0] && container.widgets[0].parameters) { - var widget = container.widgets[0]; - var isWidgetized = widget.parameters.widget == '1'; - - if (isWidgetized && widget.viewDataTable && widget.viewDataTable == 'graphEvolution') { - // we hide the first title for Visits Overview with Graph and Goal Overview - widget.parameters.showtitle = '0'; - } - } - }); - } - } - }; - } -})();
\ No newline at end of file diff --git a/plugins/CoreHome/angularjs/widget/widget.directive.html b/plugins/CoreHome/angularjs/widget/widget.directive.html deleted file mode 100644 index f0e9c48626..0000000000 --- a/plugins/CoreHome/angularjs/widget/widget.directive.html +++ /dev/null @@ -1,15 +0,0 @@ -<div id="{{ widget.uniqueId }}" - ng-show="view.showWidget" - ng-class="{'isFirstWidgetInPage': widget.isFirstInPage}"> - - <div ng-if="!widget.isContainer && widget.parameters" - piwik-widget-loader="widget.parameters" widget-name="{{ widget.name }}"></div> - - <div ng-if="widget.isContainer && widget.layout!='ByDimension'"> - <div piwik-widget-container="widget"></div> - </div> - - <div ng-if="widget.isContainer && widget.layout=='ByDimension'"> - <div piwik-widget-by-dimension-container="widget"></div> - </div> -</div>
\ No newline at end of file diff --git a/plugins/CoreHome/angularjs/widget/widget.directive.js b/plugins/CoreHome/angularjs/widget/widget.directive.js deleted file mode 100644 index 651c77e409..0000000000 --- a/plugins/CoreHome/angularjs/widget/widget.directive.js +++ /dev/null @@ -1,128 +0,0 @@ -/*! - * Matomo - free/libre analytics platform - * - * @link https://matomo.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */ - -/** - * Renders any kind of widget. If you have a widget and you want to have it rendered, use this directive. It will - * display a name on top and the actual widget below. It can handle any kind of widget, no matter whether it is a - * regular widget or a container. - * - * @param {Object} piwikWidget A widget object as returned by the WidgetMetadata API. - * @param {Object} piwikWidget.middlewareParameters If present, we will request a URL using the given parameters and - * only if this URL returns a JSON `true` the widget will be shown. - * Otherwise the widget won't be shown. - * @param {String} containerId If you do not have a widget object but a containerId we will find the correct widget - * object based on the given containerId. Be aware that we might not find the widget if - * it is for example not available for the current user or period/date. - * @param {Boolean} widgetized true if the widget is widgetized (eg in Dashboard or exported). In this case we will add - * a URL parameter widget=1 to all widgets. Eg sparklines will be then displayed one after - * another (vertically aligned) instead of two next to each other. - * - * Example: - * <div piwik-widget="widget"></div> - * <div piwik-widget containerid="widgetGoalsOverview"></div> // in this case we will find the correct widget automatically - * <div piwik-widget="widget" widetized="true"></div> // disables rating feature, no initial headline - */ -(function () { - angular.module('piwikApp').directive('piwikWidget', piwikWidget); - - piwikWidget.$inject = ['piwik', 'piwikApi', 'reportMetadataModel']; - - function piwikWidget(piwik, piwikApi, reportMetadataModel){ - function findContainerWidget(containerId, scope) { - widgetsHelper.getAvailableWidgets(function (categorizedWidgets) { - - angular.forEach(categorizedWidgets, function (widgets) { - angular.forEach(widgets, function (widget) { - if (widget && widget.isContainer && widget.parameters.containerId === containerId) { - widget = angular.copy(widget); - if (scope.widgetized) { - widget.isFirstInPage = '1'; - widget.parameters.widget = '1'; - angular.forEach(widget.widgets, function (widget) { - widget.parameters.widget = '1'; - widget.parameters.containerId = containerId; - }); - } - scope.widget = widget; - applyMiddleware(scope); - } - }); - }); - - }); - } - - function addReportDocumentationIfPossible(widget) - { - if (widget && widget.isReport && !widget.documentation) { - var report = reportMetadataModel.findReport(widget.module, widget.action); - if (report && report.documentation) { - widget.documentation = report.documentation; - } - } - } - - function applyMiddleware(scope) - { - if (!scope.widget.middlewareParameters) { - scope.$evalAsync('view.showWidget = true'); - } else { - var params = angular.copy(scope.widget.middlewareParameters); - piwikApi.fetch(params).then(function (response) { - var enabled = response ? 'true' : 'false'; - scope.$evalAsync('view.showWidget = ' + enabled); - }); - } - } - - return { - restrict: 'A', - scope: { - widget: '=?piwikWidget', - widgetized: '=?', - containerid: '=' - }, - templateUrl: 'plugins/CoreHome/angularjs/widget/widget.directive.html?cb=' + piwik.cacheBuster, - compile: function (element, attrs) { - - return function (scope, element, attrs, ngModel) { - if (scope.widget) { - addReportDocumentationIfPossible(scope.widget); - applyMiddleware(scope); - } else if (attrs.containerid) { - findContainerWidget(attrs.containerid, scope); - } - - $(element).tooltip({ - track: true, - content: function() { - var $this = $(this); - if ($this.attr('piwik-field') === '') { - // do not show it for form fields - return ''; - } - - var title = $(this).attr('title'); - return piwikHelper.escape(title.replace(/\n/g, '<br />')); - }, - show: {delay: 700, duration: 200}, - hide: false - }); - - scope.$on( - "$destroy", - function () { - try { - $(element).tooltip('destroy'); - } catch (e) {} - } - ); - } - } - }; - } -})(); |