Skip to content

Commit 3d2a7f2

Browse files
committed
update playwright fixes for finetuning
Signed-off-by: wwanarif <[email protected]>
1 parent 939d65c commit 3d2a7f2

File tree

4 files changed

+42
-16
lines changed

4 files changed

+42
-16
lines changed

studio-frontend/packages/ui/src/views/finetuning/FinetuningJobsTable.jsx

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ const FinetuningJobsTable = ({ data, isLoading = false, onRefresh = null, filter
124124
const [logsOpen, setLogsOpen] = useState(false)
125125
const [logsData, setLogsData] = useState('')
126126
const [logsLoading, setLogsLoading] = useState(false)
127+
const [deleteConfirmOpen, setDeleteConfirmOpen] = useState(false)
127128
const logsContainerRef = useRef(null)
128129

129130
// Auto-refresh logs every 3 seconds when logs dialog is open
@@ -687,18 +688,7 @@ const FinetuningJobsTable = ({ data, isLoading = false, onRefresh = null, filter
687688
<MenuItem
688689
onClick={async () => {
689690
if (!selectedJob) return
690-
if (!window.confirm('Are you sure you want to delete this job?')) return
691-
setActionLoading(true)
692-
try {
693-
await finetuningApi.deleteJob(selectedJob.id)
694-
handleMenuClose()
695-
if (onRefresh) onRefresh()
696-
} catch (error) {
697-
console.error('Error deleting job:', error)
698-
alert('Failed to delete job: ' + (error.message || 'Unknown error'))
699-
} finally {
700-
setActionLoading(false)
701-
}
691+
setDeleteConfirmOpen(true)
702692
}}
703693
disabled={actionLoading}
704694
>
@@ -768,6 +758,43 @@ const FinetuningJobsTable = ({ data, isLoading = false, onRefresh = null, filter
768758
</Button>
769759
</DialogActions>
770760
</Dialog>
761+
762+
{/* Delete Confirmation Dialog */}
763+
<Dialog open={deleteConfirmOpen} onClose={() => setDeleteConfirmOpen(false)} maxWidth="xs" fullWidth>
764+
<DialogTitle>Delete Job</DialogTitle>
765+
<DialogContent>
766+
<Typography variant="body2">
767+
Are you sure you want to delete this job? This action cannot be undone.
768+
</Typography>
769+
</DialogContent>
770+
<DialogActions>
771+
<Button onClick={() => setDeleteConfirmOpen(false)}>
772+
Cancel
773+
</Button>
774+
<Button
775+
onClick={async () => {
776+
if (!selectedJob) return
777+
setActionLoading(true)
778+
try {
779+
await finetuningApi.deleteJob(selectedJob.id)
780+
setDeleteConfirmOpen(false)
781+
handleMenuClose()
782+
if (onRefresh) onRefresh()
783+
} catch (error) {
784+
console.error('Error deleting job:', error)
785+
alert('Failed to delete job: ' + (error.message || 'Unknown error'))
786+
} finally {
787+
setActionLoading(false)
788+
}
789+
}}
790+
color="error"
791+
variant="contained"
792+
disabled={actionLoading}
793+
>
794+
Delete
795+
</Button>
796+
</DialogActions>
797+
</Dialog>
771798
</>
772799
)
773800
}

tests/playwright/studio-e2e/005_test_funetuning_rerank.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ test('005_test_funetuning_rerank', async ({ browser, baseURL }) => {
6464

6565
await page.locator('button').nth(5).click();
6666
await page.getByRole('menuitem', { name: 'Delete Job' }).click();
67-
67+
await page.getByRole('button', { name: 'Delete', exact: true }).click();
6868
});

tests/playwright/studio-e2e/006_test_funetuning_embedding.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ test('006_test_funetuning_embedding', async ({ browser, baseURL }) => {
6464

6565
await page.locator('button').nth(5).click();
6666
await page.getByRole('menuitem', { name: 'Delete Job' }).click();
67-
67+
await page.getByRole('button', { name: 'Delete', exact: true }).click();
6868
});

tests/playwright/studio-e2e/007_test_funetuning_reasoning.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,5 @@ test('007_test_funetuning_reasoning', async ({ browser, baseURL }) => {
6464

6565
await page.locator('button').nth(5).click();
6666
await page.getByRole('menuitem', { name: 'Delete Job' }).click();
67-
68-
67+
await page.getByRole('button', { name: 'Delete', exact: true }).click();
6968
});

0 commit comments

Comments
 (0)