From 26bb5d59c98375e991dca831cf157b599e64e7ca Mon Sep 17 00:00:00 2001 From: Jeff MAURY Date: Thu, 6 Jun 2024 17:21:13 +0200 Subject: [PATCH] chore: adopt Button UI component Fixes #962 Signed-off-by: Jeff MAURY --- .../frontend/src/lib/RecipeDetails.svelte | 2 +- .../frontend/src/lib/button/Button.spec.ts | 38 --------- .../frontend/src/lib/button/Button.svelte | 85 ------------------- packages/frontend/src/lib/button/Button.ts | 27 ------ .../ContainerConnectionStatusInfo.svelte | 2 +- .../frontend/src/pages/CreateService.svelte | 2 +- packages/frontend/src/pages/Dashboard.svelte | 2 +- .../frontend/src/pages/ImportModels.svelte | 2 +- .../src/pages/InferenceServerDetails.svelte | 2 +- .../src/pages/InferenceServers.svelte | 2 +- packages/frontend/src/pages/Models.svelte | 2 +- packages/frontend/src/pages/Playground.svelte | 3 +- .../src/pages/PlaygroundCreate.svelte | 2 +- .../frontend/src/pages/Playgrounds.svelte | 2 +- 14 files changed, 11 insertions(+), 162 deletions(-) delete mode 100644 packages/frontend/src/lib/button/Button.spec.ts delete mode 100644 packages/frontend/src/lib/button/Button.svelte delete mode 100644 packages/frontend/src/lib/button/Button.ts diff --git a/packages/frontend/src/lib/RecipeDetails.svelte b/packages/frontend/src/lib/RecipeDetails.svelte index 1d0f83950..dd73fc0c3 100644 --- a/packages/frontend/src/lib/RecipeDetails.svelte +++ b/packages/frontend/src/lib/RecipeDetails.svelte @@ -10,7 +10,6 @@ import { router } from 'tinro'; import { applicationStates } from '../stores/application-states'; import type { ApplicationState } from '@shared/src/models/IApplicationState'; import ApplicationActions from './ApplicationActions.svelte'; -import Button from './button/Button.svelte'; import VSCodeIcon from '/@/lib/images/VSCodeIcon.svelte'; import { localRepositories } from '../stores/localRepositories'; import { findLocalRepositoryByRecipeId } from '/@/utils/localRepositoriesUtils'; @@ -21,6 +20,7 @@ import StatusIcon from '/@/lib/StatusIcon.svelte'; import type { ModelInfo } from '@shared/src/models/IModelInfo'; import { getApplicationStatus, getApplicationStatusText } from '../pages/applications'; import Spinner from './button/Spinner.svelte'; +import { Button } from '@podman-desktop/ui-svelte'; export let recipeId: string; export let modelId: string; diff --git a/packages/frontend/src/lib/button/Button.spec.ts b/packages/frontend/src/lib/button/Button.spec.ts deleted file mode 100644 index d9cbcc7a4..000000000 --- a/packages/frontend/src/lib/button/Button.spec.ts +++ /dev/null @@ -1,38 +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 - ***********************************************************************/ - -import '@testing-library/jest-dom/vitest'; -import { test, expect } from 'vitest'; -import { render, screen } from '@testing-library/svelte'; -import Button from '/@/lib/button/Button.svelte'; - -test('Button inProgress must have a spinner', async () => { - // render the component - render(Button, { inProgress: true }); - - const svg = screen.getByRole('img'); - expect(svg).toBeDefined(); -}); - -test('Button no progress no icon do not have spinner', async () => { - // render the component - render(Button, { inProgress: false }); - - const svg = screen.queryByRole('img'); - expect(svg).toBeNull(); -}); diff --git a/packages/frontend/src/lib/button/Button.svelte b/packages/frontend/src/lib/button/Button.svelte deleted file mode 100644 index c1b97b2d6..000000000 --- a/packages/frontend/src/lib/button/Button.svelte +++ /dev/null @@ -1,85 +0,0 @@ - - - diff --git a/packages/frontend/src/lib/button/Button.ts b/packages/frontend/src/lib/button/Button.ts deleted file mode 100644 index de8854a42..000000000 --- a/packages/frontend/src/lib/button/Button.ts +++ /dev/null @@ -1,27 +0,0 @@ -/********************************************************************** - * Copyright (C) 2023 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 - ***********************************************************************/ - -/** - * Type of button: - * primary - a main action (the default) - * secondary - a secondary action - * danger - a danger action - * link - close, cancel, or other non-default button - * tab - displayed as tab - */ -export type ButtonType = 'primary' | 'secondary' | 'danger' | 'link' | 'tab'; diff --git a/packages/frontend/src/lib/notification/ContainerConnectionStatusInfo.svelte b/packages/frontend/src/lib/notification/ContainerConnectionStatusInfo.svelte index de95c7397..676b82991 100644 --- a/packages/frontend/src/lib/notification/ContainerConnectionStatusInfo.svelte +++ b/packages/frontend/src/lib/notification/ContainerConnectionStatusInfo.svelte @@ -1,10 +1,10 @@