mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 13:00:56 +03:00
add current version
This commit is contained in:
@@ -4,18 +4,7 @@ import PropTypes from 'prop-types'
|
||||
import { Dialog, DialogContent, DialogTitle, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Paper } from '@mui/material'
|
||||
import moment from 'moment'
|
||||
import axios from 'axios'
|
||||
|
||||
const fetchLatestVer = async ({ api }) => {
|
||||
let apiReturn = await axios
|
||||
.get(api)
|
||||
.then(async function (response) {
|
||||
return response.data
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.error(error)
|
||||
})
|
||||
return apiReturn
|
||||
}
|
||||
import { baseURL } from 'store/constant'
|
||||
|
||||
const AboutDialog = ({ show, onCancel }) => {
|
||||
const portalElement = document.getElementById('portal')
|
||||
@@ -24,12 +13,30 @@ const AboutDialog = ({ show, onCancel }) => {
|
||||
|
||||
useEffect(() => {
|
||||
if (show) {
|
||||
const fetchData = async (api) => {
|
||||
let response = await fetchLatestVer({ api })
|
||||
setData(response)
|
||||
}
|
||||
const username = localStorage.getItem('username')
|
||||
const password = localStorage.getItem('password')
|
||||
|
||||
fetchData('https://api.github.com/repos/FlowiseAI/Flowise/releases/latest')
|
||||
const config = {}
|
||||
if (username && password) {
|
||||
config.auth = {
|
||||
username,
|
||||
password
|
||||
}
|
||||
}
|
||||
const latestReleaseReq = axios.get('https://api.github.com/repos/FlowiseAI/Flowise/releases/latest')
|
||||
const currentVersionReq = axios.get(`${baseURL}/api/v1/version`, { ...config })
|
||||
|
||||
Promise.all([latestReleaseReq, currentVersionReq])
|
||||
.then(([latestReleaseData, currentVersionData]) => {
|
||||
const finalData = {
|
||||
...latestReleaseData.data,
|
||||
currentVersion: currentVersionData.data.version
|
||||
}
|
||||
setData(finalData)
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error fetching data:', error)
|
||||
})
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
@@ -53,12 +60,16 @@ const AboutDialog = ({ show, onCancel }) => {
|
||||
<Table aria-label='simple table'>
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell>Current Version</TableCell>
|
||||
<TableCell>Latest Version</TableCell>
|
||||
<TableCell>Published At</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
<TableRow sx={{ '&:last-child td, &:last-child th': { border: 0 } }}>
|
||||
<TableCell component='th' scope='row'>
|
||||
{data.currentVersion}
|
||||
</TableCell>
|
||||
<TableCell component='th' scope='row'>
|
||||
<a target='_blank' rel='noreferrer' href={data.html_url}>
|
||||
{data.name}
|
||||
|
||||
Reference in New Issue
Block a user