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
27 changes: 14 additions & 13 deletions src/lib/services/workflow-counts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,18 @@ export const fetchScheduleCount = async ({
namespace: string;
query?: string;
}): Promise<string> => {
try {
const countRoute = routeForApi('schedules.count', { namespace });
const { count } = await requestFromAPI<CountSchedulesResponse>(countRoute, {
params: query ? { query } : {},
notifyOnError: false,
});
return count ?? '0';
} catch (error: unknown) {
if (isNotImplemented(error) || isNotFound(error)) {
return fetchScheduleCountLegacy(namespace, query);
}
throw error;
}
return fetchScheduleCountLegacy(namespace, query);
// try {
// const countRoute = routeForApi('schedules.count', { namespace });
// const { count } = await requestFromAPI<CountSchedulesResponse>(countRoute, {
// params: query ? { query } : {},
// notifyOnError: false,
// });
// return count ?? '0';
// } catch (error: unknown) {
// if (isNotImplemented(error) || isNotFound(error)) {
// return fetchScheduleCountLegacy(namespace, query);
// }
// throw error;
// }
};
4 changes: 2 additions & 2 deletions tests/integration/schedule-edit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { expect, test } from '@playwright/test';
import {
mockScheduleApi,
mockSchedulesApis,
SCHEDULES_COUNT_API,
WORKFLOWS_COUNT_API,
} from '~/test-utilities/mock-apis';

const schedulesUrl = '/namespaces/default/schedules';
Expand All @@ -18,7 +18,7 @@ test.describe('Schedules List with schedules', () => {
test('selects schedule and edits', async ({ page }) => {
await page.goto(schedulesUrl);

await page.waitForResponse(SCHEDULES_COUNT_API);
await page.waitForResponse(WORKFLOWS_COUNT_API);

const createButton = page.getByTestId('create-schedule');
await expect(createButton.first()).toBeEnabled();
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/schedules-list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from '@playwright/test';

import {
mockSchedulesApis,
SCHEDULES_COUNT_API,
WORKFLOWS_COUNT_API,
} from '~/test-utilities/mock-apis';

const schedulesUrl = '/namespaces/default/schedules';
Expand All @@ -17,7 +17,7 @@ test.describe('Schedules List with no schedules', () => {
}) => {
await page.goto(schedulesUrl);

await page.waitForResponse(SCHEDULES_COUNT_API);
await page.waitForResponse(WORKFLOWS_COUNT_API);
const namespace = page.locator('h1');
await expect(namespace).toHaveText('0 Schedules');

Expand All @@ -36,7 +36,7 @@ test.describe('Schedules List with schedules', () => {
}) => {
await page.goto(schedulesUrl);

await page.waitForResponse(SCHEDULES_COUNT_API);
await page.waitForResponse(WORKFLOWS_COUNT_API);
const namespace = page.locator('h1');
await expect(namespace).toHaveText('15 Schedules');

Expand Down
2 changes: 1 addition & 1 deletion tests/test-utilities/mock-apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const mockSchedulesApis = (
mockNamespaceApis(page),
mockSearchAttributesApi(page, customSearchAttributes),
mockSchedulesApi(page, empty),
mockSchedulesCountApi(page, emptySchedulesCount),
mockWorkflowsCountApi(page, emptySchedulesCount),
]);
};

Expand Down
Loading