Skip to content

Commit

Permalink
chore: move PodsList to svelte5 runes mode
Browse files Browse the repository at this point in the history
part of podman-desktop/podman-desktop#10240
Signed-off-by: Florent Benoit <[email protected]>
  • Loading branch information
benoitf committed Dec 25, 2024
1 parent 4e0dd48 commit 7f43a1e
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions packages/renderer/src/lib/pod/PodsList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,32 @@ import PodColumnStatus from './PodColumnStatus.svelte';
import PodEmptyScreen from './PodEmptyScreen.svelte';
import type { PodInfoUI } from './PodInfoUI';
export let searchTerm = '';
$: searchPattern.set(searchTerm);
interface Props {
searchTerm?: string;
}
let { searchTerm = $bindable('') }: Props = $props();
$effect(() => {
searchPattern.set(searchTerm);
});
let pods: PodInfoUI[] = [];
let enginesList: EngineInfoUI[];
let pods: PodInfoUI[] = $state([]);
let enginesList: EngineInfoUI[] = $state([]);
$: providerConnections = $providerInfos
.map(provider => provider.containerConnections)
.flat()
.filter(providerContainerConnection => providerContainerConnection.status === 'started');
const providerConnections = $derived(
$providerInfos
.flatMap(provider => provider.containerConnections)
.filter(providerContainerConnection => providerContainerConnection.status === 'started'),
);
$: providerPodmanConnections = $providerInfos
.map(provider => provider.containerConnections)
.flat()
// keep only podman providers as it is not supported by docker
.filter(providerContainerConnection => providerContainerConnection.type === 'podman')
.filter(providerContainerConnection => providerContainerConnection.status === 'started');
const providerPodmanConnections = $derived(
$providerInfos
.flatMap(provider => provider.containerConnections)
// keep only podman providers as it is not supported by docker
.filter(providerContainerConnection => providerContainerConnection.type === 'podman')
.filter(providerContainerConnection => providerContainerConnection.status === 'started'),
);
const podUtils = new PodUtils();
Expand Down Expand Up @@ -79,7 +88,7 @@ onMount(() => {
});
// delete the items selected in the list
let bulkDeleteInProgress = false;
let bulkDeleteInProgress = $state(false);
async function deleteSelectedPods() {
const selectedPods = pods.filter(pod => pod.selected);
if (selectedPods.length === 0) {
Expand Down Expand Up @@ -107,7 +116,7 @@ async function deleteSelectedPods() {
bulkDeleteInProgress = false;
}
let selectedItemsNumber: number;
let selectedItemsNumber: number = $state(0);
let table: Table;
let statusColumn = new TableColumn<PodInfoUI>('Status', {
Expand Down

0 comments on commit 7f43a1e

Please sign in to comment.