Skip to content

Commit

Permalink
Add taskQueueView store to persist worker tab on task queue page (#2309)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Tideman authored Sep 4, 2024
1 parent a6d1d8a commit 830de68
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/lib/pages/task-queue.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
import Tabs from '$lib/holocene/tab/tabs.svelte';
import { translate } from '$lib/i18n/translate';
import { getPollers } from '$lib/services/pollers-service';
import { taskQueueView } from '$lib/stores/task-queue-view';
import TaskQueueVersioning from './task-queue-versioning.svelte';
$: ({ queue: taskQueue, namespace } = $page.params);
let view: 'workers' | 'versioning' = 'workers';
const onTab = (view: 'workers' | 'versioning') => {
$taskQueueView = view;
};
</script>

{#await getPollers({ queue: taskQueue, namespace }) then workers}
Expand All @@ -25,16 +28,18 @@
<Tab
label={translate('workers.workers')}
id="worker-tab"
onClick={() => (view = 'workers')}
onClick={() => onTab('workers')}
active={$taskQueueView === 'workers'}
/>
<Tab
label={translate('workers.versioning')}
id="versioning-tab"
onClick={() => (view = 'versioning')}
onClick={() => onTab('versioning')}
active={$taskQueueView === 'versioning'}
/>
</TabList>
</Tabs>
{#if view === 'versioning'}
{#if $taskQueueView === 'versioning'}
<TaskQueueVersioning {taskQueue} {workers} />
{:else}
<WorkerTable {workers} />
Expand Down
8 changes: 8 additions & 0 deletions src/lib/stores/task-queue-view.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { persistStore } from '$lib/stores/persist-store';
import type { TaskQueueView } from '$lib/types/events';

export const taskQueueView = persistStore<TaskQueueView>(
'taskQueueView',
'workers',
true,
);
1 change: 1 addition & 0 deletions src/lib/types/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export type ChildEvent = StartChildWorkflowExecutionInitiatedEvent &
ChildWorkflowExecutionTerminatedEvent;

export type EventView = 'compact' | 'feed' | 'json';
export type TaskQueueView = 'workers' | 'versioning';

export type IterableEvent = WorkflowEvent | EventGroup;

Expand Down

0 comments on commit 830de68

Please sign in to comment.