From d6630a47803671662c73564cfcf4661a0413dc4b Mon Sep 17 00:00:00 2001 From: Amire80 Date: Sun, 4 Mar 2018 23:04:14 +0200 Subject: [PATCH] Log the context of the ULS in which no search results were found Relies on updates to EventLogging schema. Diff: https://meta.wikimedia.org/w/index.php?title=Schema%3AUniversalLanguageSelector&type=revision&diff=17799034&oldid=7327441 Bug: T179402 Change-Id: I2ff9ce9b40df16ed3c5e6970fb3b691af08cedec --- UniversalLanguageSelector.hooks.php | 2 +- resources/js/ext.uls.compactlinks.js | 1 + resources/js/ext.uls.displaysettings.js | 1 + resources/js/ext.uls.eventlogger.js | 9 ++++++--- resources/js/ext.uls.ime.js | 1 + resources/js/ext.uls.inputsettings.js | 3 ++- resources/js/ext.uls.interface.js | 10 +++++++++- 7 files changed, 21 insertions(+), 6 deletions(-) diff --git a/UniversalLanguageSelector.hooks.php b/UniversalLanguageSelector.hooks.php index 4eee8173..53c8e26f 100644 --- a/UniversalLanguageSelector.hooks.php +++ b/UniversalLanguageSelector.hooks.php @@ -145,7 +145,7 @@ class UniversalLanguageSelectorHooks { } public static function onEventLoggingRegisterSchemas( array &$schemas ) { - $schemas['UniversalLanguageSelector'] = 7327441; + $schemas['UniversalLanguageSelector'] = 17799034; } /** diff --git a/resources/js/ext.uls.compactlinks.js b/resources/js/ext.uls.compactlinks.js index 0ba72238..7d0d9fef 100644 --- a/resources/js/ext.uls.compactlinks.js +++ b/resources/js/ext.uls.compactlinks.js @@ -190,6 +190,7 @@ $trigger.removeClass( 'selector-open' ); }, languages: ulsLanguageList, + ulsPurpose: 'compact-language-links', // Show common languages quickList: self.getCommonLanguages( languages ), noResultsTemplate: function () { diff --git a/resources/js/ext.uls.displaysettings.js b/resources/js/ext.uls.displaysettings.js index 69e6f852..69ef8812 100644 --- a/resources/js/ext.uls.displaysettings.js +++ b/resources/js/ext.uls.displaysettings.js @@ -356,6 +356,7 @@ // the apply button displaySettings.markDirty(); }, + ulsPurpose: 'interface-language', quickList: function () { return mw.uls.getFrequentLanguageList(); } diff --git a/resources/js/ext.uls.eventlogger.js b/resources/js/ext.uls.eventlogger.js index 262852bc..32c08ca5 100644 --- a/resources/js/ext.uls.eventlogger.js +++ b/resources/js/ext.uls.eventlogger.js @@ -237,13 +237,16 @@ /** * Log search strings which produce no search results. * - * @param {jQuery.event} event The orignal event + * @param {jQuery.event} event The original event * @param {string} context The query string + * @param {string} ulsPurpose The ulsPurpose option of the ULS panel that triggered the event */ - noSearchResults: function ( event, context ) { + noSearchResults: function ( event, context, ulsPurpose ) { this.log( { action: 'no-search-results', - context: context + context: context, + ulsPurpose: ulsPurpose, + title: mw.config.get( 'wgPageName' ) } ); } }; diff --git a/resources/js/ext.uls.ime.js b/resources/js/ext.uls.ime.js index 5ebca05b..b7ba5e14 100644 --- a/resources/js/ext.uls.ime.js +++ b/resources/js/ext.uls.ime.js @@ -293,6 +293,7 @@ $input.focus(); }, languages: mw.ime.getLanguagesWithIME(), + ulsPurpose: 'ime-selector', top: $input.offset().top } ); diff --git a/resources/js/ext.uls.inputsettings.js b/resources/js/ext.uls.inputsettings.js index e18eeab9..da531bef 100644 --- a/resources/js/ext.uls.inputsettings.js +++ b/resources/js/ext.uls.inputsettings.js @@ -390,7 +390,8 @@ inputSettings.prepareLanguages(); inputSettings.markDirty(); }, - languages: mw.ime.getLanguagesWithIME() + languages: mw.ime.getLanguagesWithIME(), + ulsPurpose: 'input-settings' } ); $moreLanguagesButton.on( 'click', function () { diff --git a/resources/js/ext.uls.interface.js b/resources/js/ext.uls.interface.js index 120da8b6..aaea8049 100644 --- a/resources/js/ext.uls.interface.js +++ b/resources/js/ext.uls.interface.js @@ -367,7 +367,15 @@ }, onSelect: function ( language ) { mw.uls.changeLanguage( language ); - } + }, + // Not actually used on sites with the gear icon + // in the interlanguage area, because this ULS + // will be a container for other ULS panels. + // However, this is used on sites with ULS + // in the personal bar, and in that case it has the same + // purpose as the selector in Display settings, + // so it has the same identifier. + ulsPurpose: 'interface-language' } ); // Allow styles to apply first and position to work by