Skip to content
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
4 changes: 4 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ jobs:
with:
path: ${{ runner.temp }}/changelog

# Pages can list zero artifacts immediately after the upload succeeds.
- name: Wait before deploying to Pages
run: sleep 5

- name: Publish commit history
id: deployment
uses: actions/deploy-pages@v5
55 changes: 10 additions & 45 deletions ui/app/components/BatchDryRunModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -244,42 +244,13 @@
:disabled="paginationBusy"
@update:model-value="changePage(1, $event)"
/>
<UFieldGroup size="sm">
<UButton
color="neutral"
variant="outline"
size="sm"
icon="i-lucide-chevron-left"
aria-label="Previous page"
:disabled="page === 1 || paginationBusy"
@click="changePage(page - 1)"
/>
<USelectMenu
:model-value="page"
:items="pageItems"
value-key="value"
:search-input="{ placeholder: 'Find a page...' }"
virtualize
color="neutral"
variant="outline"
size="sm"
class="min-w-44"
aria-label="Jump to dry-run page"
:disabled="paginationBusy"
@update:model-value="changePage($event)"
>
Page {{ page.toLocaleString('en') }} of {{ pageCount.toLocaleString('en') }}
</USelectMenu>
<UButton
color="neutral"
variant="outline"
size="sm"
icon="i-lucide-chevron-right"
aria-label="Next page"
:disabled="page >= pageCount || paginationBusy"
@click="changePage(page + 1)"
/>
</UFieldGroup>
<PageNavigation
:page="page"
:page-count="pageCount"
jump-label="Jump to dry-run page"
:disabled="paginationBusy"
@change="changePage"
/>
</div>
</nav>
<div class="ml-auto flex flex-wrap justify-end gap-2">
Expand Down Expand Up @@ -342,6 +313,7 @@ import { useStorage } from '@vueuse/core';
import StatusBadge from '~/components/StatusBadge.vue';
import ReasonDisplay from '~/components/ReasonDisplay.vue';
import FileDetailModal from '~/components/FileDetailModal.vue';
import PageNavigation from '~/components/PageNavigation.vue';
import { useFlows } from '~/composables/useFlows';
import { useDialog } from '~/composables/useDialog';
import { useBatchDryRun } from '~/composables/useBatchDryRun';
Expand Down Expand Up @@ -398,12 +370,6 @@ const pageCount = computed(() =>
Math.max(1, Math.ceil((report.value?.pagination.total ?? 0) / pageSize.value)),
);
const statusItems = statusOptions('flow').filter((option) => option.value);
const pageItems = computed(() =>
Array.from({ length: pageCount.value }, (_, index) => ({
label: `Page ${index + 1}`,
value: index + 1,
})),
);
const selectedFlowId = ref<number | undefined>(undefined);
const confirmingCancel = ref(false);
const results = ref<HTMLElement | null>(null);
Expand Down Expand Up @@ -480,7 +446,7 @@ const stopPreviews = (): void => {
closeFileDetail(false);
};
const flowItems = computed(() => flows.value.map((flow) => ({ label: flow.name, value: flow.id })));
const pageSizeItems = [50, 100, 200, 500, 1000].map((value) => ({
const pageSizeItems = [10, 50, 100, 200, 500, 1000].map((value) => ({
label: `${value.toLocaleString('en')} per page`,
value,
}));
Expand Down Expand Up @@ -594,8 +560,7 @@ const run = async (): Promise<void> => {
if (props.open && !disposed && selectedFlow.value && !flowsLoading.value)
await start(selectedFlow.value);
};
const changePage = async (value: number | undefined, size = pageSize.value): Promise<void> => {
if (value === undefined) return;
const changePage = async (value: number, size = pageSize.value): Promise<void> => {
const id = report.value?.id;
const previousPage = page.value;
const previousSize = pageSize.value;
Expand Down
29 changes: 18 additions & 11 deletions ui/app/components/JobList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
:total="total"
:shown="jobs.length"
:disabled="loading || bulkBusy"
@update:limit="updateQuery({ limit: String($event) })"
@update:offset="updateQuery({ offset: String($event) })"
@update:limit="changeLimit($event, position)"
@update:offset="changeOffset($event, position)"
>
<UButton
v-if="jobs.length"
Expand Down Expand Up @@ -103,9 +103,11 @@
:sort-dir="sortDir"
:sort-options="jobSortOptions"
sort-label="Sort jobs"
:filters-active="filtersActive"
:disabled="bulkBusy"
@update:sort-by="updateQuery({ sort_by: $event })"
@update:sort-dir="updateQuery({ sort_dir: $event })"
@clear-filters="updateQuery({ query: '', kind: JOB_FILTER_ALL, status: '' })"
>
<USelectMenu
value-key="value"
Expand Down Expand Up @@ -146,7 +148,7 @@
>
</template>
</ListFilters>
<div class="min-w-0 space-y-4">
<div ref="results" class="min-w-0 scroll-mt-4 space-y-4">
<PaginationControls position="top" />
<div
v-if="loading && !jobs.length"
Expand Down Expand Up @@ -218,6 +220,7 @@ import { useJobRequeue } from '~/composables/useJobRequeue';
import { useLibraries } from '~/composables/useLibraries';
import { useJobs, type BulkJobAction } from '~/composables/useJobs';
import { useFiles } from '~/composables/useFiles';
import { useListPagination } from '~/composables/useListPagination';
import {
applyFileProgress,
applyQueuedFileJob,
Expand Down Expand Up @@ -254,7 +257,13 @@ const [DefinePagination, PaginationControls] = createReusableTemplate<{
const query = ref('');
const kind = ref(JOB_FILTER_ALL);
const statuses = ref<string[]>([]);
const limit = ref(50);
const filtersActive = computed(
() => !!query.value.trim() || kind.value !== JOB_FILTER_ALL || statuses.value.length > 0,
);
const { limit, results, applyRouteLimit, changeLimit, changeOffset } = useListPagination(
props.dashboard ? 'dashboard_jobs_page_size' : 'jobs_page_size',
updateQuery,
);
const offset = ref(0);
const {
items: jobs,
Expand Down Expand Up @@ -569,12 +578,10 @@ const sameManagedQuery = (
values: Record<string, string>,
): boolean => jobQueryKeys.every((key) => source[key] === values[key]);

const updateQuery = async (changes: Record<string, string>): Promise<void> => {
if (bulkBusy.value || ('offset' in changes && loading.value)) return;
await router.replace({
query: updateJobRoute(route.query, changes, statusOptions),
});
};
async function updateQuery(changes: Record<string, string>): Promise<boolean> {
if (bulkBusy.value || ('offset' in changes && loading.value)) return false;
return !(await router.replace({ query: updateJobRoute(route.query, changes, statusOptions) }));
}

const loadJobs = async (): Promise<void> => {
if (bulkBusy.value) return;
Expand Down Expand Up @@ -616,7 +623,7 @@ watch(
sortBy.value = values.sort_by ?? 'created_at';
sortDir.value = (values.sort_dir as 'asc' | 'desc' | undefined) ?? 'desc';
offset.value = Number(values.offset ?? 0);
limit.value = Number(values.limit ?? 50);
applyRouteLimit(values.limit);
if (!sameManagedQuery(current, values)) {
await router.replace({
query: updateJobRoute(current, {}, statusOptions),
Expand Down
13 changes: 13 additions & 0 deletions ui/app/components/ListFilters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
class="w-full sm:min-w-48 sm:flex-1 lg:max-w-md"
/>
<slot />
<UButton
v-if="filtersActive"
color="neutral"
variant="outline"
size="sm"
icon="i-lucide-filter-x"
:disabled="disabled"
@click="emit('clearFilters')"
>
Clear filters
</UButton>
<UDropdownMenu :items="sortItems" :content="{ align: 'end' }" :modal="false">
<UButton
color="neutral"
Expand Down Expand Up @@ -41,11 +52,13 @@ const props = defineProps<{
sortDir: 'asc' | 'desc';
sortOptions: Array<{ label: string; value: string }>;
sortLabel: string;
filtersActive: boolean;
disabled?: boolean;
}>();
const emit = defineEmits<{
'update:sortBy': [value: string];
'update:sortDir': [value: 'asc' | 'desc'];
clearFilters: [];
}>();
const directionIcon = computed(() =>
props.sortDir === 'asc' ? 'i-lucide-arrow-up' : 'i-lucide-arrow-down',
Expand Down
57 changes: 9 additions & 48 deletions ui/app/components/ListPagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,50 +24,22 @@
:disabled="disabled"
@update:model-value="(value) => value !== undefined && emit('update:limit', value)"
/>
<UFieldGroup size="sm" class="min-w-0 basis-64 grow sm:basis-auto sm:grow-0">
<UButton
color="neutral"
variant="outline"
size="sm"
icon="i-lucide-chevron-left"
aria-label="Previous page"
:disabled="offset === 0 || disabled"
@click="changePage(currentPage - 1)"
/>
<USelectMenu
:model-value="currentPage"
:items="pageItems"
value-key="value"
:search-input="{ placeholder: 'Find a page...' }"
virtualize
color="neutral"
variant="outline"
size="sm"
class="min-w-0 flex-1 sm:min-w-40"
:aria-label="`Jump to ${label.toLowerCase()} page`"
:disabled="disabled"
@update:model-value="changePage"
>
Page {{ currentPage.toLocaleString('en') }} of
{{ pageCount.toLocaleString('en') }}
</USelectMenu>
<UButton
color="neutral"
variant="outline"
size="sm"
icon="i-lucide-chevron-right"
aria-label="Next page"
:disabled="offset + limit >= total || disabled"
@click="changePage(currentPage + 1)"
/>
</UFieldGroup>
<PageNavigation
class="basis-64 grow sm:basis-auto sm:grow-0"
:page="currentPage"
:page-count="pageCount"
:jump-label="`Jump to ${label.toLowerCase()} page`"
:disabled="disabled"
@change="emit('update:offset', ($event - 1) * limit)"
/>
</div>
<slot name="footer" />
</nav>
</template>

<script setup lang="ts">
import { computed } from 'vue';
import PageNavigation from '~/components/PageNavigation.vue';
import { LIST_PAGE_SIZES } from '~/utils/listPagination';

const props = defineProps<{
Expand All @@ -89,15 +61,4 @@ const pageSizeItems: Array<{ label: string; value: number }> = LIST_PAGE_SIZES.m
}));
const currentPage = computed(() => Math.floor(props.offset / props.limit) + 1);
const pageCount = computed(() => Math.max(1, Math.ceil(props.total / props.limit)));
const pageItems = computed(() =>
Array.from({ length: pageCount.value }, (_, index) => ({
label: `Page ${index + 1}`,
value: index + 1,
})),
);
const changePage = (value: number | undefined): void => {
if (value === undefined || props.disabled) return;
const selected = Math.min(pageCount.value, Math.max(1, value));
emit('update:offset', (selected - 1) * props.limit);
};
</script>
Loading