diff --git a/API.php b/API.php index 1d1fb04b..8c624e7b 100755 --- a/API.php +++ b/API.php @@ -143,15 +143,17 @@ public function getAlerts($idSites, $ifSuperUserReturnAllAlerts = false) * Allowed values: email, mobile, slack, teams. * @param string $slackChannelID Slack channel ID when the slack channel is enabled. * @param string $msTeamsWebhookUrl Microsoft Teams webhook URL when the teams channel is enabled. + * @param string $description Optional alert description (max 255 characters). * @return int ID of the newly created alert. */ - public function addAlert($name, $idSites, $period, $emailMe, $additionalEmails, $phoneNumbers, $metric, $metricCondition, $metricValue, $comparedTo, $reportUniqueId, $reportCondition = false, $reportValue = false, array $reportMediums = [], string $slackChannelID = '', string $msTeamsWebhookUrl = '') + public function addAlert($name, $idSites, $period, $emailMe, $additionalEmails, $phoneNumbers, $metric, $metricCondition, $metricValue, $comparedTo, $reportUniqueId, $reportCondition = false, $reportValue = false, array $reportMediums = [], string $slackChannelID = '', string $msTeamsWebhookUrl = '', string $description = '') { $idSites = Site::getIdSitesFromIdSitesString($idSites); - $this->checkAlert($idSites, $name, $period, $emailMe, $additionalEmails, $phoneNumbers, $slackChannelID, $msTeamsWebhookUrl, $metricCondition, $metric, $comparedTo, $reportCondition, $reportUniqueId, $reportMediums); + $this->checkAlert($idSites, $name, $description, $period, $emailMe, $additionalEmails, $phoneNumbers, $slackChannelID, $msTeamsWebhookUrl, $metricCondition, $metric, $comparedTo, $reportCondition, $reportUniqueId, $reportMediums); - $name = Common::unsanitizeInputValue($name); + $name = Common::unsanitizeInputValue($name); + $description = Common::unsanitizeInputValue($description); $login = Piwik::getCurrentUserLogin(); if (empty($reportCondition) || empty($reportValue)) { @@ -161,7 +163,7 @@ public function addAlert($name, $idSites, $period, $emailMe, $additionalEmails, $metricValue = Common::forceDotAsSeparatorForDecimalPoint((float)$metricValue); - return $this->getModel()->createAlert($name, $idSites, $login, $period, $emailMe, $additionalEmails, $phoneNumbers, $metric, $metricCondition, $metricValue, $comparedTo, $reportUniqueId, $reportCondition, $reportValue, $reportMediums, $slackChannelID, $msTeamsWebhookUrl); + return $this->getModel()->createAlert($name, $idSites, $login, $period, $emailMe, $additionalEmails, $phoneNumbers, $metric, $metricCondition, $metricValue, $comparedTo, $reportUniqueId, $reportCondition, $reportValue, $reportMediums, $slackChannelID, $msTeamsWebhookUrl, $description); } private function filterAdditionalEmails($additionalEmails) @@ -195,7 +197,7 @@ private function filterPhoneNumbers($phoneNumbers) return array_values($phoneNumbers); } - private function checkAlert($idSites, $name, $period, &$emailMe, &$additionalEmails, &$phoneNumbers, &$slackChannelID, &$msTeamsWebhookUrl, $metricCondition, $metricValue, $comparedTo, $reportCondition, $reportUniqueId, $reportMediums) + private function checkAlert($idSites, $name, $description, $period, &$emailMe, &$additionalEmails, &$phoneNumbers, &$slackChannelID, &$msTeamsWebhookUrl, $metricCondition, $metricValue, $comparedTo, $reportCondition, $reportUniqueId, $reportMediums) { Piwik::checkUserHasViewAccess($idSites); $additionalEmails = in_array('email', $reportMediums) ? $this->filterAdditionalEmails($additionalEmails) : []; @@ -205,6 +207,7 @@ private function checkAlert($idSites, $name, $period, &$emailMe, &$additionalEma $msTeamsWebhookUrl = in_array('teams', $reportMediums) ? $msTeamsWebhookUrl : ''; $this->validator->checkName($name); + $this->validator->checkDescription($description); $this->validator->checkPeriod($period); $this->validator->checkComparedTo($period, $comparedTo); $this->validator->checkMetricCondition($metricCondition); @@ -252,19 +255,21 @@ private function checkAlert($idSites, $name, $period, &$emailMe, &$additionalEma * Allowed values: email, mobile, slack, teams. * @param string $slackChannelID Slack channel ID when the slack channel is enabled. * @param string $msTeamsWebhookUrl Microsoft Teams webhook URL when the teams channel is enabled. + * @param string $description Optional alert description (max 255 characters). * * @return int Updated alert ID. */ - public function editAlert($idAlert, $name, $idSites, $period, $emailMe, $additionalEmails, $phoneNumbers, $metric, $metricCondition, $metricValue, $comparedTo, $reportUniqueId, $reportCondition = false, $reportValue = false, array $reportMediums = [], string $slackChannelID = '', string $msTeamsWebhookUrl = '') + public function editAlert($idAlert, $name, $idSites, $period, $emailMe, $additionalEmails, $phoneNumbers, $metric, $metricCondition, $metricValue, $comparedTo, $reportUniqueId, $reportCondition = false, $reportValue = false, array $reportMediums = [], string $slackChannelID = '', string $msTeamsWebhookUrl = '', string $description = '') { // make sure alert exists and user has permission to read $this->getAlert($idAlert); $idSites = Site::getIdSitesFromIdSitesString($idSites); - $this->checkAlert($idSites, $name, $period, $emailMe, $additionalEmails, $phoneNumbers, $slackChannelID, $msTeamsWebhookUrl, $metricCondition, $metric, $comparedTo, $reportCondition, $reportUniqueId, $reportMediums); + $this->checkAlert($idSites, $name, $description, $period, $emailMe, $additionalEmails, $phoneNumbers, $slackChannelID, $msTeamsWebhookUrl, $metricCondition, $metric, $comparedTo, $reportCondition, $reportUniqueId, $reportMediums); $name = Common::unsanitizeInputValue($name); + $description = Common::unsanitizeInputValue($description); if (empty($reportCondition) || empty($reportValue)) { $reportCondition = null; @@ -273,7 +278,7 @@ public function editAlert($idAlert, $name, $idSites, $period, $emailMe, $additio $metricValue = Common::forceDotAsSeparatorForDecimalPoint((float)$metricValue); - return $this->getModel()->updateAlert($idAlert, $name, $idSites, $period, $emailMe, $additionalEmails, $phoneNumbers, $metric, $metricCondition, $metricValue, $comparedTo, $reportUniqueId, $reportCondition, $reportValue, $reportMediums, $slackChannelID, $msTeamsWebhookUrl); + return $this->getModel()->updateAlert($idAlert, $name, $idSites, $period, $emailMe, $additionalEmails, $phoneNumbers, $metric, $metricCondition, $metricValue, $comparedTo, $reportUniqueId, $reportCondition, $reportValue, $reportMediums, $slackChannelID, $msTeamsWebhookUrl, $description); } /** diff --git a/CHANGELOG.md b/CHANGELOG.md index a2ada0dc..90e532c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Changelog +* 5.3.0 - 2026-05-11 - Added alert description and helptexts * 5.2.6 - 2026-04-27 - Updated API documentation * 5.2.5 - 2026-03-30 - Added escaping for report_matched value * 5.2.4 - 2026-03-02 - Updated API documentation diff --git a/CustomAlerts.php b/CustomAlerts.php index 43511f7c..177cdbfb 100755 --- a/CustomAlerts.php +++ b/CustomAlerts.php @@ -248,6 +248,11 @@ public function getClientSideTranslationKeys(&$translations) $translations[] = 'CustomAlerts_CreateNewAlert'; $translations[] = 'CustomAlerts_AlertsHistory'; $translations[] = 'CustomAlerts_AlertName'; + $translations[] = 'CustomAlerts_AlertNameInlineHelp'; + $translations[] = 'CustomAlerts_AlertNamePlaceholder'; + $translations[] = 'CustomAlerts_AlertDescriptionOptional'; + $translations[] = 'CustomAlerts_AlertDescriptionInlineHelp'; + $translations[] = 'CustomAlerts_AlertDescriptionPlaceholder'; $translations[] = 'CustomAlerts_ApplyTo'; $translations[] = 'ScheduledReports_SendReportTo'; $translations[] = 'ScheduledReports_SentToMe'; @@ -268,6 +273,7 @@ public function getClientSideTranslationKeys(&$translations) $translations[] = 'CustomAlerts_ThisAppliesToHelp'; $translations[] = 'General_Yes'; $translations[] = 'General_No'; + $translations[] = 'General_Description'; $translations[] = 'CustomAlerts_MediumTitle'; $translations[] = 'CustomAlerts_MediumDescription'; $translations[] = 'CustomAlerts_ManageTooltip'; diff --git a/Model.php b/Model.php index 796eb768..9ca93bd9 100755 --- a/Model.php +++ b/Model.php @@ -24,6 +24,7 @@ public static function install() { $tableAlert = "`idalert` INT NOT NULL PRIMARY KEY , `name` VARCHAR(100) NOT NULL , + `description` VARCHAR(255) NOT NULL DEFAULT '', `login` VARCHAR(100) NOT NULL , `period` VARCHAR(5) NOT NULL , `report` VARCHAR(150) NOT NULL , @@ -56,6 +57,7 @@ public static function install() `value_old` DECIMAL (20,3) DEFAULT NULL, `value_new` DECIMAL (20,3) DEFAULT NULL, `name` VARCHAR(100) NOT NULL , + `description` VARCHAR(255) NOT NULL DEFAULT '', `login` VARCHAR(100) NOT NULL , `period` VARCHAR(5) NOT NULL , `report` VARCHAR(150) NOT NULL , @@ -261,13 +263,14 @@ public function getAllAlertsForPeriod($period) * @return int ID of new Alert * @throws \Exception */ - public function createAlert($name, $idSites, $login, $period, $emailMe, $additionalEmails, $phoneNumbers, $metric, $metricCondition, $metricValue, $comparedTo, $reportUniqueId, $reportCondition, $reportValue, $reportMediums, $slackChannelID, $msTeamsWebhookUrl) + public function createAlert($name, $idSites, $login, $period, $emailMe, $additionalEmails, $phoneNumbers, $metric, $metricCondition, $metricValue, $comparedTo, $reportUniqueId, $reportCondition, $reportValue, $reportMediums, $slackChannelID, $msTeamsWebhookUrl, $description = '') { $idAlert = $this->getNextAlertId(); $newAlert = array( 'idalert' => $idAlert, 'name' => $name, + 'description' => $description, 'period' => $period, 'login' => $login, 'email_me' => $emailMe ? 1 : 0, @@ -346,10 +349,11 @@ private function removeAllSites($idAlert) * @return int * @throws \Exception */ - public function updateAlert($idAlert, $name, $idSites, $period, $emailMe, $additionalEmails, $phoneNumbers, $metric, $metricCondition, $metricValue, $comparedTo, $reportUniqueId, $reportCondition, $reportValue, $reportMediums, $slackChannelID, $msTeamsWebhookUrl) + public function updateAlert($idAlert, $name, $idSites, $period, $emailMe, $additionalEmails, $phoneNumbers, $metric, $metricCondition, $metricValue, $comparedTo, $reportUniqueId, $reportCondition, $reportValue, $reportMediums, $slackChannelID, $msTeamsWebhookUrl, $description = '') { $alert = array( 'name' => $name, + 'description' => $description, 'period' => $period, 'email_me' => $emailMe ? 1 : 0, 'additional_emails' => json_encode($additionalEmails), @@ -393,7 +397,7 @@ public function triggerAlert($idAlert, $idSite, $valueNew, $valueOld, $datetime) { $alert = $this->getAlert($idAlert); - $keysToKeep = array('idalert', 'name', 'login', 'period', 'metric', 'metric_condition', 'metric_matched', 'report', 'report_condition', 'report_matched', 'report_mediums', 'compared_to', 'email_me', 'additional_emails', 'phone_numbers', 'slack_channel_id', 'ms_teams_webhook_url'); + $keysToKeep = array('idalert', 'name', 'description', 'login', 'period', 'metric', 'metric_condition', 'metric_matched', 'report', 'report_condition', 'report_matched', 'report_mediums', 'compared_to', 'email_me', 'additional_emails', 'phone_numbers', 'slack_channel_id', 'ms_teams_webhook_url'); $triggeredAlert = array(); foreach ($keysToKeep as $key) { diff --git a/Updates/5.3.0.php b/Updates/5.3.0.php new file mode 100644 index 00000000..b65116e4 --- /dev/null +++ b/Updates/5.3.0.php @@ -0,0 +1,43 @@ +migration = $factory; + } + + public function doUpdate(Updater $updater) + { + $updater->executeMigrations(__FILE__, $this->getMigrations($updater)); + } + + public function getMigrations(Updater $updater): array + { + return array( + $this->migration->db->addColumn('alert', 'description', "VARCHAR(255) NOT NULL DEFAULT ''", 'name'), + $this->migration->db->addColumn('alert_triggered', 'description', "VARCHAR(255) NOT NULL DEFAULT ''", 'name'), + ); + } +} diff --git a/Validator.php b/Validator.php index 43edea9b..ea9bc486 100755 --- a/Validator.php +++ b/Validator.php @@ -10,7 +10,6 @@ namespace Piwik\Plugins\CustomAlerts; use Exception; -use Piwik\Common; use Piwik\Context; use Piwik\Piwik; use Piwik\Plugins\API\ProcessedReport; @@ -72,11 +71,18 @@ public function checkName($name) throw new Exception(Piwik::translate("General_PleaseSpecifyValue", "name")); } - if (Common::mb_strlen($name) > 100) { + if (mb_strlen($name, 'UTF-8') > 100) { throw new Exception(Piwik::translate("CustomAlerts_ParmeterIsTooLong", array(Piwik::translate('General_Name'), 100))); } } + public function checkDescription($description) + { + if (mb_strlen($description, 'UTF-8') > 255) { + throw new Exception(Piwik::translate("CustomAlerts_ParmeterIsTooLong", array(Piwik::translate('General_Description'), 255))); + } + } + public function isValidComparableDate($period, $comparedToDate) { $dates = Processor::getComparablesDates(); diff --git a/lang/en.json b/lang/en.json index 43fc5704..fd0075e8 100644 --- a/lang/en.json +++ b/lang/en.json @@ -5,7 +5,12 @@ "AlertCondition": "Alert Condition", "AlertDoesNotExist": "Alert with ID %d does not exist!", "AlertMeWhen": "Alert me when", + "AlertDescriptionOptional": "Description (optional)", + "AlertDescriptionInlineHelp": "Enter a description to provide additional context, such as the purpose or usage.", + "AlertDescriptionPlaceholder": "Alert me when visits decrease by 40%", "AlertName": "Alert Name", + "AlertNameInlineHelp": "Enter a unique name to clearly identify this custom alert.", + "AlertNamePlaceholder": "Visits drop detected", "Alerts": "Alerts", "AlertsHistory": "History of triggered alerts", "ApplyTo": "Apply to", diff --git a/plugin.json b/plugin.json index ce458104..d0a992bd 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "name": "CustomAlerts", "description": "Create custom Alerts to be notified of important changes on your website or app! ", - "version": "5.2.6", + "version": "5.3.0", "require": { "matomo": ">=5.0.0-b1,<6.0.0-b1" }, diff --git a/tests/Integration/ApiTest.php b/tests/Integration/ApiTest.php index 5f615055..656dc9ab 100644 --- a/tests/Integration/ApiTest.php +++ b/tests/Integration/ApiTest.php @@ -38,7 +38,8 @@ protected function createAlert( $metricCondition = 'less_than', $reportCondition = 'matches_exactly', $emails = array('test1@example.com', 'test2@example.com'), - $comparedTo = 1 + $comparedTo = 1, + $description = '' ) { if (is_null($idSites)) { $idSites = $this->idSite; @@ -63,7 +64,8 @@ protected function createAlert( 'Piwik', ['email', 'mobile'], '', - '' + '', + $description ); return $id; } @@ -188,10 +190,19 @@ public function test_addAlert_ShouldCreateANewAlert() { $this->setSuperUser(); - $id = $this->createAlert('MyCustomAlert', 'week'); + $id = $this->createAlert('MyCustomAlert', 'week', null, 'nb_visits', 'MultiSites_getOne', 'less_than', 'matches_exactly', array('test1@example.com', 'test2@example.com'), 1, 'Description text'); $this->assertGreaterThan(3, $id); - $this->assertIsAlert($id, 'MyCustomAlert', 'week'); + $this->assertIsAlert($id, 'MyCustomAlert', 'week', null, 'superUserLogin', 'nb_visits', 'less_than', 5, 'MultiSites_getOne', 'matches_exactly', 'Piwik', 'Description text'); + } + + public function test_addAlert_ShouldFail_IfDescriptionTooLong() + { + $this->setSuperUser(); + $this->expectException(\Exception::class); + $this->expectExceptionMessage('CustomAlerts_ParmeterIsTooLong'); + + $this->createAlert('MyCustomAlert', 'week', null, 'nb_visits', 'MultiSites_getOne', 'less_than', 'matches_exactly', array('test1@example.com', 'test2@example.com'), 1, str_repeat('x', 256)); } protected function assertIsAlert( @@ -205,7 +216,8 @@ protected function assertIsAlert( $metricMatched = 5, $report = 'MultiSites_getOne', $reportCondition = 'matches_exactly', - $reportMatched = 'Piwik' + $reportMatched = 'Piwik', + $description = '' ) { if (is_null($idSites)) { $idSites = array($this->idSite); @@ -216,6 +228,7 @@ protected function assertIsAlert( $expected = array( 'idalert' => $id, 'name' => $name, + 'description' => $description, 'login' => $login, 'period' => $period, 'report' => $report, @@ -254,7 +267,8 @@ protected function editAlert( $report = 'MultiSites_getOne', $metricCondition = 'less_than', $reportCondition = 'matches_exactly', - $emails = array('test1@example.com', 'test2@example.com') + $emails = array('test1@example.com', 'test2@example.com'), + $description = '' ) { if (is_null($idSites)) { $idSites = $this->idSite; @@ -279,7 +293,10 @@ protected function editAlert( $report, $reportCondition, 'Piwik', - ['email', 'mobile'] + ['email', 'mobile'], + '', + '', + $description ); return $id; } @@ -349,10 +366,10 @@ public function test_editAlert_ShouldUpdateExistingEntry() { $this->setSuperUser(); - $id = $this->editAlert(2, 'MyCustomAlert', 'day'); + $id = $this->editAlert(2, 'MyCustomAlert', 'day', null, 'nb_visits', 'MultiSites_getOne', 'less_than', 'matches_exactly', array('test1@example.com', 'test2@example.com'), 'Updated description'); $this->assertEquals(2, $id); - $this->assertIsAlert(2, 'MyCustomAlert', 'day', array(1)); + $this->assertIsAlert(2, 'MyCustomAlert', 'day', array(1), 'superUserLogin', 'nb_visits', 'less_than', 5, 'MultiSites_getOne', 'matches_exactly', 'Piwik', 'Updated description'); } public function test_getAlert_ShouldLoadAlertAndRelatedWebsiteIds_IfExists() @@ -572,6 +589,7 @@ public function test_triggerAlert_getTriggeredAlertsForPeriod_ShouldMarkAlertAsT 'idsite' => 1, 'ts_last_sent' => null, 'name' => 'Initial2', + 'description' => '', 'period' => 'week', 'login' => 'superUserLogin', 'report' => 'MultiSites_getOne', diff --git a/tests/Integration/ModelTest.php b/tests/Integration/ModelTest.php index 6bc2935f..a662b43c 100644 --- a/tests/Integration/ModelTest.php +++ b/tests/Integration/ModelTest.php @@ -37,7 +37,8 @@ private function createAlert( $idSites = null, $metric = 'nb_visits', $report = 'MultiSites_getOne', - $login = 'superUserLogin' + $login = 'superUserLogin', + $description = '' ) { if (is_null($idSites)) { $idSites = $this->idSite; @@ -49,7 +50,7 @@ private function createAlert( $emails = array('test1@example.com', 'test2@example.com'); $phoneNumbers = array('0123456789'); - $id = $this->model->createAlert($name, $idSites, $login, $period, 0, $emails, $phoneNumbers, $metric, 'less_than', 5, $comparedTo = 1, $report, 'matches_exactly', 'Piwik', ['email', 'mobile'], '', ''); + $id = $this->model->createAlert($name, $idSites, $login, $period, 0, $emails, $phoneNumbers, $metric, 'less_than', 5, $comparedTo = 1, $report, 'matches_exactly', 'Piwik', ['email', 'mobile'], '', '', $description); return $id; } @@ -58,13 +59,13 @@ public function test_install_ShouldNotFailAndActuallyCreateTheDatabases() $this->assertContainTables(array('alert', 'alert_site', 'alert_triggered')); $columns = Db::fetchAll('show columns from ' . Common::prefixTable('alert')); - $this->assertCount(17, $columns); + $this->assertCount(18, $columns); $columns = Db::fetchAll('show columns from ' . Common::prefixTable('alert_site')); $this->assertCount(2, $columns); $columns = Db::fetchAll('show columns from ' . Common::prefixTable('alert_triggered')); - $this->assertCount(23, $columns); + $this->assertCount(24, $columns); } private function assertContainTables($expectedTables) @@ -108,10 +109,10 @@ private function assertNotContainTables($expectedTables) public function test_addAlert_ShouldCreateANewAlert() { - $id = $this->createAlert('MyCustomAlert', 'week'); + $id = $this->createAlert('MyCustomAlert', 'week', null, 'nb_visits', 'MultiSites_getOne', 'superUserLogin', 'Description text'); $this->assertGreaterThan(3, $id); - $this->assertIsAlert($id, 'MyCustomAlert', 'week'); + $this->assertIsAlert($id, 'MyCustomAlert', 'week', null, 'superUserLogin', 'nb_visits', 'less_than', 5, 'MultiSites_getOne', 'matches_exactly', 'Piwik', 'Description text'); } private function assertIsAlert( @@ -125,7 +126,8 @@ private function assertIsAlert( $metricMatched = 5, $report = 'MultiSites_getOne', $reportCondition = 'matches_exactly', - $reportMatched = 'Piwik' + $reportMatched = 'Piwik', + $description = '' ) { if (is_null($idSites)) { $idSites = array($this->idSite); @@ -136,6 +138,7 @@ private function assertIsAlert( $expected = array( 'idalert' => $id, 'name' => $name, + 'description' => $description, 'login' => $login, 'period' => $period, 'report' => $report, @@ -166,10 +169,10 @@ public function test_addAlert_ShouldIncreaseId() public function test_editAlert_ShouldUpdateExistingEntry() { - $id = $this->editAlert(2, 'MyCustomAlert', 'day'); + $id = $this->editAlert(2, 'MyCustomAlert', 'day', null, 'nb_visits', 'MultiSites_getOne', 'Updated description'); $this->assertEquals(2, $id); - $this->assertIsAlert(2, 'MyCustomAlert', 'day', array(1)); + $this->assertIsAlert(2, 'MyCustomAlert', 'day', array(1), 'superUserLogin', 'nb_visits', 'less_than', 5, 'MultiSites_getOne', 'matches_exactly', 'Piwik', 'Updated description'); } private function editAlert( @@ -178,7 +181,8 @@ private function editAlert( $period = 'week', $idSites = null, $metric = 'nb_visits', - $report = 'MultiSites_getOne' + $report = 'MultiSites_getOne', + $description = '' ) { if (is_null($idSites)) { $idSites = $this->idSite; @@ -207,7 +211,8 @@ private function editAlert( 'Piwik', ['email', 'mobile'], '', - '' + '', + $description ); return $id; } @@ -312,6 +317,7 @@ public function test_triggerAlert_getTriggeredAlertsForPeriod_ShouldMarkAlertAsT 'idsite' => 1, 'ts_last_sent' => null, 'name' => 'Initial2', + 'description' => '', 'period' => 'week', 'login' => 'superUserLogin', 'report' => 'MultiSites_getOne', diff --git a/tests/UI/expected-ui-screenshots/CustomAlerts_alert_condition_reloaded_site1.png b/tests/UI/expected-ui-screenshots/CustomAlerts_alert_condition_reloaded_site1.png index aee0e42d..2e198adc 100644 Binary files a/tests/UI/expected-ui-screenshots/CustomAlerts_alert_condition_reloaded_site1.png and b/tests/UI/expected-ui-screenshots/CustomAlerts_alert_condition_reloaded_site1.png differ diff --git a/tests/UI/expected-ui-screenshots/CustomAlerts_alert_condition_reloaded_site2.png b/tests/UI/expected-ui-screenshots/CustomAlerts_alert_condition_reloaded_site2.png index 5cc52835..317cc868 100644 Binary files a/tests/UI/expected-ui-screenshots/CustomAlerts_alert_condition_reloaded_site2.png and b/tests/UI/expected-ui-screenshots/CustomAlerts_alert_condition_reloaded_site2.png differ diff --git a/tests/UI/expected-ui-screenshots/CustomAlerts_edit.png b/tests/UI/expected-ui-screenshots/CustomAlerts_edit.png index 3573a9eb..c27d89fe 100644 Binary files a/tests/UI/expected-ui-screenshots/CustomAlerts_edit.png and b/tests/UI/expected-ui-screenshots/CustomAlerts_edit.png differ diff --git a/tests/UI/expected-ui-screenshots/CustomAlerts_report_mediums.png b/tests/UI/expected-ui-screenshots/CustomAlerts_report_mediums.png index fa31f879..1e1b5763 100644 Binary files a/tests/UI/expected-ui-screenshots/CustomAlerts_report_mediums.png and b/tests/UI/expected-ui-screenshots/CustomAlerts_report_mediums.png differ diff --git a/vue/dist/CustomAlerts.umd.js b/vue/dist/CustomAlerts.umd.js index 97053f78..56bbe403 100644 --- a/vue/dist/CustomAlerts.umd.js +++ b/vue/dist/CustomAlerts.umd.js @@ -277,68 +277,68 @@ var external_CoreHome_ = __webpack_require__("19dc"); ListAlertsvue_type_script_lang_ts.render = render /* harmony default export */ var ListAlerts = (ListAlertsvue_type_script_lang_ts); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-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--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/CustomAlerts/vue/src/EditAlert/EditAlert.vue?vue&type=template&id=7fe6cbad +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-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--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/CustomAlerts/vue/src/EditAlert/EditAlert.vue?vue&type=template&id=39490cfc -const EditAlertvue_type_template_id_7fe6cbad_hoisted_1 = { +const EditAlertvue_type_template_id_39490cfc_hoisted_1 = { id: "customAlertPeriodHelp", class: "inline-help-node" }; -const EditAlertvue_type_template_id_7fe6cbad_hoisted_2 = { +const EditAlertvue_type_template_id_39490cfc_hoisted_2 = { class: "report-mediums" }; -const EditAlertvue_type_template_id_7fe6cbad_hoisted_3 = { +const EditAlertvue_type_template_id_39490cfc_hoisted_3 = { key: 0 }; -const EditAlertvue_type_template_id_7fe6cbad_hoisted_4 = { +const EditAlertvue_type_template_id_39490cfc_hoisted_4 = { key: 1 }; -const EditAlertvue_type_template_id_7fe6cbad_hoisted_5 = { +const EditAlertvue_type_template_id_39490cfc_hoisted_5 = { key: 0 }; -const EditAlertvue_type_template_id_7fe6cbad_hoisted_6 = { +const EditAlertvue_type_template_id_39490cfc_hoisted_6 = { key: 1, class: "row" }; -const EditAlertvue_type_template_id_7fe6cbad_hoisted_7 = { +const EditAlertvue_type_template_id_39490cfc_hoisted_7 = { class: "col s12" }; -const EditAlertvue_type_template_id_7fe6cbad_hoisted_8 = ["innerHTML"]; -const EditAlertvue_type_template_id_7fe6cbad_hoisted_9 = { +const EditAlertvue_type_template_id_39490cfc_hoisted_8 = ["innerHTML"]; +const EditAlertvue_type_template_id_39490cfc_hoisted_9 = { key: 2 }; -const EditAlertvue_type_template_id_7fe6cbad_hoisted_10 = { +const EditAlertvue_type_template_id_39490cfc_hoisted_10 = { key: 3 }; -const EditAlertvue_type_template_id_7fe6cbad_hoisted_11 = { +const EditAlertvue_type_template_id_39490cfc_hoisted_11 = { class: "row" }; -const EditAlertvue_type_template_id_7fe6cbad_hoisted_12 = { +const EditAlertvue_type_template_id_39490cfc_hoisted_12 = { class: "col s12" }; -const EditAlertvue_type_template_id_7fe6cbad_hoisted_13 = { +const EditAlertvue_type_template_id_39490cfc_hoisted_13 = { class: "row conditionAndValue" }; -const EditAlertvue_type_template_id_7fe6cbad_hoisted_14 = { +const EditAlertvue_type_template_id_39490cfc_hoisted_14 = { class: "col s12 m6" }; -const EditAlertvue_type_template_id_7fe6cbad_hoisted_15 = { +const EditAlertvue_type_template_id_39490cfc_hoisted_15 = { class: "col s12 m6" }; -const EditAlertvue_type_template_id_7fe6cbad_hoisted_16 = { +const EditAlertvue_type_template_id_39490cfc_hoisted_16 = { class: "ui-autocomplete-input", ref: "reportValue" }; -const EditAlertvue_type_template_id_7fe6cbad_hoisted_17 = { +const EditAlertvue_type_template_id_39490cfc_hoisted_17 = { class: "row conditionAndValue" }; -const EditAlertvue_type_template_id_7fe6cbad_hoisted_18 = { +const EditAlertvue_type_template_id_39490cfc_hoisted_18 = { class: "col s12 m6" }; -const EditAlertvue_type_template_id_7fe6cbad_hoisted_19 = { +const EditAlertvue_type_template_id_39490cfc_hoisted_19 = { class: "col s12 m6" }; const _hoisted_20 = ["innerHTML"]; -function EditAlertvue_type_template_id_7fe6cbad_render(_ctx, _cache, $props, $setup, $data, $options) { +function EditAlertvue_type_template_id_39490cfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); const _component_SelectPhoneNumbers = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("SelectPhoneNumbers"); const _component_Alert = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Alert"); @@ -360,33 +360,48 @@ function EditAlertvue_type_template_id_7fe6cbad_render(_ctx, _cache, $props, $se modelValue: _ctx.actualAlert.name, "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => _ctx.actualAlert.name = $event), maxlength: 100, - title: _ctx.translate('CustomAlerts_AlertName') - }, null, 8, ["modelValue", "title"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + title: _ctx.translate('CustomAlerts_AlertName'), + placeholder: _ctx.translate('CustomAlerts_AlertNamePlaceholder'), + "inline-help": _ctx.translate('CustomAlerts_AlertNameInlineHelp') + }, null, 8, ["modelValue", "title", "placeholder", "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: "textarea", + name: "alertDescription", + modelValue: _ctx.actualAlert.description, + "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => _ctx.actualAlert.description = $event), + maxlength: 255, + rows: 3, + "ui-control-attributes": { + class: 'compact-textarea' + }, + title: _ctx.translate('CustomAlerts_AlertDescriptionOptional'), + placeholder: _ctx.translate('CustomAlerts_AlertDescriptionPlaceholder'), + "inline-help": _ctx.translate('CustomAlerts_AlertDescriptionInlineHelp') + }, null, 8, ["modelValue", "title", "placeholder", "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: "site", name: "idSite", "model-value": { id: (_ctx$actualAlert$id_s = _ctx.actualAlert.id_sites) === null || _ctx$actualAlert$id_s === void 0 ? void 0 : _ctx$actualAlert$id_s[0], name: _ctx.actualCurrentSite.name }, - "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => { + "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => { _ctx.actualAlert.id_sites = [$event.id]; _ctx.actualCurrentSite = $event; _ctx.changeReport(); }), title: _ctx.translate('General_Website'), introduction: _ctx.translate('CustomAlerts_ApplyTo') - }, null, 8, ["model-value", "title", "introduction"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_7fe6cbad_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomAlerts_YouCanChoosePeriodFrom')) + ": ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("ul", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", null, "• " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomAlerts_PeriodDayDescription')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", null, "• " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomAlerts_PeriodWeekDescription')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", null, "• " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomAlerts_PeriodMonthDescription')), 1)])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + }, null, 8, ["model-value", "title", "introduction"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_39490cfc_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomAlerts_YouCanChoosePeriodFrom')) + ": ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("ul", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", null, "• " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomAlerts_PeriodDayDescription')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", null, "• " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomAlerts_PeriodWeekDescription')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", null, "• " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomAlerts_PeriodMonthDescription')), 1)])]), 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: "period", "inline-help": "#customAlertPeriodHelp", "model-value": _ctx.actualAlert.period, - "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => { + "onUpdate:modelValue": _cache[3] || (_cache[3] = $event => { _ctx.actualAlert.period = $event; _ctx.changeReport(); }), title: _ctx.translate('General_Period'), options: _ctx.periodOptions - }, null, 8, ["model-value", "title", "options"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_7fe6cbad_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + }, null, 8, ["model-value", "title", "options"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_39490cfc_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { uicontrol: "multiselect", name: "report_mediums", id: "report_mediums", @@ -394,48 +409,48 @@ function EditAlertvue_type_template_id_7fe6cbad_render(_ctx, _cache, $props, $se "inline-help": _ctx.$sanitize(_ctx.getDeliveryMediumInlineTooltip), options: _ctx.alertReportMediumOptions, "model-value": _ctx.actualAlert.report_mediums, - "onUpdate:modelValue": _cache[3] || (_cache[3] = $event => { + "onUpdate:modelValue": _cache[4] || (_cache[4] = $event => { _ctx.actualAlert.report_mediums = $event; }) - }, null, 8, ["title", "inline-help", "options", "model-value"])]), _ctx.actualAlert.report_mediums && _ctx.actualAlert.report_mediums.includes('email') ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", EditAlertvue_type_template_id_7fe6cbad_hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + }, null, 8, ["title", "inline-help", "options", "model-value"])]), _ctx.actualAlert.report_mediums && _ctx.actualAlert.report_mediums.includes('email') ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", EditAlertvue_type_template_id_39490cfc_hoisted_3, [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: "report_email_me", modelValue: _ctx.actualAlert.email_me, - "onUpdate:modelValue": _cache[4] || (_cache[4] = $event => _ctx.actualAlert.email_me = $event), + "onUpdate:modelValue": _cache[5] || (_cache[5] = $event => _ctx.actualAlert.email_me = $event), introduction: _ctx.translate('ScheduledReports_SendReportTo'), title: `${_ctx.translate('ScheduledReports_SentToMe')} (${_ctx.currentUserEmail})` }, null, 8, ["modelValue", "introduction", "title"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { uicontrol: "textarea", modelValue: _ctx.actualAlert.additional_emails, - "onUpdate:modelValue": _cache[5] || (_cache[5] = $event => _ctx.actualAlert.additional_emails = $event), + "onUpdate:modelValue": _cache[6] || (_cache[6] = $event => _ctx.actualAlert.additional_emails = $event), "var-type": "array", title: _ctx.translate('ScheduledReports_AlsoSendReportToTheseEmails') - }, null, 8, ["modelValue", "title"])])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.actualAlert.report_mediums && _ctx.actualAlert.report_mediums.includes('mobile') ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", EditAlertvue_type_template_id_7fe6cbad_hoisted_4, [_ctx.supportsSMS ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", EditAlertvue_type_template_id_7fe6cbad_hoisted_5, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SelectPhoneNumbers, { + }, null, 8, ["modelValue", "title"])])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.actualAlert.report_mediums && _ctx.actualAlert.report_mediums.includes('mobile') ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", EditAlertvue_type_template_id_39490cfc_hoisted_4, [_ctx.supportsSMS ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", EditAlertvue_type_template_id_39490cfc_hoisted_5, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SelectPhoneNumbers, { "phone-numbers": _ctx.phoneNumbers || [], modelValue: _ctx.actualAlert.phone_numbers, - "onUpdate:modelValue": _cache[6] || (_cache[6] = $event => _ctx.actualAlert.phone_numbers = $event) - }, null, 8, ["phone-numbers", "modelValue"])])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", EditAlertvue_type_template_id_7fe6cbad_hoisted_6, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_7fe6cbad_hoisted_7, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Alert, { + "onUpdate:modelValue": _cache[7] || (_cache[7] = $event => _ctx.actualAlert.phone_numbers = $event) + }, null, 8, ["phone-numbers", "modelValue"])])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", EditAlertvue_type_template_id_39490cfc_hoisted_6, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_39490cfc_hoisted_7, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Alert, { severity: "info" }, { default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("strong", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('MobileMessaging_PhoneNumbers')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(": "), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { innerHTML: _ctx.$sanitize(_ctx.mobileMessagingNotActivated) - }, null, 8, EditAlertvue_type_template_id_7fe6cbad_hoisted_8)]), + }, null, 8, EditAlertvue_type_template_id_39490cfc_hoisted_8)]), _: 1 - })])]))])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.actualAlert.report_mediums && _ctx.actualAlert.report_mediums.includes('slack') ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", EditAlertvue_type_template_id_7fe6cbad_hoisted_9, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SelectSlackChannel, { + })])]))])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.actualAlert.report_mediums && _ctx.actualAlert.report_mediums.includes('slack') ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", EditAlertvue_type_template_id_39490cfc_hoisted_9, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SelectSlackChannel, { "model-value": _ctx.actualAlert.slack_channel_id || '', "is-slack-oauth-token-added": _ctx.isSlackOauthTokenAdded, modelValue: _ctx.actualAlert.slack_channel_id, - "onUpdate:modelValue": _cache[7] || (_cache[7] = $event => _ctx.actualAlert.slack_channel_id = $event) - }, null, 8, ["model-value", "is-slack-oauth-token-added", "modelValue"])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.actualAlert.report_mediums && _ctx.actualAlert.report_mediums.includes('teams') ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", EditAlertvue_type_template_id_7fe6cbad_hoisted_10, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SelectMicrosoftTeamsWebhookUrl, { + "onUpdate:modelValue": _cache[8] || (_cache[8] = $event => _ctx.actualAlert.slack_channel_id = $event) + }, null, 8, ["model-value", "is-slack-oauth-token-added", "modelValue"])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.actualAlert.report_mediums && _ctx.actualAlert.report_mediums.includes('teams') ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", EditAlertvue_type_template_id_39490cfc_hoisted_10, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SelectMicrosoftTeamsWebhookUrl, { "is-required-fields-set": true, "model-value": _ctx.actualAlert.ms_teams_webhook_url || '', modelValue: _ctx.actualAlert.ms_teams_webhook_url, - "onUpdate:modelValue": _cache[8] || (_cache[8] = $event => _ctx.actualAlert.ms_teams_webhook_url = $event) + "onUpdate:modelValue": _cache[9] || (_cache[9] = $event => _ctx.actualAlert.ms_teams_webhook_url = $event) }, null, 8, ["model-value", "modelValue"])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { uicontrol: "expandable-select", name: "report", "model-value": _ctx.actualAlert.report, - "onUpdate:modelValue": _cache[9] || (_cache[9] = $event => { + "onUpdate:modelValue": _cache[10] || (_cache[10] = $event => { _ctx.actualAlert.report = $event; _ctx.changeReport(); }), @@ -443,22 +458,22 @@ function EditAlertvue_type_template_id_7fe6cbad_render(_ctx, _cache, $props, $se title: `${_ctx.translate('CustomAlerts_ThisAppliesTo')}: ${(_ctx$actualReportMeta = _ctx.actualReportMetadata) === null || _ctx$actualReportMeta === void 0 ? void 0 : _ctx$actualReportMeta.name}`, introduction: _ctx.translate('CustomAlerts_AlertCondition'), "inline-help": _ctx.thisAppliesToInlineHelp - }, null, 8, ["model-value", "options", "title", "introduction", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_7fe6cbad_hoisted_11, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_7fe6cbad_hoisted_12, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ActivityIndicator, { + }, null, 8, ["model-value", "options", "title", "introduction", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_39490cfc_hoisted_11, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_39490cfc_hoisted_12, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ActivityIndicator, { loading: _ctx.isLoadingReport - }, null, 8, ["loading"])])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isLoadingReport]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_7fe6cbad_hoisted_13, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_7fe6cbad_hoisted_14, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + }, null, 8, ["loading"])])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isLoadingReport]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_39490cfc_hoisted_13, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_39490cfc_hoisted_14, [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: "reportCondition", modelValue: _ctx.actualAlert.report_condition, - "onUpdate:modelValue": _cache[10] || (_cache[10] = $event => _ctx.actualAlert.report_condition = $event), + "onUpdate:modelValue": _cache[11] || (_cache[11] = $event => _ctx.actualAlert.report_condition = $event), "full-width": true, title: _ctx.reportConditionTitle, options: _ctx.alertGroupConditions - }, null, 8, ["modelValue", "title", "options"])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_7fe6cbad_hoisted_15, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_7fe6cbad_hoisted_16, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + }, null, 8, ["modelValue", "title", "options"])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_39490cfc_hoisted_15, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_39490cfc_hoisted_16, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { uicontrol: "text", role: "textbox", name: "reportValue", modelValue: _ctx.actualAlert.report_matched, - "onUpdate:modelValue": _cache[11] || (_cache[11] = $event => _ctx.actualAlert.report_matched = $event), + "onUpdate:modelValue": _cache[12] || (_cache[12] = $event => _ctx.actualAlert.report_matched = $event), "full-width": true, autocomplete: 'off', maxlength: 255, @@ -467,24 +482,24 @@ function EditAlertvue_type_template_id_7fe6cbad_render(_ctx, _cache, $props, $se uicontrol: "select", name: "metric", "model-value": _ctx.actualAlert.metric, - "onUpdate:modelValue": _cache[12] || (_cache[12] = $event => _ctx.actualAlert.metric = $event), + "onUpdate:modelValue": _cache[13] || (_cache[13] = $event => _ctx.actualAlert.metric = $event), options: _ctx.metricOptions, introduction: _ctx.translate('CustomAlerts_AlertMeWhen') - }, null, 8, ["model-value", "options", "introduction"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_7fe6cbad_hoisted_17, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_7fe6cbad_hoisted_18, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + }, null, 8, ["model-value", "options", "introduction"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_39490cfc_hoisted_17, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_39490cfc_hoisted_18, [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: "metricCondition", "model-value": _ctx.actualAlert.metric_condition, - "onUpdate:modelValue": _cache[13] || (_cache[13] = $event => _ctx.actualAlert.metric_condition = $event), + "onUpdate:modelValue": _cache[14] || (_cache[14] = $event => _ctx.actualAlert.metric_condition = $event), "full-width": true, options: _ctx.metricConditionOptions - }, null, 8, ["model-value", "options"])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_7fe6cbad_hoisted_19, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + }, null, 8, ["model-value", "options"])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", EditAlertvue_type_template_id_39490cfc_hoisted_19, [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: "metricValue", class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])({ invalid: _ctx.isMetricValueInvalid }), modelValue: _ctx.actualAlert.metric_matched, - "onUpdate:modelValue": _cache[14] || (_cache[14] = $event => _ctx.actualAlert.metric_matched = $event), + "onUpdate:modelValue": _cache[15] || (_cache[15] = $event => _ctx.actualAlert.metric_matched = $event), title: `${_ctx.metricDescription}`, "full-width": true }, null, 8, ["class", "modelValue", "title"])])])]), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.comparablesDates, (comparablesDatesPeriod, period) => { @@ -501,11 +516,11 @@ function EditAlertvue_type_template_id_7fe6cbad_render(_ctx, _cache, $props, $se }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "options", "introduction"]), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], period === _ctx.actualAlert.period && _ctx.isComparable]])]); }), 128)), (_ctx$actualAlert = _ctx.actualAlert) !== null && _ctx$actualAlert !== void 0 && _ctx$actualAlert.idalert ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(_component_SaveButton, { key: 4, - onClick: _cache[15] || (_cache[15] = $event => _ctx.updateAlert(_ctx.actualAlert.idalert)), + onClick: _cache[16] || (_cache[16] = $event => _ctx.updateAlert(_ctx.actualAlert.idalert)), saving: _ctx.isLoading }, null, 8, ["saving"])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(_component_SaveButton, { key: 5, - onClick: _cache[16] || (_cache[16] = $event => _ctx.createAlert()), + onClick: _cache[17] || (_cache[17] = $event => _ctx.createAlert()), saving: _ctx.isLoading }, null, 8, ["saving"])), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { class: "entityCancel", @@ -515,7 +530,7 @@ function EditAlertvue_type_template_id_7fe6cbad_render(_ctx, _cache, $props, $se _: 1 }, 8, ["content-title"]); } -// CONCATENATED MODULE: ./plugins/CustomAlerts/vue/src/EditAlert/EditAlert.vue?vue&type=template&id=7fe6cbad +// CONCATENATED MODULE: ./plugins/CustomAlerts/vue/src/EditAlert/EditAlert.vue?vue&type=template&id=39490cfc // EXTERNAL MODULE: external "CorePluginsAdmin" var external_CorePluginsAdmin_ = __webpack_require__("a5a2"); @@ -606,6 +621,7 @@ const { actualReportMetadata: reportMetadata, reportValuesAutoComplete: null, actualAlert: alert ? Object.assign({}, alert) : { + description: '', period: 'day', id_sites: [(currentSite === null || currentSite === void 0 ? void 0 : currentSite.id) || external_CoreHome_["Matomo"].idSite], report_mediums: [] @@ -783,6 +799,7 @@ const { idAlert: this.actualAlert.idalert, format: 'json', name: this.actualAlert.name, + description: this.actualAlert.description, metric: this.actualAlert.metric, metricCondition: this.actualAlert.metric_condition, metricValue: this.actualAlert.metric_matched, @@ -869,7 +886,7 @@ const { -EditAlertvue_type_script_lang_ts.render = EditAlertvue_type_template_id_7fe6cbad_render +EditAlertvue_type_script_lang_ts.render = EditAlertvue_type_template_id_39490cfc_render /* harmony default export */ var EditAlert = (EditAlertvue_type_script_lang_ts); // CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-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--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/CustomAlerts/vue/src/HistoryTriggeredAlerts/HistoryTriggeredAlerts.vue?vue&type=template&id=50fdd954 diff --git a/vue/dist/CustomAlerts.umd.min.js b/vue/dist/CustomAlerts.umd.min.js index ddbc681a..3c27fb5b 100644 --- a/vue/dist/CustomAlerts.umd.min.js +++ b/vue/dist/CustomAlerts.umd.min.js @@ -1,4 +1,4 @@ -(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["CustomAlerts"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):e["CustomAlerts"]=t(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,t,l){return function(e){var t={};function l(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,l),o.l=!0,o.exports}return l.m=e,l.c=t,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},l.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)l.d(r,o,function(t){return e[t]}.bind(null,o));return r},l.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="plugins/CustomAlerts/vue/dist/",l(l.s="fae3")}({"19dc":function(t,l){t.exports=e},"8bbf":function(e,l){e.exports=t},a5a2:function(e,t){e.exports=l},fae3:function(e,t,l){"use strict";if(l.r(t),l.d(t,"ListAlerts",(function(){return E})),l.d(t,"EditAlert",(function(){return re})),l.d(t,"HistoryTriggeredAlerts",(function(){return se})),l.d(t,"ListAlertsPage",(function(){return Oe})),"undefined"!==typeof window){var r=window.document.currentScript,o=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);o&&(l.p=o[1])}var a=l("8bbf");const n={key:0},i={colspan:"6"},c=Object(a["createElementVNode"])("br",null,null,-1),s=Object(a["createElementVNode"])("br",null,null,-1),d=Object(a["createElementVNode"])("br",null,null,-1),u={class:"name"},m={class:"site"},p={class:"period"},b={class:"reportName"},O={class:"edit"},j=["href","title"],h=["onClick","id","title"],A=Object(a["createElementVNode"])("span",{class:"icon-delete"},null,-1),v=[A],V={class:"tableActionBar"},_=["href"],f=Object(a["createElementVNode"])("span",{class:"icon-add"},null,-1),g=["href"],C=Object(a["createElementVNode"])("span",{class:"icon-table"},null,-1);function N(e,t,l,r,o,A){var N;const k=Object(a["resolveDirective"])("content-table");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",null,[Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("table",null,[Object(a["createElementVNode"])("thead",null,[Object(a["createElementVNode"])("tr",null,[Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("General_Name")),1),Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("General_Website")),1),Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("General_Period")),1),Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("General_Report")),1),Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("General_Actions")),1)])]),Object(a["createElementVNode"])("tbody",null,[null!==(N=e.alerts)&&void 0!==N&&N.length?Object(a["createCommentVNode"])("",!0):(Object(a["openBlock"])(),Object(a["createElementBlock"])("tr",n,[Object(a["createElementVNode"])("td",i,[c,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("CustomAlerts_NoAlertsDefined"))+" ",1),s,d])])),(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.alerts,t=>(Object(a["openBlock"])(),Object(a["createElementBlock"])("tr",{key:t.idalert},[Object(a["createElementVNode"])("td",u,Object(a["toDisplayString"])(t.name),1),Object(a["createElementVNode"])("td",m,Object(a["toDisplayString"])(e.decode(t.siteName)),1),Object(a["createElementVNode"])("td",p,Object(a["toDisplayString"])(e.ucfirst(e.translate("Intl_Period"+e.ucfirst(t.period)))),1),Object(a["createElementVNode"])("td",b,Object(a["toDisplayString"])(t.reportName||"-"),1),Object(a["createElementVNode"])("td",O,[Object(a["createElementVNode"])("a",{class:"table-action icon-edit",href:e.linkTo({module:"CustomAlerts",action:"editAlert",idAlert:t.idalert}),title:e.translate("General_Edit")},null,8,j),Object(a["createElementVNode"])("button",{class:"deleteAlert table-action",onClick:l=>e.deleteAlert(t.idalert),id:t.idalert,title:e.translate("General_Delete")},v,8,h)])]))),128))])])),[[k]]),Object(a["createElementVNode"])("div",V,[Object(a["createElementVNode"])("a",{href:e.linkTo({module:"CustomAlerts",action:"addNewAlert"})},[f,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("CustomAlerts_CreateNewAlert")),1)],8,_),Object(a["createElementVNode"])("a",{href:e.linkTo({module:"CustomAlerts",action:"historyTriggeredAlerts"})},[C,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("CustomAlerts_AlertsHistory")),1)],8,g)])])}var k=l("19dc"),y=Object(a["defineComponent"])({props:{alerts:{type:Array,default(){return[]}}},directives:{ContentTable:k["ContentTable"]},methods:{deleteAlert(e){k["Matomo"].helper.modalConfirm("#confirm",{yes:()=>{k["AjaxHelper"].fetch({method:"CustomAlerts.deleteAlert",idAlert:e}).then(()=>{k["Matomo"].helper.redirect()})}})},ucfirst(e){return`${e[0].toUpperCase()}${e.substr(1)}`},linkTo(e){return"?"+k["MatomoUrl"].stringify(Object.assign(Object.assign({},k["MatomoUrl"].urlParsed.value),e))},decode(e){return k["Matomo"].helper.htmlDecode(e)}}});y.render=N;var E=y;const S={id:"customAlertPeriodHelp",class:"inline-help-node"},M={class:"report-mediums"},T={key:0},B={key:1},x={key:0},D={key:1,class:"row"},w={class:"col s12"},R=["innerHTML"],P={key:2},U={key:3},L={class:"row"},q={class:"col s12"},$={class:"row conditionAndValue"},I={class:"col s12 m6"},H={class:"col s12 m6"},G={class:"ui-autocomplete-input",ref:"reportValue"},F={class:"row conditionAndValue"},W={class:"col s12 m6"},z={class:"col s12 m6"},Y=["innerHTML"];function J(e,t,l,r,o,n){const i=Object(a["resolveComponent"])("Field"),c=Object(a["resolveComponent"])("SelectPhoneNumbers"),s=Object(a["resolveComponent"])("Alert"),d=Object(a["resolveComponent"])("SelectSlackChannel"),u=Object(a["resolveComponent"])("SelectMicrosoftTeamsWebhookUrl"),m=Object(a["resolveComponent"])("ActivityIndicator"),p=Object(a["resolveComponent"])("SaveButton"),b=Object(a["resolveComponent"])("ContentBlock"),O=Object(a["resolveDirective"])("form");return Object(a["openBlock"])(),Object(a["createBlock"])(b,{class:"alerts","content-title":e.headline},{default:Object(a["withCtx"])(()=>{var l,r,o;return[Object(a["createElementVNode"])("p",null,Object(a["toDisplayString"])(e.translate("CustomAlerts_CreateTooltip")),1),Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("div",null,[Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"text",name:"alertName",modelValue:e.actualAlert.name,"onUpdate:modelValue":t[0]||(t[0]=t=>e.actualAlert.name=t),maxlength:100,title:e.translate("CustomAlerts_AlertName")},null,8,["modelValue","title"])]),Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"site",name:"idSite","model-value":{id:null===(l=e.actualAlert.id_sites)||void 0===l?void 0:l[0],name:e.actualCurrentSite.name},"onUpdate:modelValue":t[1]||(t[1]=t=>{e.actualAlert.id_sites=[t.id],e.actualCurrentSite=t,e.changeReport()}),title:e.translate("General_Website"),introduction:e.translate("CustomAlerts_ApplyTo")},null,8,["model-value","title","introduction"])]),Object(a["createElementVNode"])("div",S,[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.translate("CustomAlerts_YouCanChoosePeriodFrom"))+": ",1),Object(a["createElementVNode"])("ul",null,[Object(a["createElementVNode"])("li",null,"• "+Object(a["toDisplayString"])(e.translate("CustomAlerts_PeriodDayDescription")),1),Object(a["createElementVNode"])("li",null,"• "+Object(a["toDisplayString"])(e.translate("CustomAlerts_PeriodWeekDescription")),1),Object(a["createElementVNode"])("li",null,"• "+Object(a["toDisplayString"])(e.translate("CustomAlerts_PeriodMonthDescription")),1)])]),Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"select",name:"period","inline-help":"#customAlertPeriodHelp","model-value":e.actualAlert.period,"onUpdate:modelValue":t[2]||(t[2]=t=>{e.actualAlert.period=t,e.changeReport()}),title:e.translate("General_Period"),options:e.periodOptions},null,8,["model-value","title","options"])]),Object(a["createElementVNode"])("div",M,[Object(a["createVNode"])(i,{uicontrol:"multiselect",name:"report_mediums",id:"report_mediums",title:e.translate("CustomAlerts_MediumTitle"),"inline-help":e.$sanitize(e.getDeliveryMediumInlineTooltip),options:e.alertReportMediumOptions,"model-value":e.actualAlert.report_mediums,"onUpdate:modelValue":t[3]||(t[3]=t=>{e.actualAlert.report_mediums=t})},null,8,["title","inline-help","options","model-value"])]),e.actualAlert.report_mediums&&e.actualAlert.report_mediums.includes("email")?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",T,[Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"checkbox",name:"report_email_me",modelValue:e.actualAlert.email_me,"onUpdate:modelValue":t[4]||(t[4]=t=>e.actualAlert.email_me=t),introduction:e.translate("ScheduledReports_SendReportTo"),title:`${e.translate("ScheduledReports_SentToMe")} (${e.currentUserEmail})`},null,8,["modelValue","introduction","title"])]),Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"textarea",modelValue:e.actualAlert.additional_emails,"onUpdate:modelValue":t[5]||(t[5]=t=>e.actualAlert.additional_emails=t),"var-type":"array",title:e.translate("ScheduledReports_AlsoSendReportToTheseEmails")},null,8,["modelValue","title"])])])):Object(a["createCommentVNode"])("",!0),e.actualAlert.report_mediums&&e.actualAlert.report_mediums.includes("mobile")?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",B,[e.supportsSMS?(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",x,[Object(a["createVNode"])(c,{"phone-numbers":e.phoneNumbers||[],modelValue:e.actualAlert.phone_numbers,"onUpdate:modelValue":t[6]||(t[6]=t=>e.actualAlert.phone_numbers=t)},null,8,["phone-numbers","modelValue"])])):(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",D,[Object(a["createElementVNode"])("div",w,[Object(a["createVNode"])(s,{severity:"info"},{default:Object(a["withCtx"])(()=>[Object(a["createElementVNode"])("strong",null,Object(a["toDisplayString"])(e.translate("MobileMessaging_PhoneNumbers")),1),Object(a["createTextVNode"])(": "),Object(a["createElementVNode"])("span",{innerHTML:e.$sanitize(e.mobileMessagingNotActivated)},null,8,R)]),_:1})])]))])):Object(a["createCommentVNode"])("",!0),e.actualAlert.report_mediums&&e.actualAlert.report_mediums.includes("slack")?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",P,[Object(a["createVNode"])(d,{"model-value":e.actualAlert.slack_channel_id||"","is-slack-oauth-token-added":e.isSlackOauthTokenAdded,modelValue:e.actualAlert.slack_channel_id,"onUpdate:modelValue":t[7]||(t[7]=t=>e.actualAlert.slack_channel_id=t)},null,8,["model-value","is-slack-oauth-token-added","modelValue"])])):Object(a["createCommentVNode"])("",!0),e.actualAlert.report_mediums&&e.actualAlert.report_mediums.includes("teams")?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",U,[Object(a["createVNode"])(u,{"is-required-fields-set":!0,"model-value":e.actualAlert.ms_teams_webhook_url||"",modelValue:e.actualAlert.ms_teams_webhook_url,"onUpdate:modelValue":t[8]||(t[8]=t=>e.actualAlert.ms_teams_webhook_url=t)},null,8,["model-value","modelValue"])])):Object(a["createCommentVNode"])("",!0),Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"expandable-select",name:"report","model-value":e.actualAlert.report,"onUpdate:modelValue":t[9]||(t[9]=t=>{e.actualAlert.report=t,e.changeReport()}),options:e.reportOptions,title:`${e.translate("CustomAlerts_ThisAppliesTo")}: ${null===(r=e.actualReportMetadata)||void 0===r?void 0:r.name}`,introduction:e.translate("CustomAlerts_AlertCondition"),"inline-help":e.thisAppliesToInlineHelp},null,8,["model-value","options","title","introduction","inline-help"])]),Object(a["withDirectives"])(Object(a["createElementVNode"])("div",L,[Object(a["createElementVNode"])("div",q,[Object(a["createVNode"])(m,{loading:e.isLoadingReport},null,8,["loading"])])],512),[[a["vShow"],e.isLoadingReport]]),Object(a["withDirectives"])(Object(a["createElementVNode"])("div",$,[Object(a["createElementVNode"])("div",I,[Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"select",name:"reportCondition",modelValue:e.actualAlert.report_condition,"onUpdate:modelValue":t[10]||(t[10]=t=>e.actualAlert.report_condition=t),"full-width":!0,title:e.reportConditionTitle,options:e.alertGroupConditions},null,8,["modelValue","title","options"])])]),Object(a["createElementVNode"])("div",H,[Object(a["createElementVNode"])("div",G,[Object(a["withDirectives"])(Object(a["createVNode"])(i,{uicontrol:"text",role:"textbox",name:"reportValue",modelValue:e.actualAlert.report_matched,"onUpdate:modelValue":t[11]||(t[11]=t=>e.actualAlert.report_matched=t),"full-width":!0,autocomplete:"off",maxlength:255,title:e.translate("General_Value")},null,8,["modelValue","title"]),[[a["vShow"],"matches_any"!==e.actualAlert.report_condition]])],512)])],512),[[a["vShow"],e.hasReportDimension]]),Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"select",name:"metric","model-value":e.actualAlert.metric,"onUpdate:modelValue":t[12]||(t[12]=t=>e.actualAlert.metric=t),options:e.metricOptions,introduction:e.translate("CustomAlerts_AlertMeWhen")},null,8,["model-value","options","introduction"])]),Object(a["createElementVNode"])("div",F,[Object(a["createElementVNode"])("div",W,[Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"select",name:"metricCondition","model-value":e.actualAlert.metric_condition,"onUpdate:modelValue":t[13]||(t[13]=t=>e.actualAlert.metric_condition=t),"full-width":!0,options:e.metricConditionOptions},null,8,["model-value","options"])])]),Object(a["createElementVNode"])("div",z,[Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"text",name:"metricValue",class:Object(a["normalizeClass"])({invalid:e.isMetricValueInvalid}),modelValue:e.actualAlert.metric_matched,"onUpdate:modelValue":t[14]||(t[14]=t=>e.actualAlert.metric_matched=t),title:`${e.metricDescription}`,"full-width":!0},null,8,["class","modelValue","title"])])])]),(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.comparablesDates,(t,l)=>(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{key:l},[Object(a["withDirectives"])(Object(a["createVNode"])(i,{uicontrol:"select",name:"compared_to",modelValue:e.comparedTo[l],"onUpdate:modelValue":t=>e.comparedTo[l]=t,disabled:Object.keys(t).length<=1,options:t,introduction:e.translate("CustomAlerts_ComparedToThe")},null,8,["modelValue","onUpdate:modelValue","disabled","options","introduction"]),[[a["vShow"],l===e.actualAlert.period&&e.isComparable]])]))),128)),null!==(o=e.actualAlert)&&void 0!==o&&o.idalert?(Object(a["openBlock"])(),Object(a["createBlock"])(p,{key:4,onClick:t[15]||(t[15]=t=>e.updateAlert(e.actualAlert.idalert)),saving:e.isLoading},null,8,["saving"])):(Object(a["openBlock"])(),Object(a["createBlock"])(p,{key:5,onClick:t[16]||(t[16]=t=>e.createAlert()),saving:e.isLoading},null,8,["saving"])),Object(a["createElementVNode"])("div",{class:"entityCancel",innerHTML:e.$sanitize(e.cancelLink)},null,8,Y)])),[[O]])]}),_:1},8,["content-title"])}var K=l("a5a2");const Q=Object(k["useExternalPluginComponent"])("MobileMessaging","SelectPhoneNumbers"),X=Object(k["useExternalPluginComponent"])("Slack","SelectSlackChannel"),Z=Object(k["useExternalPluginComponent"])("MicrosoftTeams","SelectMicrosoftTeamsWebhookUrl");function ee(e){return"MultiSites_getOne"===e||"MultiSites_getAll"===e}const{$:te}=window;var le=Object(a["defineComponent"])({props:{alert:Object,headline:{type:String,required:!0},currentSite:{type:Object,required:!0},periodOptions:{type:Array,required:!0},alertReportMediumOptions:{type:Array,required:!0},currentUserEmail:{type:String,required:!0},supportsSMS:Boolean,phoneNumbers:[Array,Object],isSlackOauthTokenAdded:Boolean,reportMetadata:Object,alertGroupConditions:{type:Array,required:!0},metricConditionOptions:{type:Array,required:!0},comparablesDates:{type:Object,required:!0}},components:{Field:K["Field"],Alert:k["Alert"],ActivityIndicator:k["ActivityIndicator"],SaveButton:K["SaveButton"],SelectPhoneNumbers:Q,SelectSlackChannel:X,SelectMicrosoftTeamsWebhookUrl:Z,ContentBlock:k["ContentBlock"]},directives:{Form:K["Form"]},data(){const e=this.currentSite,t=this.alert,l=this.reportMetadata,r=Object.fromEntries(Object.entries(this.comparablesDates).map(([e,t])=>{var l;return[e,null===t||void 0===t||null===(l=t[0])||void 0===l?void 0:l.key]}));return this.alert&&(r[this.alert.period]=""+t.compared_to),{isLoading:!1,isLoadingReport:!1,showReportConditionField:!1,reportOptions:[],actualReportMetadata:l,reportValuesAutoComplete:null,actualAlert:t?Object.assign({},t):{period:"day",id_sites:[(null===e||void 0===e?void 0:e.id)||k["Matomo"].idSite],report_mediums:[]},comparedTo:r,actualCurrentSite:{id:e.id,name:k["Matomo"].helper.htmlDecode(e.name)}}},watch:{actualReportMetadata(){var e;const t=null===(e=this.actualReportMetadata)||void 0===e?void 0:e.metrics;t&&(this.actualAlert.metric&&t[this.actualAlert.metric]||([this.actualAlert.metric]=Object.keys(t)))},isMetricValueInvalid(e){if(!e)return;const t=k["NotificationsStore"].show({message:Object(k["translate"])("CustomAlerts_InvalidMetricValue"),id:"CustomAlertsMetricValueError",context:"error",type:"toast"});k["NotificationsStore"].scrollToNotification(t)}},created(){this.changeReport(),setTimeout(()=>{te(this.$refs.reportValue).find("input").autocomplete({source:this.getValuesForReportAndMetric.bind(this),minLength:1,delay:300})},1e3)},methods:{renderForm(e){const t=[];this.actualReportMetadata=null,e.forEach(e=>{const l=e.uniqueId;ee(l)||(this.actualAlert.report||(this.actualAlert.report=l),t.push({key:l,value:e.name,group:e.category}),l===this.actualAlert.report&&(this.actualReportMetadata=e))}),this.reportOptions=t},sendApiRequest(e,t){this.isLoading=!0;const{period:l}=this.actualAlert;k["AjaxHelper"].post({period:l,method:e},t).then(()=>{k["Matomo"].helper.redirect({module:"CustomAlerts",action:"index"})}).finally(()=>{this.isLoading=!1})},getValuesForReportAndMetric(e,t){var l;const{metric:r}=this.actualAlert;function o(l){const o=new RegExp(te.ui.autocomplete.escapeRegex(e.term),"i");t(te.grep(l,e=>!!e&&o.test(e.label||e.value||e[r]||e)))}if(this.reportValuesAutoComplete)return void o(this.reportValuesAutoComplete);this.reportValuesAutoComplete=[];const a=this.actualReportMetadata;if(!a)return;const n=a.module,i=a.action;r&&n&&i||o(this.reportValuesAutoComplete),k["AjaxHelper"].fetch({method:"API.getProcessedReport",date:"yesterday",period:"month",disable_queued_filters:1,flat:1,filter_limit:-1,showColumns:r,language:"en",apiModule:n,apiAction:i,idSite:null===(l=this.actualAlert.id_sites)||void 0===l?void 0:l[0],format:"JSON"}).then(e=>{null!==e&&void 0!==e&&e.reportData?(this.reportValuesAutoComplete=e.reportData,o(e.reportData)):o([])}).catch(()=>{o([])})},changeReport(){var e;this.isLoadingReport=!0,this.reportValuesAutoComplete=null,k["AjaxHelper"].fetch({method:"API.getReportMetadata",date:k["Matomo"].currentDateString,period:this.actualAlert.period,idSite:null===(e=this.actualAlert.id_sites)||void 0===e?void 0:e[0],filter_limit:"-1"}).then(e=>{this.renderForm(e)}).finally(()=>{this.isLoadingReport=!1})},createAlert(){return!this.isMetricValueInvalid&&(this.sendApiRequest("CustomAlerts.addAlert",this.apiParameters),!0)},updateAlert(){return!this.isMetricValueInvalid&&(this.sendApiRequest("CustomAlerts.editAlert",this.apiParameters),!0)}},computed:{apiParameters(){var e,t,l,r;return{idAlert:this.actualAlert.idalert,format:"json",name:this.actualAlert.name,metric:this.actualAlert.metric,metricCondition:this.actualAlert.metric_condition,metricValue:this.actualAlert.metric_matched,emailMe:this.actualAlert.email_me?1:0,additionalEmails:null!==(e=this.actualAlert.additional_emails)&&void 0!==e&&e.length?this.actualAlert.additional_emails:[""],phoneNumbers:null!==(t=this.actualAlert.phone_numbers)&&void 0!==t&&t.length?this.actualAlert.phone_numbers:[""],slackChannelID:null!==(l=this.actualAlert)&&void 0!==l&&l.slack_channel_id?this.actualAlert.slack_channel_id:"",msTeamsWebhookUrl:null!==(r=this.actualAlert)&&void 0!==r&&r.ms_teams_webhook_url?this.actualAlert.ms_teams_webhook_url:"",reportUniqueId:this.actualAlert.report,reportCondition:this.actualAlert.report_condition,reportValue:this.actualAlert.report_matched,reportMediums:this.actualAlert.report_mediums,idSites:this.actualAlert.id_sites,comparedTo:this.comparedTo[this.actualAlert.period]}},isMetricValueInvalid(){return!te.isNumeric(this.actualAlert.metric_matched)},mobileMessagingNotActivated(){const e="?"+k["MatomoUrl"].stringify(Object.assign(Object.assign({},k["MatomoUrl"].urlParsed.value),{},{module:"CorePluginsAdmin",action:"plugins",updated:null}));return Object(k["translate"])("CustomAlerts_MobileMessagingPluginNotActivated",``,"")},cancelLink(){const e="?"+k["MatomoUrl"].stringify(Object.assign(Object.assign({},k["MatomoUrl"].urlParsed.value),{},{module:"CustomAlerts",action:"index"}));return Object(k["translate"])("General_OrCancel",``,"")},thisAppliesToInlineHelp(){const e="https://matomo.org/guide/manage-matomo/custom-alerts/",t="https://matomo.org/faq/general/examples-of-custom-alerts#events";return Object(k["translate"])("CustomAlerts_ThisAppliesToHelp",``,"","","",``,"")},getDeliveryMediumInlineTooltip(){return`${Object(k["translate"])("CustomAlerts_CreateTooltip")} ${Object(k["externalLink"])("https://matomo.org/faq/general/create-and-manage-custom-alerts/")} ${Object(k["translate"])("CustomAlerts_LearnMore")}.`},metricOptions(){var e;return Object.entries((null===(e=this.actualReportMetadata)||void 0===e?void 0:e.metrics)||{}).map(([e,t])=>({key:e,value:t}))},hasReportDimension(){var e;return!(null===(e=this.actualReportMetadata)||void 0===e||!e.dimension)},reportConditionTitle(){var e;const t=null===(e=this.actualReportMetadata)||void 0===e?void 0:e.dimension;return`${Object(k["translate"])("CustomAlerts_When")} ${t}`},isComparable(){const e=this.actualAlert.metric_condition;return!!e&&-1!==e.indexOf("_more_than")},metricDescription(){const e=this.actualAlert.metric_condition,{metric:t}=this.actualAlert,l=e&&0===e.indexOf("percentage_"),r=t&&-1!==t.indexOf("_rate"),o=t&&-1!==t.indexOf("_time_");return l||r?"%":o?"s":Object(k["translate"])("General_Value")}}});le.render=J;var re=le;const oe={class:"tableActionBar"},ae=["href"],ne=Object(a["createElementVNode"])("span",{class:"icon-table"},null,-1);function ie(e,t,l,r,o,n){const i=Object(a["resolveComponent"])("ContentBlock");return Object(a["openBlock"])(),Object(a["createBlock"])(i,{class:"alerts","content-title":e.translate("CustomAlerts_AlertsHistory")},{default:Object(a["withCtx"])(()=>[Object(a["renderSlot"])(e.$slots,"default"),Object(a["createElementVNode"])("div",oe,[Object(a["createElementVNode"])("a",{href:e.customAlertsIndexLink},[ne,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("CustomAlerts_ManageAlerts")),1)],8,ae)])]),_:3},8,["content-title"])}var ce=Object(a["defineComponent"])({props:{},components:{ContentBlock:k["ContentBlock"]},computed:{customAlertsIndexLink(){return"?"+k["MatomoUrl"].stringify(Object.assign(Object.assign({},k["MatomoUrl"].urlParsed.value),{},{module:"CustomAlerts",action:"index"}))}}});ce.render=ie;var se=ce;const de={class:"ui-confirm",id:"confirm"},ue=["value"],me=["value"];function pe(e,t,l,r,o,n){const i=Object(a["resolveComponent"])("ListAlerts"),c=Object(a["resolveComponent"])("ContentBlock");return Object(a["openBlock"])(),Object(a["createBlock"])(c,{class:"alerts","content-title":e.title},{default:Object(a["withCtx"])(()=>[Object(a["createElementVNode"])("p",null,Object(a["toDisplayString"])(e.translate("CustomAlerts_ManageTooltip")),1),Object(a["createVNode"])(i,{alerts:e.alerts},null,8,["alerts"]),Object(a["createElementVNode"])("div",de,[Object(a["createElementVNode"])("h2",null,Object(a["toDisplayString"])(e.translate("CustomAlerts_AreYouSureDeleteAlert")),1),Object(a["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,ue),Object(a["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,me)])]),_:1},8,["content-title"])}var be=Object(a["defineComponent"])({props:{title:{type:String,required:!0},alerts:{type:Array,default(){return[]}}},components:{ContentBlock:k["ContentBlock"],ListAlerts:E}});be.render=pe;var Oe=be; +(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["CustomAlerts"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):e["CustomAlerts"]=t(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,t,l){return function(e){var t={};function l(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,l),o.l=!0,o.exports}return l.m=e,l.c=t,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},l.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)l.d(r,o,function(t){return e[t]}.bind(null,o));return r},l.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="plugins/CustomAlerts/vue/dist/",l(l.s="fae3")}({"19dc":function(t,l){t.exports=e},"8bbf":function(e,l){e.exports=t},a5a2:function(e,t){e.exports=l},fae3:function(e,t,l){"use strict";if(l.r(t),l.d(t,"ListAlerts",(function(){return E})),l.d(t,"EditAlert",(function(){return re})),l.d(t,"HistoryTriggeredAlerts",(function(){return se})),l.d(t,"ListAlertsPage",(function(){return Oe})),"undefined"!==typeof window){var r=window.document.currentScript,o=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);o&&(l.p=o[1])}var a=l("8bbf");const n={key:0},i={colspan:"6"},c=Object(a["createElementVNode"])("br",null,null,-1),s=Object(a["createElementVNode"])("br",null,null,-1),d=Object(a["createElementVNode"])("br",null,null,-1),u={class:"name"},m={class:"site"},p={class:"period"},b={class:"reportName"},O={class:"edit"},h=["href","title"],j=["onClick","id","title"],A=Object(a["createElementVNode"])("span",{class:"icon-delete"},null,-1),v=[A],V={class:"tableActionBar"},_=["href"],f=Object(a["createElementVNode"])("span",{class:"icon-add"},null,-1),g=["href"],C=Object(a["createElementVNode"])("span",{class:"icon-table"},null,-1);function N(e,t,l,r,o,A){var N;const k=Object(a["resolveDirective"])("content-table");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",null,[Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("table",null,[Object(a["createElementVNode"])("thead",null,[Object(a["createElementVNode"])("tr",null,[Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("General_Name")),1),Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("General_Website")),1),Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("General_Period")),1),Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("General_Report")),1),Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("General_Actions")),1)])]),Object(a["createElementVNode"])("tbody",null,[null!==(N=e.alerts)&&void 0!==N&&N.length?Object(a["createCommentVNode"])("",!0):(Object(a["openBlock"])(),Object(a["createElementBlock"])("tr",n,[Object(a["createElementVNode"])("td",i,[c,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("CustomAlerts_NoAlertsDefined"))+" ",1),s,d])])),(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.alerts,t=>(Object(a["openBlock"])(),Object(a["createElementBlock"])("tr",{key:t.idalert},[Object(a["createElementVNode"])("td",u,Object(a["toDisplayString"])(t.name),1),Object(a["createElementVNode"])("td",m,Object(a["toDisplayString"])(e.decode(t.siteName)),1),Object(a["createElementVNode"])("td",p,Object(a["toDisplayString"])(e.ucfirst(e.translate("Intl_Period"+e.ucfirst(t.period)))),1),Object(a["createElementVNode"])("td",b,Object(a["toDisplayString"])(t.reportName||"-"),1),Object(a["createElementVNode"])("td",O,[Object(a["createElementVNode"])("a",{class:"table-action icon-edit",href:e.linkTo({module:"CustomAlerts",action:"editAlert",idAlert:t.idalert}),title:e.translate("General_Edit")},null,8,h),Object(a["createElementVNode"])("button",{class:"deleteAlert table-action",onClick:l=>e.deleteAlert(t.idalert),id:t.idalert,title:e.translate("General_Delete")},v,8,j)])]))),128))])])),[[k]]),Object(a["createElementVNode"])("div",V,[Object(a["createElementVNode"])("a",{href:e.linkTo({module:"CustomAlerts",action:"addNewAlert"})},[f,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("CustomAlerts_CreateNewAlert")),1)],8,_),Object(a["createElementVNode"])("a",{href:e.linkTo({module:"CustomAlerts",action:"historyTriggeredAlerts"})},[C,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("CustomAlerts_AlertsHistory")),1)],8,g)])])}var k=l("19dc"),y=Object(a["defineComponent"])({props:{alerts:{type:Array,default(){return[]}}},directives:{ContentTable:k["ContentTable"]},methods:{deleteAlert(e){k["Matomo"].helper.modalConfirm("#confirm",{yes:()=>{k["AjaxHelper"].fetch({method:"CustomAlerts.deleteAlert",idAlert:e}).then(()=>{k["Matomo"].helper.redirect()})}})},ucfirst(e){return`${e[0].toUpperCase()}${e.substr(1)}`},linkTo(e){return"?"+k["MatomoUrl"].stringify(Object.assign(Object.assign({},k["MatomoUrl"].urlParsed.value),e))},decode(e){return k["Matomo"].helper.htmlDecode(e)}}});y.render=N;var E=y;const S={id:"customAlertPeriodHelp",class:"inline-help-node"},M={class:"report-mediums"},x={key:0},D={key:1},T={key:0},B={key:1,class:"row"},w={class:"col s12"},P=["innerHTML"],R={key:2},U={key:3},L={class:"row"},q={class:"col s12"},I={class:"row conditionAndValue"},$={class:"col s12 m6"},H={class:"col s12 m6"},G={class:"ui-autocomplete-input",ref:"reportValue"},F={class:"row conditionAndValue"},W={class:"col s12 m6"},z={class:"col s12 m6"},Y=["innerHTML"];function J(e,t,l,r,o,n){const i=Object(a["resolveComponent"])("Field"),c=Object(a["resolveComponent"])("SelectPhoneNumbers"),s=Object(a["resolveComponent"])("Alert"),d=Object(a["resolveComponent"])("SelectSlackChannel"),u=Object(a["resolveComponent"])("SelectMicrosoftTeamsWebhookUrl"),m=Object(a["resolveComponent"])("ActivityIndicator"),p=Object(a["resolveComponent"])("SaveButton"),b=Object(a["resolveComponent"])("ContentBlock"),O=Object(a["resolveDirective"])("form");return Object(a["openBlock"])(),Object(a["createBlock"])(b,{class:"alerts","content-title":e.headline},{default:Object(a["withCtx"])(()=>{var l,r,o;return[Object(a["createElementVNode"])("p",null,Object(a["toDisplayString"])(e.translate("CustomAlerts_CreateTooltip")),1),Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("div",null,[Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"text",name:"alertName",modelValue:e.actualAlert.name,"onUpdate:modelValue":t[0]||(t[0]=t=>e.actualAlert.name=t),maxlength:100,title:e.translate("CustomAlerts_AlertName"),placeholder:e.translate("CustomAlerts_AlertNamePlaceholder"),"inline-help":e.translate("CustomAlerts_AlertNameInlineHelp")},null,8,["modelValue","title","placeholder","inline-help"])]),Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"textarea",name:"alertDescription",modelValue:e.actualAlert.description,"onUpdate:modelValue":t[1]||(t[1]=t=>e.actualAlert.description=t),maxlength:255,rows:3,"ui-control-attributes":{class:"compact-textarea"},title:e.translate("CustomAlerts_AlertDescriptionOptional"),placeholder:e.translate("CustomAlerts_AlertDescriptionPlaceholder"),"inline-help":e.translate("CustomAlerts_AlertDescriptionInlineHelp")},null,8,["modelValue","title","placeholder","inline-help"])]),Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"site",name:"idSite","model-value":{id:null===(l=e.actualAlert.id_sites)||void 0===l?void 0:l[0],name:e.actualCurrentSite.name},"onUpdate:modelValue":t[2]||(t[2]=t=>{e.actualAlert.id_sites=[t.id],e.actualCurrentSite=t,e.changeReport()}),title:e.translate("General_Website"),introduction:e.translate("CustomAlerts_ApplyTo")},null,8,["model-value","title","introduction"])]),Object(a["createElementVNode"])("div",S,[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.translate("CustomAlerts_YouCanChoosePeriodFrom"))+": ",1),Object(a["createElementVNode"])("ul",null,[Object(a["createElementVNode"])("li",null,"• "+Object(a["toDisplayString"])(e.translate("CustomAlerts_PeriodDayDescription")),1),Object(a["createElementVNode"])("li",null,"• "+Object(a["toDisplayString"])(e.translate("CustomAlerts_PeriodWeekDescription")),1),Object(a["createElementVNode"])("li",null,"• "+Object(a["toDisplayString"])(e.translate("CustomAlerts_PeriodMonthDescription")),1)])]),Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"select",name:"period","inline-help":"#customAlertPeriodHelp","model-value":e.actualAlert.period,"onUpdate:modelValue":t[3]||(t[3]=t=>{e.actualAlert.period=t,e.changeReport()}),title:e.translate("General_Period"),options:e.periodOptions},null,8,["model-value","title","options"])]),Object(a["createElementVNode"])("div",M,[Object(a["createVNode"])(i,{uicontrol:"multiselect",name:"report_mediums",id:"report_mediums",title:e.translate("CustomAlerts_MediumTitle"),"inline-help":e.$sanitize(e.getDeliveryMediumInlineTooltip),options:e.alertReportMediumOptions,"model-value":e.actualAlert.report_mediums,"onUpdate:modelValue":t[4]||(t[4]=t=>{e.actualAlert.report_mediums=t})},null,8,["title","inline-help","options","model-value"])]),e.actualAlert.report_mediums&&e.actualAlert.report_mediums.includes("email")?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",x,[Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"checkbox",name:"report_email_me",modelValue:e.actualAlert.email_me,"onUpdate:modelValue":t[5]||(t[5]=t=>e.actualAlert.email_me=t),introduction:e.translate("ScheduledReports_SendReportTo"),title:`${e.translate("ScheduledReports_SentToMe")} (${e.currentUserEmail})`},null,8,["modelValue","introduction","title"])]),Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"textarea",modelValue:e.actualAlert.additional_emails,"onUpdate:modelValue":t[6]||(t[6]=t=>e.actualAlert.additional_emails=t),"var-type":"array",title:e.translate("ScheduledReports_AlsoSendReportToTheseEmails")},null,8,["modelValue","title"])])])):Object(a["createCommentVNode"])("",!0),e.actualAlert.report_mediums&&e.actualAlert.report_mediums.includes("mobile")?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",D,[e.supportsSMS?(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",T,[Object(a["createVNode"])(c,{"phone-numbers":e.phoneNumbers||[],modelValue:e.actualAlert.phone_numbers,"onUpdate:modelValue":t[7]||(t[7]=t=>e.actualAlert.phone_numbers=t)},null,8,["phone-numbers","modelValue"])])):(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",B,[Object(a["createElementVNode"])("div",w,[Object(a["createVNode"])(s,{severity:"info"},{default:Object(a["withCtx"])(()=>[Object(a["createElementVNode"])("strong",null,Object(a["toDisplayString"])(e.translate("MobileMessaging_PhoneNumbers")),1),Object(a["createTextVNode"])(": "),Object(a["createElementVNode"])("span",{innerHTML:e.$sanitize(e.mobileMessagingNotActivated)},null,8,P)]),_:1})])]))])):Object(a["createCommentVNode"])("",!0),e.actualAlert.report_mediums&&e.actualAlert.report_mediums.includes("slack")?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",R,[Object(a["createVNode"])(d,{"model-value":e.actualAlert.slack_channel_id||"","is-slack-oauth-token-added":e.isSlackOauthTokenAdded,modelValue:e.actualAlert.slack_channel_id,"onUpdate:modelValue":t[8]||(t[8]=t=>e.actualAlert.slack_channel_id=t)},null,8,["model-value","is-slack-oauth-token-added","modelValue"])])):Object(a["createCommentVNode"])("",!0),e.actualAlert.report_mediums&&e.actualAlert.report_mediums.includes("teams")?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",U,[Object(a["createVNode"])(u,{"is-required-fields-set":!0,"model-value":e.actualAlert.ms_teams_webhook_url||"",modelValue:e.actualAlert.ms_teams_webhook_url,"onUpdate:modelValue":t[9]||(t[9]=t=>e.actualAlert.ms_teams_webhook_url=t)},null,8,["model-value","modelValue"])])):Object(a["createCommentVNode"])("",!0),Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"expandable-select",name:"report","model-value":e.actualAlert.report,"onUpdate:modelValue":t[10]||(t[10]=t=>{e.actualAlert.report=t,e.changeReport()}),options:e.reportOptions,title:`${e.translate("CustomAlerts_ThisAppliesTo")}: ${null===(r=e.actualReportMetadata)||void 0===r?void 0:r.name}`,introduction:e.translate("CustomAlerts_AlertCondition"),"inline-help":e.thisAppliesToInlineHelp},null,8,["model-value","options","title","introduction","inline-help"])]),Object(a["withDirectives"])(Object(a["createElementVNode"])("div",L,[Object(a["createElementVNode"])("div",q,[Object(a["createVNode"])(m,{loading:e.isLoadingReport},null,8,["loading"])])],512),[[a["vShow"],e.isLoadingReport]]),Object(a["withDirectives"])(Object(a["createElementVNode"])("div",I,[Object(a["createElementVNode"])("div",$,[Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"select",name:"reportCondition",modelValue:e.actualAlert.report_condition,"onUpdate:modelValue":t[11]||(t[11]=t=>e.actualAlert.report_condition=t),"full-width":!0,title:e.reportConditionTitle,options:e.alertGroupConditions},null,8,["modelValue","title","options"])])]),Object(a["createElementVNode"])("div",H,[Object(a["createElementVNode"])("div",G,[Object(a["withDirectives"])(Object(a["createVNode"])(i,{uicontrol:"text",role:"textbox",name:"reportValue",modelValue:e.actualAlert.report_matched,"onUpdate:modelValue":t[12]||(t[12]=t=>e.actualAlert.report_matched=t),"full-width":!0,autocomplete:"off",maxlength:255,title:e.translate("General_Value")},null,8,["modelValue","title"]),[[a["vShow"],"matches_any"!==e.actualAlert.report_condition]])],512)])],512),[[a["vShow"],e.hasReportDimension]]),Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"select",name:"metric","model-value":e.actualAlert.metric,"onUpdate:modelValue":t[13]||(t[13]=t=>e.actualAlert.metric=t),options:e.metricOptions,introduction:e.translate("CustomAlerts_AlertMeWhen")},null,8,["model-value","options","introduction"])]),Object(a["createElementVNode"])("div",F,[Object(a["createElementVNode"])("div",W,[Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"select",name:"metricCondition","model-value":e.actualAlert.metric_condition,"onUpdate:modelValue":t[14]||(t[14]=t=>e.actualAlert.metric_condition=t),"full-width":!0,options:e.metricConditionOptions},null,8,["model-value","options"])])]),Object(a["createElementVNode"])("div",z,[Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(i,{uicontrol:"text",name:"metricValue",class:Object(a["normalizeClass"])({invalid:e.isMetricValueInvalid}),modelValue:e.actualAlert.metric_matched,"onUpdate:modelValue":t[15]||(t[15]=t=>e.actualAlert.metric_matched=t),title:`${e.metricDescription}`,"full-width":!0},null,8,["class","modelValue","title"])])])]),(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.comparablesDates,(t,l)=>(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{key:l},[Object(a["withDirectives"])(Object(a["createVNode"])(i,{uicontrol:"select",name:"compared_to",modelValue:e.comparedTo[l],"onUpdate:modelValue":t=>e.comparedTo[l]=t,disabled:Object.keys(t).length<=1,options:t,introduction:e.translate("CustomAlerts_ComparedToThe")},null,8,["modelValue","onUpdate:modelValue","disabled","options","introduction"]),[[a["vShow"],l===e.actualAlert.period&&e.isComparable]])]))),128)),null!==(o=e.actualAlert)&&void 0!==o&&o.idalert?(Object(a["openBlock"])(),Object(a["createBlock"])(p,{key:4,onClick:t[16]||(t[16]=t=>e.updateAlert(e.actualAlert.idalert)),saving:e.isLoading},null,8,["saving"])):(Object(a["openBlock"])(),Object(a["createBlock"])(p,{key:5,onClick:t[17]||(t[17]=t=>e.createAlert()),saving:e.isLoading},null,8,["saving"])),Object(a["createElementVNode"])("div",{class:"entityCancel",innerHTML:e.$sanitize(e.cancelLink)},null,8,Y)])),[[O]])]}),_:1},8,["content-title"])}var K=l("a5a2");const Q=Object(k["useExternalPluginComponent"])("MobileMessaging","SelectPhoneNumbers"),X=Object(k["useExternalPluginComponent"])("Slack","SelectSlackChannel"),Z=Object(k["useExternalPluginComponent"])("MicrosoftTeams","SelectMicrosoftTeamsWebhookUrl");function ee(e){return"MultiSites_getOne"===e||"MultiSites_getAll"===e}const{$:te}=window;var le=Object(a["defineComponent"])({props:{alert:Object,headline:{type:String,required:!0},currentSite:{type:Object,required:!0},periodOptions:{type:Array,required:!0},alertReportMediumOptions:{type:Array,required:!0},currentUserEmail:{type:String,required:!0},supportsSMS:Boolean,phoneNumbers:[Array,Object],isSlackOauthTokenAdded:Boolean,reportMetadata:Object,alertGroupConditions:{type:Array,required:!0},metricConditionOptions:{type:Array,required:!0},comparablesDates:{type:Object,required:!0}},components:{Field:K["Field"],Alert:k["Alert"],ActivityIndicator:k["ActivityIndicator"],SaveButton:K["SaveButton"],SelectPhoneNumbers:Q,SelectSlackChannel:X,SelectMicrosoftTeamsWebhookUrl:Z,ContentBlock:k["ContentBlock"]},directives:{Form:K["Form"]},data(){const e=this.currentSite,t=this.alert,l=this.reportMetadata,r=Object.fromEntries(Object.entries(this.comparablesDates).map(([e,t])=>{var l;return[e,null===t||void 0===t||null===(l=t[0])||void 0===l?void 0:l.key]}));return this.alert&&(r[this.alert.period]=""+t.compared_to),{isLoading:!1,isLoadingReport:!1,showReportConditionField:!1,reportOptions:[],actualReportMetadata:l,reportValuesAutoComplete:null,actualAlert:t?Object.assign({},t):{description:"",period:"day",id_sites:[(null===e||void 0===e?void 0:e.id)||k["Matomo"].idSite],report_mediums:[]},comparedTo:r,actualCurrentSite:{id:e.id,name:k["Matomo"].helper.htmlDecode(e.name)}}},watch:{actualReportMetadata(){var e;const t=null===(e=this.actualReportMetadata)||void 0===e?void 0:e.metrics;t&&(this.actualAlert.metric&&t[this.actualAlert.metric]||([this.actualAlert.metric]=Object.keys(t)))},isMetricValueInvalid(e){if(!e)return;const t=k["NotificationsStore"].show({message:Object(k["translate"])("CustomAlerts_InvalidMetricValue"),id:"CustomAlertsMetricValueError",context:"error",type:"toast"});k["NotificationsStore"].scrollToNotification(t)}},created(){this.changeReport(),setTimeout(()=>{te(this.$refs.reportValue).find("input").autocomplete({source:this.getValuesForReportAndMetric.bind(this),minLength:1,delay:300})},1e3)},methods:{renderForm(e){const t=[];this.actualReportMetadata=null,e.forEach(e=>{const l=e.uniqueId;ee(l)||(this.actualAlert.report||(this.actualAlert.report=l),t.push({key:l,value:e.name,group:e.category}),l===this.actualAlert.report&&(this.actualReportMetadata=e))}),this.reportOptions=t},sendApiRequest(e,t){this.isLoading=!0;const{period:l}=this.actualAlert;k["AjaxHelper"].post({period:l,method:e},t).then(()=>{k["Matomo"].helper.redirect({module:"CustomAlerts",action:"index"})}).finally(()=>{this.isLoading=!1})},getValuesForReportAndMetric(e,t){var l;const{metric:r}=this.actualAlert;function o(l){const o=new RegExp(te.ui.autocomplete.escapeRegex(e.term),"i");t(te.grep(l,e=>!!e&&o.test(e.label||e.value||e[r]||e)))}if(this.reportValuesAutoComplete)return void o(this.reportValuesAutoComplete);this.reportValuesAutoComplete=[];const a=this.actualReportMetadata;if(!a)return;const n=a.module,i=a.action;r&&n&&i||o(this.reportValuesAutoComplete),k["AjaxHelper"].fetch({method:"API.getProcessedReport",date:"yesterday",period:"month",disable_queued_filters:1,flat:1,filter_limit:-1,showColumns:r,language:"en",apiModule:n,apiAction:i,idSite:null===(l=this.actualAlert.id_sites)||void 0===l?void 0:l[0],format:"JSON"}).then(e=>{null!==e&&void 0!==e&&e.reportData?(this.reportValuesAutoComplete=e.reportData,o(e.reportData)):o([])}).catch(()=>{o([])})},changeReport(){var e;this.isLoadingReport=!0,this.reportValuesAutoComplete=null,k["AjaxHelper"].fetch({method:"API.getReportMetadata",date:k["Matomo"].currentDateString,period:this.actualAlert.period,idSite:null===(e=this.actualAlert.id_sites)||void 0===e?void 0:e[0],filter_limit:"-1"}).then(e=>{this.renderForm(e)}).finally(()=>{this.isLoadingReport=!1})},createAlert(){return!this.isMetricValueInvalid&&(this.sendApiRequest("CustomAlerts.addAlert",this.apiParameters),!0)},updateAlert(){return!this.isMetricValueInvalid&&(this.sendApiRequest("CustomAlerts.editAlert",this.apiParameters),!0)}},computed:{apiParameters(){var e,t,l,r;return{idAlert:this.actualAlert.idalert,format:"json",name:this.actualAlert.name,description:this.actualAlert.description,metric:this.actualAlert.metric,metricCondition:this.actualAlert.metric_condition,metricValue:this.actualAlert.metric_matched,emailMe:this.actualAlert.email_me?1:0,additionalEmails:null!==(e=this.actualAlert.additional_emails)&&void 0!==e&&e.length?this.actualAlert.additional_emails:[""],phoneNumbers:null!==(t=this.actualAlert.phone_numbers)&&void 0!==t&&t.length?this.actualAlert.phone_numbers:[""],slackChannelID:null!==(l=this.actualAlert)&&void 0!==l&&l.slack_channel_id?this.actualAlert.slack_channel_id:"",msTeamsWebhookUrl:null!==(r=this.actualAlert)&&void 0!==r&&r.ms_teams_webhook_url?this.actualAlert.ms_teams_webhook_url:"",reportUniqueId:this.actualAlert.report,reportCondition:this.actualAlert.report_condition,reportValue:this.actualAlert.report_matched,reportMediums:this.actualAlert.report_mediums,idSites:this.actualAlert.id_sites,comparedTo:this.comparedTo[this.actualAlert.period]}},isMetricValueInvalid(){return!te.isNumeric(this.actualAlert.metric_matched)},mobileMessagingNotActivated(){const e="?"+k["MatomoUrl"].stringify(Object.assign(Object.assign({},k["MatomoUrl"].urlParsed.value),{},{module:"CorePluginsAdmin",action:"plugins",updated:null}));return Object(k["translate"])("CustomAlerts_MobileMessagingPluginNotActivated",``,"")},cancelLink(){const e="?"+k["MatomoUrl"].stringify(Object.assign(Object.assign({},k["MatomoUrl"].urlParsed.value),{},{module:"CustomAlerts",action:"index"}));return Object(k["translate"])("General_OrCancel",``,"")},thisAppliesToInlineHelp(){const e="https://matomo.org/guide/manage-matomo/custom-alerts/",t="https://matomo.org/faq/general/examples-of-custom-alerts#events";return Object(k["translate"])("CustomAlerts_ThisAppliesToHelp",``,"","","",``,"")},getDeliveryMediumInlineTooltip(){return`${Object(k["translate"])("CustomAlerts_CreateTooltip")} ${Object(k["externalLink"])("https://matomo.org/faq/general/create-and-manage-custom-alerts/")} ${Object(k["translate"])("CustomAlerts_LearnMore")}.`},metricOptions(){var e;return Object.entries((null===(e=this.actualReportMetadata)||void 0===e?void 0:e.metrics)||{}).map(([e,t])=>({key:e,value:t}))},hasReportDimension(){var e;return!(null===(e=this.actualReportMetadata)||void 0===e||!e.dimension)},reportConditionTitle(){var e;const t=null===(e=this.actualReportMetadata)||void 0===e?void 0:e.dimension;return`${Object(k["translate"])("CustomAlerts_When")} ${t}`},isComparable(){const e=this.actualAlert.metric_condition;return!!e&&-1!==e.indexOf("_more_than")},metricDescription(){const e=this.actualAlert.metric_condition,{metric:t}=this.actualAlert,l=e&&0===e.indexOf("percentage_"),r=t&&-1!==t.indexOf("_rate"),o=t&&-1!==t.indexOf("_time_");return l||r?"%":o?"s":Object(k["translate"])("General_Value")}}});le.render=J;var re=le;const oe={class:"tableActionBar"},ae=["href"],ne=Object(a["createElementVNode"])("span",{class:"icon-table"},null,-1);function ie(e,t,l,r,o,n){const i=Object(a["resolveComponent"])("ContentBlock");return Object(a["openBlock"])(),Object(a["createBlock"])(i,{class:"alerts","content-title":e.translate("CustomAlerts_AlertsHistory")},{default:Object(a["withCtx"])(()=>[Object(a["renderSlot"])(e.$slots,"default"),Object(a["createElementVNode"])("div",oe,[Object(a["createElementVNode"])("a",{href:e.customAlertsIndexLink},[ne,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("CustomAlerts_ManageAlerts")),1)],8,ae)])]),_:3},8,["content-title"])}var ce=Object(a["defineComponent"])({props:{},components:{ContentBlock:k["ContentBlock"]},computed:{customAlertsIndexLink(){return"?"+k["MatomoUrl"].stringify(Object.assign(Object.assign({},k["MatomoUrl"].urlParsed.value),{},{module:"CustomAlerts",action:"index"}))}}});ce.render=ie;var se=ce;const de={class:"ui-confirm",id:"confirm"},ue=["value"],me=["value"];function pe(e,t,l,r,o,n){const i=Object(a["resolveComponent"])("ListAlerts"),c=Object(a["resolveComponent"])("ContentBlock");return Object(a["openBlock"])(),Object(a["createBlock"])(c,{class:"alerts","content-title":e.title},{default:Object(a["withCtx"])(()=>[Object(a["createElementVNode"])("p",null,Object(a["toDisplayString"])(e.translate("CustomAlerts_ManageTooltip")),1),Object(a["createVNode"])(i,{alerts:e.alerts},null,8,["alerts"]),Object(a["createElementVNode"])("div",de,[Object(a["createElementVNode"])("h2",null,Object(a["toDisplayString"])(e.translate("CustomAlerts_AreYouSureDeleteAlert")),1),Object(a["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,ue),Object(a["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,me)])]),_:1},8,["content-title"])}var be=Object(a["defineComponent"])({props:{title:{type:String,required:!0},alerts:{type:Array,default(){return[]}}},components:{ContentBlock:k["ContentBlock"],ListAlerts:E}});be.render=pe;var Oe=be; /*! * Matomo - free/libre analytics platform * diff --git a/vue/src/EditAlert/EditAlert.vue b/vue/src/EditAlert/EditAlert.vue index afe5c42d..5e0ce387 100644 --- a/vue/src/EditAlert/EditAlert.vue +++ b/vue/src/EditAlert/EditAlert.vue @@ -18,9 +18,24 @@ v-model="actualAlert.name" :maxlength="100" :title="translate('CustomAlerts_AlertName')" + :placeholder="translate('CustomAlerts_AlertNamePlaceholder')" + :inline-help="translate('CustomAlerts_AlertNameInlineHelp')" > +
+ +