Skip to content

Commit

Permalink
feat(ui): adding kubernetesCurrentContextPortForwards store (podman-d…
Browse files Browse the repository at this point in the history
…esktop#9642)

* feat(ui): adding kubernetesCurrentContextPortForwards store

Signed-off-by: axel7083 <[email protected]>

* fix: apply suggestion by @deboer-tim

Signed-off-by: axel7083 <[email protected]>

---------

Signed-off-by: axel7083 <[email protected]>
  • Loading branch information
axel7083 authored Oct 28, 2024
1 parent 16363c5 commit 71c2e17
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/renderer/src/stores/kubernetes-contexts-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type { KubernetesObject } from '@kubernetes/client-node';
import { derived, type Readable, readable, writable } from 'svelte/store';

import type { CheckingState, ContextGeneralState } from '/@api/kubernetes-contexts-states';
import type { UserForwardConfig } from '/@api/kubernetes-port-forward-model';

import { findMatchInLeaves } from './search-util';

Expand Down Expand Up @@ -246,3 +247,14 @@ export const kubernetesCurrentContextRoutesFiltered = derived(
[routeSearchPattern, kubernetesCurrentContextRoutes],
([$searchPattern, $routes]) => $routes.filter(route => findMatchInLeaves(route, $searchPattern.toLowerCase())),
);

// Port Forwarding

export const kubernetesCurrentContextPortForwards = readable<UserForwardConfig[]>([], set => {
window.getKubernetesPortForwards().then(value => {
set(value);
});
window.events?.receive('kubernetes-port-forwards-update', (value: unknown) => {
set(value as UserForwardConfig[]);
});
});

0 comments on commit 71c2e17

Please sign in to comment.