8000 Add onClick to Tab, fix presets, sort recent runs, remove required on name field by Alex-Tideman · Pull Request #1315 · temporalio/ui · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add onClick to Tab, fix presets, sort recent runs, remove required on name field #1315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the c 8000 ommunity.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/lib/components/schedule/schedule-recent-runs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,23 @@

export let recentRuns: ScheduleActionResult[] = [];
export let namespace: string;

const sortRecentRuns = (recentRuns: ScheduleActionResult[]) => {
return (
recentRuns
?.sort(
(a, b) =>
new Date(b.actualTime as string).getTime() -
new Date(a.actualTime as string).getTime(),
)
?.slice(0, 5) ?? []
);
};
</script>

<Panel>
<h2 class="mb-4 text-2xl">Recent Runs</h2>
{#each recentRuns.slice(0, 5) as run (run?.startWorkflowResult?.workflowId)}
{#each sortRecentRuns(recentRuns) as run (run?.startWorkflowResult?.workflowId)}
{#await fetchWorkflowForSchedule({ namespace, workflowId: decodeURIForSvelte(run.startWorkflowResult.workflowId), runId: run.startWorkflowResult.runId }, fetch) then workflow}
<div class="row">
<div class="w-28">
Expand Down
35 changes: 30 additions & 5 deletions src/lib/components/schedule/schedules-calendar-view.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,37 @@
<h2 class="mb-4 text-2xl">Frequency</h2>
<TabList label="Schedule Tabs" class="flex flex-wrap gap-6">
{#if schedule}
<Tab label="Existing" id="existing-tab" panelId="existing-panel" />
<Tab
label="Existing"
id="existing-tab"
panelId="existing-panel"
=> (preset = 'existing')}
/>
{/if}
<Tab label="Interval" id="interval-tab" panelId="interval-panel" />
<Tab label="Days of the Week" id="daily-tab" panelId="daily-panel" />
<Tab label="Days of the Month" id="monthly-tab" panelId="monthly-panel" />
<Tab label="String" id="string-tab" panelId="string-panel" />
<Tab
label="Interval"
id="interval-tab"
panelId="interval-panel"
=> (preset = 'interval')}
/>
<Tab
label="Days of the Week"
id="daily-tab"
panelId="daily-panel"
=> (preset = 'week')}
/>
<Tab
label="Days of the Month"
id="monthly-tab"
panelId="monthly-panel"
=> (preset = 'month')}
/>
<Tab
label="String"
id="string-tab"
panelId="string-panel"
=> (preset = 'string')}
/>
</TabList>
<div class="mt-4 flex w-full flex-wrap gap-6">
{#if schedule}
Expand Down
1 change: 0 additions & 1 deletion src/lib/components/schedule/schedules-time-view.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
<div class="w-24">
<Input
id="minute"
required
bind:value={minute}
placeholder="00"
suffix="min"
Expand Down
4 changes: 4 additions & 0 deletions src/lib/holocene/tab/tab.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import type { HTMLButtonAttributes, HTMLAttributes } from 'svelte/elements';
import { isNull } from '$lib/utilities/is';
import { type TabContext, TABS } from './tabs.svelte';
import { noop } from 'svelte/internal';

type OwnProps = {
label: string;
Expand All @@ -12,6 +13,7 @@
panelId?: string;
disabled?: boolean;
active?: boolean;
onClick?: () => void;
};

type $$Props =
Expand All @@ -24,6 +26,7 @@
export let panelId: string = null;
export let disabled = false;
export let active: boolean = null;
export let onClick: () => void = noop;

const { registerTab, selectTab, activeTab } = getContext<TabContext>(TABS);

Expand All @@ -33,6 +36,7 @@

const handleClick = () => {
selectTab(id);
onClick && onClick();
};
</script>

Expand Down
0