diff --git a/packages/renderer/src/PreferencesNavigation.spec.ts b/packages/renderer/src/PreferencesNavigation.spec.ts index f6e229032cb..102fd6fae2a 100644 --- a/packages/renderer/src/PreferencesNavigation.spec.ts +++ b/packages/renderer/src/PreferencesNavigation.spec.ts @@ -51,9 +51,5 @@ test('Test rendering of the preferences navigation bar and its items', () => { expect(registries).toBeVisible(); const authentication = screen.getByRole('link', { name: 'Authentication' }); expect(authentication).toBeVisible(); - const extensions = screen.getByRole('link', { name: 'Extensions' }); - expect(extensions).toBeVisible(); - const desktop = screen.getByRole('link', { name: 'Desktop Extensions' }); - expect(desktop).toBeVisible(); // ToDo: adding configuration section/items mocks for preferences, issue #2966 }); diff --git a/packages/renderer/src/PreferencesNavigation.svelte b/packages/renderer/src/PreferencesNavigation.svelte index 7cf464ddb2a..48369392296 100644 --- a/packages/renderer/src/PreferencesNavigation.svelte +++ b/packages/renderer/src/PreferencesNavigation.svelte @@ -5,7 +5,6 @@ import type { TinroRouteMeta } from 'tinro'; import { CONFIGURATION_DEFAULT_SCOPE } from '../../main/src/plugin/configuration-registry-constants'; import SettingsNavItem from './lib/preferences/SettingsNavItem.svelte'; import { configurationProperties } from './stores/configurationProperties'; -import { extensionInfos } from './stores/extensions'; export let meta: TinroRouteMeta; @@ -62,24 +61,6 @@ onMount(async () => { - - {#if sectionExpanded['extensionsCatalog']} - {#each $extensionInfos as extension} - - {/each} - {/if} - - - {#each Object.entries(configProperties) as [configSection, configItems]} { - (window.events as unknown) = { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - receive: (_channel: string, func: any) => { - func(); - }, - }; -}); - -const buttonText = 'Install extension from the OCI image'; - -describe('PreferencesPageDockerExtensions', () => { - test('Expect that textbox is available and button is displayed', async () => { - render(PreferencesPageDockerExtensions, {}); - - const input = screen.getByRole('textbox', { name: 'OCI Image Name' }); - expect(input).toBeInTheDocument(); - const button = screen.getByRole('button', { name: buttonText }); - expect(button).toBeInTheDocument(); - expect(button).toBeDisabled(); - }); - - test('Expect that whitespace does not enable button', async () => { - render(PreferencesPageDockerExtensions, { ociImage: ' ' }); - - const button = screen.getByRole('button', { name: buttonText }); - expect(button).toBeInTheDocument(); - expect(button).toBeDisabled(); - }); - - test('Expect that valid entry enables button', async () => { - render(PreferencesPageDockerExtensions, { ociImage: 'some-valid-image-name' }); - - const button = screen.getByRole('button', { name: buttonText }); - expect(button).toBeInTheDocument(); - expect(button).toBeEnabled(); - }); -}); diff --git a/packages/renderer/src/lib/docker-extension/PreferencesPageDockerExtensions.svelte b/packages/renderer/src/lib/docker-extension/PreferencesPageDockerExtensions.svelte deleted file mode 100644 index c65c24e5df0..00000000000 --- a/packages/renderer/src/lib/docker-extension/PreferencesPageDockerExtensions.svelte +++ /dev/null @@ -1,127 +0,0 @@ - - - -
-

There is an ongoing support of Docker Desktop UI extensions from Podman Desktop.

-

- Not all are guaranteed to work but you can add their OCI Image below to try and load them. -

-

- Example: aquasec/trivy-docker-extension:latest for Trivy extension or redhatdeveloper/openshift-dd-ext:latest for - the OpenShift extension. -

- -
-
- - -
-
- - - -
- {#each logs as log} -

{log}

- {/each} -
- - -
- - {#if $contributions.length > 0} -
-

Installed extensions:

-
- {#each $contributions as contribution, index} -
-
- -
-
-

{index + 1}. {contribution.extensionId}

-
-
- {/each} -
-
- {/if} -
diff --git a/packages/renderer/src/lib/preferences/PreferencesExtensionList.spec.ts b/packages/renderer/src/lib/preferences/PreferencesExtensionList.spec.ts deleted file mode 100644 index fa7a5e862eb..00000000000 --- a/packages/renderer/src/lib/preferences/PreferencesExtensionList.spec.ts +++ /dev/null @@ -1,66 +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 - ***********************************************************************/ - -/* eslint-disable @typescript-eslint/no-explicit-any */ - -import '@testing-library/jest-dom/vitest'; - -import { render, screen } from '@testing-library/svelte'; -import { beforeAll, describe, expect, test } from 'vitest'; - -import PreferencesExtensionList from './PreferencesExtensionList.svelte'; - -// fake the window.events object -beforeAll(() => { - (window.events as unknown) = { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - receive: (_channel: string, func: any) => { - func(); - }, - }; -}); - -const buttonText = 'Install extension from the OCI image'; - -describe('PreferencesExtensionList', () => { - test('Expect that textbox is available and button is displayed', async () => { - render(PreferencesExtensionList, {}); - - const entry = screen.getByPlaceholderText('Name of the Image'); - expect(entry).toBeInTheDocument(); - const button = screen.getByRole('button', { name: buttonText }); - expect(button).toBeInTheDocument(); - expect(button).toBeDisabled(); - }); - - test('Expect that whitespace does not enable button', async () => { - render(PreferencesExtensionList, { ociImage: ' ' }); - - const button = screen.getByRole('button', { name: buttonText }); - expect(button).toBeInTheDocument(); - expect(button).toBeDisabled(); - }); - - test('Expect that valid entry enables button', async () => { - render(PreferencesExtensionList, { ociImage: 'some-valid-image' }); - - const button = screen.getByRole('button', { name: buttonText }); - expect(button).toBeInTheDocument(); - expect(button).toBeEnabled(); - }); -}); diff --git a/packages/renderer/src/lib/preferences/PreferencesExtensionList.svelte b/packages/renderer/src/lib/preferences/PreferencesExtensionList.svelte deleted file mode 100644 index 767b29a7822..00000000000 --- a/packages/renderer/src/lib/preferences/PreferencesExtensionList.svelte +++ /dev/null @@ -1,206 +0,0 @@ - - - -
-
- -
- -
-

Install a new extension from OCI Image

- -
-
- - - -
- -
-
- {#each logs as log} -

{log}

- {/each} -
- - -
-
-
-
- - - {#each $extensionInfos as extension} - - - - - {/each} - -
-
-
- -
-
-
-
- {extension.displayName} - {extension.removable ? '(user)' : '(default extension)'} - v{extension.version} - {#if extension.update} - {@const extensionUpdate = extension.update} - - {/if} -
-
-
-
- {extension.description} -
-
-
- -
-
-
-
-
- - - - {#if extension.removable} - {#if extension.state === 'stopped'} - - {:else} -
- -
- {/if} - {:else} -
- -
- {/if} -
-
-
-
diff --git a/packages/renderer/src/lib/preferences/PreferencesExtensionRendering.spec.ts b/packages/renderer/src/lib/preferences/PreferencesExtensionRendering.spec.ts deleted file mode 100644 index 4f0313fca55..00000000000 --- a/packages/renderer/src/lib/preferences/PreferencesExtensionRendering.spec.ts +++ /dev/null @@ -1,142 +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 - ***********************************************************************/ - -/* eslint-disable @typescript-eslint/no-explicit-any */ - -import '@testing-library/jest-dom/vitest'; - -import { render, screen, waitForElementToBeRemoved } from '@testing-library/svelte'; -import { beforeAll, describe, expect, test, vi } from 'vitest'; - -import { extensionInfos } from '../../stores/extensions'; -import PreferencesExtensionRendering from './PreferencesExtensionRendering.svelte'; - -const getOnboardingMock = vi.fn(); -// fake the window.events object -beforeAll(() => { - (window as any).getOnboarding = getOnboardingMock; - (window.events as unknown) = { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - receive: (_channel: string, func: any) => { - func(); - }, - }; -}); - -// extension page needs a mock extension to work correctly -function setup(state: string): string { - const extensionInfo = { - id: 'test', - name: 'test', - version: '1.0', - displayName: 'Test extension', - state: state, - description: 'An extension for testing', - path: '/test', - publisher: 'podman-desktop', - readme: '', - removable: true, - }; - - extensionInfos.set([extensionInfo]); - return extensionInfo.id; -} -describe('PreferencesExtensionRendering', () => { - test('Expect that the buttons have the correct state when an extension is stopped', async () => { - const id = setup('stopped'); - render(PreferencesExtensionRendering, { extensionId: id }); - - const start = screen.getByRole('button', { name: 'Enable' }); - expect(start).toBeInTheDocument(); - expect(start).toBeEnabled(); - const stop = screen.getByRole('button', { name: 'Disable' }); - expect(stop).toBeInTheDocument(); - expect(stop).toBeDisabled(); - const remove = screen.getByRole('button', { name: 'Remove' }); - expect(remove).toBeInTheDocument(); - expect(remove).toBeEnabled(); - }); - - test('Expect that the buttons have the correct state when an extension is started', async () => { - const id = setup('started'); - render(PreferencesExtensionRendering, { extensionId: id }); - - const start = screen.getByRole('button', { name: 'Enable' }); - expect(start).toBeInTheDocument(); - expect(start).toBeDisabled(); - const stop = screen.getByRole('button', { name: 'Disable' }); - expect(stop).toBeInTheDocument(); - expect(stop).toBeEnabled(); - const remove = screen.getByRole('button', { name: 'Remove' }); - expect(remove).toBeInTheDocument(); - expect(remove).toBeDisabled(); - }); - - test('Expect that the buttons have the correct state when an extension is starting', async () => { - const id = setup('starting'); - render(PreferencesExtensionRendering, { extensionId: id }); - - const start = screen.getByRole('button', { name: 'Enable' }); - expect(start).toBeInTheDocument(); - expect(start).toBeDisabled(); - const stop = screen.getByRole('button', { name: 'Disable' }); - expect(stop).toBeInTheDocument(); - expect(stop).toBeDisabled(); - const remove = screen.getByRole('button', { name: 'Remove' }); - expect(remove).toBeInTheDocument(); - expect(remove).toBeDisabled(); - }); - - test('Expect that the buttons have the correct state when an extension is stopping', async () => { - const id = setup('stopping'); - render(PreferencesExtensionRendering, { extensionId: id }); - - const start = screen.getByRole('button', { name: 'Enable' }); - expect(start).toBeInTheDocument(); - expect(start).toBeDisabled(); - const stop = screen.getByRole('button', { name: 'Disable' }); - expect(stop).toBeInTheDocument(); - expect(stop).toBeDisabled(); - const remove = screen.getByRole('button', { name: 'Remove' }); - expect(remove).toBeInTheDocument(); - expect(remove).toBeDisabled(); - }); - - test('Expect empty screen if there is no matching extension (could be during providerInfos is loading)', async () => { - // clear store - extensionInfos.set([]); - - // start without extension in the stores, should be empty - render(PreferencesExtensionRendering, { extensionId: 'test' }); - - // check empty page is displayed if we do not have matching of the extension - const emptyHeading = screen.getByRole('heading', { name: 'Extension not found', level: 1 }); - expect(emptyHeading).toBeInTheDocument(); - - // now register the extension in the store - setup('started'); - - // wait empty page disappear - await waitForElementToBeRemoved(() => screen.queryByRole('heading', { name: 'Extension not found', level: 1 })); - - // now check disable button is displayed as extension is started - const start = screen.getByRole('button', { name: 'Disable' }); - expect(start).toBeInTheDocument(); - expect(start).toBeEnabled(); - }); -}); diff --git a/packages/renderer/src/lib/preferences/PreferencesExtensionRendering.svelte b/packages/renderer/src/lib/preferences/PreferencesExtensionRendering.svelte deleted file mode 100644 index d5fb5094240..00000000000 --- a/packages/renderer/src/lib/preferences/PreferencesExtensionRendering.svelte +++ /dev/null @@ -1,97 +0,0 @@ - - -{#if !extensionInfo} - -{:else} - - - {extensionInfo.description} - -
- {#if extensionInfo} - - -
-
Status
- -
- -
- -
- -
- - -
- -
- - - {#if extensionInfo.removable} -
- -
- {:else} -
Default extension, cannot be removed
- {/if} -
- - {#if extensionInfo.error} -
-
Extension error: {extensionInfo.error.message}
- {#if extensionInfo.error.stack} -
Stack trace
-
{extensionInfo.error.stack}
- {/if} -
- {/if} -
- {/if} -
-{/if} diff --git a/packages/renderer/src/lib/preferences/PreferencesPage.svelte b/packages/renderer/src/lib/preferences/PreferencesPage.svelte index 2f82ae7708e..36f446240b9 100644 --- a/packages/renderer/src/lib/preferences/PreferencesPage.svelte +++ b/packages/renderer/src/lib/preferences/PreferencesPage.svelte @@ -6,13 +6,10 @@ import PreferencesContainerConnectionEdit from '/@/lib/preferences/PreferencesCo import type { IConfigurationPropertyRecordedSchema } from '../../../../main/src/plugin/configuration-registry'; import Route from '../../Route.svelte'; import { configurationProperties } from '../../stores/configurationProperties'; -import PreferencesPageDockerExtensions from '../docker-extension/PreferencesPageDockerExtensions.svelte'; import Onboarding from '../onboarding/Onboarding.svelte'; import PreferencesAuthenticationProvidersRendering from './PreferencesAuthenticationProvidersRendering.svelte'; import PreferencesCliToolsRendering from './PreferencesCliToolsRendering.svelte'; import PreferencesContainerConnectionRendering from './PreferencesContainerConnectionRendering.svelte'; -import PreferencesExtensionList from './PreferencesExtensionList.svelte'; -import PreferencesExtensionRendering from './PreferencesExtensionRendering.svelte'; import PreferencesKubernetesConnectionRendering from './PreferencesKubernetesConnectionRendering.svelte'; import PreferencesKubernetesContextsRendering from './PreferencesKubernetesContextsRendering.svelte'; import PreferencesProviderRendering from './PreferencesProviderRendering.svelte'; @@ -52,12 +49,6 @@ onMount(async () => { - - - - - - @@ -85,9 +76,6 @@ onMount(async () => { - - -