Skip to content

Commit

Permalink
chore: add delete button for scheduled backups (#37)
Browse files Browse the repository at this point in the history
* chore: add delete button for scheduled backups

* chore: add delete button for scheduled backup
  • Loading branch information
fuziontech authored Sep 1, 2023
1 parent e4a1f3d commit d55bec5
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 44 deletions.
8 changes: 4 additions & 4 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"dependencies": {
"@ant-design/charts": "^1.4.2",
"@ant-design/icons": "^5.2.0",
"antd": "^5.0.0",
"prismjs": "^1.29.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand All @@ -19,10 +18,11 @@
"@types/jest": "^27.5.2",
"@types/lodash": "^4.14.192",
"@types/node": "^16.18.22",
"@types/react": "^18.0.31",
"@types/react-dom": "^18.0.11",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@types/react-router-dom": "5.3.3",
"@types/uuid": "^9.0.1"
"@types/uuid": "^9.0.1",
"icons": "link:@types/ant-design/icons"
},
"scripts": {
"start": "react-scripts start",
Expand Down
80 changes: 40 additions & 40 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions frontend/src/pages/Backups/ScheduledBackups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'
import { usePollingEffect } from '../../utils/usePollingEffect'
import { ColumnType } from 'antd/es/table'
import { Switch, Select, Table, Button, Form, Input, Modal, Tag, Col, Progress, Row, Tooltip, notification } from 'antd'
import { DeleteOutlined } from '@ant-design/icons'
import { Clusters } from '../Clusters/Clusters'

interface ScheduleRow {
Expand Down Expand Up @@ -133,6 +134,32 @@ export default function ScheduledBackups() {
{ title: 'Bucket', dataIndex: 'bucket' },
{ title: 'Path', dataIndex: 'path' },
{ title: 'Created At', dataIndex: 'created_at' },
{
title: '',
dataIndex: 'id',
render: id => {
const deleteBackup = async () => {
try {
const res = await fetch(`/api/scheduled_backups/${id}`, {
method: 'DELETE',
})
loadData()
return await res.text()
} catch (error) {
console.log(error)
notification.error({
message: 'Failed to delete backup',
})
}
}

return (
<a id={id} onClick={deleteBackup}>
<DeleteOutlined rev={undefined} />
</a>
)
},
},
]

usePollingEffect(
Expand Down

0 comments on commit d55bec5

Please sign in to comment.