From 10e706230f11606a83a86837c820a6c338d29a4f Mon Sep 17 00:00:00 2001 From: Vijay Raghavan Aravamudhan Date: Thu, 12 Aug 2021 14:50:41 +0000 Subject: Services now support aliases!!!! (#1774) Users can now search for the services not only based on the name, but also the alias (partial match, case-insensitive), when adding new services. fixes #1614, #1615, #1291 --- CHANGELOG.md | 3 ++- recipes | 2 +- src/components/settings/recipes/RecipeItem.js | 5 +++++ src/containers/settings/RecipesScreen.js | 2 +- src/models/Recipe.js | 3 +++ src/models/RecipePreview.js | 2 ++ src/styles/recipes.scss | 5 +++++ 7 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d1c6e9e2..eb42f4433 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ -# [v5.6.1-nightly.24](https://github.com/getferdi/ferdi/compare/v5.6.1-nightly.23...v5.6.1-nightly.24) (2021-08-12) +# [v5.6.1-nightly.24](https://github.com/getferdi/ferdi/compare/v5.6.1-nightly.23...v5.6.1-nightly.24) (2021-08-13) - Added new recipe for Proton Calendar (getferdi/recipes#606) 💖 @cereum +- Services now have aliases - so the user can search for alternative names to get matches (#1774) 💖 @vraravam ### Bug Fixes diff --git a/recipes b/recipes index 52ca44b9d..b2164aa7c 160000 --- a/recipes +++ b/recipes @@ -1 +1 @@ -Subproject commit 52ca44b9df4dafcdc0eaa517146638e01fca5449 +Subproject commit b2164aa7c0aaf42afda09c00254d99a67b888fdd diff --git a/src/components/settings/recipes/RecipeItem.js b/src/components/settings/recipes/RecipeItem.js index 12e3775f6..55f415bd5 100644 --- a/src/components/settings/recipes/RecipeItem.js +++ b/src/components/settings/recipes/RecipeItem.js @@ -28,6 +28,11 @@ export default @observer class RecipeItem extends Component { alt="" /> {recipe.name} + {recipe.aliases && recipe.aliases.length > 0 && ( + + {`Aliases: ${recipe.aliases.join(', ')}`} + + )} ); } diff --git a/src/containers/settings/RecipesScreen.js b/src/containers/settings/RecipesScreen.js index ff3c688fa..52bf31383 100644 --- a/src/containers/settings/RecipesScreen.js +++ b/src/containers/settings/RecipesScreen.js @@ -128,7 +128,7 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend // All search recipes from local recipes ...this.createPreviews( this.customRecipes - .filter((service) => service.name.toLowerCase().includes(this.state.needle.toLowerCase())), + .filter((service) => service.name.toLowerCase().includes(this.state.needle.toLowerCase()) || (service.aliases || []).some(alias => alias.toLowerCase().includes(this.state.needle.toLowerCase()))), ), ]) : recipeFilter; diff --git a/src/models/Recipe.js b/src/models/Recipe.js index e616055d6..0d97d4472 100644 --- a/src/models/Recipe.js +++ b/src/models/Recipe.js @@ -12,6 +12,8 @@ export default class Recipe { version = ''; + aliases = []; + path = ''; serviceURL = ''; @@ -61,6 +63,7 @@ export default class Recipe { this.id = data.id || this.id; this.name = data.name || this.name; this.version = data.version || this.version; + this.aliases = data.aliases || this.aliases; this.path = data.path; this.serviceURL = data.config.serviceURL || this.serviceURL; diff --git a/src/models/RecipePreview.js b/src/models/RecipePreview.js index 7a37ccb56..6a9ce3080 100644 --- a/src/models/RecipePreview.js +++ b/src/models/RecipePreview.js @@ -9,6 +9,8 @@ export default class RecipePreview { featured = false; + aliases = []; + constructor(data) { if (!data.id) { throw Error('RecipePreview requires Id'); diff --git a/src/styles/recipes.scss b/src/styles/recipes.scss index 37c2febf6..628d28f05 100644 --- a/src/styles/recipes.scss +++ b/src/styles/recipes.scss @@ -69,6 +69,11 @@ display: block; } + .recipe-teaser__alias_label { + display: block; + font-size: x-small; + } + h2 { z-index: 10; } -- cgit v1.2.3-54-g00ecf