diff options
author | dizzy <diosmosis@users.noreply.github.com> | 2022-04-04 12:45:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-04 12:45:29 +0300 |
commit | dd5b4ffbb9fe1d0f30ec2ab54112d475923e0006 (patch) | |
tree | c4d0736bc571eb2ec62d6abaa11977aedb4016a6 | |
parent | b507907a6e306c8e890c2926028e6bf01a3fd7b3 (diff) |
[Vue] migrate report deletion controllers/store to Vue (#18988)
* migrate report deletion service, delete-logs/delete-reports controllers
* migrate schedule report deletion controller
* delete angularjs files
* couple fixes
* get to work in UI
* fix ajax request params not having every required param & add missing translation for manual purge estimate feature
Co-authored-by: sgiehl <stefan@matomo.org>
13 files changed, 1714 insertions, 576 deletions
diff --git a/plugins/PrivacyManager/PrivacyManager.php b/plugins/PrivacyManager/PrivacyManager.php index 2e04d85055..b79423bf0a 100644 --- a/plugins/PrivacyManager/PrivacyManager.php +++ b/plugins/PrivacyManager/PrivacyManager.php @@ -1,4 +1,5 @@ <?php + /** * Matomo - free/libre analytics platform * @@ -6,6 +7,7 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later * */ + namespace Piwik\Plugins\PrivacyManager; use HTML_QuickForm2_DataSource_Array; @@ -48,7 +50,7 @@ class PrivacyManager extends Plugin // options for data purging feature array[configName => configSection] - public static $purgeDataOptions = array( + public static $purgeDataOptions = [ 'delete_logs_enable' => 'Deletelogs', 'delete_logs_schedule_lowest_interval' => 'Deletelogs', 'delete_logs_older_than' => 'Deletelogs', @@ -66,7 +68,7 @@ class PrivacyManager extends Plugin 'delete_reports_keep_year_reports' => 'Deletereports', 'delete_reports_keep_range_reports' => 'Deletereports', 'delete_reports_keep_segment_reports' => 'Deletereports', - ); + ]; private $dntChecker = null; private $ipAnonymizer = null; @@ -108,7 +110,8 @@ class PrivacyManager extends Plugin $strPeriod = Common::getRequestVar('period', false); $strDate = Common::getRequestVar('date', false); - if (false !== $strPeriod + if ( + false !== $strPeriod && false !== $strDate && (is_null($dataTable) || (!empty($dataTable) && $dataTable->getRowsCount() == 0)) @@ -175,12 +178,12 @@ class PrivacyManager extends Plugin */ public function registerEvents() { - return array( + return [ 'AssetManager.getJavaScriptFiles' => 'getJsFiles', 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', 'Tracker.setTrackerCacheGeneral' => 'setTrackerCacheGeneral', - 'Tracker.isExcludedVisit' => array($this->dntChecker, 'checkHeaderInTracker'), - 'Tracker.setVisitorIp' => array($this->ipAnonymizer, 'setVisitorIpAddress'), + 'Tracker.isExcludedVisit' => [$this->dntChecker, 'checkHeaderInTracker'], + 'Tracker.setVisitorIp' => [$this->ipAnonymizer, 'setVisitorIpAddress'], 'Installation.defaultSettingsForm.init' => 'installationFormInit', 'Installation.defaultSettingsForm.submit' => 'installationFormSubmit', 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys', @@ -188,7 +191,7 @@ class PrivacyManager extends Plugin 'Db.getTablesInstalled' => 'getTablesInstalled', 'Visualization.beforeRender' => 'onConfigureVisualisation', 'CustomJsTracker.shouldAddTrackerFile' => 'shouldAddTrackerFile' - ); + ]; } public function onConfigureVisualisation(Plugin\Visualization $view) @@ -226,82 +229,112 @@ class PrivacyManager extends Plugin public function getClientSideTranslationKeys(&$translationKeys) { - $translationKeys[] = 'General_Visit'; + $translationKeys[] = 'CoreAdminHome_OptOutExplanation'; + $translationKeys[] = 'CoreAdminHome_OptOutExplanationIntro'; + $translationKeys[] = 'CoreAdminHome_SettingsSaveSuccess'; $translationKeys[] = 'General_Action'; + $translationKeys[] = 'General_ClickHere'; + $translationKeys[] = 'General_DailyReports'; $translationKeys[] = 'General_Details'; + $translationKeys[] = 'General_MonthlyReports'; + $translationKeys[] = 'General_RangeReports'; + $translationKeys[] = 'General_Recommended'; + $translationKeys[] = 'General_UserId'; + $translationKeys[] = 'General_Visit'; $translationKeys[] = 'General_VisitId'; $translationKeys[] = 'General_VisitorID'; $translationKeys[] = 'General_VisitorIP'; - $translationKeys[] = 'General_UserId'; $translationKeys[] = 'General_Website'; + $translationKeys[] = 'General_WeeklyReports'; + $translationKeys[] = 'General_YearlyReports'; + $translationKeys[] = 'Intl_PeriodDays'; + $translationKeys[] = 'Intl_PeriodMonths'; $translationKeys[] = 'Live_ViewVisitorProfile'; - $translationKeys[] = 'CoreAdminHome_SettingsSaveSuccess'; - $translationKeys[] = 'CoreAdminHome_OptOutExplanation'; - $translationKeys[] = 'CoreAdminHome_OptOutExplanationIntro'; - $translationKeys[] = 'PrivacyManager_OptOutCustomize'; - $translationKeys[] = 'PrivacyManager_FontColor'; - $translationKeys[] = 'PrivacyManager_BackgroundColor'; - $translationKeys[] = 'PrivacyManager_FontSize'; - $translationKeys[] = 'PrivacyManager_FontFamily'; - $translationKeys[] = 'PrivacyManager_OptOutHtmlCode'; - $translationKeys[] = 'PrivacyManager_OptOutPreview'; - $translationKeys[] = 'PrivacyManager_AnonymizeSites'; - $translationKeys[] = 'PrivacyManager_AnonymizeRowDataFrom'; - $translationKeys[] = 'PrivacyManager_AnonymizeRowDataTo'; + $translationKeys[] = 'PrivacyManager_AddUserIdToSearch'; + $translationKeys[] = 'PrivacyManager_AddVisitorIPToSearch'; + $translationKeys[] = 'PrivacyManager_AddVisitorIdToSearch'; + $translationKeys[] = 'PrivacyManager_AnonymizeDataConfirm'; + $translationKeys[] = 'PrivacyManager_AnonymizeDataNow'; $translationKeys[] = 'PrivacyManager_AnonymizeIp'; + $translationKeys[] = 'PrivacyManager_AnonymizeIpDescription'; $translationKeys[] = 'PrivacyManager_AnonymizeIpHelp'; + $translationKeys[] = 'PrivacyManager_AnonymizeIpInlineHelp'; + $translationKeys[] = 'PrivacyManager_AnonymizeIpMaskLengtDescription'; $translationKeys[] = 'PrivacyManager_AnonymizeLocation'; $translationKeys[] = 'PrivacyManager_AnonymizeLocationHelp'; + $translationKeys[] = 'PrivacyManager_AnonymizeOrderIdNote'; + $translationKeys[] = 'PrivacyManager_AnonymizeProcessInfo'; + $translationKeys[] = 'PrivacyManager_AnonymizeReferrer'; + $translationKeys[] = 'PrivacyManager_AnonymizeReferrerNote'; + $translationKeys[] = 'PrivacyManager_AnonymizeRowDataFrom'; + $translationKeys[] = 'PrivacyManager_AnonymizeRowDataTo'; + $translationKeys[] = 'PrivacyManager_AnonymizeSites'; $translationKeys[] = 'PrivacyManager_AnonymizeUserId'; $translationKeys[] = 'PrivacyManager_AnonymizeUserIdHelp'; - $translationKeys[] = 'PrivacyManager_AnonymizeProcessInfo'; - $translationKeys[] = 'PrivacyManager_AnonymizeDataNow'; - $translationKeys[] = 'PrivacyManager_AnonymizeDataConfirm'; - $translationKeys[] = 'PrivacyManager_UnsetVisitColumns'; - $translationKeys[] = 'PrivacyManager_UnsetVisitColumnsHelp'; - $translationKeys[] = 'PrivacyManager_UnsetActionColumns'; - $translationKeys[] = 'PrivacyManager_UnsetActionColumnsHelp'; - $translationKeys[] = 'PrivacyManager_SearchForDataSubject'; - $translationKeys[] = 'PrivacyManager_FindDataSubjectsBy'; - $translationKeys[] = 'PrivacyManager_NoDataSubjectsFound'; + $translationKeys[] = 'PrivacyManager_BackgroundColor'; + $translationKeys[] = 'PrivacyManager_DeleteAggregateReportsDetailedInfo'; + $translationKeys[] = 'PrivacyManager_DeleteDataInterval'; + $translationKeys[] = 'PrivacyManager_DeleteLogsOlderThan'; + $translationKeys[] = 'PrivacyManager_DeleteRawDataInfo'; + $translationKeys[] = 'PrivacyManager_DeleteReportsInfo2'; + $translationKeys[] = 'PrivacyManager_DeleteReportsInfo3'; + $translationKeys[] = 'PrivacyManager_DeleteReportsOlderThan'; + $translationKeys[] = 'PrivacyManager_DeleteSchedulingSettings'; + $translationKeys[] = 'PrivacyManager_DeleteSelectedVisits'; $translationKeys[] = 'PrivacyManager_DeleteVisitsConfirm'; - $translationKeys[] = 'PrivacyManager_ResultTruncated'; - $translationKeys[] = 'PrivacyManager_AddVisitorIdToSearch'; - $translationKeys[] = 'PrivacyManager_AddVisitorIPToSearch'; - $translationKeys[] = 'PrivacyManager_AddUserIdToSearch'; + $translationKeys[] = 'PrivacyManager_DeletionFromMatomoOnly'; + $translationKeys[] = 'PrivacyManager_DoNotTrack_Description'; $translationKeys[] = 'PrivacyManager_ExportSelectedVisits'; - $translationKeys[] = 'PrivacyManager_DeleteSelectedVisits'; - $translationKeys[] = 'PrivacyManager_SelectWebsite'; - $translationKeys[] = 'PrivacyManager_MatchingDataSubjects'; - $translationKeys[] = 'PrivacyManager_VisitsMatchedCriteria'; $translationKeys[] = 'PrivacyManager_ExportingNote'; - $translationKeys[] = 'PrivacyManager_DeletionFromMatomoOnly'; - $translationKeys[] = 'PrivacyManager_ResultIncludesAllVisits'; + $translationKeys[] = 'PrivacyManager_FindDataSubjectsBy'; + $translationKeys[] = 'PrivacyManager_FontColor'; + $translationKeys[] = 'PrivacyManager_FontFamily'; + $translationKeys[] = 'PrivacyManager_FontSize'; + $translationKeys[] = 'PrivacyManager_ForceCookielessTracking'; + $translationKeys[] = 'PrivacyManager_ForceCookielessTrackingDescription'; + $translationKeys[] = 'PrivacyManager_ForceCookielessTrackingDescription2'; + $translationKeys[] = 'PrivacyManager_ForceCookielessTrackingDescriptionNotWritable'; $translationKeys[] = 'PrivacyManager_GdprTools'; + $translationKeys[] = 'PrivacyManager_GdprToolsOverviewHint'; $translationKeys[] = 'PrivacyManager_GdprToolsPageIntro1'; $translationKeys[] = 'PrivacyManager_GdprToolsPageIntro2'; $translationKeys[] = 'PrivacyManager_GdprToolsPageIntroAccessRight'; $translationKeys[] = 'PrivacyManager_GdprToolsPageIntroEraseRight'; - $translationKeys[] = 'PrivacyManager_GdprToolsOverviewHint'; - $translationKeys[] = 'PrivacyManager_UseAnonymizeIp'; - $translationKeys[] = 'PrivacyManager_AnonymizeIpMaskLengtDescription'; - $translationKeys[] = 'PrivacyManager_UseAnonymizedIpForVisitEnrichment'; - $translationKeys[] = 'PrivacyManager_PseudonymizeUserId'; - $translationKeys[] = 'PrivacyManager_UseAnonymizeOrderId'; - $translationKeys[] = 'PrivacyManager_ForceCookielessTracking'; - $translationKeys[] = 'PrivacyManager_ForceCookielessTrackingDescription'; - $translationKeys[] = 'PrivacyManager_ForceCookielessTrackingDescription2'; - $translationKeys[] = 'PrivacyManager_ForceCookielessTrackingDescriptionNotWritable'; - $translationKeys[] = 'PrivacyManager_AnonymizeIpInlineHelp'; - $translationKeys[] = 'PrivacyManager_AnonymizeIpDescription'; $translationKeys[] = 'PrivacyManager_GeolocationAnonymizeIpNote'; - $translationKeys[] = 'PrivacyManager_UseAnonymizedIpForVisitEnrichmentNote'; + $translationKeys[] = 'PrivacyManager_KeepBasicMetrics'; + $translationKeys[] = 'PrivacyManager_KeepBasicMetricsReportsDetailedInfo'; + $translationKeys[] = 'PrivacyManager_KeepDataFor'; + $translationKeys[] = 'PrivacyManager_KeepReportSegments'; + $translationKeys[] = 'PrivacyManager_LastDelete'; + $translationKeys[] = 'PrivacyManager_LeastDaysInput'; + $translationKeys[] = 'PrivacyManager_LeastMonthsInput'; + $translationKeys[] = 'PrivacyManager_MatchingDataSubjects'; + $translationKeys[] = 'PrivacyManager_NextDelete'; + $translationKeys[] = 'PrivacyManager_NoDataSubjectsFound'; + $translationKeys[] = 'PrivacyManager_OptOutCustomize'; + $translationKeys[] = 'PrivacyManager_OptOutHtmlCode'; + $translationKeys[] = 'PrivacyManager_OptOutPreview'; + $translationKeys[] = 'PrivacyManager_PseudonymizeUserId'; $translationKeys[] = 'PrivacyManager_PseudonymizeUserIdNote'; $translationKeys[] = 'PrivacyManager_PseudonymizeUserIdNote2'; - $translationKeys[] = 'PrivacyManager_AnonymizeOrderIdNote'; - $translationKeys[] = 'PrivacyManager_AnonymizeReferrerNote'; - $translationKeys[] = 'PrivacyManager_AnonymizeReferrer'; - $translationKeys[] = 'PrivacyManager_DoNotTrack_Description'; + $translationKeys[] = 'PrivacyManager_PurgeNow'; + $translationKeys[] = 'PrivacyManager_ReportsDataSavedEstimate'; + $translationKeys[] = 'PrivacyManager_ResultIncludesAllVisits'; + $translationKeys[] = 'PrivacyManager_ResultTruncated'; + $translationKeys[] = 'PrivacyManager_SearchForDataSubject'; + $translationKeys[] = 'PrivacyManager_SelectWebsite'; + $translationKeys[] = 'PrivacyManager_UnsetActionColumns'; + $translationKeys[] = 'PrivacyManager_UnsetActionColumnsHelp'; + $translationKeys[] = 'PrivacyManager_UnsetVisitColumns'; + $translationKeys[] = 'PrivacyManager_UnsetVisitColumnsHelp'; + $translationKeys[] = 'PrivacyManager_UseAnonymizeIp'; + $translationKeys[] = 'PrivacyManager_UseAnonymizeOrderId'; + $translationKeys[] = 'PrivacyManager_UseAnonymizedIpForVisitEnrichment'; + $translationKeys[] = 'PrivacyManager_UseAnonymizedIpForVisitEnrichmentNote'; + $translationKeys[] = 'PrivacyManager_UseDeleteLog'; + $translationKeys[] = 'PrivacyManager_UseDeleteReports'; + $translationKeys[] = 'PrivacyManager_VisitsMatchedCriteria'; + $translationKeys[] = 'PrivacyManager_GetPurgeEstimate'; } public function setTrackerCacheGeneral(&$cacheContent) @@ -318,10 +351,6 @@ class PrivacyManager extends Plugin public function getJsFiles(&$jsFiles) { - $jsFiles[] = "plugins/PrivacyManager/angularjs/report-deletion.model.js"; - $jsFiles[] = "plugins/PrivacyManager/angularjs/schedule-report-deletion/schedule-report-deletion.controller.js"; - $jsFiles[] = "plugins/PrivacyManager/angularjs/delete-old-logs/delete-old-logs.controller.js"; - $jsFiles[] = "plugins/PrivacyManager/angularjs/delete-old-reports/delete-old-reports.controller.js"; $jsFiles[] = "plugins/PrivacyManager/angularjs/opt-out-customizer/opt-out-customizer.controller.js"; $jsFiles[] = "plugins/PrivacyManager/angularjs/opt-out-customizer/opt-out-customizer.directive.js"; $jsFiles[] = "plugins/PrivacyManager/angularjs/manage-gdpr/managegdpr.controller.js"; @@ -344,20 +373,28 @@ class PrivacyManager extends Plugin */ public function installationFormInit(FormDefaultSettings $form) { - $form->addElement('checkbox', 'do_not_track', null, - array( + $form->addElement( + 'checkbox', + 'do_not_track', + null, + [ 'content' => '<div class="form-help">' . Piwik::translate('PrivacyManager_DoNotTrack_EnabledMoreInfo') . '</div> ' . Piwik::translate('PrivacyManager_DoNotTrack_Enable') - )); - $form->addElement('checkbox', 'anonymise_ip', null, - array( - 'content' => '<div class="form-help">' . Piwik::translate('PrivacyManager_AnonymizeIpExtendedHelp', array('213.34.51.91', '213.34.0.0')) . '</div> ' . Piwik::translate('PrivacyManager_AnonymizeIpInlineHelp') - )); + ] + ); + $form->addElement( + 'checkbox', + 'anonymise_ip', + null, + [ + 'content' => '<div class="form-help">' . Piwik::translate('PrivacyManager_AnonymizeIpExtendedHelp', ['213.34.51.91', '213.34.0.0']) . '</div> ' . Piwik::translate('PrivacyManager_AnonymizeIpInlineHelp') + ] + ); // default values - $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array( + $form->addDataSource(new HTML_QuickForm2_DataSource_Array([ 'do_not_track' => $this->dntChecker->isActive(), 'anonymise_ip' => IPAnonymizer::isActive(), - ))); + ])); } /** @@ -390,7 +427,7 @@ class PrivacyManager extends Plugin */ public static function getPurgeDataSettings() { - $settings = array(); + $settings = []; // load settings from ini config $config = PiwikConfig::getInstance(); @@ -535,7 +572,7 @@ class PrivacyManager extends Plugin $settings = self::getPurgeDataSettings(); } - $result = array(); + $result = []; if ($settings['delete_logs_enable']) { /** @var LogDataPurger $logDataPurger */ @@ -554,8 +591,7 @@ class PrivacyManager extends Plugin private static function getReportDate($strPeriod, $strDate) { // if range, only look at the first date - if ($strPeriod == 'range') { - + if ($strPeriod === 'range') { $idSite = Common::getRequestVar('idSite', ''); if (intval($idSite) != 0) { @@ -567,13 +603,10 @@ class PrivacyManager extends Plugin $period = new Range('range', $strDate, $timezone); $reportDate = $period->getDateStart(); - } elseif (Period::isMultiplePeriod($strDate, $strPeriod)) { - // if a multiple period, this function is irrelevant return false; - - } else { + } else { // otherwise, use the date as given $reportDate = Date::factory($strDate); } @@ -613,8 +646,7 @@ class PrivacyManager extends Plugin $reportsOlderThan = Date::factory('today')->subMonth(1 + $reportsOlderThan); } - return ReportsPurger::shouldReportBePurged( - $reportDateYear, $reportDateMonth, $reportsOlderThan); + return ReportsPurger::shouldReportBePurged($reportDateYear, $reportDateMonth, $reportsOlderThan); } /** @@ -623,9 +655,9 @@ class PrivacyManager extends Plugin */ private static function getMetricsToKeep() { - return array('nb_uniq_visitors', 'nb_visits', 'nb_users', 'nb_actions', 'max_actions', - 'sum_visit_length', 'bounce_count', 'nb_visits_converted', 'nb_conversions', - 'revenue', 'quantity', 'price', 'orders'); + return ['nb_uniq_visitors', 'nb_visits', 'nb_users', 'nb_actions', 'max_actions', + 'sum_visit_length', 'bounce_count', 'nb_visits_converted', 'nb_conversions', + 'revenue', 'quantity', 'price', 'orders']; } /** @@ -655,8 +687,7 @@ class PrivacyManager extends Plugin // for each goal metric, there's a different name for each goal, including the overview, // the order report & cart report foreach ($goalMetricsToKeep as $metric) { - for ($i = 1; $i <= $maxGoalId; ++$i) // maxGoalId can be 0 - { + for ($i = 1; $i <= $maxGoalId; ++$i) { // maxGoalId can be 0 $metricsToKeep[] = Archiver::getRecordName($metric, $i); } @@ -687,9 +718,10 @@ class PrivacyManager extends Plugin $deleteIntervalDays = $settings[$setting]; $deleteIntervalSeconds = $this->getDeleteIntervalInSeconds($deleteIntervalDays); - if ($lastDelete === false || - $lastDelete === '' || - ((int)$lastDelete + $deleteIntervalSeconds) <= time() + if ( + $lastDelete === false + || $lastDelete === '' + || ((int)$lastDelete + $deleteIntervalSeconds) <= time() ) { return true; } else // not time to run data purge @@ -698,7 +730,7 @@ class PrivacyManager extends Plugin } } - function getDeleteIntervalInSeconds($deleteInterval) + private function getDeleteIntervalInSeconds($deleteInterval) { return (int)$deleteInterval * 24 * 60 * 60; } diff --git a/plugins/PrivacyManager/angularjs/delete-old-logs/delete-old-logs.controller.js b/plugins/PrivacyManager/angularjs/delete-old-logs/delete-old-logs.controller.js deleted file mode 100644 index 08cda646b8..0000000000 --- a/plugins/PrivacyManager/angularjs/delete-old-logs/delete-old-logs.controller.js +++ /dev/null @@ -1,54 +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 - */ -(function () { - angular.module('piwikApp').controller('DeleteOldLogsController', DeleteOldLogsController); - - DeleteOldLogsController.$inject = ['reportDeletionModel', 'piwikApi', '$timeout']; - - function DeleteOldLogsController(reportDeletionModel, piwikApi, $timeout) { - - var self = this; - - this.isLoading = false; - - function saveSettings() - { - var method = 'PrivacyManager.setDeleteLogsSettings'; - reportDeletionModel.savePurageDataSettings(self, method, self.getSettings()); - } - - this.getSettings = function () { - return { - enableDeleteLogs: this.enabled ? '1' : '0', - deleteLogsOlderThan: this.deleteOlderThan - }; - } - - this.reloadDbStats = function () { - reportDeletionModel.updateSettings(this.getSettings()); - } - - $timeout(function () { - reportDeletionModel.initSettings(self.getSettings()); - }); - - this.save = function () { - - if (this.enabled) { - var confirmId = 'deleteLogsConfirm'; - if (reportDeletionModel.settings && '1' === reportDeletionModel.settings.enableDeleteReports) { - confirmId = 'deleteBothConfirm'; - } - $('#confirmDeleteSettings').find('>h2').hide(); - $("#" + confirmId).show(); - piwikHelper.modalConfirm('#confirmDeleteSettings', {yes: saveSettings}); - } else { - saveSettings(); - } - }; - } -})();
\ No newline at end of file diff --git a/plugins/PrivacyManager/angularjs/delete-old-reports/delete-old-reports.controller.js b/plugins/PrivacyManager/angularjs/delete-old-reports/delete-old-reports.controller.js deleted file mode 100644 index 1839dc7bfa..0000000000 --- a/plugins/PrivacyManager/angularjs/delete-old-reports/delete-old-reports.controller.js +++ /dev/null @@ -1,66 +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 - */ -(function () { - angular.module('piwikApp').controller('DeleteOldReportsController', DeleteOldReportsController); - - DeleteOldReportsController.$inject = ['reportDeletionModel', 'piwikApi', '$timeout']; - - function DeleteOldReportsController(reportDeletionModel, piwikApi, $timeout) { - // remember to keep controller very simple. Create a service/factory (model) if needed - - var self = this; - this.isLoading = false; - - function getInt(value) - { - return value ? '1' : '0'; - } - - function saveSettings() - { - var method = 'PrivacyManager.setDeleteReportsSettings'; - reportDeletionModel.savePurageDataSettings(self, method, self.getSettings()); - } - - this.getSettings = function () { - return { - enableDeleteReports: this.enabled ? '1' : '0', - deleteReportsOlderThan: this.deleteOlderThan, - keepBasic: getInt(this.keepBasic), - keepDay: getInt(this.keepDataForDay), - keepWeek: getInt(this.keepDataForWeek), - keepMonth: getInt(this.keepDataForMonth), - keepYear: getInt(this.keepDataForYear), - keepRange: getInt(this.keepDataForRange), - keepSegments: getInt(this.keepDataForSegments), - }; - } - - this.reloadDbStats = function () { - reportDeletionModel.updateSettings(this.getSettings()); - } - - $timeout(function () { - reportDeletionModel.initSettings(self.getSettings()); - }); - - this.save = function () { - - if (this.enabled) { - var confirmId = 'deleteReportsConfirm'; - if (reportDeletionModel.settings && '1' === reportDeletionModel.settings.enableDeleteLogs) { - confirmId = 'deleteBothConfirm'; - } - $('#confirmDeleteSettings').find('>h2').hide(); - $("#" + confirmId).show(); - piwikHelper.modalConfirm('#confirmDeleteSettings', {yes: saveSettings}); - } else { - saveSettings(); - } - }; - } -})();
\ No newline at end of file diff --git a/plugins/PrivacyManager/angularjs/report-deletion.model.js b/plugins/PrivacyManager/angularjs/report-deletion.model.js deleted file mode 100644 index 412ab4a7bb..0000000000 --- a/plugins/PrivacyManager/angularjs/report-deletion.model.js +++ /dev/null @@ -1,111 +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 - */ -(function () { - angular.module('piwikApp.service').factory('reportDeletionModel', reportDeletionModel); - - reportDeletionModel.$inject = ['piwik', 'piwikApi']; - - function reportDeletionModel (piwik, piwikApi) { - - var currentRequest; - var isFirstLoad = true; - - var model = { - settings: {}, - showEstimate: false, - loadingEstimation: false, - estimation: '', - isModified: false, - isEitherDeleteSectionEnabled: isEitherDeleteSectionEnabled, - reloadDbStats: reloadDbStats, - savePurageDataSettings: savePurageDataSettings, - updateSettings: updateSettings, - initSettings: initSettings - }; - - return model; - - function updateSettings(settings) - { - initSettings(settings); - model.isModified = true; - } - - function initSettings(settings) - { - model.settings = angular.merge({}, model.settings, settings); - model.reloadDbStats(); - } - - function savePurageDataSettings(controller, apiMethod, settings) - { - controller.isLoading = true; - model.isModified = false; - - return piwikApi.post({ - module: 'API', method: apiMethod - }, settings).then(function () { - controller.isLoading = false; - - var UI = require('piwik/UI'); - var notification = new UI.Notification(); - notification.show(_pk_translate('CoreAdminHome_SettingsSaveSuccess'), {context: 'success', id:'privacyManagerSettings'}); - notification.scrollToNotification(); - }, function () { - controller.isLoading = false; - }); - } - - function isEitherDeleteSectionEnabled() { - return ('1' === model.settings.enableDeleteLogs || '1' === model.settings.enableDeleteReports); - } - - function isManualEstimationLinkShowing() - { - return $('#getPurgeEstimateLink').length > 0; - } - - /** - * @param {boolean} [forceEstimate] (defaults to false) - */ - function reloadDbStats(forceEstimate) { - if (currentRequest) { - currentRequest.abort(); - } - - // if the manual estimate link is showing, abort unless forcing - if (forceEstimate !== true - && (!isEitherDeleteSectionEnabled() || isManualEstimationLinkShowing())) { - return; - } - - model.loadingEstimation = true; - model.estimation = ''; - model.showEstimate = false; - - var formData = model.settings; - - if (forceEstimate === true) { - formData['forceEstimate'] = 1; - } - - currentRequest = piwikApi.post({ - module: 'PrivacyManager', - action: 'getDatabaseSize', - format: 'html' - }, formData).then(function (data) { - currentRequest = undefined; - model.estimation = data; - model.showEstimate = true; - model.loadingEstimation = false; - }, function () { - model.loadingEstimation = true; - }); - } - - } -})();
\ No newline at end of file diff --git a/plugins/PrivacyManager/angularjs/schedule-report-deletion/schedule-report-deletion.controller.js b/plugins/PrivacyManager/angularjs/schedule-report-deletion/schedule-report-deletion.controller.js deleted file mode 100644 index 0f940bf78a..0000000000 --- a/plugins/PrivacyManager/angularjs/schedule-report-deletion/schedule-report-deletion.controller.js +++ /dev/null @@ -1,65 +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 - */ -(function () { - angular.module('piwikApp').controller('ScheduleReportDeletionController', ScheduleReportDeletionController); - - ScheduleReportDeletionController.$inject = ['reportDeletionModel', 'piwikApi', '$timeout']; - - function ScheduleReportDeletionController(reportDeletionModel, piwikApi, $timeout) { - - var self = this; - this.isLoading = false; - this.dataWasPurged = false; - this.showPurgeNowLink = true; - this.model = reportDeletionModel; - - this.save = function () { - var method = 'PrivacyManager.setScheduleReportDeletionSettings'; - self.model.savePurageDataSettings(this, method, { - deleteLowestInterval: this.deleteLowestInterval - }); - }; - - this.executeDataPurgeNow = function () { - - if (reportDeletionModel.isModified) { - piwikHelper.modalConfirm('#saveSettingsBeforePurge', {yes: function () {}}); - return; - } - - // ask user if they really want to delete their old data - piwikHelper.modalConfirm('#confirmPurgeNow', { - yes: function () { - self.loadingDataPurge = true; - self.showPurgeNowLink = false; - - // execute a data purge - piwikApi.withTokenInUrl(); - var ajaxRequest = piwikApi.fetch({ - module: 'PrivacyManager', - action: 'executeDataPurge', - format: 'html' - }).then(function () { - self.loadingDataPurge = false; - // force reload - reportDeletionModel.reloadDbStats(); - - self.dataWasPurged = true; - - $timeout(function () { - self.dataWasPurged = false; - self.showPurgeNowLink = true; - }, 2000); - }, function () { - self.loadingDataPurge = false; - }); - } - }); - }; - - } -})(); diff --git a/plugins/PrivacyManager/templates/privacySettings.twig b/plugins/PrivacyManager/templates/privacySettings.twig index 1d3d85530e..c2731d95ec 100644 --- a/plugins/PrivacyManager/templates/privacySettings.twig +++ b/plugins/PrivacyManager/templates/privacySettings.twig @@ -56,202 +56,35 @@ <p>{{ 'PrivacyManager_DeleteDataDescription'|translate }}</p> - <div piwik-form - ng-controller="DeleteOldLogsController as deleteOldLogs" - id="formDeleteSettings"> - <div id="deleteLogSettingEnabled"> - - <div piwik-field uicontrol="checkbox" name="deleteEnable" - ng-model="deleteOldLogs.enabled" - ng-change="deleteOldLogs.reloadDbStats()" - data-title="{{ 'PrivacyManager_UseDeleteLog'|translate|e('html_attr') }}" - value="{{ deleteData.config.delete_logs_enable }}" - inline-help="{{ 'PrivacyManager_DeleteRawDataInfo'|translate|e('html_attr') }}"> - </div> - - <div class="alert alert-warning deleteOldLogsWarning" style="width: 50%;" ng-show="deleteOldLogs.enabled"> - <a href="https://matomo.org/faq/general/#faq_125" rel="noreferrer noopener" target="_blank"> - {{ 'General_ClickHere'|translate }} - </a> - </div> - </div> - - <div id="deleteLogSettings" ng-show="deleteOldLogs.enabled"> - <div piwik-field uicontrol="text" name="deleteOlderThan" - ng-model="deleteOldLogs.deleteOlderThan" - ng-change="deleteOldLogs.reloadDbStats()" - data-title="{{ 'PrivacyManager_DeleteLogsOlderThan'|translate|e('html_attr') }} ({{ 'Intl_PeriodDays'|translate }})" - value="{{ deleteData.config.delete_logs_older_than }}" - inline-help="{{ 'PrivacyManager_LeastDaysInput'|translate("1")|e('html_attr') }}"> - </div> - </div> - - <div piwik-save-button onconfirm="deleteOldLogs.save()" saving="deleteOldLogs.isLoading"></div> - </div> + <div + vue-entry="PrivacyManager.DeleteOldLogs" + is-data-purge-settings-enabled="{{ isDataPurgeSettingsEnabled|default(null)|json_encode|e('html_attr') }}" + delete-data="{{ deleteData|default(null)|json_encode|e('html_attr') }}" + schedule-deletion-options="{{ scheduleDeletionOptions|default(null)|json_encode|e('html_attr') }}" + ></div> </div> <div piwik-content-block id="deleteReportsAnchor" content-title="{{ 'PrivacyManager_DeleteOldAggregatedReports'|translate|e('html_attr') }}"> - <div piwik-form - ng-controller="DeleteOldReportsController as deleteReports" - id="formDeleteSettings"> - - <div id="deleteReportsSettingEnabled"> - - <div piwik-field uicontrol="checkbox" name="deleteReportsEnable" - ng-model="deleteReports.enabled" - ng-change="deleteReports.reloadDbStats()" - data-title="{{ 'PrivacyManager_UseDeleteReports'|translate|e('html_attr') }}" - value="{{ deleteData.config.delete_reports_enable }}" - inline-help="{{ 'PrivacyManager_DeleteAggregateReportsDetailedInfo'|translate|e('html_attr') }}"> - </div> - - <div class="alert alert-warning" style="width: 50%;" ng-show="deleteReports.enabled"> - {% set deleteOldLogs %}{{ 'PrivacyManager_UseDeleteLog'|translate }}{% endset %} - <span> - {{ 'PrivacyManager_DeleteReportsInfo2'|translate(deleteOldLogs) }}<br/><br/> - {{ 'PrivacyManager_DeleteReportsInfo3'|translate(deleteOldLogs) }} - </span> - </div> - - </div> - - <div id="deleteReportsSettings" ng-show="deleteReports.enabled"> - - <div piwik-field uicontrol="text" name="deleteReportsOlderThan" - ng-model="deleteReports.deleteOlderThan" - ng-change="deleteReports.reloadDbStats()" - data-title="{{ 'PrivacyManager_DeleteReportsOlderThan'|translate|e('html_attr') }} ({{ 'Intl_PeriodMonths'|translate }})" - value="{{ deleteData.config.delete_reports_older_than }}" - inline-help="{{ 'PrivacyManager_LeastMonthsInput'|translate("1")|e('html_attr') }}"> - </div> - - <div piwik-field uicontrol="checkbox" name="deleteReportsKeepBasic" - ng-model="deleteReports.keepBasic" - ng-change="deleteReports.reloadDbStats()" - data-title="{{ 'PrivacyManager_KeepBasicMetrics'|translate|e('html_attr') }} ({{ 'General_Recommended'|translate|e('html_attr') }})" - value="{{ deleteData.config.delete_reports_keep_basic_metrics }}" - inline-help="{{ 'PrivacyManager_KeepBasicMetricsReportsDetailedInfo'|translate|e('html_attr') }}"> - </div> - - <h3> - {{ 'PrivacyManager_KeepDataFor'|translate }} - </h3> - <div> - - <div piwik-field uicontrol="checkbox" name="deleteReportsKeepDay" - ng-model="deleteReports.keepDataForDay" - ng-change="deleteReports.reloadDbStats()" - data-title="{{ 'General_DailyReports'|translate|e('html_attr') }}" - value="{{ deleteData.config.delete_reports_keep_day_reports }}"> - </div> - <div piwik-field uicontrol="checkbox" name="deleteReportsKeepWeek" - ng-model="deleteReports.keepDataForWeek" - ng-change="deleteReports.reloadDbStats()" - data-title="{{ 'General_WeeklyReports'|translate|e('html_attr') }}" - value="{{ deleteData.config.delete_reports_keep_week_reports }}"> - </div> - <div piwik-field uicontrol="checkbox" name="deleteReportsKeepMonth" - ng-model="deleteReports.keepDataForMonth" - ng-change="deleteReports.reloadDbStats()" - data-title="{{ 'General_MonthlyReports'|translate|e('html_attr') }} ({{ 'General_Recommended'|translate|e('html_attr') }})" - value="{{ deleteData.config.delete_reports_keep_month_reports }}"> - </div> - <div piwik-field uicontrol="checkbox" name="deleteReportsKeepYear" - ng-model="deleteReports.keepDataForYear" - ng-change="deleteReports.reloadDbStats()" - data-title="{{ 'General_YearlyReports'|translate|e('html_attr') }} ({{ 'General_Recommended'|translate|e('html_attr') }})" - value="{{ deleteData.config.delete_reports_keep_year_reports }}"> - </div> - <div piwik-field uicontrol="checkbox" name="deleteReportsKeepRange" - ng-model="deleteReports.keepDataForRange" - ng-change="deleteReports.reloadDbStats()" - data-title="{{ 'General_RangeReports'|translate|e('html_attr') }}" - value="{{ deleteData.config.delete_reports_keep_range_reports }}"> - </div> - <div piwik-field uicontrol="checkbox" name="deleteReportsKeepSegments" - ng-model="deleteReports.keepDataForSegments" - ng-change="deleteReports.reloadDbStats()" - title="{{ 'PrivacyManager_KeepReportSegments'|translate|e('html_attr') }}" - value="{{ deleteData.config.delete_reports_keep_segment_reports }}"> - </div> - </div> - </div> + <div + vue-entry="PrivacyManager.DeleteOldReports" + is-data-purge-settings-enabled="{{ isDataPurgeSettingsEnabled|default(null)|json_encode|e('html_attr') }}" + delete-data="{{ deleteData|default(null)|json_encode|e('html_attr') }}" + delete-old-logs="{{ deleteOldLogs|default(null)|json_encode|e('html_attr') }}" + schedule-deletion-options="{{ scheduleDeletionOptions|default(null)|json_encode|e('html_attr') }}" + ></div> - <div piwik-save-button onconfirm="deleteReports.save()" saving="deleteReports.isLoading"></div> - </div> </div> - <div piwik-form - ng-controller="ScheduleReportDeletionController as reportDeletionSchedule" - id="formDeleteSettings"> - - <div piwik-content-block id="scheduleSettingsHeadline" - ng-show="reportDeletionSchedule.model.isEitherDeleteSectionEnabled()" - content-title="{{ 'PrivacyManager_DeleteSchedulingSettings'|translate|e('html_attr') }}"> - - <div id="deleteSchedulingSettings"> - <div id="deleteSchedulingSettingsInlineHelp" class="inline-help-node"> - {% if deleteData.lastRun %}<strong>{{ 'PrivacyManager_LastDelete'|translate }}:</strong> - {{ deleteData.lastRunPretty }} - <br/> - <br/> - {% endif %} - <strong>{{ 'PrivacyManager_NextDelete'|translate }}:</strong> - {{ deleteData.nextRunPretty|rawSafeDecoded }} - <br/> - <br/> - <a id="purgeDataNowLink" href="#" - ng-show="reportDeletionSchedule.showPurgeNowLink" - ng-click="reportDeletionSchedule.executeDataPurgeNow()">{{ 'PrivacyManager_PurgeNow'|translate }}</a> - - <div piwik-activity-indicator - loading-message="'{{ 'PrivacyManager_PurgingData'|translate|e('html_attr') }}'" - loading="reportDeletionSchedule.loadingDataPurge"></div> - <span id="db-purged-message" - ng-show="reportDeletionSchedule.dataWasPurged" - >{{ 'PrivacyManager_DBPurged'|translate }}</span> - </div> - - <div piwik-field uicontrol="select" name="deleteLowestInterval" - ng-model="reportDeletionSchedule.deleteLowestInterval" - options="{{ scheduleDeletionOptions|json_encode }}" - data-title="{{ 'PrivacyManager_DeleteDataInterval'|translate|e('html_attr') }}" - value="{{ deleteData.config.delete_logs_schedule_lowest_interval }}" - inline-help="#deleteSchedulingSettingsInlineHelp"> - </div> - </div> - - {% if deleteData.config.enable_database_size_estimate == '1' %} - <div id="deleteDataEstimateSect" class="form-group row"> - - <h3 class="col s12" id="databaseSizeHeadline"> - {{ 'PrivacyManager_ReportsDataSavedEstimate'|translate }} - </h3> - <div class="col s12 m6"> - <div id="deleteDataEstimate" ng-show="reportDeletionSchedule.model.showEstimate" - ng-bind-html="reportDeletionSchedule.model.estimation"></div> - - <div piwik-activity-indicator loading="reportDeletionSchedule.model.loadingEstimation"></div> - </div> - <div class="col s12 m6"> - {% if deleteData.config.enable_auto_database_size_estimate == '0' %} - <div class="form-help"> - <a id="getPurgeEstimateLink" - ng-click="reportDeletionSchedule.model.reloadDbStats(true)" - href="#">{{ 'PrivacyManager_GetPurgeEstimate'|translate }}</a> - </div> - {% endif %} - </div> - </div> - {% endif %} - - <div piwik-save-button onconfirm="reportDeletionSchedule.save()" saving="reportDeletionSchedule.isLoading"></div> - - </div> - {% endif %} -</div> + <div + vue-entry="PrivacyManager.ScheduleReportDeletion" + is-data-purge-settings-enabled="{{ isDataPurgeSettingsEnabled|default(null)|json_encode|e('html_attr') }}" + delete-data="{{ deleteData|default(null)|json_encode|e('html_attr') }}" + delete-old-logs="{{ deleteOldLogs|default(null)|json_encode|e('html_attr') }}" + schedule-deletion-options="{{ scheduleDeletionOptions|default(null)|json_encode|e('html_attr') }}" + ></div> +{% endif %} <a name="anonymizeHistoricalData" id="anonymizeHistoricalData"></a> diff --git a/plugins/PrivacyManager/vue/dist/PrivacyManager.umd.js b/plugins/PrivacyManager/vue/dist/PrivacyManager.umd.js index 4f91d6a889..3bdc63af42 100644 --- a/plugins/PrivacyManager/vue/dist/PrivacyManager.umd.js +++ b/plugins/PrivacyManager/vue/dist/PrivacyManager.umd.js @@ -128,6 +128,10 @@ __webpack_require__.r(__webpack_exports__); __webpack_require__.d(__webpack_exports__, "AnonymizeIp", function() { return /* reexport */ AnonymizeIp; }); __webpack_require__.d(__webpack_exports__, "AnonymizeLogData", function() { return /* reexport */ AnonymizeLogData; }); __webpack_require__.d(__webpack_exports__, "DoNotTrackPreference", function() { return /* reexport */ DoNotTrackPreference; }); +__webpack_require__.d(__webpack_exports__, "ReportDeletionSettings", function() { return /* reexport */ ReportDeletionSettings_store; }); +__webpack_require__.d(__webpack_exports__, "DeleteOldLogs", function() { return /* reexport */ DeleteOldLogs; }); +__webpack_require__.d(__webpack_exports__, "DeleteOldReports", function() { return /* reexport */ DeleteOldReports; }); +__webpack_require__.d(__webpack_exports__, "ScheduleReportDeletion", function() { return /* reexport */ ScheduleReportDeletion; }); // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js // This file is imported into lib/wc client bundles. @@ -889,6 +893,775 @@ function DoNotTrackPreferencevue_type_template_id_0506d6be_render(_ctx, _cache, DoNotTrackPreferencevue_type_script_lang_ts.render = DoNotTrackPreferencevue_type_template_id_0506d6be_render /* harmony default export */ var DoNotTrackPreference = (DoNotTrackPreferencevue_type_script_lang_ts); +// CONCATENATED MODULE: ./plugins/PrivacyManager/vue/src/ReportDeletionSettings/ReportDeletionSettings.store.ts +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + + + +var ReportDeletionSettings_store_ReportDeletionSettingsStore = /*#__PURE__*/function () { + function ReportDeletionSettingsStore() { + var _this = this; + + _classCallCheck(this, ReportDeletionSettingsStore); + + _defineProperty(this, "privateState", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["reactive"])({ + settings: {}, + showEstimate: false, + loadingEstimation: false, + estimation: '', + isModified: false + })); + + _defineProperty(this, "state", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["readonly"])(_this.privateState); + })); + + _defineProperty(this, "enableDeleteReports", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () { + return _this.state.value.settings.enableDeleteReports; + })); + + _defineProperty(this, "enableDeleteLogs", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () { + return _this.state.value.settings.enableDeleteLogs; + })); + + _defineProperty(this, "currentRequest", void 0); + } + + _createClass(ReportDeletionSettingsStore, [{ + key: "updateSettings", + value: function updateSettings(settings) { + this.initSettings(settings); + this.privateState.isModified = true; + } + }, { + key: "initSettings", + value: function initSettings(settings) { + this.privateState.settings = Object.assign(Object.assign({}, this.privateState.settings), settings); + this.reloadDbStats(); + } + }, { + key: "savePurgeDataSettings", + value: function savePurgeDataSettings(apiMethod, settings) { + this.privateState.isModified = false; + return external_CoreHome_["AjaxHelper"].post({ + module: 'API', + method: apiMethod + }, Object.assign(Object.assign({}, settings), {}, { + enableDeleteLogs: settings.enableDeleteLogs ? '1' : '0', + enableDeleteReports: settings.enableDeleteReports ? '1' : '0' + })).then(function () { + var notificationInstanceId = external_CoreHome_["NotificationsStore"].show({ + message: Object(external_CoreHome_["translate"])('CoreAdminHome_SettingsSaveSuccess'), + context: 'success', + id: 'privacyManagerSettings', + type: 'toast' + }); + external_CoreHome_["NotificationsStore"].scrollToNotification(notificationInstanceId); + }); + } + }, { + key: "isEitherDeleteSectionEnabled", + value: function isEitherDeleteSectionEnabled() { + return this.state.value.settings.enableDeleteLogs || this.state.value.settings.enableDeleteReports; + } + }, { + key: "isManualEstimationLinkShowing", + value: function isManualEstimationLinkShowing() { + return window.$('#getPurgeEstimateLink').length > 0; + } + }, { + key: "reloadDbStats", + value: function reloadDbStats(forceEstimate) { + var _this2 = this; + + if (this.currentRequest) { + // if the manual estimate link is showing, abort unless forcing + this.currentRequest.abort(); + this.currentRequest = undefined; + } + + if (!forceEstimate && (!this.isEitherDeleteSectionEnabled() || this.isManualEstimationLinkShowing())) { + return; + } + + this.privateState.loadingEstimation = true; + this.privateState.estimation = ''; + this.privateState.showEstimate = false; + var settings = this.privateState.settings; + var formData = Object.assign(Object.assign({}, settings), {}, { + enableDeleteLogs: settings.enableDeleteLogs ? '1' : '0', + enableDeleteReports: settings.enableDeleteReports ? '1' : '0' + }); + + if (forceEstimate === true) { + formData.forceEstimate = 1; + } + + this.currentRequest = new AbortController(); + external_CoreHome_["AjaxHelper"].post({ + module: 'PrivacyManager', + action: 'getDatabaseSize', + format: 'html' + }, formData, { + abortController: this.currentRequest, + format: 'html' + }).then(function (data) { + _this2.privateState.estimation = data; + _this2.privateState.showEstimate = true; + _this2.privateState.loadingEstimation = false; + }).finally(function () { + _this2.currentRequest = undefined; + _this2.privateState.loadingEstimation = false; + }); + } + }]); + + return ReportDeletionSettingsStore; +}(); + +/* harmony default export */ var ReportDeletionSettings_store = (new ReportDeletionSettings_store_ReportDeletionSettingsStore()); +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/PrivacyManager/vue/src/DeleteOldLogs/DeleteOldLogs.vue?vue&type=template&id=2d91a21d + +var DeleteOldLogsvue_type_template_id_2d91a21d_hoisted_1 = { + id: "formDeleteSettings" +}; +var DeleteOldLogsvue_type_template_id_2d91a21d_hoisted_2 = { + id: "deleteLogSettingEnabled" +}; +var DeleteOldLogsvue_type_template_id_2d91a21d_hoisted_3 = { + class: "alert alert-warning deleteOldLogsWarning", + style: { + "width": "50%" + } +}; +var DeleteOldLogsvue_type_template_id_2d91a21d_hoisted_4 = { + href: "https://matomo.org/faq/general/#faq_125", + rel: "noreferrer noopener", + target: "_blank" +}; +var DeleteOldLogsvue_type_template_id_2d91a21d_hoisted_5 = { + id: "deleteLogSettings" +}; +function DeleteOldLogsvue_type_template_id_2d91a21d_render(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); + + var _component_SaveButton = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("SaveButton"); + + var _directive_form = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("form"); + + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", DeleteOldLogsvue_type_template_id_2d91a21d_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", DeleteOldLogsvue_type_template_id_2d91a21d_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "deleteEnable", + "model-value": _ctx.enabled, + "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { + _ctx.enabled = $event; + + _ctx.reloadDbStats(); + }), + title: _ctx.translate('PrivacyManager_UseDeleteLog'), + "inline-help": _ctx.translate('PrivacyManager_DeleteRawDataInfo') + }, null, 8, ["model-value", "title", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", DeleteOldLogsvue_type_template_id_2d91a21d_hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", DeleteOldLogsvue_type_template_id_2d91a21d_hoisted_4, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_ClickHere')), 1)], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.enabled]])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", DeleteOldLogsvue_type_template_id_2d91a21d_hoisted_5, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + name: "deleteOlderThan", + "model-value": _ctx.deleteOlderThan, + "onUpdate:modelValue": _cache[1] || (_cache[1] = function ($event) { + _ctx.deleteOlderThan = $event; + + _ctx.reloadDbStats(); + }), + title: _ctx.deleteOlderThanTitle, + "inline-help": _ctx.translate('PrivacyManager_LeastDaysInput', '1') + }, null, 8, ["model-value", "title", "inline-help"])])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.enabled]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SaveButton, { + onConfirm: _cache[2] || (_cache[2] = function ($event) { + return _ctx.save(); + }), + saving: _ctx.isLoading + }, null, 8, ["saving"])], 512)), [[_directive_form]]); +} +// CONCATENATED MODULE: ./plugins/PrivacyManager/vue/src/DeleteOldLogs/DeleteOldLogs.vue?vue&type=template&id=2d91a21d + +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/PrivacyManager/vue/src/DeleteOldLogs/DeleteOldLogs.vue?vue&type=script&lang=ts + + + + +var _window = window, + DeleteOldLogsvue_type_script_lang_ts_$ = _window.$; +/* harmony default export */ var DeleteOldLogsvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ + props: { + isDataPurgeSettingsEnabled: Boolean, + deleteData: { + type: Object, + required: true + }, + scheduleDeletionOptions: { + type: Object, + required: true + } + }, + components: { + Field: external_CorePluginsAdmin_["Field"], + SaveButton: external_CorePluginsAdmin_["SaveButton"] + }, + directives: { + Form: external_CorePluginsAdmin_["Form"] + }, + data: function data() { + return { + isLoading: false, + enabled: this.deleteData.config.delete_logs_enable === '1', + deleteOlderThan: this.deleteData.config.delete_logs_older_than + }; + }, + created: function created() { + var _this = this; + + setTimeout(function () { + ReportDeletionSettings_store.initSettings(_this.settings); + }); + }, + methods: { + saveSettings: function saveSettings() { + var _this2 = this; + + var method = 'PrivacyManager.setDeleteLogsSettings'; + this.isLoading = true; + ReportDeletionSettings_store.savePurgeDataSettings(method, this.settings).finally(function () { + _this2.isLoading = false; + }); + }, + reloadDbStats: function reloadDbStats() { + ReportDeletionSettings_store.updateSettings(this.settings); + }, + save: function save() { + var _this3 = this; + + if (this.enabled) { + var confirmId = 'deleteLogsConfirm'; + + if (ReportDeletionSettings_store.enableDeleteReports.value) { + confirmId = 'deleteBothConfirm'; + } + + DeleteOldLogsvue_type_script_lang_ts_$('#confirmDeleteSettings').find('>h2').hide(); + DeleteOldLogsvue_type_script_lang_ts_$("#".concat(confirmId)).show(); + external_CoreHome_["Matomo"].helper.modalConfirm('#confirmDeleteSettings', { + yes: function yes() { + _this3.saveSettings(); + } + }); + } else { + this.saveSettings(); + } + } + }, + computed: { + settings: function settings() { + return { + enableDeleteLogs: !!this.enabled, + deleteLogsOlderThan: this.deleteOlderThan + }; + }, + deleteOlderThanTitle: function deleteOlderThanTitle() { + return "".concat(Object(external_CoreHome_["translate"])('PrivacyManager_DeleteLogsOlderThan'), " (").concat(Object(external_CoreHome_["translate"])('Intl_PeriodDays'), ")"); + } + } +})); +// CONCATENATED MODULE: ./plugins/PrivacyManager/vue/src/DeleteOldLogs/DeleteOldLogs.vue?vue&type=script&lang=ts + +// CONCATENATED MODULE: ./plugins/PrivacyManager/vue/src/DeleteOldLogs/DeleteOldLogs.vue + + + +DeleteOldLogsvue_type_script_lang_ts.render = DeleteOldLogsvue_type_template_id_2d91a21d_render + +/* harmony default export */ var DeleteOldLogs = (DeleteOldLogsvue_type_script_lang_ts); +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/PrivacyManager/vue/src/DeleteOldReports/DeleteOldReports.vue?vue&type=template&id=0a48298a + +var DeleteOldReportsvue_type_template_id_0a48298a_hoisted_1 = { + id: "formDeleteSettings" +}; +var DeleteOldReportsvue_type_template_id_0a48298a_hoisted_2 = { + id: "deleteReportsSettingEnabled" +}; +var DeleteOldReportsvue_type_template_id_0a48298a_hoisted_3 = { + class: "alert alert-warning", + style: { + "width": "50%" + } +}; + +var DeleteOldReportsvue_type_template_id_0a48298a_hoisted_4 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var DeleteOldReportsvue_type_template_id_0a48298a_hoisted_5 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var DeleteOldReportsvue_type_template_id_0a48298a_hoisted_6 = { + id: "deleteReportsSettings" +}; +function DeleteOldReportsvue_type_template_id_0a48298a_render(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); + + var _component_SaveButton = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("SaveButton"); + + var _directive_form = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("form"); + + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", DeleteOldReportsvue_type_template_id_0a48298a_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", DeleteOldReportsvue_type_template_id_0a48298a_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "deleteReportsEnable", + "model-value": _ctx.enabled, + "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { + _ctx.enabled = $event; + + _ctx.reloadDbStats(); + }), + title: _ctx.translate('PrivacyManager_UseDeleteReports'), + "inline-help": _ctx.translate('PrivacyManager_DeleteAggregateReportsDetailedInfo') + }, null, 8, ["model-value", "title", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", DeleteOldReportsvue_type_template_id_0a48298a_hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('PrivacyManager_DeleteReportsInfo2', _ctx.deleteOldLogsText)), 1), DeleteOldReportsvue_type_template_id_0a48298a_hoisted_4, DeleteOldReportsvue_type_template_id_0a48298a_hoisted_5, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('PrivacyManager_DeleteReportsInfo3', _ctx.deleteOldLogsText)), 1)])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.enabled]])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", DeleteOldReportsvue_type_template_id_0a48298a_hoisted_6, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + name: "deleteReportsOlderThan", + "model-value": _ctx.deleteOlderThan, + "onUpdate:modelValue": _cache[1] || (_cache[1] = function ($event) { + _ctx.deleteOlderThan = $event; + + _ctx.reloadDbStats(); + }), + title: _ctx.deleteReportsOlderThanTitle, + "inline-help": _ctx.translate('PrivacyManager_LeastMonthsInput', '1') + }, null, 8, ["model-value", "title", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "deleteReportsKeepBasic", + "model-value": _ctx.keepBasic, + "onUpdate:modelValue": _cache[2] || (_cache[2] = function ($event) { + _ctx.keepBasic = $event; + + _ctx.reloadDbStats(); + }), + title: _ctx.deleteReportsKeepBasicTitle, + "inline-help": _ctx.translate('PrivacyManager_KeepBasicMetricsReportsDetailedInfo') + }, null, 8, ["model-value", "title", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('PrivacyManager_KeepDataFor')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "deleteReportsKeepDay", + "model-value": _ctx.keepDataForDay, + "onUpdate:modelValue": _cache[3] || (_cache[3] = function ($event) { + _ctx.keepDataForDay = $event; + + _ctx.reloadDbStats(); + }), + title: _ctx.translate('General_DailyReports') + }, null, 8, ["model-value", "title"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "deleteReportsKeepWeek", + "model-value": _ctx.keepDataForWeek, + "onUpdate:modelValue": _cache[4] || (_cache[4] = function ($event) { + _ctx.keepDataForWeek = $event; + + _ctx.reloadDbStats(); + }), + title: _ctx.translate('General_WeeklyReports') + }, null, 8, ["model-value", "title"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "deleteReportsKeepMonth", + "model-value": _ctx.keepDataForMonth, + "onUpdate:modelValue": _cache[5] || (_cache[5] = function ($event) { + _ctx.keepDataForMonth = $event; + + _ctx.reloadDbStats(); + }), + title: "".concat(_ctx.translate('General_MonthlyReports'), " (").concat(_ctx.translate('General_Recommended'), ")") + }, null, 8, ["model-value", "title"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "deleteReportsKeepYear", + "model-value": _ctx.keepDataForYear, + "onUpdate:modelValue": _cache[6] || (_cache[6] = function ($event) { + _ctx.keepDataForYear = $event; + + _ctx.reloadDbStats(); + }), + title: "".concat(_ctx.translate('General_YearlyReports'), " (").concat(_ctx.translate('General_Recommended'), ")") + }, null, 8, ["model-value", "title"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "deleteReportsKeepRange", + "model-value": _ctx.keepDataForRange, + "onUpdate:modelValue": _cache[7] || (_cache[7] = function ($event) { + _ctx.keepDataForRange = $event; + + _ctx.reloadDbStats(); + }), + title: _ctx.translate('General_RangeReports') + }, null, 8, ["model-value", "title"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "deleteReportsKeepSegments", + "model-value": _ctx.keepDataForSegments, + "onUpdate:modelValue": _cache[8] || (_cache[8] = function ($event) { + _ctx.keepDataForSegments = $event; + + _ctx.reloadDbStats(); + }), + title: _ctx.translate('PrivacyManager_KeepReportSegments') + }, null, 8, ["model-value", "title"])])])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.enabled]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SaveButton, { + onConfirm: _cache[9] || (_cache[9] = function ($event) { + return _ctx.save(); + }), + saving: _ctx.isLoading + }, null, 8, ["saving"])], 512)), [[_directive_form]]); +} +// CONCATENATED MODULE: ./plugins/PrivacyManager/vue/src/DeleteOldReports/DeleteOldReports.vue?vue&type=template&id=0a48298a + +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/PrivacyManager/vue/src/DeleteOldReports/DeleteOldReports.vue?vue&type=script&lang=ts + + + + + +function getInt(value) { + return value ? '1' : '0'; +} + +var DeleteOldReportsvue_type_script_lang_ts_window = window, + DeleteOldReportsvue_type_script_lang_ts_$ = DeleteOldReportsvue_type_script_lang_ts_window.$; +/* harmony default export */ var DeleteOldReportsvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ + props: { + isDataPurgeSettingsEnabled: Boolean, + deleteData: { + type: Object, + required: true + }, + scheduleDeletionOptions: { + type: Object, + required: true + } + }, + components: { + Field: external_CorePluginsAdmin_["Field"], + SaveButton: external_CorePluginsAdmin_["SaveButton"] + }, + directives: { + Form: external_CorePluginsAdmin_["Form"] + }, + data: function data() { + return { + isLoading: false, + enabled: parseInt(this.deleteData.config.delete_reports_enable, 10) === 1, + deleteOlderThan: this.deleteData.config.delete_reports_older_than, + keepBasic: parseInt(this.deleteData.config.delete_reports_keep_basic_metrics, 10) === 1, + keepDataForDay: parseInt(this.deleteData.config.delete_reports_keep_day_reports, 10) === 1, + keepDataForWeek: parseInt(this.deleteData.config.delete_reports_keep_week_reports, 10) === 1, + keepDataForMonth: parseInt(this.deleteData.config.delete_reports_keep_month_reports, 10) === 1, + keepDataForYear: parseInt(this.deleteData.config.delete_reports_keep_year_reports, 10) === 1, + keepDataForRange: parseInt(this.deleteData.config.delete_reports_keep_range_reports, 10) === 1, + keepDataForSegments: parseInt(this.deleteData.config.delete_reports_keep_segment_reports, 10) === 1 + }; + }, + created: function created() { + var _this = this; + + setTimeout(function () { + ReportDeletionSettings_store.initSettings(_this.settings); + }); + }, + methods: { + saveSettings: function saveSettings() { + var _this2 = this; + + var method = 'PrivacyManager.setDeleteReportsSettings'; + this.isLoading = true; + ReportDeletionSettings_store.savePurgeDataSettings(method, this.settings).finally(function () { + _this2.isLoading = false; + }); + }, + reloadDbStats: function reloadDbStats() { + ReportDeletionSettings_store.updateSettings(this.settings); + }, + save: function save() { + var _this3 = this; + + if (this.enabled) { + var confirmId = 'deleteReportsConfirm'; + + if (ReportDeletionSettings_store.enableDeleteLogs.value) { + confirmId = 'deleteBothConfirm'; + } + + DeleteOldReportsvue_type_script_lang_ts_$('#confirmDeleteSettings').find('>h2').hide(); + DeleteOldReportsvue_type_script_lang_ts_$("#".concat(confirmId)).show(); + external_CoreHome_["Matomo"].helper.modalConfirm('#confirmDeleteSettings', { + yes: function yes() { + _this3.saveSettings(); + } + }); + } else { + this.saveSettings(); + } + } + }, + computed: { + settings: function settings() { + return { + enableDeleteReports: this.enabled, + deleteReportsOlderThan: this.deleteOlderThan, + keepBasic: getInt(this.keepBasic), + keepDay: getInt(this.keepDataForDay), + keepWeek: getInt(this.keepDataForWeek), + keepMonth: getInt(this.keepDataForMonth), + keepYear: getInt(this.keepDataForYear), + keepRange: getInt(this.keepDataForRange), + keepSegments: getInt(this.keepDataForSegments) + }; + }, + deleteOldLogsText: function deleteOldLogsText() { + return Object(external_CoreHome_["translate"])('PrivacyManager_UseDeleteLog'); + }, + deleteReportsOlderThanTitle: function deleteReportsOlderThanTitle() { + var first = Object(external_CoreHome_["translate"])('PrivacyManager_DeleteReportsOlderThan'); + return "".concat(first, " (").concat(Object(external_CoreHome_["translate"])('Intl_PeriodMonths'), ")"); + }, + deleteReportsKeepBasicTitle: function deleteReportsKeepBasicTitle() { + var first = Object(external_CoreHome_["translate"])('PrivacyManager_KeepBasicMetrics'); + return "".concat(first, " (").concat(Object(external_CoreHome_["translate"])('General_Recommended'), ")"); + } + } +})); +// CONCATENATED MODULE: ./plugins/PrivacyManager/vue/src/DeleteOldReports/DeleteOldReports.vue?vue&type=script&lang=ts + +// CONCATENATED MODULE: ./plugins/PrivacyManager/vue/src/DeleteOldReports/DeleteOldReports.vue + + + +DeleteOldReportsvue_type_script_lang_ts.render = DeleteOldReportsvue_type_template_id_0a48298a_render + +/* harmony default export */ var DeleteOldReports = (DeleteOldReportsvue_type_script_lang_ts); +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/PrivacyManager/vue/src/ScheduleReportDeletion/ScheduleReportDeletion.vue?vue&type=template&id=22bfc8d0 + +var ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_1 = { + id: "formDeleteSettings" +}; +var ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_2 = { + id: "deleteSchedulingSettings" +}; +var ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_3 = { + id: "deleteSchedulingSettingsInlineHelp", + class: "inline-help-node" +}; +var ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_4 = { + key: 0 +}; + +var ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_5 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_6 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_7 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_8 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_9 = { + key: 0, + id: "deleteDataEstimateSect", + class: "form-group row" +}; +var ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_10 = { + class: "col s12", + id: "databaseSizeHeadline" +}; +var ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_11 = { + class: "col s12 m6" +}; +var ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_12 = ["innerHTML"]; + +var ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_13 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" "); + +var ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_14 = { + class: "col s12 m6" +}; +var ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_15 = { + key: 0, + class: "form-help" +}; +function ScheduleReportDeletionvue_type_template_id_22bfc8d0_render(_ctx, _cache, $props, $setup, $data, $options) { + var _component_ActivityIndicator = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ActivityIndicator"); + + var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); + + var _component_SaveButton = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("SaveButton"); + + var _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); + + var _directive_form = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("form"); + + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, { + id: "scheduleSettingsHeadline", + "content-title": _ctx.translate('PrivacyManager_DeleteSchedulingSettings') + }, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(function () { + return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "select", + name: "deleteLowestInterval", + title: _ctx.translate('PrivacyManager_DeleteDataInterval'), + modelValue: _ctx.deleteLowestInterval, + "onUpdate:modelValue": _cache[1] || (_cache[1] = function ($event) { + return _ctx.deleteLowestInterval = $event; + }), + options: _ctx.scheduleDeletionOptions + }, { + "inline-help": Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(function () { + return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_3, [_ctx.deleteData.lastRun ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_4, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("strong", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('PrivacyManager_LastDelete')) + ":", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.deleteData.lastRunPretty) + " ", 1), ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_5, ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_6])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("strong", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('PrivacyManager_NextDelete')) + ":", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.deleteData.nextRunPretty) + " ", 1), ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_7, ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_8, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + id: "purgeDataNowLink", + href: "#", + onClick: _cache[0] || (_cache[0] = function ($event) { + return _ctx.executeDataPurgeNow(); + }) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('PrivacyManager_PurgeNow')), 513), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.showPurgeNowLink]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ActivityIndicator, { + "loading-message": _ctx.translate('PrivacyManager_PurgingData'), + loading: _ctx.loadingDataPurge + }, null, 8, ["loading-message", "loading"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + id: "db-purged-message" + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('PrivacyManager_DBPurged')), 513), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.dataWasPurged]])])]; + }), + _: 1 + }, 8, ["title", "modelValue", "options"])])]), _ctx.deleteData.config.enable_database_size_estimate === '1' || _ctx.deleteData.config.enable_database_size_estimate === 1 ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_9, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_10, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('PrivacyManager_ReportsDataSavedEstimate')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_11, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + id: "deleteDataEstimate", + innerHTML: _ctx.$sanitize(_ctx.estimation) + }, null, 8, ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_12), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.showEstimate]]), ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_13, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ActivityIndicator, { + loading: _ctx.loadingEstimation + }, null, 8, ["loading"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_14, [_ctx.deleteData.config.enable_auto_database_size_estimate !== '1' && _ctx.deleteData.config.enable_auto_database_size_estimate !== 1 ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", ScheduleReportDeletionvue_type_template_id_22bfc8d0_hoisted_15, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + id: "getPurgeEstimateLink", + href: "#", + onClick: _cache[2] || (_cache[2] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])(function ($event) { + return _ctx.getPurgeEstimate(); + }, ["prevent"])) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('PrivacyManager_GetPurgeEstimate')), 1)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SaveButton, { + onConfirm: _cache[3] || (_cache[3] = function ($event) { + return _ctx.save(); + }), + saving: _ctx.isLoading + }, null, 8, ["saving"])]; + }), + _: 1 + }, 8, ["content-title"]), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isEitherDeleteSectionEnabled]])], 512)), [[_directive_form]]); +} +// CONCATENATED MODULE: ./plugins/PrivacyManager/vue/src/ScheduleReportDeletion/ScheduleReportDeletion.vue?vue&type=template&id=22bfc8d0 + +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/PrivacyManager/vue/src/ScheduleReportDeletion/ScheduleReportDeletion.vue?vue&type=script&lang=ts + + + + +/* harmony default export */ var ScheduleReportDeletionvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ + props: { + isDataPurgeSettingsEnabled: Boolean, + deleteData: { + type: Object, + required: true + }, + scheduleDeletionOptions: { + type: Object, + required: true + } + }, + components: { + ContentBlock: external_CoreHome_["ContentBlock"], + ActivityIndicator: external_CoreHome_["ActivityIndicator"], + Field: external_CorePluginsAdmin_["Field"], + SaveButton: external_CorePluginsAdmin_["SaveButton"] + }, + directives: { + Form: external_CorePluginsAdmin_["Form"] + }, + data: function data() { + return { + isLoading: false, + loadingDataPurge: false, + dataWasPurged: false, + showPurgeNowLink: true, + deleteLowestInterval: this.deleteData.config.delete_logs_schedule_lowest_interval + }; + }, + methods: { + save: function save() { + var method = 'PrivacyManager.setScheduleReportDeletionSettings'; + ReportDeletionSettings_store.savePurgeDataSettings(method, { + deleteLowestInterval: this.deleteLowestInterval + }); + }, + executeDataPurgeNow: function executeDataPurgeNow() { + var _this = this; + + if (ReportDeletionSettings_store.state.value.isModified) { + // ask user if they really want to delete their old data + external_CoreHome_["Matomo"].helper.modalConfirm('#saveSettingsBeforePurge', { + yes: function yes() { + return null; + } + }); + return; + } + + external_CoreHome_["Matomo"].helper.modalConfirm('#confirmPurgeNow', { + yes: function yes() { + _this.loadingDataPurge = true; + _this.showPurgeNowLink = false; // execute a data purge + + external_CoreHome_["AjaxHelper"].fetch({ + module: 'PrivacyManager', + action: 'executeDataPurge', + format: 'html' + }, { + withTokenInUrl: true + }).then(function () { + // force reload + ReportDeletionSettings_store.reloadDbStats(); + _this.dataWasPurged = true; + setTimeout(function () { + _this.dataWasPurged = false; + _this.showPurgeNowLink = true; + }, 2000); + }).finally(function () { + _this.loadingDataPurge = false; + }); + } + }); + }, + getPurgeEstimate: function getPurgeEstimate() { + return ReportDeletionSettings_store.reloadDbStats(true); + } + }, + computed: { + showEstimate: function showEstimate() { + return ReportDeletionSettings_store.state.value.showEstimate; + }, + isEitherDeleteSectionEnabled: function isEitherDeleteSectionEnabled() { + return ReportDeletionSettings_store.isEitherDeleteSectionEnabled(); + }, + estimation: function estimation() { + return ReportDeletionSettings_store.state.value.estimation; + }, + loadingEstimation: function loadingEstimation() { + return ReportDeletionSettings_store.state.value.loadingEstimation; + } + } +})); +// CONCATENATED MODULE: ./plugins/PrivacyManager/vue/src/ScheduleReportDeletion/ScheduleReportDeletion.vue?vue&type=script&lang=ts + +// CONCATENATED MODULE: ./plugins/PrivacyManager/vue/src/ScheduleReportDeletion/ScheduleReportDeletion.vue + + + +ScheduleReportDeletionvue_type_script_lang_ts.render = ScheduleReportDeletionvue_type_template_id_22bfc8d0_render + +/* harmony default export */ var ScheduleReportDeletion = (ScheduleReportDeletionvue_type_script_lang_ts); // CONCATENATED MODULE: ./plugins/PrivacyManager/vue/src/index.ts /*! * Matomo - free/libre analytics platform @@ -899,6 +1672,10 @@ DoNotTrackPreferencevue_type_script_lang_ts.render = DoNotTrackPreferencevue_typ + + + + // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib-no-default.js diff --git a/plugins/PrivacyManager/vue/dist/PrivacyManager.umd.min.js b/plugins/PrivacyManager/vue/dist/PrivacyManager.umd.min.js index d254c575bb..208816381f 100644 --- a/plugins/PrivacyManager/vue/dist/PrivacyManager.umd.min.js +++ b/plugins/PrivacyManager/vue/dist/PrivacyManager.umd.min.js @@ -1,4 +1,10 @@ -(function(e,n){"object"===typeof exports&&"object"===typeof module?module.exports=n(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):"function"===typeof define&&define.amd?define(["CoreHome",,"CorePluginsAdmin"],n):"object"===typeof exports?exports["PrivacyManager"]=n(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):e["PrivacyManager"]=n(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,n,t){return function(e){var n={};function t(o){if(n[o])return n[o].exports;var a=n[o]={i:o,l:!1,exports:{}};return e[o].call(a.exports,a,a.exports,t),a.l=!0,a.exports}return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:o})},t.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"===typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var a in e)t.d(o,a,function(n){return e[n]}.bind(null,a));return o},t.n=function(e){var n=e&&e.__esModule?function(){return e["default"]}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="plugins/PrivacyManager/vue/dist/",t(t.s="fae3")}({"19dc":function(n,t){n.exports=e},"8bbf":function(e,t){e.exports=n},a5a2:function(e,n){e.exports=t},fae3:function(e,n,t){"use strict";if(t.r(n),t.d(n,"AnonymizeIp",(function(){return O})),t.d(n,"AnonymizeLogData",(function(){return le})),t.d(n,"DoNotTrackPreference",(function(){return se})),"undefined"!==typeof window){var o=window.document.currentScript,a=o&&o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);a&&(t.p=a[1])}var i=t("8bbf"),l=Object(i["createElementVNode"])("br",null,null,-1),r=Object(i["createElementVNode"])("br",null,null,-1),c=Object(i["createElementVNode"])("br",null,null,-1),s=Object(i["createElementVNode"])("br",null,null,-1),u={key:0},m=Object(i["createElementVNode"])("br",null,null,-1),d=Object(i["createElementVNode"])("br",null,null,-1),p={class:"alert-warning alert"};function y(e,n,t,o,a,y){var b=Object(i["resolveComponent"])("Field"),v=Object(i["resolveComponent"])("SaveButton"),f=Object(i["resolveDirective"])("form");return Object(i["withDirectives"])((Object(i["openBlock"])(),Object(i["createElementBlock"])("div",null,[Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(b,{uicontrol:"checkbox",name:"anonymizeIpSettings",title:e.translate("PrivacyManager_UseAnonymizeIp"),modelValue:e.actualEnabled,"onUpdate:modelValue":n[0]||(n[0]=function(n){return e.actualEnabled=n}),"inline-help":e.anonymizeIpEnabledHelp},null,8,["title","modelValue","inline-help"])]),Object(i["withDirectives"])(Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(b,{uicontrol:"radio",name:"maskLength",title:e.translate("PrivacyManager_AnonymizeIpMaskLengtDescription"),modelValue:e.actualMaskLength,"onUpdate:modelValue":n[1]||(n[1]=function(n){return e.actualMaskLength=n}),options:e.maskLengthOptions,"inline-help":e.translate("PrivacyManager_GeolocationAnonymizeIpNote")},null,8,["title","modelValue","options","inline-help"])]),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(b,{uicontrol:"radio",name:"useAnonymizedIpForVisitEnrichment",title:e.translate("PrivacyManager_UseAnonymizedIpForVisitEnrichment"),modelValue:e.actualUseAnonymizedIpForVisitEnrichment,"onUpdate:modelValue":n[2]||(n[2]=function(n){return e.actualUseAnonymizedIpForVisitEnrichment=n}),options:e.useAnonymizedIpForVisitEnrichmentOptions,"inline-help":e.translate("PrivacyManager_UseAnonymizedIpForVisitEnrichmentNote")},null,8,["title","modelValue","options","inline-help"])])],512),[[i["vShow"],e.actualEnabled]]),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(b,{uicontrol:"checkbox",name:"anonymizeUserId",title:e.translate("PrivacyManager_PseudonymizeUserId"),modelValue:e.actualAnonymizeUserId,"onUpdate:modelValue":n[3]||(n[3]=function(n){return e.actualAnonymizeUserId=n})},{"inline-help":Object(i["withCtx"])((function(){return[Object(i["createTextVNode"])(Object(i["toDisplayString"])(e.translate("PrivacyManager_PseudonymizeUserIdNote"))+" ",1),l,r,Object(i["createElementVNode"])("em",null,Object(i["toDisplayString"])(e.translate("PrivacyManager_PseudonymizeUserIdNote2")),1)]})),_:1},8,["title","modelValue"])]),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(b,{uicontrol:"checkbox",name:"anonymizeOrderId",title:e.translate("PrivacyManager_UseAnonymizeOrderId"),modelValue:e.actualAnonymizeOrderId,"onUpdate:modelValue":n[4]||(n[4]=function(n){return e.actualAnonymizeOrderId=n}),"inline-help":e.translate("PrivacyManager_AnonymizeOrderIdNote")},null,8,["title","modelValue","inline-help"])]),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(b,{uicontrol:"checkbox",name:"forceCookielessTracking",title:e.translate("PrivacyManager_ForceCookielessTracking"),modelValue:e.actualForceCookielessTracking,"onUpdate:modelValue":n[5]||(n[5]=function(n){return e.actualForceCookielessTracking=n})},{"inline-help":Object(i["withCtx"])((function(){return[Object(i["createTextVNode"])(Object(i["toDisplayString"])(e.translate("PrivacyManager_ForceCookielessTrackingDescription",e.trackerFileName))+" ",1),c,s,Object(i["createElementVNode"])("em",null,Object(i["toDisplayString"])(e.translate("PrivacyManager_ForceCookielessTrackingDescription2")),1),e.trackerWritable?Object(i["createCommentVNode"])("",!0):(Object(i["openBlock"])(),Object(i["createElementBlock"])("span",u,[m,d,Object(i["createElementVNode"])("p",p,Object(i["toDisplayString"])(e.translate("PrivacyManager_ForceCookielessTrackingDescriptionNotWritable",e.trackerFileName)),1)]))]})),_:1},8,["title","modelValue"])]),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(b,{uicontrol:"select",name:"anonymizeReferrer",title:e.translate("PrivacyManager_AnonymizeReferrer"),modelValue:e.actualAnonymizeReferrer,"onUpdate:modelValue":n[6]||(n[6]=function(n){return e.actualAnonymizeReferrer=n}),options:e.referrerAnonymizationOptions,"inline-help":e.translate("PrivacyManager_AnonymizeReferrerNote")},null,8,["title","modelValue","options","inline-help"])]),Object(i["createVNode"])(v,{onConfirm:n[7]||(n[7]=function(n){return e.save()}),saving:e.isLoading},null,8,["saving"])],512)),[[f]])}var b=t("19dc"),v=t("a5a2"),f=Object(i["defineComponent"])({props:{anonymizeIpEnabled:Boolean,anonymizeUserId:Boolean,maskLength:{type:Number,required:!0},useAnonymizedIpForVisitEnrichment:Boolean,anonymizeOrderId:Boolean,forceCookielessTracking:Boolean,anonymizeReferrer:String,maskLengthOptions:{type:Array,required:!0},useAnonymizedIpForVisitEnrichmentOptions:{type:Array,required:!0},trackerFileName:{type:String,required:!0},trackerWritable:{type:Boolean,required:!0},referrerAnonymizationOptions:{type:Object,required:!0}},components:{Field:v["Field"],SaveButton:v["SaveButton"]},directives:{Form:v["Form"]},data:function(){return{isLoading:!1,actualEnabled:!!this.anonymizeIpEnabled,actualMaskLength:this.maskLength,actualUseAnonymizedIpForVisitEnrichment:this.useAnonymizedIpForVisitEnrichment?"1":"0",actualAnonymizeUserId:!!this.anonymizeUserId,actualAnonymizeOrderId:!!this.anonymizeOrderId,actualForceCookielessTracking:!!this.forceCookielessTracking,actualAnonymizeReferrer:this.anonymizeReferrer}},methods:{save:function(){var e=this;this.isLoading=!0,b["AjaxHelper"].post({module:"API",method:"PrivacyManager.setAnonymizeIpSettings"},{anonymizeIPEnable:this.actualEnabled?"1":"0",anonymizeUserId:this.actualAnonymizeUserId?"1":"0",anonymizeOrderId:this.actualAnonymizeOrderId?"1":"0",forceCookielessTracking:this.actualForceCookielessTracking?"1":"0",anonymizeReferrer:this.actualAnonymizeReferrer?this.actualAnonymizeReferrer:"",maskLength:this.actualMaskLength,useAnonymizedIpForVisitEnrichment:this.actualUseAnonymizedIpForVisitEnrichment?"1":"0"}).then((function(){var e=b["NotificationsStore"].show({message:Object(b["translate"])("CoreAdminHome_SettingsSaveSuccess"),context:"success",id:"privacyManagerSettings",type:"toast"});b["NotificationsStore"].scrollToNotification(e)})).finally((function(){e.isLoading=!1}))}},computed:{anonymizeIpEnabledHelp:function(){var e=Object(b["translate"])("PrivacyManager_AnonymizeIpInlineHelp"),n=Object(b["translate"])("PrivacyManager_AnonymizeIpDescription");return"".concat(e," ").concat(n)}}});f.render=y;var O=f,h={class:"anonymizeLogData"},V={class:"form-group row"},j={class:"col s12 input-field"},g={for:"anonymizeSite",class:"siteSelectorLabel"},z={class:"sites_autocomplete"},N={class:"form-group row"},A={class:"col s6 input-field"},E={for:"anonymizeStartDate",class:"active"},C=["value"],k={class:"col s6 input-field"},D={for:"anonymizeEndDate",class:"active"},S=["value"],I={name:"anonymizeIp"},P={name:"anonymizeLocation"},_={name:"anonymizeTheUserId"},M={class:"form-group row"},w={class:"col s12 m6"},U={for:"visit_columns"},F={class:"innerFormField",name:"visit_columns"},L=["onClick","title"],B={class:"col s12 m6"},x={class:"form-help"},T={class:"inline-help"},H={class:"form-group row"},R={class:"col s12"},q={class:"form-group row"},K={class:"col s12 m6"},G={for:"action_columns"},W={class:"innerFormField",name:"action_columns"},Y=["onClick","title"],J={class:"col s12 m6"},Q={class:"form-help"},X={class:"inline-help"},Z=Object(i["createElementVNode"])("span",{class:"icon-info"},null,-1),ee={class:"ui-confirm",id:"confirmAnonymizeLogData",ref:"confirmAnonymizeLogData"},ne=["value"],te=["value"];function oe(e,n,t,o,a,l){var r=Object(i["resolveComponent"])("SiteSelector"),c=Object(i["resolveComponent"])("Field"),s=Object(i["resolveComponent"])("SaveButton");return Object(i["openBlock"])(),Object(i["createElementBlock"])("div",h,[Object(i["createElementVNode"])("div",V,[Object(i["createElementVNode"])("div",j,[Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("label",g,Object(i["toDisplayString"])(e.translate("PrivacyManager_AnonymizeSites")),1),Object(i["createElementVNode"])("div",z,[Object(i["createVNode"])(r,{id:"anonymizeSite",modelValue:e.site,"onUpdate:modelValue":n[0]||(n[0]=function(n){return e.site=n}),"show-all-sites-item":!0,"switch-site-on-select":!1,"show-selected-site":!0},null,8,["modelValue"])])])])]),Object(i["createElementVNode"])("div",N,[Object(i["createElementVNode"])("div",A,[Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("label",E,Object(i["toDisplayString"])(e.translate("PrivacyManager_AnonymizeRowDataFrom")),1),Object(i["createElementVNode"])("input",{type:"text",id:"anonymizeStartDate",class:"anonymizeStartDate",ref:"anonymizeStartDate",name:"anonymizeStartDate",value:e.startDate,onKeydown:n[1]||(n[1]=function(n){return e.onKeydownStartDate(n)}),onChange:n[2]||(n[2]=function(n){return e.onKeydownStartDate(n)})},null,40,C)])]),Object(i["createElementVNode"])("div",k,[Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("label",D,Object(i["toDisplayString"])(e.translate("PrivacyManager_AnonymizeRowDataTo")),1),Object(i["createElementVNode"])("input",{type:"text",class:"anonymizeEndDate",id:"anonymizeEndDate",ref:"anonymizeEndDate",name:"anonymizeEndDate",value:e.endDate,onKeydown:n[3]||(n[3]=function(n){return e.onKeydownEndDate(n)}),onChange:n[4]||(n[4]=function(n){return e.onKeydownEndDate(n)})},null,40,S)])])]),Object(i["createElementVNode"])("div",I,[Object(i["createVNode"])(c,{uicontrol:"checkbox",name:"anonymizeIp",title:e.translate("PrivacyManager_AnonymizeIp"),modelValue:e.anonymizeIp,"onUpdate:modelValue":n[5]||(n[5]=function(n){return e.anonymizeIp=n}),introduction:e.translate("General_Visit"),"inline-help":e.translate("PrivacyManager_AnonymizeIpHelp")},null,8,["title","modelValue","introduction","inline-help"])]),Object(i["createElementVNode"])("div",P,[Object(i["createVNode"])(c,{uicontrol:"checkbox",name:"anonymizeLocation",title:e.translate("PrivacyManager_AnonymizeLocation"),modelValue:e.anonymizeLocation,"onUpdate:modelValue":n[6]||(n[6]=function(n){return e.anonymizeLocation=n}),"inline-help":e.translate("PrivacyManager_AnonymizeLocationHelp")},null,8,["title","modelValue","inline-help"])]),Object(i["createElementVNode"])("div",_,[Object(i["createVNode"])(c,{uicontrol:"checkbox",name:"anonymizeTheUserId",title:e.translate("PrivacyManager_AnonymizeUserId"),modelValue:e.anonymizeUserId,"onUpdate:modelValue":n[7]||(n[7]=function(n){return e.anonymizeUserId=n}),"inline-help":e.translate("PrivacyManager_AnonymizeUserIdHelp")},null,8,["title","modelValue","inline-help"])]),Object(i["createElementVNode"])("div",M,[Object(i["createElementVNode"])("div",w,[Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("label",U,Object(i["toDisplayString"])(e.translate("PrivacyManager_UnsetVisitColumns")),1),(Object(i["openBlock"])(!0),Object(i["createElementBlock"])(i["Fragment"],null,Object(i["renderList"])(e.selectedVisitColumns,(function(n,t){return Object(i["openBlock"])(),Object(i["createElementBlock"])("div",{class:Object(i["normalizeClass"])("selectedVisitColumns selectedVisitColumns".concat(t," multiple valign-wrapper")),key:t},[Object(i["createElementVNode"])("div",F,[Object(i["createVNode"])(c,{uicontrol:"select",name:"visit_columns","model-value":n.column,"onUpdate:modelValue":function(t){n.column=t,e.onVisitColumnChange()},"full-width":!0,options:e.availableVisitColumns},null,8,["model-value","onUpdate:modelValue","options"])]),Object(i["withDirectives"])(Object(i["createElementVNode"])("span",{class:"icon-minus valign",onClick:function(n){return e.removeVisitColumn(t)},title:e.translate("General_Remove")},null,8,L),[[i["vShow"],t+1!==e.selectedVisitColumns.length]])],2)})),128))])]),Object(i["createElementVNode"])("div",B,[Object(i["createElementVNode"])("div",x,[Object(i["createElementVNode"])("span",T,Object(i["toDisplayString"])(e.translate("PrivacyManager_UnsetVisitColumnsHelp")),1)])])]),Object(i["createElementVNode"])("div",H,[Object(i["createElementVNode"])("div",R,[Object(i["createElementVNode"])("h3",null,Object(i["toDisplayString"])(e.translate("General_Action")),1)])]),Object(i["createElementVNode"])("div",q,[Object(i["createElementVNode"])("div",K,[Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("label",G,Object(i["toDisplayString"])(e.translate("PrivacyManager_UnsetActionColumns")),1),(Object(i["openBlock"])(!0),Object(i["createElementBlock"])(i["Fragment"],null,Object(i["renderList"])(e.selectedActionColumns,(function(n,t){return Object(i["openBlock"])(),Object(i["createElementBlock"])("div",{class:Object(i["normalizeClass"])("selectedActionColumns selectedActionColumns".concat(t," multiple valign-wrapper")),key:t},[Object(i["createElementVNode"])("div",W,[Object(i["createVNode"])(c,{uicontrol:"select",name:"action_columns","model-value":n.column,"onUpdate:modelValue":function(t){n.column=t,e.onActionColumnChange()},"full-width":!0,options:e.availableActionColumns},null,8,["model-value","onUpdate:modelValue","options"])]),Object(i["withDirectives"])(Object(i["createElementVNode"])("span",{class:"icon-minus valign",onClick:function(n){return e.removeActionColumn(t)},title:e.translate("General_Remove")},null,8,Y),[[i["vShow"],t+1!==e.selectedActionColumns.length]])],2)})),128))])]),Object(i["createElementVNode"])("div",J,[Object(i["createElementVNode"])("div",Q,[Object(i["createElementVNode"])("span",X,Object(i["toDisplayString"])(e.translate("PrivacyManager_UnsetActionColumnsHelp")),1)])])]),Object(i["createElementVNode"])("p",null,[Z,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("PrivacyManager_AnonymizeProcessInfo")),1)]),Object(i["createVNode"])(s,{class:"anonymizePastData",onConfirm:n[8]||(n[8]=function(n){return e.scheduleAnonymization()}),disabled:e.isAnonymizePastDataDisabled,value:e.translate("PrivacyManager_AnonymizeDataNow")},null,8,["disabled","value"]),Object(i["createElementVNode"])("div",ee,[Object(i["createElementVNode"])("h2",null,Object(i["toDisplayString"])(e.translate("PrivacyManager_AnonymizeDataConfirm")),1),Object(i["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,ne),Object(i["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,te)],512)])}function ae(e){return e<10?"0".concat(e):e}var ie=Object(i["defineComponent"])({components:{SiteSelector:b["SiteSelector"],Field:v["Field"],SaveButton:v["SaveButton"]},data:function(){var e=new Date,n="".concat(e.getFullYear(),"-").concat(ae(e.getMonth()+1),"-").concat(ae(e.getDay()+1));return{isLoading:!1,isDeleting:!1,anonymizeIp:!1,anonymizeLocation:!1,anonymizeUserId:!1,site:{id:"all",name:"All Websites"},availableVisitColumns:[],availableActionColumns:[],selectedVisitColumns:[{column:""}],selectedActionColumns:[{column:""}],startDate:n,endDate:n}},created:function(){var e=this;this.onKeydownStartDate=Object(b["debounce"])(this.onKeydownStartDate,50),this.onKeydownEndDate=Object(b["debounce"])(this.onKeydownEndDate,50),b["AjaxHelper"].fetch({method:"PrivacyManager.getAvailableVisitColumnsToAnonymize"}).then((function(n){e.availableVisitColumns=[],n.forEach((function(n){e.availableVisitColumns.push({key:n.column_name,value:n.column_name})}))})),b["AjaxHelper"].fetch({method:"PrivacyManager.getAvailableLinkVisitActionColumnsToAnonymize"}).then((function(n){e.availableActionColumns=[],n.forEach((function(n){e.availableActionColumns.push({key:n.column_name,value:n.column_name})}))})),setTimeout((function(){var n=b["Matomo"].getBaseDatePickerOptions(null),t=b["Matomo"].getBaseDatePickerOptions(null);$(e.$refs.anonymizeStartDate).datepicker(n),$(e.$refs.anonymizeEndDate).datepicker(t)}))},methods:{onVisitColumnChange:function(){var e=this.selectedVisitColumns.every((function(e){return!(null===e||void 0===e||!e.column)}));e&&this.addVisitColumn()},addVisitColumn:function(){this.selectedVisitColumns.push({column:""})},removeVisitColumn:function(e){if(e>-1){var n=this.selectedVisitColumns.length-1;n===e?this.selectedVisitColumns[e]={column:""}:this.selectedVisitColumns.splice(e,1)}},onActionColumnChange:function(){var e=this.selectedActionColumns.every((function(e){return!(null===e||void 0===e||!e.column)}));e&&this.addActionColumn()},addActionColumn:function(){this.selectedActionColumns.push({column:""})},removeActionColumn:function(e){if(e>-1){var n=this.selectedActionColumns.length-1;n===e?this.selectedActionColumns[e]={column:""}:this.selectedActionColumns.splice(e,1)}},scheduleAnonymization:function(){var e="".concat(this.startDate,",").concat(this.endDate);this.startDate===this.endDate&&(e=this.startDate);var n={date:e};n.idSites=this.site.id,n.anonymizeIp=this.anonymizeIp?"1":"0",n.anonymizeLocation=this.anonymizeLocation?"1":"0",n.anonymizeUserId=this.anonymizeUserId?"1":"0",n.unsetVisitColumns=this.selectedVisitColumns.filter((function(e){return!(null===e||void 0===e||!e.column)})).map((function(e){return e.column})),n.unsetLinkVisitActionColumns=this.selectedActionColumns.filter((function(e){return!(null===e||void 0===e||!e.column)})).map((function(e){return e.column})),b["Matomo"].helper.modalConfirm(this.$refs.confirmAnonymizeLogData,{yes:function(){b["AjaxHelper"].post({method:"PrivacyManager.anonymizeSomeRawData"},n).then((function(){window.location.reload(!0)}))}})},onKeydownStartDate:function(e){this.startDate=e.target.value},onKeydownEndDate:function(e){this.endDate=e.target.value}},computed:{isAnonymizePastDataDisabled:function(){return!this.anonymizeIp&&!this.anonymizeLocation&&!this.selectedVisitColumns&&!this.selectedActionColumns}}});ie.render=oe;var le=ie;function re(e,n,t,o,a,l){var r=Object(i["resolveComponent"])("Field"),c=Object(i["resolveComponent"])("SaveButton"),s=Object(i["resolveDirective"])("form");return Object(i["withDirectives"])((Object(i["openBlock"])(),Object(i["createElementBlock"])("div",null,[Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(r,{uicontrol:"radio",name:"doNotTrack",modelValue:e.enabled,"onUpdate:modelValue":n[0]||(n[0]=function(n){return e.enabled=n}),options:e.doNotTrackOptions,"inline-help":e.translate("PrivacyManager_DoNotTrack_Description")},null,8,["modelValue","options","inline-help"])]),Object(i["createVNode"])(c,{onConfirm:n[1]||(n[1]=function(n){return e.save()}),saving:e.isLoading},null,8,["saving"])],512)),[[s]])}var ce=Object(i["defineComponent"])({props:{dntSupport:Boolean,doNotTrackOptions:{type:Array,required:!0}},components:{Field:v["Field"],SaveButton:v["SaveButton"]},directives:{Form:v["Form"]},data:function(){return{isLoading:!1,enabled:this.dntSupport?1:0}},methods:{save:function(){var e=this;this.isLoading=!0;var n="deactivateDoNotTrack";this.enabled&&"0"!==this.enabled&&(n="activateDoNotTrack"),b["AjaxHelper"].post({module:"API",method:"PrivacyManager.".concat(n)}).then((function(){var e=b["NotificationsStore"].show({message:Object(b["translate"])("CoreAdminHome_SettingsSaveSuccess"),context:"success",id:"privacyManagerSettings",type:"transient"});b["NotificationsStore"].scrollToNotification(e)})).finally((function(){e.isLoading=!1}))}}});ce.render=re;var se=ce; +(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):"function"===typeof define&&define.amd?define(["CoreHome",,"CorePluginsAdmin"],t):"object"===typeof exports?exports["PrivacyManager"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):e["PrivacyManager"]=t(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,t,n){return function(e){var t={};function n(a){if(t[a])return t[a].exports;var o=t[a]={i:a,l:!1,exports:{}};return e[a].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(a,o,function(t){return e[t]}.bind(null,o));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="plugins/PrivacyManager/vue/dist/",n(n.s="fae3")}({"19dc":function(t,n){t.exports=e},"8bbf":function(e,n){e.exports=t},a5a2:function(e,t){e.exports=n},fae3:function(e,t,n){"use strict";if(n.r(t),n.d(t,"AnonymizeIp",(function(){return f})),n.d(t,"AnonymizeLogData",(function(){return le})),n.d(t,"DoNotTrackPreference",(function(){return se})),n.d(t,"ReportDeletionSettings",(function(){return ve})),n.d(t,"DeleteOldLogs",(function(){return Ee})),n.d(t,"DeleteOldReports",(function(){return Fe})),n.d(t,"ScheduleReportDeletion",(function(){return tt})),"undefined"!==typeof window){var a=window.document.currentScript,o=a&&a.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);o&&(n.p=o[1])}var i=n("8bbf"),l=Object(i["createElementVNode"])("br",null,null,-1),r=Object(i["createElementVNode"])("br",null,null,-1),c=Object(i["createElementVNode"])("br",null,null,-1),s=Object(i["createElementVNode"])("br",null,null,-1),d={key:0},u=Object(i["createElementVNode"])("br",null,null,-1),m=Object(i["createElementVNode"])("br",null,null,-1),p={class:"alert-warning alert"};function b(e,t,n,a,o,b){var v=Object(i["resolveComponent"])("Field"),g=Object(i["resolveComponent"])("SaveButton"),h=Object(i["resolveDirective"])("form");return Object(i["withDirectives"])((Object(i["openBlock"])(),Object(i["createElementBlock"])("div",null,[Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(v,{uicontrol:"checkbox",name:"anonymizeIpSettings",title:e.translate("PrivacyManager_UseAnonymizeIp"),modelValue:e.actualEnabled,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.actualEnabled=t}),"inline-help":e.anonymizeIpEnabledHelp},null,8,["title","modelValue","inline-help"])]),Object(i["withDirectives"])(Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(v,{uicontrol:"radio",name:"maskLength",title:e.translate("PrivacyManager_AnonymizeIpMaskLengtDescription"),modelValue:e.actualMaskLength,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.actualMaskLength=t}),options:e.maskLengthOptions,"inline-help":e.translate("PrivacyManager_GeolocationAnonymizeIpNote")},null,8,["title","modelValue","options","inline-help"])]),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(v,{uicontrol:"radio",name:"useAnonymizedIpForVisitEnrichment",title:e.translate("PrivacyManager_UseAnonymizedIpForVisitEnrichment"),modelValue:e.actualUseAnonymizedIpForVisitEnrichment,"onUpdate:modelValue":t[2]||(t[2]=function(t){return e.actualUseAnonymizedIpForVisitEnrichment=t}),options:e.useAnonymizedIpForVisitEnrichmentOptions,"inline-help":e.translate("PrivacyManager_UseAnonymizedIpForVisitEnrichmentNote")},null,8,["title","modelValue","options","inline-help"])])],512),[[i["vShow"],e.actualEnabled]]),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(v,{uicontrol:"checkbox",name:"anonymizeUserId",title:e.translate("PrivacyManager_PseudonymizeUserId"),modelValue:e.actualAnonymizeUserId,"onUpdate:modelValue":t[3]||(t[3]=function(t){return e.actualAnonymizeUserId=t})},{"inline-help":Object(i["withCtx"])((function(){return[Object(i["createTextVNode"])(Object(i["toDisplayString"])(e.translate("PrivacyManager_PseudonymizeUserIdNote"))+" ",1),l,r,Object(i["createElementVNode"])("em",null,Object(i["toDisplayString"])(e.translate("PrivacyManager_PseudonymizeUserIdNote2")),1)]})),_:1},8,["title","modelValue"])]),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(v,{uicontrol:"checkbox",name:"anonymizeOrderId",title:e.translate("PrivacyManager_UseAnonymizeOrderId"),modelValue:e.actualAnonymizeOrderId,"onUpdate:modelValue":t[4]||(t[4]=function(t){return e.actualAnonymizeOrderId=t}),"inline-help":e.translate("PrivacyManager_AnonymizeOrderIdNote")},null,8,["title","modelValue","inline-help"])]),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(v,{uicontrol:"checkbox",name:"forceCookielessTracking",title:e.translate("PrivacyManager_ForceCookielessTracking"),modelValue:e.actualForceCookielessTracking,"onUpdate:modelValue":t[5]||(t[5]=function(t){return e.actualForceCookielessTracking=t})},{"inline-help":Object(i["withCtx"])((function(){return[Object(i["createTextVNode"])(Object(i["toDisplayString"])(e.translate("PrivacyManager_ForceCookielessTrackingDescription",e.trackerFileName))+" ",1),c,s,Object(i["createElementVNode"])("em",null,Object(i["toDisplayString"])(e.translate("PrivacyManager_ForceCookielessTrackingDescription2")),1),e.trackerWritable?Object(i["createCommentVNode"])("",!0):(Object(i["openBlock"])(),Object(i["createElementBlock"])("span",d,[u,m,Object(i["createElementVNode"])("p",p,Object(i["toDisplayString"])(e.translate("PrivacyManager_ForceCookielessTrackingDescriptionNotWritable",e.trackerFileName)),1)]))]})),_:1},8,["title","modelValue"])]),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(v,{uicontrol:"select",name:"anonymizeReferrer",title:e.translate("PrivacyManager_AnonymizeReferrer"),modelValue:e.actualAnonymizeReferrer,"onUpdate:modelValue":t[6]||(t[6]=function(t){return e.actualAnonymizeReferrer=t}),options:e.referrerAnonymizationOptions,"inline-help":e.translate("PrivacyManager_AnonymizeReferrerNote")},null,8,["title","modelValue","options","inline-help"])]),Object(i["createVNode"])(g,{onConfirm:t[7]||(t[7]=function(t){return e.save()}),saving:e.isLoading},null,8,["saving"])],512)),[[h]])}var v=n("19dc"),g=n("a5a2"),h=Object(i["defineComponent"])({props:{anonymizeIpEnabled:Boolean,anonymizeUserId:Boolean,maskLength:{type:Number,required:!0},useAnonymizedIpForVisitEnrichment:Boolean,anonymizeOrderId:Boolean,forceCookielessTracking:Boolean,anonymizeReferrer:String,maskLengthOptions:{type:Array,required:!0},useAnonymizedIpForVisitEnrichmentOptions:{type:Array,required:!0},trackerFileName:{type:String,required:!0},trackerWritable:{type:Boolean,required:!0},referrerAnonymizationOptions:{type:Object,required:!0}},components:{Field:g["Field"],SaveButton:g["SaveButton"]},directives:{Form:g["Form"]},data:function(){return{isLoading:!1,actualEnabled:!!this.anonymizeIpEnabled,actualMaskLength:this.maskLength,actualUseAnonymizedIpForVisitEnrichment:this.useAnonymizedIpForVisitEnrichment?"1":"0",actualAnonymizeUserId:!!this.anonymizeUserId,actualAnonymizeOrderId:!!this.anonymizeOrderId,actualForceCookielessTracking:!!this.forceCookielessTracking,actualAnonymizeReferrer:this.anonymizeReferrer}},methods:{save:function(){var e=this;this.isLoading=!0,v["AjaxHelper"].post({module:"API",method:"PrivacyManager.setAnonymizeIpSettings"},{anonymizeIPEnable:this.actualEnabled?"1":"0",anonymizeUserId:this.actualAnonymizeUserId?"1":"0",anonymizeOrderId:this.actualAnonymizeOrderId?"1":"0",forceCookielessTracking:this.actualForceCookielessTracking?"1":"0",anonymizeReferrer:this.actualAnonymizeReferrer?this.actualAnonymizeReferrer:"",maskLength:this.actualMaskLength,useAnonymizedIpForVisitEnrichment:this.actualUseAnonymizedIpForVisitEnrichment?"1":"0"}).then((function(){var e=v["NotificationsStore"].show({message:Object(v["translate"])("CoreAdminHome_SettingsSaveSuccess"),context:"success",id:"privacyManagerSettings",type:"toast"});v["NotificationsStore"].scrollToNotification(e)})).finally((function(){e.isLoading=!1}))}},computed:{anonymizeIpEnabledHelp:function(){var e=Object(v["translate"])("PrivacyManager_AnonymizeIpInlineHelp"),t=Object(v["translate"])("PrivacyManager_AnonymizeIpDescription");return"".concat(e," ").concat(t)}}});h.render=b;var f=h,O={class:"anonymizeLogData"},y={class:"form-group row"},j={class:"col s12 input-field"},D={for:"anonymizeSite",class:"siteSelectorLabel"},V={class:"sites_autocomplete"},S={class:"form-group row"},E={class:"col s6 input-field"},N={for:"anonymizeStartDate",class:"active"},k=["value"],_={class:"col s6 input-field"},C={for:"anonymizeEndDate",class:"active"},P=["value"],z={name:"anonymizeIp"},w={name:"anonymizeLocation"},A={name:"anonymizeTheUserId"},M={class:"form-group row"},I={class:"col s12 m6"},L={for:"visit_columns"},F={class:"innerFormField",name:"visit_columns"},R=["onClick","title"],B={class:"col s12 m6"},T={class:"form-help"},U={class:"inline-help"},x={class:"form-group row"},H={class:"col s12"},q={class:"form-group row"},K={class:"col s12 m6"},G={for:"action_columns"},W={class:"innerFormField",name:"action_columns"},Y=["onClick","title"],J={class:"col s12 m6"},Q={class:"form-help"},X={class:"inline-help"},Z=Object(i["createElementVNode"])("span",{class:"icon-info"},null,-1),ee={class:"ui-confirm",id:"confirmAnonymizeLogData",ref:"confirmAnonymizeLogData"},te=["value"],ne=["value"];function ae(e,t,n,a,o,l){var r=Object(i["resolveComponent"])("SiteSelector"),c=Object(i["resolveComponent"])("Field"),s=Object(i["resolveComponent"])("SaveButton");return Object(i["openBlock"])(),Object(i["createElementBlock"])("div",O,[Object(i["createElementVNode"])("div",y,[Object(i["createElementVNode"])("div",j,[Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("label",D,Object(i["toDisplayString"])(e.translate("PrivacyManager_AnonymizeSites")),1),Object(i["createElementVNode"])("div",V,[Object(i["createVNode"])(r,{id:"anonymizeSite",modelValue:e.site,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.site=t}),"show-all-sites-item":!0,"switch-site-on-select":!1,"show-selected-site":!0},null,8,["modelValue"])])])])]),Object(i["createElementVNode"])("div",S,[Object(i["createElementVNode"])("div",E,[Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("label",N,Object(i["toDisplayString"])(e.translate("PrivacyManager_AnonymizeRowDataFrom")),1),Object(i["createElementVNode"])("input",{type:"text",id:"anonymizeStartDate",class:"anonymizeStartDate",ref:"anonymizeStartDate",name:"anonymizeStartDate",value:e.startDate,onKeydown:t[1]||(t[1]=function(t){return e.onKeydownStartDate(t)}),onChange:t[2]||(t[2]=function(t){return e.onKeydownStartDate(t)})},null,40,k)])]),Object(i["createElementVNode"])("div",_,[Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("label",C,Object(i["toDisplayString"])(e.translate("PrivacyManager_AnonymizeRowDataTo")),1),Object(i["createElementVNode"])("input",{type:"text",class:"anonymizeEndDate",id:"anonymizeEndDate",ref:"anonymizeEndDate",name:"anonymizeEndDate",value:e.endDate,onKeydown:t[3]||(t[3]=function(t){return e.onKeydownEndDate(t)}),onChange:t[4]||(t[4]=function(t){return e.onKeydownEndDate(t)})},null,40,P)])])]),Object(i["createElementVNode"])("div",z,[Object(i["createVNode"])(c,{uicontrol:"checkbox",name:"anonymizeIp",title:e.translate("PrivacyManager_AnonymizeIp"),modelValue:e.anonymizeIp,"onUpdate:modelValue":t[5]||(t[5]=function(t){return e.anonymizeIp=t}),introduction:e.translate("General_Visit"),"inline-help":e.translate("PrivacyManager_AnonymizeIpHelp")},null,8,["title","modelValue","introduction","inline-help"])]),Object(i["createElementVNode"])("div",w,[Object(i["createVNode"])(c,{uicontrol:"checkbox",name:"anonymizeLocation",title:e.translate("PrivacyManager_AnonymizeLocation"),modelValue:e.anonymizeLocation,"onUpdate:modelValue":t[6]||(t[6]=function(t){return e.anonymizeLocation=t}),"inline-help":e.translate("PrivacyManager_AnonymizeLocationHelp")},null,8,["title","modelValue","inline-help"])]),Object(i["createElementVNode"])("div",A,[Object(i["createVNode"])(c,{uicontrol:"checkbox",name:"anonymizeTheUserId",title:e.translate("PrivacyManager_AnonymizeUserId"),modelValue:e.anonymizeUserId,"onUpdate:modelValue":t[7]||(t[7]=function(t){return e.anonymizeUserId=t}),"inline-help":e.translate("PrivacyManager_AnonymizeUserIdHelp")},null,8,["title","modelValue","inline-help"])]),Object(i["createElementVNode"])("div",M,[Object(i["createElementVNode"])("div",I,[Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("label",L,Object(i["toDisplayString"])(e.translate("PrivacyManager_UnsetVisitColumns")),1),(Object(i["openBlock"])(!0),Object(i["createElementBlock"])(i["Fragment"],null,Object(i["renderList"])(e.selectedVisitColumns,(function(t,n){return Object(i["openBlock"])(),Object(i["createElementBlock"])("div",{class:Object(i["normalizeClass"])("selectedVisitColumns selectedVisitColumns".concat(n," multiple valign-wrapper")),key:n},[Object(i["createElementVNode"])("div",F,[Object(i["createVNode"])(c,{uicontrol:"select",name:"visit_columns","model-value":t.column,"onUpdate:modelValue":function(n){t.column=n,e.onVisitColumnChange()},"full-width":!0,options:e.availableVisitColumns},null,8,["model-value","onUpdate:modelValue","options"])]),Object(i["withDirectives"])(Object(i["createElementVNode"])("span",{class:"icon-minus valign",onClick:function(t){return e.removeVisitColumn(n)},title:e.translate("General_Remove")},null,8,R),[[i["vShow"],n+1!==e.selectedVisitColumns.length]])],2)})),128))])]),Object(i["createElementVNode"])("div",B,[Object(i["createElementVNode"])("div",T,[Object(i["createElementVNode"])("span",U,Object(i["toDisplayString"])(e.translate("PrivacyManager_UnsetVisitColumnsHelp")),1)])])]),Object(i["createElementVNode"])("div",x,[Object(i["createElementVNode"])("div",H,[Object(i["createElementVNode"])("h3",null,Object(i["toDisplayString"])(e.translate("General_Action")),1)])]),Object(i["createElementVNode"])("div",q,[Object(i["createElementVNode"])("div",K,[Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("label",G,Object(i["toDisplayString"])(e.translate("PrivacyManager_UnsetActionColumns")),1),(Object(i["openBlock"])(!0),Object(i["createElementBlock"])(i["Fragment"],null,Object(i["renderList"])(e.selectedActionColumns,(function(t,n){return Object(i["openBlock"])(),Object(i["createElementBlock"])("div",{class:Object(i["normalizeClass"])("selectedActionColumns selectedActionColumns".concat(n," multiple valign-wrapper")),key:n},[Object(i["createElementVNode"])("div",W,[Object(i["createVNode"])(c,{uicontrol:"select",name:"action_columns","model-value":t.column,"onUpdate:modelValue":function(n){t.column=n,e.onActionColumnChange()},"full-width":!0,options:e.availableActionColumns},null,8,["model-value","onUpdate:modelValue","options"])]),Object(i["withDirectives"])(Object(i["createElementVNode"])("span",{class:"icon-minus valign",onClick:function(t){return e.removeActionColumn(n)},title:e.translate("General_Remove")},null,8,Y),[[i["vShow"],n+1!==e.selectedActionColumns.length]])],2)})),128))])]),Object(i["createElementVNode"])("div",J,[Object(i["createElementVNode"])("div",Q,[Object(i["createElementVNode"])("span",X,Object(i["toDisplayString"])(e.translate("PrivacyManager_UnsetActionColumnsHelp")),1)])])]),Object(i["createElementVNode"])("p",null,[Z,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("PrivacyManager_AnonymizeProcessInfo")),1)]),Object(i["createVNode"])(s,{class:"anonymizePastData",onConfirm:t[8]||(t[8]=function(t){return e.scheduleAnonymization()}),disabled:e.isAnonymizePastDataDisabled,value:e.translate("PrivacyManager_AnonymizeDataNow")},null,8,["disabled","value"]),Object(i["createElementVNode"])("div",ee,[Object(i["createElementVNode"])("h2",null,Object(i["toDisplayString"])(e.translate("PrivacyManager_AnonymizeDataConfirm")),1),Object(i["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,te),Object(i["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,ne)],512)])}function oe(e){return e<10?"0".concat(e):e}var ie=Object(i["defineComponent"])({components:{SiteSelector:v["SiteSelector"],Field:g["Field"],SaveButton:g["SaveButton"]},data:function(){var e=new Date,t="".concat(e.getFullYear(),"-").concat(oe(e.getMonth()+1),"-").concat(oe(e.getDay()+1));return{isLoading:!1,isDeleting:!1,anonymizeIp:!1,anonymizeLocation:!1,anonymizeUserId:!1,site:{id:"all",name:"All Websites"},availableVisitColumns:[],availableActionColumns:[],selectedVisitColumns:[{column:""}],selectedActionColumns:[{column:""}],startDate:t,endDate:t}},created:function(){var e=this;this.onKeydownStartDate=Object(v["debounce"])(this.onKeydownStartDate,50),this.onKeydownEndDate=Object(v["debounce"])(this.onKeydownEndDate,50),v["AjaxHelper"].fetch({method:"PrivacyManager.getAvailableVisitColumnsToAnonymize"}).then((function(t){e.availableVisitColumns=[],t.forEach((function(t){e.availableVisitColumns.push({key:t.column_name,value:t.column_name})}))})),v["AjaxHelper"].fetch({method:"PrivacyManager.getAvailableLinkVisitActionColumnsToAnonymize"}).then((function(t){e.availableActionColumns=[],t.forEach((function(t){e.availableActionColumns.push({key:t.column_name,value:t.column_name})}))})),setTimeout((function(){var t=v["Matomo"].getBaseDatePickerOptions(null),n=v["Matomo"].getBaseDatePickerOptions(null);$(e.$refs.anonymizeStartDate).datepicker(t),$(e.$refs.anonymizeEndDate).datepicker(n)}))},methods:{onVisitColumnChange:function(){var e=this.selectedVisitColumns.every((function(e){return!(null===e||void 0===e||!e.column)}));e&&this.addVisitColumn()},addVisitColumn:function(){this.selectedVisitColumns.push({column:""})},removeVisitColumn:function(e){if(e>-1){var t=this.selectedVisitColumns.length-1;t===e?this.selectedVisitColumns[e]={column:""}:this.selectedVisitColumns.splice(e,1)}},onActionColumnChange:function(){var e=this.selectedActionColumns.every((function(e){return!(null===e||void 0===e||!e.column)}));e&&this.addActionColumn()},addActionColumn:function(){this.selectedActionColumns.push({column:""})},removeActionColumn:function(e){if(e>-1){var t=this.selectedActionColumns.length-1;t===e?this.selectedActionColumns[e]={column:""}:this.selectedActionColumns.splice(e,1)}},scheduleAnonymization:function(){var e="".concat(this.startDate,",").concat(this.endDate);this.startDate===this.endDate&&(e=this.startDate);var t={date:e};t.idSites=this.site.id,t.anonymizeIp=this.anonymizeIp?"1":"0",t.anonymizeLocation=this.anonymizeLocation?"1":"0",t.anonymizeUserId=this.anonymizeUserId?"1":"0",t.unsetVisitColumns=this.selectedVisitColumns.filter((function(e){return!(null===e||void 0===e||!e.column)})).map((function(e){return e.column})),t.unsetLinkVisitActionColumns=this.selectedActionColumns.filter((function(e){return!(null===e||void 0===e||!e.column)})).map((function(e){return e.column})),v["Matomo"].helper.modalConfirm(this.$refs.confirmAnonymizeLogData,{yes:function(){v["AjaxHelper"].post({method:"PrivacyManager.anonymizeSomeRawData"},t).then((function(){window.location.reload(!0)}))}})},onKeydownStartDate:function(e){this.startDate=e.target.value},onKeydownEndDate:function(e){this.endDate=e.target.value}},computed:{isAnonymizePastDataDisabled:function(){return!this.anonymizeIp&&!this.anonymizeLocation&&!this.selectedVisitColumns&&!this.selectedActionColumns}}});ie.render=ae;var le=ie;function re(e,t,n,a,o,l){var r=Object(i["resolveComponent"])("Field"),c=Object(i["resolveComponent"])("SaveButton"),s=Object(i["resolveDirective"])("form");return Object(i["withDirectives"])((Object(i["openBlock"])(),Object(i["createElementBlock"])("div",null,[Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(r,{uicontrol:"radio",name:"doNotTrack",modelValue:e.enabled,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.enabled=t}),options:e.doNotTrackOptions,"inline-help":e.translate("PrivacyManager_DoNotTrack_Description")},null,8,["modelValue","options","inline-help"])]),Object(i["createVNode"])(c,{onConfirm:t[1]||(t[1]=function(t){return e.save()}),saving:e.isLoading},null,8,["saving"])],512)),[[s]])}var ce=Object(i["defineComponent"])({props:{dntSupport:Boolean,doNotTrackOptions:{type:Array,required:!0}},components:{Field:g["Field"],SaveButton:g["SaveButton"]},directives:{Form:g["Form"]},data:function(){return{isLoading:!1,enabled:this.dntSupport?1:0}},methods:{save:function(){var e=this;this.isLoading=!0;var t="deactivateDoNotTrack";this.enabled&&"0"!==this.enabled&&(t="activateDoNotTrack"),v["AjaxHelper"].post({module:"API",method:"PrivacyManager.".concat(t)}).then((function(){var e=v["NotificationsStore"].show({message:Object(v["translate"])("CoreAdminHome_SettingsSaveSuccess"),context:"success",id:"privacyManagerSettings",type:"transient"});v["NotificationsStore"].scrollToNotification(e)})).finally((function(){e.isLoading=!1}))}}});ce.render=re;var se=ce;function de(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ue(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function me(e,t,n){return t&&ue(e.prototype,t),n&&ue(e,n),e}function pe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */var be=function(){function e(){var t=this;de(this,e),pe(this,"privateState",Object(i["reactive"])({settings:{},showEstimate:!1,loadingEstimation:!1,estimation:"",isModified:!1})),pe(this,"state",Object(i["computed"])((function(){return Object(i["readonly"])(t.privateState)}))),pe(this,"enableDeleteReports",Object(i["computed"])((function(){return t.state.value.settings.enableDeleteReports}))),pe(this,"enableDeleteLogs",Object(i["computed"])((function(){return t.state.value.settings.enableDeleteLogs}))),pe(this,"currentRequest",void 0)}return me(e,[{key:"updateSettings",value:function(e){this.initSettings(e),this.privateState.isModified=!0}},{key:"initSettings",value:function(e){this.privateState.settings=Object.assign(Object.assign({},this.privateState.settings),e),this.reloadDbStats()}},{key:"savePurgeDataSettings",value:function(e,t){return this.privateState.isModified=!1,v["AjaxHelper"].post({module:"API",method:e},Object.assign(Object.assign({},t),{},{enableDeleteLogs:t.enableDeleteLogs?"1":"0",enableDeleteReports:t.enableDeleteReports?"1":"0"})).then((function(){var e=v["NotificationsStore"].show({message:Object(v["translate"])("CoreAdminHome_SettingsSaveSuccess"),context:"success",id:"privacyManagerSettings",type:"toast"});v["NotificationsStore"].scrollToNotification(e)}))}},{key:"isEitherDeleteSectionEnabled",value:function(){return this.state.value.settings.enableDeleteLogs||this.state.value.settings.enableDeleteReports}},{key:"isManualEstimationLinkShowing",value:function(){return window.$("#getPurgeEstimateLink").length>0}},{key:"reloadDbStats",value:function(e){var t=this;if(this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=void 0),e||this.isEitherDeleteSectionEnabled()&&!this.isManualEstimationLinkShowing()){this.privateState.loadingEstimation=!0,this.privateState.estimation="",this.privateState.showEstimate=!1;var n=this.privateState.settings,a=Object.assign(Object.assign({},n),{},{enableDeleteLogs:n.enableDeleteLogs?"1":"0",enableDeleteReports:n.enableDeleteReports?"1":"0"});!0===e&&(a.forceEstimate=1),this.currentRequest=new AbortController,v["AjaxHelper"].post({module:"PrivacyManager",action:"getDatabaseSize",format:"html"},a,{abortController:this.currentRequest,format:"html"}).then((function(e){t.privateState.estimation=e,t.privateState.showEstimate=!0,t.privateState.loadingEstimation=!1})).finally((function(){t.currentRequest=void 0,t.privateState.loadingEstimation=!1}))}}}]),e}(),ve=new be,ge={id:"formDeleteSettings"},he={id:"deleteLogSettingEnabled"},fe={class:"alert alert-warning deleteOldLogsWarning",style:{width:"50%"}},Oe={href:"https://matomo.org/faq/general/#faq_125",rel:"noreferrer noopener",target:"_blank"},ye={id:"deleteLogSettings"};function je(e,t,n,a,o,l){var r=Object(i["resolveComponent"])("Field"),c=Object(i["resolveComponent"])("SaveButton"),s=Object(i["resolveDirective"])("form");return Object(i["withDirectives"])((Object(i["openBlock"])(),Object(i["createElementBlock"])("div",ge,[Object(i["createElementVNode"])("div",he,[Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(r,{uicontrol:"checkbox",name:"deleteEnable","model-value":e.enabled,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.enabled=t,e.reloadDbStats()}),title:e.translate("PrivacyManager_UseDeleteLog"),"inline-help":e.translate("PrivacyManager_DeleteRawDataInfo")},null,8,["model-value","title","inline-help"])]),Object(i["withDirectives"])(Object(i["createElementVNode"])("div",fe,[Object(i["createElementVNode"])("a",Oe,Object(i["toDisplayString"])(e.translate("General_ClickHere")),1)],512),[[i["vShow"],e.enabled]])]),Object(i["withDirectives"])(Object(i["createElementVNode"])("div",ye,[Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(r,{uicontrol:"text",name:"deleteOlderThan","model-value":e.deleteOlderThan,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.deleteOlderThan=t,e.reloadDbStats()}),title:e.deleteOlderThanTitle,"inline-help":e.translate("PrivacyManager_LeastDaysInput","1")},null,8,["model-value","title","inline-help"])])],512),[[i["vShow"],e.enabled]]),Object(i["createVNode"])(c,{onConfirm:t[2]||(t[2]=function(t){return e.save()}),saving:e.isLoading},null,8,["saving"])],512)),[[s]])}var De=window,Ve=De.$,Se=Object(i["defineComponent"])({props:{isDataPurgeSettingsEnabled:Boolean,deleteData:{type:Object,required:!0},scheduleDeletionOptions:{type:Object,required:!0}},components:{Field:g["Field"],SaveButton:g["SaveButton"]},directives:{Form:g["Form"]},data:function(){return{isLoading:!1,enabled:"1"===this.deleteData.config.delete_logs_enable,deleteOlderThan:this.deleteData.config.delete_logs_older_than}},created:function(){var e=this;setTimeout((function(){ve.initSettings(e.settings)}))},methods:{saveSettings:function(){var e=this,t="PrivacyManager.setDeleteLogsSettings";this.isLoading=!0,ve.savePurgeDataSettings(t,this.settings).finally((function(){e.isLoading=!1}))},reloadDbStats:function(){ve.updateSettings(this.settings)},save:function(){var e=this;if(this.enabled){var t="deleteLogsConfirm";ve.enableDeleteReports.value&&(t="deleteBothConfirm"),Ve("#confirmDeleteSettings").find(">h2").hide(),Ve("#".concat(t)).show(),v["Matomo"].helper.modalConfirm("#confirmDeleteSettings",{yes:function(){e.saveSettings()}})}else this.saveSettings()}},computed:{settings:function(){return{enableDeleteLogs:!!this.enabled,deleteLogsOlderThan:this.deleteOlderThan}},deleteOlderThanTitle:function(){return"".concat(Object(v["translate"])("PrivacyManager_DeleteLogsOlderThan")," (").concat(Object(v["translate"])("Intl_PeriodDays"),")")}}});Se.render=je;var Ee=Se,Ne={id:"formDeleteSettings"},ke={id:"deleteReportsSettingEnabled"},_e={class:"alert alert-warning",style:{width:"50%"}},Ce=Object(i["createElementVNode"])("br",null,null,-1),Pe=Object(i["createElementVNode"])("br",null,null,-1),ze={id:"deleteReportsSettings"};function we(e,t,n,a,o,l){var r=Object(i["resolveComponent"])("Field"),c=Object(i["resolveComponent"])("SaveButton"),s=Object(i["resolveDirective"])("form");return Object(i["withDirectives"])((Object(i["openBlock"])(),Object(i["createElementBlock"])("div",Ne,[Object(i["createElementVNode"])("div",ke,[Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(r,{uicontrol:"checkbox",name:"deleteReportsEnable","model-value":e.enabled,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.enabled=t,e.reloadDbStats()}),title:e.translate("PrivacyManager_UseDeleteReports"),"inline-help":e.translate("PrivacyManager_DeleteAggregateReportsDetailedInfo")},null,8,["model-value","title","inline-help"])]),Object(i["withDirectives"])(Object(i["createElementVNode"])("div",_e,[Object(i["createElementVNode"])("span",null,[Object(i["createTextVNode"])(Object(i["toDisplayString"])(e.translate("PrivacyManager_DeleteReportsInfo2",e.deleteOldLogsText)),1),Ce,Pe,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("PrivacyManager_DeleteReportsInfo3",e.deleteOldLogsText)),1)])],512),[[i["vShow"],e.enabled]])]),Object(i["withDirectives"])(Object(i["createElementVNode"])("div",ze,[Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(r,{uicontrol:"text",name:"deleteReportsOlderThan","model-value":e.deleteOlderThan,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.deleteOlderThan=t,e.reloadDbStats()}),title:e.deleteReportsOlderThanTitle,"inline-help":e.translate("PrivacyManager_LeastMonthsInput","1")},null,8,["model-value","title","inline-help"])]),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(r,{uicontrol:"checkbox",name:"deleteReportsKeepBasic","model-value":e.keepBasic,"onUpdate:modelValue":t[2]||(t[2]=function(t){e.keepBasic=t,e.reloadDbStats()}),title:e.deleteReportsKeepBasicTitle,"inline-help":e.translate("PrivacyManager_KeepBasicMetricsReportsDetailedInfo")},null,8,["model-value","title","inline-help"])]),Object(i["createElementVNode"])("h3",null,Object(i["toDisplayString"])(e.translate("PrivacyManager_KeepDataFor")),1),Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(r,{uicontrol:"checkbox",name:"deleteReportsKeepDay","model-value":e.keepDataForDay,"onUpdate:modelValue":t[3]||(t[3]=function(t){e.keepDataForDay=t,e.reloadDbStats()}),title:e.translate("General_DailyReports")},null,8,["model-value","title"])]),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(r,{uicontrol:"checkbox",name:"deleteReportsKeepWeek","model-value":e.keepDataForWeek,"onUpdate:modelValue":t[4]||(t[4]=function(t){e.keepDataForWeek=t,e.reloadDbStats()}),title:e.translate("General_WeeklyReports")},null,8,["model-value","title"])]),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(r,{uicontrol:"checkbox",name:"deleteReportsKeepMonth","model-value":e.keepDataForMonth,"onUpdate:modelValue":t[5]||(t[5]=function(t){e.keepDataForMonth=t,e.reloadDbStats()}),title:"".concat(e.translate("General_MonthlyReports")," (").concat(e.translate("General_Recommended"),")")},null,8,["model-value","title"])]),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(r,{uicontrol:"checkbox",name:"deleteReportsKeepYear","model-value":e.keepDataForYear,"onUpdate:modelValue":t[6]||(t[6]=function(t){e.keepDataForYear=t,e.reloadDbStats()}),title:"".concat(e.translate("General_YearlyReports")," (").concat(e.translate("General_Recommended"),")")},null,8,["model-value","title"])]),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(r,{uicontrol:"checkbox",name:"deleteReportsKeepRange","model-value":e.keepDataForRange,"onUpdate:modelValue":t[7]||(t[7]=function(t){e.keepDataForRange=t,e.reloadDbStats()}),title:e.translate("General_RangeReports")},null,8,["model-value","title"])]),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(r,{uicontrol:"checkbox",name:"deleteReportsKeepSegments","model-value":e.keepDataForSegments,"onUpdate:modelValue":t[8]||(t[8]=function(t){e.keepDataForSegments=t,e.reloadDbStats()}),title:e.translate("PrivacyManager_KeepReportSegments")},null,8,["model-value","title"])])])],512),[[i["vShow"],e.enabled]]),Object(i["createVNode"])(c,{onConfirm:t[9]||(t[9]=function(t){return e.save()}),saving:e.isLoading},null,8,["saving"])],512)),[[s]])}function Ae(e){return e?"1":"0"}var Me=window,Ie=Me.$,Le=Object(i["defineComponent"])({props:{isDataPurgeSettingsEnabled:Boolean,deleteData:{type:Object,required:!0},scheduleDeletionOptions:{type:Object,required:!0}},components:{Field:g["Field"],SaveButton:g["SaveButton"]},directives:{Form:g["Form"]},data:function(){return{isLoading:!1,enabled:1===parseInt(this.deleteData.config.delete_reports_enable,10),deleteOlderThan:this.deleteData.config.delete_reports_older_than,keepBasic:1===parseInt(this.deleteData.config.delete_reports_keep_basic_metrics,10),keepDataForDay:1===parseInt(this.deleteData.config.delete_reports_keep_day_reports,10),keepDataForWeek:1===parseInt(this.deleteData.config.delete_reports_keep_week_reports,10),keepDataForMonth:1===parseInt(this.deleteData.config.delete_reports_keep_month_reports,10),keepDataForYear:1===parseInt(this.deleteData.config.delete_reports_keep_year_reports,10),keepDataForRange:1===parseInt(this.deleteData.config.delete_reports_keep_range_reports,10),keepDataForSegments:1===parseInt(this.deleteData.config.delete_reports_keep_segment_reports,10)}},created:function(){var e=this;setTimeout((function(){ve.initSettings(e.settings)}))},methods:{saveSettings:function(){var e=this,t="PrivacyManager.setDeleteReportsSettings";this.isLoading=!0,ve.savePurgeDataSettings(t,this.settings).finally((function(){e.isLoading=!1}))},reloadDbStats:function(){ve.updateSettings(this.settings)},save:function(){var e=this;if(this.enabled){var t="deleteReportsConfirm";ve.enableDeleteLogs.value&&(t="deleteBothConfirm"),Ie("#confirmDeleteSettings").find(">h2").hide(),Ie("#".concat(t)).show(),v["Matomo"].helper.modalConfirm("#confirmDeleteSettings",{yes:function(){e.saveSettings()}})}else this.saveSettings()}},computed:{settings:function(){return{enableDeleteReports:this.enabled,deleteReportsOlderThan:this.deleteOlderThan,keepBasic:Ae(this.keepBasic),keepDay:Ae(this.keepDataForDay),keepWeek:Ae(this.keepDataForWeek),keepMonth:Ae(this.keepDataForMonth),keepYear:Ae(this.keepDataForYear),keepRange:Ae(this.keepDataForRange),keepSegments:Ae(this.keepDataForSegments)}},deleteOldLogsText:function(){return Object(v["translate"])("PrivacyManager_UseDeleteLog")},deleteReportsOlderThanTitle:function(){var e=Object(v["translate"])("PrivacyManager_DeleteReportsOlderThan");return"".concat(e," (").concat(Object(v["translate"])("Intl_PeriodMonths"),")")},deleteReportsKeepBasicTitle:function(){var e=Object(v["translate"])("PrivacyManager_KeepBasicMetrics");return"".concat(e," (").concat(Object(v["translate"])("General_Recommended"),")")}}});Le.render=we;var Fe=Le,Re={id:"formDeleteSettings"},Be={id:"deleteSchedulingSettings"},Te={id:"deleteSchedulingSettingsInlineHelp",class:"inline-help-node"},Ue={key:0},xe=Object(i["createElementVNode"])("br",null,null,-1),He=Object(i["createElementVNode"])("br",null,null,-1),qe=Object(i["createElementVNode"])("br",null,null,-1),Ke=Object(i["createElementVNode"])("br",null,null,-1),Ge={key:0,id:"deleteDataEstimateSect",class:"form-group row"},We={class:"col s12",id:"databaseSizeHeadline"},$e={class:"col s12 m6"},Ye=["innerHTML"],Je=Object(i["createTextVNode"])(" "),Qe={class:"col s12 m6"},Xe={key:0,class:"form-help"};function Ze(e,t,n,a,o,l){var r=Object(i["resolveComponent"])("ActivityIndicator"),c=Object(i["resolveComponent"])("Field"),s=Object(i["resolveComponent"])("SaveButton"),d=Object(i["resolveComponent"])("ContentBlock"),u=Object(i["resolveDirective"])("form");return Object(i["withDirectives"])((Object(i["openBlock"])(),Object(i["createElementBlock"])("div",Re,[Object(i["withDirectives"])(Object(i["createVNode"])(d,{id:"scheduleSettingsHeadline","content-title":e.translate("PrivacyManager_DeleteSchedulingSettings")},{default:Object(i["withCtx"])((function(){return[Object(i["createElementVNode"])("div",Be,[Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(c,{uicontrol:"select",name:"deleteLowestInterval",title:e.translate("PrivacyManager_DeleteDataInterval"),modelValue:e.deleteLowestInterval,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.deleteLowestInterval=t}),options:e.scheduleDeletionOptions},{"inline-help":Object(i["withCtx"])((function(){return[Object(i["createElementVNode"])("div",Te,[e.deleteData.lastRun?(Object(i["openBlock"])(),Object(i["createElementBlock"])("span",Ue,[Object(i["createElementVNode"])("strong",null,Object(i["toDisplayString"])(e.translate("PrivacyManager_LastDelete"))+":",1),Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.deleteData.lastRunPretty)+" ",1),xe,He])):Object(i["createCommentVNode"])("",!0),Object(i["createElementVNode"])("strong",null,Object(i["toDisplayString"])(e.translate("PrivacyManager_NextDelete"))+":",1),Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.deleteData.nextRunPretty)+" ",1),qe,Ke,Object(i["withDirectives"])(Object(i["createElementVNode"])("a",{id:"purgeDataNowLink",href:"#",onClick:t[0]||(t[0]=function(t){return e.executeDataPurgeNow()})},Object(i["toDisplayString"])(e.translate("PrivacyManager_PurgeNow")),513),[[i["vShow"],e.showPurgeNowLink]]),Object(i["createVNode"])(r,{"loading-message":e.translate("PrivacyManager_PurgingData"),loading:e.loadingDataPurge},null,8,["loading-message","loading"]),Object(i["withDirectives"])(Object(i["createElementVNode"])("span",{id:"db-purged-message"},Object(i["toDisplayString"])(e.translate("PrivacyManager_DBPurged")),513),[[i["vShow"],e.dataWasPurged]])])]})),_:1},8,["title","modelValue","options"])])]),"1"===e.deleteData.config.enable_database_size_estimate||1===e.deleteData.config.enable_database_size_estimate?(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",Ge,[Object(i["createElementVNode"])("h3",We,Object(i["toDisplayString"])(e.translate("PrivacyManager_ReportsDataSavedEstimate")),1),Object(i["createElementVNode"])("div",$e,[Object(i["withDirectives"])(Object(i["createElementVNode"])("div",{id:"deleteDataEstimate",innerHTML:e.$sanitize(e.estimation)},null,8,Ye),[[i["vShow"],e.showEstimate]]),Je,Object(i["createVNode"])(r,{loading:e.loadingEstimation},null,8,["loading"])]),Object(i["createElementVNode"])("div",Qe,["1"!==e.deleteData.config.enable_auto_database_size_estimate&&1!==e.deleteData.config.enable_auto_database_size_estimate?(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",Xe,[Object(i["createElementVNode"])("a",{id:"getPurgeEstimateLink",href:"#",onClick:t[2]||(t[2]=Object(i["withModifiers"])((function(t){return e.getPurgeEstimate()}),["prevent"]))},Object(i["toDisplayString"])(e.translate("PrivacyManager_GetPurgeEstimate")),1)])):Object(i["createCommentVNode"])("",!0)])])):Object(i["createCommentVNode"])("",!0),Object(i["createVNode"])(s,{onConfirm:t[3]||(t[3]=function(t){return e.save()}),saving:e.isLoading},null,8,["saving"])]})),_:1},8,["content-title"]),[[i["vShow"],e.isEitherDeleteSectionEnabled]])],512)),[[u]])}var et=Object(i["defineComponent"])({props:{isDataPurgeSettingsEnabled:Boolean,deleteData:{type:Object,required:!0},scheduleDeletionOptions:{type:Object,required:!0}},components:{ContentBlock:v["ContentBlock"],ActivityIndicator:v["ActivityIndicator"],Field:g["Field"],SaveButton:g["SaveButton"]},directives:{Form:g["Form"]},data:function(){return{isLoading:!1,loadingDataPurge:!1,dataWasPurged:!1,showPurgeNowLink:!0,deleteLowestInterval:this.deleteData.config.delete_logs_schedule_lowest_interval}},methods:{save:function(){var e="PrivacyManager.setScheduleReportDeletionSettings";ve.savePurgeDataSettings(e,{deleteLowestInterval:this.deleteLowestInterval})},executeDataPurgeNow:function(){var e=this;ve.state.value.isModified?v["Matomo"].helper.modalConfirm("#saveSettingsBeforePurge",{yes:function(){return null}}):v["Matomo"].helper.modalConfirm("#confirmPurgeNow",{yes:function(){e.loadingDataPurge=!0,e.showPurgeNowLink=!1,v["AjaxHelper"].fetch({module:"PrivacyManager",action:"executeDataPurge",format:"html"},{withTokenInUrl:!0}).then((function(){ve.reloadDbStats(),e.dataWasPurged=!0,setTimeout((function(){e.dataWasPurged=!1,e.showPurgeNowLink=!0}),2e3)})).finally((function(){e.loadingDataPurge=!1}))}})},getPurgeEstimate:function(){return ve.reloadDbStats(!0)}},computed:{showEstimate:function(){return ve.state.value.showEstimate},isEitherDeleteSectionEnabled:function(){return ve.isEitherDeleteSectionEnabled()},estimation:function(){return ve.state.value.estimation},loadingEstimation:function(){return ve.state.value.loadingEstimation}}});et.render=Ze;var tt=et; /*! * Matomo - free/libre analytics platform * diff --git a/plugins/PrivacyManager/vue/src/DeleteOldLogs/DeleteOldLogs.vue b/plugins/PrivacyManager/vue/src/DeleteOldLogs/DeleteOldLogs.vue new file mode 100644 index 0000000000..a93ae8d7d9 --- /dev/null +++ b/plugins/PrivacyManager/vue/src/DeleteOldLogs/DeleteOldLogs.vue @@ -0,0 +1,151 @@ +<!-- + Matomo - free/libre analytics platform + @link https://matomo.org + @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later +--> + +<template> + <div + id="formDeleteSettings" + v-form + > + <div id="deleteLogSettingEnabled"> + <div> + <Field + uicontrol="checkbox" + name="deleteEnable" + :model-value="enabled" + @update:model-value="enabled = $event; reloadDbStats()" + :title="translate('PrivacyManager_UseDeleteLog')" + :inline-help="translate('PrivacyManager_DeleteRawDataInfo')" + > + </Field> + </div> + <div + class="alert alert-warning deleteOldLogsWarning" + style="width: 50%;" + v-show="enabled" + > + <a + href="https://matomo.org/faq/general/#faq_125" + rel="noreferrer noopener" + target="_blank" + > + {{ translate('General_ClickHere') }} + </a> + </div> + </div> + <div + id="deleteLogSettings" + v-show="enabled" + > + <div> + <Field + uicontrol="text" + name="deleteOlderThan" + :model-value="deleteOlderThan" + @update:model-value="deleteOlderThan = $event; reloadDbStats()" + :title="deleteOlderThanTitle" + :inline-help="translate('PrivacyManager_LeastDaysInput', '1')" + > + </Field> + </div> + </div> + <SaveButton + @confirm="save()" + :saving="isLoading" + /> + </div> +</template> + +<script lang="ts"> +import { defineComponent } from 'vue'; +import { Matomo, translate } from 'CoreHome'; +import { Form, Field, SaveButton } from 'CorePluginsAdmin'; +import ReportDeletionSettingsStore, { + ReportDeletionSettings, +} from '../ReportDeletionSettings/ReportDeletionSettings.store'; + +interface DeleteOldLogsState { + isLoading: boolean; + enabled: boolean; + deleteOlderThan: string; +} + +const { $ } = window; + +export default defineComponent({ + props: { + isDataPurgeSettingsEnabled: Boolean, + deleteData: { + type: Object, + required: true, + }, + scheduleDeletionOptions: { + type: Object, + required: true, + }, + }, + components: { + Field, + SaveButton, + }, + directives: { + Form, + }, + data(): DeleteOldLogsState { + return { + isLoading: false, + enabled: this.deleteData.config.delete_logs_enable === '1', + deleteOlderThan: this.deleteData.config.delete_logs_older_than, + }; + }, + created() { + setTimeout(() => { + ReportDeletionSettingsStore.initSettings(this.settings); + }); + }, + methods: { + saveSettings() { + const method = 'PrivacyManager.setDeleteLogsSettings'; + this.isLoading = true; + ReportDeletionSettingsStore.savePurgeDataSettings(method, this.settings).finally(() => { + this.isLoading = false; + }); + }, + reloadDbStats() { + ReportDeletionSettingsStore.updateSettings(this.settings); + }, + save() { + if (this.enabled) { + let confirmId = 'deleteLogsConfirm'; + if (ReportDeletionSettingsStore.enableDeleteReports.value) { + confirmId = 'deleteBothConfirm'; + } + + $('#confirmDeleteSettings').find('>h2').hide(); + $(`#${confirmId}`).show(); + + Matomo.helper.modalConfirm('#confirmDeleteSettings', { + yes: () => { + this.saveSettings(); + }, + }); + } else { + this.saveSettings(); + } + }, + }, + computed: { + settings(): ReportDeletionSettings { + return { + enableDeleteLogs: !!this.enabled, + deleteLogsOlderThan: this.deleteOlderThan, + }; + }, + deleteOlderThanTitle(): string { + return `${translate('PrivacyManager_DeleteLogsOlderThan')} (${translate('Intl_PeriodDays')})`; + }, + }, +}); +</script> diff --git a/plugins/PrivacyManager/vue/src/DeleteOldReports/DeleteOldReports.vue b/plugins/PrivacyManager/vue/src/DeleteOldReports/DeleteOldReports.vue new file mode 100644 index 0000000000..737e04ae81 --- /dev/null +++ b/plugins/PrivacyManager/vue/src/DeleteOldReports/DeleteOldReports.vue @@ -0,0 +1,267 @@ +<!-- + Matomo - free/libre analytics platform + @link https://matomo.org + @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later +--> + +<template> + <div + id="formDeleteSettings" + v-form + > + <div id="deleteReportsSettingEnabled"> + <div> + <Field + uicontrol="checkbox" + name="deleteReportsEnable" + :model-value="enabled" + @update:model-value="enabled = $event; reloadDbStats()" + :title="translate('PrivacyManager_UseDeleteReports')" + :inline-help="translate('PrivacyManager_DeleteAggregateReportsDetailedInfo')" + > + </Field> + </div> + <div + class="alert alert-warning" + style="width: 50%;" + v-show="enabled" + > + <span> + {{ translate('PrivacyManager_DeleteReportsInfo2', deleteOldLogsText) }}<br /><br /> + {{ translate('PrivacyManager_DeleteReportsInfo3', deleteOldLogsText) }} + </span> + </div> + </div> + <div + id="deleteReportsSettings" + v-show="enabled" + > + <div> + <Field + uicontrol="text" + name="deleteReportsOlderThan" + :model-value="deleteOlderThan" + @update:model-value="deleteOlderThan = $event; reloadDbStats()" + :title="deleteReportsOlderThanTitle" + :inline-help="translate('PrivacyManager_LeastMonthsInput', '1')" + > + </Field> + </div> + <div> + <Field + uicontrol="checkbox" + name="deleteReportsKeepBasic" + :model-value="keepBasic" + @update:model-value="keepBasic = $event; reloadDbStats()" + :title="deleteReportsKeepBasicTitle" + :inline-help="translate('PrivacyManager_KeepBasicMetricsReportsDetailedInfo')" + > + </Field> + </div> + <h3> + {{ translate('PrivacyManager_KeepDataFor') }} + </h3> + <div> + <div> + <Field + uicontrol="checkbox" + name="deleteReportsKeepDay" + :model-value="keepDataForDay" + @update:model-value="keepDataForDay = $event; reloadDbStats()" + :title="translate('General_DailyReports')" + > + </Field> + </div> + <div> + <Field + uicontrol="checkbox" + name="deleteReportsKeepWeek" + :model-value="keepDataForWeek" + @update:model-value="keepDataForWeek = $event; reloadDbStats()" + :title="translate('General_WeeklyReports')" + > + </Field> + </div> + <div> + <Field + uicontrol="checkbox" + name="deleteReportsKeepMonth" + :model-value="keepDataForMonth" + @update:model-value="keepDataForMonth = $event; reloadDbStats()" + :title="`${translate('General_MonthlyReports')} (${translate('General_Recommended')})`" + > + </Field> + </div> + <div> + <Field + uicontrol="checkbox" + name="deleteReportsKeepYear" + :model-value="keepDataForYear" + @update:model-value="keepDataForYear = $event; reloadDbStats()" + :title="`${translate('General_YearlyReports')} (${translate('General_Recommended')})`" + > + </Field> + </div> + <div> + <Field + uicontrol="checkbox" + name="deleteReportsKeepRange" + :model-value="keepDataForRange" + @update:model-value="keepDataForRange = $event; reloadDbStats()" + :title="translate('General_RangeReports')" + > + </Field> + </div> + <div> + <Field + uicontrol="checkbox" + name="deleteReportsKeepSegments" + :model-value="keepDataForSegments" + @update:model-value="keepDataForSegments = $event; reloadDbStats()" + :title="translate('PrivacyManager_KeepReportSegments')" + > + </Field> + </div> + </div> + </div> + <SaveButton + @confirm="save()" + :saving="isLoading" + /> + </div> +</template> + +<script lang="ts"> +import { defineComponent } from 'vue'; +import { translate, Matomo } from 'CoreHome'; +import { Form, Field, SaveButton } from 'CorePluginsAdmin'; +import ReportDeletionSettingsStore, { + ReportDeletionSettings, +} from '../ReportDeletionSettings/ReportDeletionSettings.store'; + +interface DeleteOldReportsState { + isLoading: boolean; + enabled: boolean; + deleteOlderThan: string; + keepBasic: boolean; + keepDataForDay: boolean; + keepDataForWeek: boolean; + keepDataForMonth: boolean; + keepDataForYear: boolean; + keepDataForRange: boolean; + keepDataForSegments: boolean; +} + +function getInt(value: unknown) { + return value ? '1' : '0'; +} + +const { $ } = window; + +export default defineComponent({ + props: { + isDataPurgeSettingsEnabled: Boolean, + deleteData: { + type: Object, + required: true, + }, + scheduleDeletionOptions: { + type: Object, + required: true, + }, + }, + components: { + Field, + SaveButton, + }, + directives: { + Form, + }, + data(): DeleteOldReportsState { + return { + isLoading: false, + enabled: parseInt(this.deleteData.config.delete_reports_enable, 10) === 1, + deleteOlderThan: this.deleteData.config.delete_reports_older_than, + keepBasic: parseInt(this.deleteData.config.delete_reports_keep_basic_metrics, 10) === 1, + keepDataForDay: parseInt(this.deleteData.config.delete_reports_keep_day_reports, 10) === 1, + keepDataForWeek: parseInt(this.deleteData.config.delete_reports_keep_week_reports, 10) === 1, + keepDataForMonth: parseInt( + this.deleteData.config.delete_reports_keep_month_reports, + 10, + ) === 1, + keepDataForYear: parseInt(this.deleteData.config.delete_reports_keep_year_reports, 10) === 1, + keepDataForRange: parseInt( + this.deleteData.config.delete_reports_keep_range_reports, + 10, + ) === 1, + keepDataForSegments: parseInt( + this.deleteData.config.delete_reports_keep_segment_reports, + 10, + ) === 1, + }; + }, + created() { + setTimeout(() => { + ReportDeletionSettingsStore.initSettings(this.settings); + }); + }, + methods: { + saveSettings() { + const method = 'PrivacyManager.setDeleteReportsSettings'; + + this.isLoading = true; + ReportDeletionSettingsStore.savePurgeDataSettings(method, this.settings).finally(() => { + this.isLoading = false; + }); + }, + reloadDbStats() { + ReportDeletionSettingsStore.updateSettings(this.settings); + }, + save() { + if (this.enabled) { + let confirmId = 'deleteReportsConfirm'; + if (ReportDeletionSettingsStore.enableDeleteLogs.value) { + confirmId = 'deleteBothConfirm'; + } + + $('#confirmDeleteSettings').find('>h2').hide(); + $(`#${confirmId}`).show(); + + Matomo.helper.modalConfirm('#confirmDeleteSettings', { + yes: () => { + this.saveSettings(); + }, + }); + } else { + this.saveSettings(); + } + }, + }, + computed: { + settings(): ReportDeletionSettings { + return { + enableDeleteReports: this.enabled, + deleteReportsOlderThan: this.deleteOlderThan, + keepBasic: getInt(this.keepBasic), + keepDay: getInt(this.keepDataForDay), + keepWeek: getInt(this.keepDataForWeek), + keepMonth: getInt(this.keepDataForMonth), + keepYear: getInt(this.keepDataForYear), + keepRange: getInt(this.keepDataForRange), + keepSegments: getInt(this.keepDataForSegments), + }; + }, + deleteOldLogsText(): string { + return translate('PrivacyManager_UseDeleteLog'); + }, + deleteReportsOlderThanTitle(): string { + const first = translate('PrivacyManager_DeleteReportsOlderThan'); + return `${first} (${translate('Intl_PeriodMonths')})`; + }, + deleteReportsKeepBasicTitle(): string { + const first = translate('PrivacyManager_KeepBasicMetrics'); + return `${first} (${translate('General_Recommended')})`; + }, + }, +}); +</script> diff --git a/plugins/PrivacyManager/vue/src/ReportDeletionSettings/ReportDeletionSettings.store.ts b/plugins/PrivacyManager/vue/src/ReportDeletionSettings/ReportDeletionSettings.store.ts new file mode 100644 index 0000000000..a7ab29eeeb --- /dev/null +++ b/plugins/PrivacyManager/vue/src/ReportDeletionSettings/ReportDeletionSettings.store.ts @@ -0,0 +1,149 @@ +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +import { + reactive, + computed, + readonly, +} from 'vue'; +import { + AjaxHelper, + NotificationsStore, + translate, +} from 'CoreHome'; + +export interface ReportDeletionSettings { + enableDeleteLogs?: boolean; + enableDeleteReports?: boolean; + deleteLogsOlderThan?: string; + deleteReportsOlderThan?: string; + keepBasic?: string; + keepDay?: string; + keepWeek?: string; + keepMonth?: string; + keepYear?: string; + keepRange?: string; + keepSegments?: string; + deleteLowestInterval?: string; +} + +interface ReportDeletionSettingsStoreState { + settings: ReportDeletionSettings; + showEstimate: boolean; + loadingEstimation: boolean; + estimation: string; + isModified: boolean; +} + +class ReportDeletionSettingsStore { + private privateState = reactive<ReportDeletionSettingsStoreState>({ + settings: {}, + showEstimate: false, + loadingEstimation: false, + estimation: '', + isModified: false, + }); + + readonly state = computed(() => readonly(this.privateState)); + + readonly enableDeleteReports = computed(() => this.state.value.settings.enableDeleteReports); + + readonly enableDeleteLogs = computed(() => this.state.value.settings.enableDeleteLogs); + + private currentRequest?: AbortController; + + updateSettings(settings: ReportDeletionSettings) { + this.initSettings(settings); + this.privateState.isModified = true; + } + + initSettings(settings: ReportDeletionSettings) { + this.privateState.settings = { ...this.privateState.settings, ...settings }; + this.reloadDbStats(); + } + + savePurgeDataSettings(apiMethod: string, settings: ReportDeletionSettings) { + this.privateState.isModified = false; + return AjaxHelper.post( + { + module: 'API', + method: apiMethod, + }, + { + ...settings, + enableDeleteLogs: settings.enableDeleteLogs ? '1' : '0', + enableDeleteReports: settings.enableDeleteReports ? '1' : '0', + }, + ).then(() => { + const notificationInstanceId = NotificationsStore.show({ + message: translate('CoreAdminHome_SettingsSaveSuccess'), + context: 'success', + id: 'privacyManagerSettings', + type: 'toast', + }); + NotificationsStore.scrollToNotification(notificationInstanceId); + }); + } + + isEitherDeleteSectionEnabled() { + return this.state.value.settings.enableDeleteLogs + || this.state.value.settings.enableDeleteReports; + } + + isManualEstimationLinkShowing() { + return window.$('#getPurgeEstimateLink').length > 0; + } + + reloadDbStats(forceEstimate?: boolean) { + if (this.currentRequest) { // if the manual estimate link is showing, abort unless forcing + this.currentRequest.abort(); + this.currentRequest = undefined; + } + + if (!forceEstimate + && (!this.isEitherDeleteSectionEnabled() + || this.isManualEstimationLinkShowing()) + ) { + return; + } + + this.privateState.loadingEstimation = true; + this.privateState.estimation = ''; + this.privateState.showEstimate = false; + + const { settings } = this.privateState; + const formData: QueryParameters = { + ...settings, + enableDeleteLogs: settings.enableDeleteLogs ? '1' : '0', + enableDeleteReports: settings.enableDeleteReports ? '1' : '0', + }; + + if (forceEstimate === true) { + formData.forceEstimate = 1; + } + + this.currentRequest = new AbortController(); + AjaxHelper.post( + { + module: 'PrivacyManager', + action: 'getDatabaseSize', + format: 'html', + }, + formData, + { abortController: this.currentRequest, format: 'html' }, + ).then((data) => { + this.privateState.estimation = data; + this.privateState.showEstimate = true; + this.privateState.loadingEstimation = false; + }).finally(() => { + this.currentRequest = undefined; + this.privateState.loadingEstimation = false; + }); + } +} + +export default new ReportDeletionSettingsStore(); diff --git a/plugins/PrivacyManager/vue/src/ScheduleReportDeletion/ScheduleReportDeletion.vue b/plugins/PrivacyManager/vue/src/ScheduleReportDeletion/ScheduleReportDeletion.vue new file mode 100644 index 0000000000..6c5843a83b --- /dev/null +++ b/plugins/PrivacyManager/vue/src/ScheduleReportDeletion/ScheduleReportDeletion.vue @@ -0,0 +1,213 @@ +<!-- + Matomo - free/libre analytics platform + @link https://matomo.org + @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later +--> + +<template> + <div + id="formDeleteSettings" + v-form + > + <ContentBlock + id="scheduleSettingsHeadline" + v-show="isEitherDeleteSectionEnabled" + :content-title="translate('PrivacyManager_DeleteSchedulingSettings')" + > + <div id="deleteSchedulingSettings"> + <div> + <Field + uicontrol="select" + name="deleteLowestInterval" + :title="translate('PrivacyManager_DeleteDataInterval')" + v-model="deleteLowestInterval" + :options="scheduleDeletionOptions" + > + <template v-slot:inline-help> + <div + id="deleteSchedulingSettingsInlineHelp" + class="inline-help-node" + > + <span v-if="deleteData.lastRun"> + <strong>{{ translate('PrivacyManager_LastDelete') }}:</strong> + {{ deleteData.lastRunPretty }} + <br /> + <br /> + </span> + <strong>{{ translate('PrivacyManager_NextDelete') }}:</strong> + {{ deleteData.nextRunPretty }} + <br /> + <br /> + <a + id="purgeDataNowLink" + href="#" + v-show="showPurgeNowLink" + @click="executeDataPurgeNow()" + >{{ translate('PrivacyManager_PurgeNow') }}</a> + <ActivityIndicator + :loading-message="translate('PrivacyManager_PurgingData')" + :loading="loadingDataPurge" + /> + <span + id="db-purged-message" + v-show="dataWasPurged" + >{{ translate('PrivacyManager_DBPurged') }}</span> + </div> + </template> + </Field> + </div> + </div> + <div + id="deleteDataEstimateSect" + class="form-group row" + v-if="deleteData.config.enable_database_size_estimate === '1' + || deleteData.config.enable_database_size_estimate === 1" + > + <h3 + class="col s12" + id="databaseSizeHeadline" + > + {{ translate('PrivacyManager_ReportsDataSavedEstimate') }} + </h3> + <div class="col s12 m6"> + <div + id="deleteDataEstimate" + v-show="showEstimate" + v-html="$sanitize(estimation)" + /> <ActivityIndicator :loading="loadingEstimation" /> + </div> + <div class="col s12 m6"> + <div + v-if="deleteData.config.enable_auto_database_size_estimate !== '1' + && deleteData.config.enable_auto_database_size_estimate !== 1" + class="form-help" + > + <a + id="getPurgeEstimateLink" + href="#" + @click.prevent="getPurgeEstimate()" + >{{ translate('PrivacyManager_GetPurgeEstimate') }}</a> + </div> + </div> + </div> + <SaveButton + @confirm="save()" + :saving="isLoading" + /> + </ContentBlock> + </div> +</template> + +<script lang="ts"> +import { defineComponent } from 'vue'; +import { + Matomo, + AjaxHelper, + ContentBlock, + ActivityIndicator, +} from 'CoreHome'; +import { Form, Field, SaveButton } from 'CorePluginsAdmin'; +import ReportDeletionSettingsStore from '../ReportDeletionSettings/ReportDeletionSettings.store'; + +interface ScheduleReportDeletionState { + isLoading: boolean; + loadingDataPurge: boolean; + dataWasPurged: boolean; + showPurgeNowLink: boolean; + deleteLowestInterval: string; +} + +export default defineComponent({ + props: { + isDataPurgeSettingsEnabled: Boolean, + deleteData: { + type: Object, + required: true, + }, + scheduleDeletionOptions: { + type: Object, + required: true, + }, + }, + components: { + ContentBlock, + ActivityIndicator, + Field, + SaveButton, + }, + directives: { + Form, + }, + data(): ScheduleReportDeletionState { + return { + isLoading: false, + loadingDataPurge: false, + dataWasPurged: false, + showPurgeNowLink: true, + deleteLowestInterval: this.deleteData.config.delete_logs_schedule_lowest_interval, + }; + }, + methods: { + save() { + const method = 'PrivacyManager.setScheduleReportDeletionSettings'; + ReportDeletionSettingsStore.savePurgeDataSettings(method, { + deleteLowestInterval: this.deleteLowestInterval, + }); + }, + executeDataPurgeNow() { + if (ReportDeletionSettingsStore.state.value.isModified) { + // ask user if they really want to delete their old data + Matomo.helper.modalConfirm('#saveSettingsBeforePurge', { + yes: () => null, + }); + + return; + } + + Matomo.helper.modalConfirm('#confirmPurgeNow', { + yes: () => { + this.loadingDataPurge = true; + this.showPurgeNowLink = false; // execute a data purge + + AjaxHelper.fetch( + { + module: 'PrivacyManager', + action: 'executeDataPurge', + format: 'html', + }, + { withTokenInUrl: true }, + ).then(() => { + // force reload + ReportDeletionSettingsStore.reloadDbStats(); + this.dataWasPurged = true; + + setTimeout(() => { + this.dataWasPurged = false; + this.showPurgeNowLink = true; + }, 2000); + }).finally(() => { + this.loadingDataPurge = false; + }); + }, + }); + }, + getPurgeEstimate() { + return ReportDeletionSettingsStore.reloadDbStats(true); + }, + }, + computed: { + showEstimate() { + return ReportDeletionSettingsStore.state.value.showEstimate; + }, + isEitherDeleteSectionEnabled() { + return ReportDeletionSettingsStore.isEitherDeleteSectionEnabled(); + }, + estimation() { + return ReportDeletionSettingsStore.state.value.estimation; + }, + loadingEstimation() { + return ReportDeletionSettingsStore.state.value.loadingEstimation; + }, + }, +}); +</script> diff --git a/plugins/PrivacyManager/vue/src/index.ts b/plugins/PrivacyManager/vue/src/index.ts index 876fcab45c..469926a4c7 100644 --- a/plugins/PrivacyManager/vue/src/index.ts +++ b/plugins/PrivacyManager/vue/src/index.ts @@ -8,3 +8,9 @@ export { default as AnonymizeIp } from './AnonymizeIp/AnonymizeIp.vue'; export { default as AnonymizeLogData } from './AnonymizeLogData/AnonymizeLogData.vue'; export { default as DoNotTrackPreference } from './DoNotTrackPreference/DoNotTrackPreference.vue'; +export { + default as ReportDeletionSettings, +} from './ReportDeletionSettings/ReportDeletionSettings.store'; +export { default as DeleteOldLogs } from './DeleteOldLogs/DeleteOldLogs.vue'; +export { default as DeleteOldReports } from './DeleteOldReports/DeleteOldReports.vue'; +export { default as ScheduleReportDeletion } from './ScheduleReportDeletion/ScheduleReportDeletion.vue'; |