diff options
-rw-r--r-- | src/js/Controller/Setting/Get.js | 3 | ||||
-rw-r--r-- | src/js/Controller/Setting/Reset.js | 3 | ||||
-rw-r--r-- | src/js/Controller/Setting/Set.js | 12 | ||||
-rw-r--r-- | src/js/Manager/RecommendationManager.js | 10 | ||||
-rw-r--r-- | src/js/Settings/MasterSettingsProvider.js | 35 | ||||
-rw-r--r-- | src/platform/generic/_locales/de/messages.json | 92 | ||||
-rw-r--r-- | src/platform/generic/_locales/en/messages.json | 92 | ||||
-rw-r--r-- | src/vue/Components/Options/Settings.vue | 58 |
8 files changed, 266 insertions, 39 deletions
diff --git a/src/js/Controller/Setting/Get.js b/src/js/Controller/Setting/Get.js index 341bb4e..7bac31b 100644 --- a/src/js/Controller/Setting/Get.js +++ b/src/js/Controller/Setting/Get.js @@ -21,7 +21,8 @@ export default class Get extends AbstractController { 'theme.current', 'theme.custom', 'debug.localisation.enabled', - 'search.recommendation.option' + 'search.recommendation.option', + 'search.recommendation.maxRows' ]; } diff --git a/src/js/Controller/Setting/Reset.js b/src/js/Controller/Setting/Reset.js index 327d27f..f3cbe98 100644 --- a/src/js/Controller/Setting/Reset.js +++ b/src/js/Controller/Setting/Reset.js @@ -18,7 +18,8 @@ export default class Reset extends AbstractController { 'theme.current', 'theme.custom', 'debug.localisation.enabled', - 'search.recommendation.option' + 'search.recommendation.option', + 'search.recommendation.maxRows' ]; } diff --git a/src/js/Controller/Setting/Set.js b/src/js/Controller/Setting/Set.js index 1c054bd..a28f5c5 100644 --- a/src/js/Controller/Setting/Set.js +++ b/src/js/Controller/Setting/Set.js @@ -38,6 +38,8 @@ export default class Set extends AbstractController { await this._setCurrentTheme(value); } else if(setting === 'search.recommendation.option') { await this._setSearchRecommendationOption(value); + } else if(setting === 'search.recommendation.maxRows') { + await this._setSearchRecommendationMaxRows(Number(value)); } else if(this._booleanSettings.indexOf(setting) !== -1) { await this._setBoolean(setting, value); } else { @@ -95,6 +97,16 @@ export default class Set extends AbstractController { /** * + * @param {Number} value + * @return {Promise<void>} + * @private + */ + async _setSearchRecommendationMaxRows(value) { + await SettingsService.set('search.recommendation.maxRows', value); + } + + /** + * * @param {String} setting * @param {Boolean} value * @return {Promise<void>} diff --git a/src/js/Manager/RecommendationManager.js b/src/js/Manager/RecommendationManager.js index cda001c..4ca175e 100644 --- a/src/js/Manager/RecommendationManager.js +++ b/src/js/Manager/RecommendationManager.js @@ -39,13 +39,19 @@ class RecommendationManager { } initRecommendationOptions() { - this.options = { searchQuery: "Host", maxResults: 8 } + this.options = { searchQuery: "", maxResults: 8 } SettingsService.getValue('search.recommendation.option') .then((value) => { if(value) { this.options.searchQuery = value; } }); + SettingsService.getValue('search.recommendation.maxRows') + .then((value) => { + if(value) { + this.options.maxRows = Number(value); + } + }); } /** @@ -93,7 +99,7 @@ class RecommendationManager { ) .type('password') .score(0.3) - .limit(8) + .limit(this.options.maxRows) .sortBy('favorite') .sortBy('uses') .sortBy('shared') diff --git a/src/js/Settings/MasterSettingsProvider.js b/src/js/Settings/MasterSettingsProvider.js index 826b8b0..7707329 100644 --- a/src/js/Settings/MasterSettingsProvider.js +++ b/src/js/Settings/MasterSettingsProvider.js @@ -77,26 +77,31 @@ class MasterSettingsProvider { 'debug.localisation.enabled' : [ 'local.localisation.enabled' ], - 'search.recommendation.option' : [ + 'search.recommendation.maxRows': [ + 'sync.search.recommendation.maxRows', + 'local.search.recommendation.maxRows' + ], + 'search.recommendation.option': [ 'sync.search.recommendation.option', 'local.search.recommendation.option' ], }; this._defaults = { - 'theme.custom' : null, - 'theme.current' : 'light', - 'server.default' : null, - 'paste.popup.close' : true, - 'paste.form.submit' : true, - 'paste.compromised.warning' : true, - 'paste.autofill' : false, - 'paste.basic-auth' : false, - 'popup.related.search' : true, - 'password.folder.private' : null, - 'notification.password.new' : true, - 'notification.password.update': true, - 'debug.localisation.enabled' : true, - 'search.recommendation.option': 'host' + 'theme.custom' : null, + 'theme.current' : 'light', + 'server.default' : null, + 'paste.popup.close' : true, + 'paste.form.submit' : true, + 'paste.compromised.warning' : true, + 'paste.autofill' : false, + 'paste.basic-auth' : false, + 'popup.related.search' : true, + 'password.folder.private' : null, + 'notification.password.new' : true, + 'notification.password.update' : true, + 'debug.localisation.enabled' : true, + 'search.recommendation.option' : 'host', + 'search.recommendation.maxRows': 8 }; } diff --git a/src/platform/generic/_locales/de/messages.json b/src/platform/generic/_locales/de/messages.json index 0f63bba..2f057ea 100644 --- a/src/platform/generic/_locales/de/messages.json +++ b/src/platform/generic/_locales/de/messages.json @@ -1177,6 +1177,14 @@ "message" : "Keine Fehlerberichte vorhanden", "description": "Message shown when no error reports exist instead of the error logs in the error logs section in the extension settings in the debug tab" }, + "RecommendationSettings" : { + "message" : "Password empfehlungen", + "description": "Label of the section password recommendations in the extension settings." + }, + "RecommendationSettingsHelp" : { + "message" : "Beim ändern doeser Einstellungen muss die Erweiterung neu gestartet werden. Entweder durch deaktivieren und aktivieren der Erweiterung oder mit einem Browser neustart.", + "description": "Label of the help text for section password recommendations in the extension settings." + }, "SettingsSearchRecommendationOption" : { "message" : "Suche Passwort empfehlungen auf Basis von dieser Option.", "description": "Label of the setting in the extension settings to define how password recommendations are searched." @@ -1196,5 +1204,89 @@ "LabelSearchRecommendationExact" : { "message" : "Exakte URL", "description": "Find only passwords where th url matches exact to the current browser url." + }, + "SettingsSearchRecommendationMaxRows" : { + "message" : "Maximale Anzahl an Ergebnissen für die Password Empfehlung.", + "description": "Label of the setting in the extension settings to define the maximum number of results for the password recommendation." + }, + "LabelSearchRecommendationRows1" : { + "message" : "1", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows2" : { + "message" : "2", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows3" : { + "message" : "3", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows4" : { + "message" : "4", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows5" : { + "message" : "5", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows6" : { + "message" : "6", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows7" : { + "message" : "7", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows8" : { + "message" : "8", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows9" : { + "message" : "9", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows10" : { + "message" : "10", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows11" : { + "message" : "11", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows12" : { + "message" : "12", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows13" : { + "message" : "13", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows14" : { + "message" : "14", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows15" : { + "message" : "15", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows16" : { + "message" : "16", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows17" : { + "message" : "17", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows18" : { + "message" : "18", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows19" : { + "message" : "19", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows20" : { + "message" : "20", + "description": "Number of results that should be displayed for password recommendations." } }
\ No newline at end of file diff --git a/src/platform/generic/_locales/en/messages.json b/src/platform/generic/_locales/en/messages.json index 4547062..f4098d0 100644 --- a/src/platform/generic/_locales/en/messages.json +++ b/src/platform/generic/_locales/en/messages.json @@ -1191,6 +1191,14 @@ "message" : "No errors in log", "description": "Message shown when no error reports exist instead of the error logs in the error logs section in the extension settings in the debug tab" }, + "RecommendationSettings" : { + "message" : "Password recommendations", + "description": "Label of the section password recommendations in the extension settings." + }, + "RecommendationSettingsHelp" : { + "message" : "If you change the settings below you will need to restart the extension. This can be done by disabling/enabling the extension or with a browser restart.", + "description": "Label of the help text for section password recommendations in the extension settings." + }, "SettingsSearchRecommendationOption" : { "message" : "Search passwords based on the following option.", "description": "Label of the setting in the extension settings to define how password recommendations are searched." @@ -1210,5 +1218,89 @@ "LabelSearchRecommendationExact" : { "message" : "Exact url", "description": "Find only passwords where th url matches exact to the current browser url." + }, + "SettingsSearchRecommendationMaxRows" : { + "message" : "Maximum number of results for the password recommendation.", + "description": "Label of the setting in the extension settings to define the maximum number of results for the password recommendation." + }, + "LabelSearchRecommendationRows1" : { + "message" : "1", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows2" : { + "message" : "2", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows3" : { + "message" : "3", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows4" : { + "message" : "4", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows5" : { + "message" : "5", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows6" : { + "message" : "6", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows7" : { + "message" : "7", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows8" : { + "message" : "8", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows9" : { + "message" : "9", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows10" : { + "message" : "10", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows11" : { + "message" : "11", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows12" : { + "message" : "12", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows13" : { + "message" : "13", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows14" : { + "message" : "14", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows15" : { + "message" : "15", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows16" : { + "message" : "16", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows17" : { + "message" : "17", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows18" : { + "message" : "18", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows19" : { + "message" : "19", + "description": "Number of results that should be displayed for password recommendations." + }, + "LabelSearchRecommendationRows20" : { + "message" : "20", + "description": "Number of results that should be displayed for password recommendations." } } diff --git a/src/vue/Components/Options/Settings.vue b/src/vue/Components/Options/Settings.vue index 439f52a..0bfc4f0 100644 --- a/src/vue/Components/Options/Settings.vue +++ b/src/vue/Components/Options/Settings.vue @@ -39,9 +39,16 @@ <slider-field id="popup-related-search" v-model="relatedSearch"/> <translate tag="label" for="popup-related-search" say="SettingsPopupRelatedSearch"/> </div> - <div class="setting dropdown"> + + <translate tag="h3" say="RecommendationSettings"/> + <translate tag="p" say="RecommendationSettingsHelp"/> + <div class="setting"> <translate tag="label" for="search-recommendation-option" say="SettingsSearchRecommendationOption"/> - <select-field id="search-recommendation-option" :options="recommendationOptions" v-model="searchOption"/> + <select-field id="search-recommendation-option" :options="recommendationOptions" v-model="recSearchOption"/> + </div> + <div class="setting"> + <translate tag="label" for="search-recommendation-maxRows" say="SettingsSearchRecommendationMaxRows"/> + <select-field id="search-recommendation-maxRows" :options="recommendationMaxRows" v-model="recSearchRows"/> </div> </div> </template> @@ -59,15 +66,16 @@ components: {HelpText, SliderField, SelectField, Translate}, data() { return { - autoclose : false, - autosubmit : false, - autofill : false, - basicAuth : false, - compromised : false, - notifyPwNew : false, - relatedSearch : false, - notifyPwUpdate: false, - searchOption : 'host' + autoclose : false, + autosubmit : false, + autofill : false, + basicAuth : false, + compromised : false, + notifyPwNew : false, + relatedSearch : false, + notifyPwUpdate : false, + recSearchOption : 'host', + recSearchRows : 8 }; }, @@ -95,6 +103,14 @@ label: 'LabelSearchRecommendationExact' } ]; + }, + recommendationMaxRows() { + var i = 1; + var result = []; + for(i =1; i <= 20; i++) { + result.push({id: i, label: "LabelSearchRecommendationRows" + i.toString()}) + } + return result; } }, @@ -108,7 +124,8 @@ this.getSetting('popup.related.search', 'relatedSearch'); this.getSetting('notification.password.new', 'notifyPwNew'); this.getSetting('notification.password.update', 'notifyPwUpdate'); - this.getSetting('search.recommendation.option', 'searchOption'); + this.getSetting('search.recommendation.option', 'recSearchOption'); + this.getSetting('search.recommendation.maxRows', 'recSearchRows'); }, async getSetting(name, variable) { try { @@ -169,13 +186,15 @@ this.setSetting('notification.password.update', value); } }, - searchOption(value, oldValue) { - console.log("value : " + value); - console.log("oldvalue: " + oldValue); + recSearchOption(value, oldValue) { if(oldValue !== null && value !== oldValue) { - console.log("yeah"); this.setSetting('search.recommendation.option', value); } + }, + recSearchRows(value, oldValue) { + if(oldValue !== null && value !== oldValue) { + this.setSetting('search.recommendation.maxRows', value); + } } } }; @@ -187,6 +206,9 @@ h3 { margin : 1.5rem 1rem .5rem; } + p { + margin : 1.5rem 1rem .5rem; + } .setting { padding : 0.5rem 1rem; @@ -207,10 +229,6 @@ .settings-help-text { margin-right : -.5rem; } - - .dropdown { - align-items: flex-start - } } } </style>
\ No newline at end of file |