diff --git a/cypress/e2e/job/preheats/create-preheat.cy.ts b/cypress/e2e/job/preheats/create-preheat.cy.ts index 70b2f6d3..cf292e67 100644 --- a/cypress/e2e/job/preheats/create-preheat.cy.ts +++ b/cypress/e2e/job/preheats/create-preheat.cy.ts @@ -21,7 +21,7 @@ describe('Create preheat', () => { cy.intercept( { method: 'GET', - url: '/api/v1/jobs?page=1&per_page=10', + url: '/api/v1/jobs?page=1&per_page=10&type=preheat', }, (req) => { req.reply((res: any) => { @@ -77,7 +77,7 @@ describe('Create preheat', () => { cy.intercept( { method: 'GET', - url: '/api/v1/jobs?page=1&per_page=10', + url: '/api/v1/jobs?page=1&per_page=10&type=preheat', }, (req) => { req.reply((res: any) => { @@ -171,7 +171,7 @@ describe('Create preheat', () => { cy.intercept( { method: 'GET', - url: '/api/v1/jobs?page=1&per_page=10', + url: '/api/v1/jobs?page=1&per_page=10&type=preheat', }, (req) => { req.reply((res: any) => { diff --git a/cypress/e2e/job/preheats/preheat.cy.ts b/cypress/e2e/job/preheats/preheat.cy.ts index 60c9b986..7ee85369 100644 --- a/cypress/e2e/job/preheats/preheat.cy.ts +++ b/cypress/e2e/job/preheats/preheat.cy.ts @@ -12,7 +12,7 @@ describe('Preheat', () => { cy.intercept( { method: 'GET', - url: '/api/v1/jobs?page=1&per_page=10', + url: '/api/v1/jobs?page=1&per_page=10&type=preheat', }, (req) => { req.reply((res: any) => { diff --git a/cypress/e2e/job/preheats/preheats.cy.ts b/cypress/e2e/job/preheats/preheats.cy.ts index 13778207..7bcf5207 100644 --- a/cypress/e2e/job/preheats/preheats.cy.ts +++ b/cypress/e2e/job/preheats/preheats.cy.ts @@ -13,7 +13,7 @@ describe('Preheats', () => { cy.intercept( { method: 'GET', - url: '/api/v1/jobs?page=1&per_page=10', + url: '/api/v1/jobs?page=1&per_page=10&type=preheat', }, (req) => { req.reply((res: any) => { @@ -28,7 +28,7 @@ describe('Preheats', () => { cy.intercept( { method: 'GET', - url: '/api/v1/jobs?page=2&per_page=10', + url: '/api/v1/jobs?page=2&per_page=10&type=preheat', }, (req) => { req.reply((res: any) => { @@ -52,7 +52,7 @@ describe('Preheats', () => { cy.intercept( { method: 'GET', - url: '/api/v1/jobs?page=1&per_page=10', + url: '/api/v1/jobs?page=1&per_page=10&type=preheat', }, (req) => { req.reply((res: any) => { @@ -115,7 +115,7 @@ describe('Preheats', () => { cy.intercept( { method: 'GET', - url: '/api/v1/jobs?page=1&per_page=10&state=SUCCESS', + url: '/api/v1/jobs?page=1&per_page=10&state=SUCCESS&type=preheat', }, (req) => { req.reply((res: any) => { @@ -141,7 +141,7 @@ describe('Preheats', () => { cy.intercept( { method: 'GET', - url: '/api/v1/jobs?page=1&per_page=10&state=FAILURE', + url: '/api/v1/jobs?page=1&per_page=10&state=FAILURE&type=preheat', }, (req) => { req.reply((res: any) => { @@ -167,7 +167,7 @@ describe('Preheats', () => { cy.intercept( { method: 'GET', - url: '/api/v1/jobs?page=1&per_page=10&state=PENDING', + url: '/api/v1/jobs?page=1&per_page=10&state=PENDING&type=preheat', }, (req) => { req.reply((res: any) => { @@ -199,7 +199,7 @@ describe('Preheats', () => { cy.intercept( { method: 'GET', - url: '/api/v1/jobs?page=1&per_page=10&state=PENDING', + url: '/api/v1/jobs?page=1&per_page=10&state=PENDING&type=preheat', }, (req) => { req.reply({ @@ -220,7 +220,7 @@ describe('Preheats', () => { cy.intercept( { method: 'GET', - url: '/api/v1/jobs?page=1&per_page=10', + url: '/api/v1/jobs?page=1&per_page=10&type=preheat', }, (req) => { req.reply((res: any) => { @@ -245,7 +245,7 @@ describe('Preheats', () => { cy.intercept( { method: 'GET', - url: '/api/v1/jobs?page=1&per_page=10', + url: '/api/v1/jobs?page=1&per_page=10&type=preheat', }, (req) => { req.reply({ diff --git a/src/components/job/preheats/index.tsx b/src/components/job/preheats/index.tsx index aca05bce..f0eb1ba6 100644 --- a/src/components/job/preheats/index.tsx +++ b/src/components/job/preheats/index.tsx @@ -129,8 +129,7 @@ export default function Preheats() { const changeStatus = (event: any) => { setStatus(event.target.value); - setShouldPoll(true); - setPreheatPage(1); + navigate(`/jobs/preheats`); }; const handleClose = (_event: any, reason?: string) => { diff --git a/src/lib/api.ts b/src/lib/api.ts index a0db824d..f542e112 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -393,7 +393,10 @@ interface updateSchedulerFeatruesRequset { features: Array; } -export async function updateSchedulerFeatrues(id: string,request: updateSchedulerFeatruesRequset,): Promise { +export async function updateSchedulerFeatrues( + id: string, + request: updateSchedulerFeatruesRequset, +): Promise { const url = new URL(`/api/v1/schedulers/${id}`, API_URL); const response = await patch(url, request); return await response.json(); @@ -712,10 +715,8 @@ interface getJobsResponse { total_page?: number; } -export async function getJobs(params?: getJobsParams): Promise { - const url = params - ? new URL(`/api/v1/jobs?${queryString.stringify(params)}`, API_URL) - : new URL('/api/v1/jobs', API_URL); +export async function getJobs(params: getJobsParams): Promise { + const url = new URL(`/api/v1/jobs?${queryString.stringify(params)}&type=preheat`, API_URL); const response = await get(url); const data = await response.json();