From ee828098b2a046cd0a6170d244f0073e72023011 Mon Sep 17 00:00:00 2001 From: axel7083 <42176370+axel7083@users.noreply.github.com> Date: Thu, 7 Mar 2024 18:00:18 +0100 Subject: [PATCH 1/3] fix: remove categories from catalog interface Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com> --- packages/backend/src/managers/catalogManager.ts | 1 - packages/frontend/src/lib/RecipeDetails.spec.ts | 1 - packages/frontend/src/lib/RecipesCard.svelte | 13 +++---------- .../lib/table/application/ColumnModel.spec.ts | 1 - .../lib/table/application/ColumnRecipe.spec.ts | 1 - packages/frontend/src/pages/Recipe.spec.ts | 2 -- packages/frontend/src/pages/Recipe.svelte | 4 +--- packages/frontend/src/pages/Recipes.svelte | 17 +---------------- packages/shared/src/models/ICatalog.ts | 1 - 9 files changed, 5 insertions(+), 36 deletions(-) diff --git a/packages/backend/src/managers/catalogManager.ts b/packages/backend/src/managers/catalogManager.ts index 80cdf19ac..b5f591827 100644 --- a/packages/backend/src/managers/catalogManager.ts +++ b/packages/backend/src/managers/catalogManager.ts @@ -37,7 +37,6 @@ export class CatalogManager extends Publisher implements Disposable { super(webview, MSG_NEW_CATALOG_STATE, () => this.getCatalog()); // We start with an empty catalog, for the methods to work before the catalog is loaded this.catalog = { - categories: [], models: [], recipes: [], }; diff --git a/packages/frontend/src/lib/RecipeDetails.spec.ts b/packages/frontend/src/lib/RecipeDetails.spec.ts index 2f41eb7d2..96e6fdc39 100644 --- a/packages/frontend/src/lib/RecipeDetails.spec.ts +++ b/packages/frontend/src/lib/RecipeDetails.spec.ts @@ -77,7 +77,6 @@ vi.mock('../stores/localRepositories', () => ({ })); const initialCatalog: Catalog = { - categories: [], models: [ { id: 'model1', diff --git a/packages/frontend/src/lib/RecipesCard.svelte b/packages/frontend/src/lib/RecipesCard.svelte index 166e41ddc..0a9525534 100644 --- a/packages/frontend/src/lib/RecipesCard.svelte +++ b/packages/frontend/src/lib/RecipesCard.svelte @@ -1,13 +1,9 @@ - +
{#if recipes.length === 0} @@ -31,10 +27,7 @@ export let displayDescription: boolean = true;
{#if displayCategory} {#each recipe.categories as categoryId} - + {/each} {/if} {#if displayDescription} diff --git a/packages/frontend/src/lib/table/application/ColumnModel.spec.ts b/packages/frontend/src/lib/table/application/ColumnModel.spec.ts index 69f97f8d3..042cdc7dd 100644 --- a/packages/frontend/src/lib/table/application/ColumnModel.spec.ts +++ b/packages/frontend/src/lib/table/application/ColumnModel.spec.ts @@ -32,7 +32,6 @@ vi.mock('/@/stores/catalog', async () => { }); const initialCatalog: Catalog = { - categories: [], models: [ { id: 'model1', diff --git a/packages/frontend/src/lib/table/application/ColumnRecipe.spec.ts b/packages/frontend/src/lib/table/application/ColumnRecipe.spec.ts index 47aa961d9..1f5e2b7e2 100644 --- a/packages/frontend/src/lib/table/application/ColumnRecipe.spec.ts +++ b/packages/frontend/src/lib/table/application/ColumnRecipe.spec.ts @@ -47,7 +47,6 @@ vi.mock('/@/utils/client', async () => { }); const initialCatalog: Catalog = { - categories: [], models: [], recipes: [ { diff --git a/packages/frontend/src/pages/Recipe.spec.ts b/packages/frontend/src/pages/Recipe.spec.ts index 18d53e66a..99a7d53f2 100644 --- a/packages/frontend/src/pages/Recipe.spec.ts +++ b/packages/frontend/src/pages/Recipe.spec.ts @@ -80,7 +80,6 @@ vi.mock('/@/stores/catalog', async () => { }); const initialCatalog: Catalog = { - categories: [], models: [ { id: 'model1', @@ -123,7 +122,6 @@ const initialCatalog: Catalog = { }; const updatedCatalog: Catalog = { - categories: [], models: [ { id: 'model1', diff --git a/packages/frontend/src/pages/Recipe.svelte b/packages/frontend/src/pages/Recipe.svelte index 1fed02663..100b86f5b 100644 --- a/packages/frontend/src/pages/Recipe.svelte +++ b/packages/frontend/src/pages/Recipe.svelte @@ -63,9 +63,7 @@ function setSelectedModel(modelId: string) {
{#each recipe?.categories || [] as categoryId} - + {/each}
diff --git a/packages/frontend/src/pages/Recipes.svelte b/packages/frontend/src/pages/Recipes.svelte index 1910b97e8..1accc7938 100644 --- a/packages/frontend/src/pages/Recipes.svelte +++ b/packages/frontend/src/pages/Recipes.svelte @@ -3,28 +3,13 @@ import NavPage from '/@/lib/NavPage.svelte'; import RecipesCard from '/@/lib/RecipesCard.svelte'; import { RECENT_CATEGORY_ID } from '/@/utils/client'; import { catalog } from '/@/stores/catalog'; - -$: categories = $catalog.categories;
- - - - {#each categories as category} - - - {/each} +
diff --git a/packages/shared/src/models/ICatalog.ts b/packages/shared/src/models/ICatalog.ts index 1e4a8aa65..cdf5b285f 100644 --- a/packages/shared/src/models/ICatalog.ts +++ b/packages/shared/src/models/ICatalog.ts @@ -23,5 +23,4 @@ import type { Recipe } from './IRecipe'; export interface Catalog { recipes: Recipe[]; models: ModelInfo[]; - categories: Category[]; } From ed2aabd577d9c4da23e6bdd6932a74bab22b324f Mon Sep 17 00:00:00 2001 From: axel7083 <42176370+axel7083@users.noreply.github.com> Date: Thu, 7 Mar 2024 18:08:48 +0100 Subject: [PATCH 2/3] fix: remove category interface Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com> --- packages/shared/src/models/ICatalog.ts | 1 - packages/shared/src/models/ICategory.ts | 23 ----------------------- 2 files changed, 24 deletions(-) delete mode 100644 packages/shared/src/models/ICategory.ts diff --git a/packages/shared/src/models/ICatalog.ts b/packages/shared/src/models/ICatalog.ts index cdf5b285f..afa96667a 100644 --- a/packages/shared/src/models/ICatalog.ts +++ b/packages/shared/src/models/ICatalog.ts @@ -16,7 +16,6 @@ * SPDX-License-Identifier: Apache-2.0 ***********************************************************************/ -import type { Category } from './ICategory'; import type { ModelInfo } from './IModelInfo'; import type { Recipe } from './IRecipe'; diff --git a/packages/shared/src/models/ICategory.ts b/packages/shared/src/models/ICategory.ts deleted file mode 100644 index cbe87d47f..000000000 --- a/packages/shared/src/models/ICategory.ts +++ /dev/null @@ -1,23 +0,0 @@ -/********************************************************************** - * Copyright (C) 2024 Red Hat, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ***********************************************************************/ - -export interface Category { - id: string; - name: string; - description?: string; -} From d08d59b17fdce0c99cdf1ea64bfa37453d82e23d Mon Sep 17 00:00:00 2001 From: axel7083 <42176370+axel7083@users.noreply.github.com> Date: Thu, 7 Mar 2024 18:11:46 +0100 Subject: [PATCH 3/3] fix: import Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com> --- packages/frontend/src/pages/Recipe.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/frontend/src/pages/Recipe.svelte b/packages/frontend/src/pages/Recipe.svelte index 100b86f5b..1fc24636b 100644 --- a/packages/frontend/src/pages/Recipe.svelte +++ b/packages/frontend/src/pages/Recipe.svelte @@ -14,7 +14,6 @@ export let recipeId: string; // The recipe model provided $: recipe = $catalog.recipes.find(r => r.id === recipeId); -$: categories = $catalog.categories; let selectedModelId: string; $: selectedModelId = recipe?.models?.[0] ?? '';