Bổ sung biểu đồ drawio cho trang allocation
This commit is contained in:
parent
281c8ad98a
commit
0ebe4c772e
|
|
@ -1 +1,3 @@
|
|||
VITE_BACKEND_URL=http://localhost:8000/
|
||||
VITE_BACKEND_URL=http://localhost:8000/
|
||||
|
||||
VITE_URL_DRAWIO="https://viewer.diagrams.net/?tags=%7B%7D&lightbox=1&highlight=0000ff&edit=_blank&layers=1&nav=1&title=Test%20Draw.drawio&dark=auto#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1LmB9wCac9DonQPFU-53g1nhI9SfvWuWK%26export%3Ddownload"
|
||||
|
|
@ -10,6 +10,7 @@ import {
|
|||
Popover,
|
||||
Text,
|
||||
Tooltip,
|
||||
Switch,
|
||||
} from '@mantine/core'
|
||||
import { IconInnerShadowTopRightFilled } from '@tabler/icons-react'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
|
@ -80,6 +81,7 @@ const Allocation = () => {
|
|||
const [opened, setOpened] = useState(false)
|
||||
const [issDetail, setIssDetail] = useState('')
|
||||
const [data, setData] = useState<any>({})
|
||||
const [showDrawio, setShowDrawio] = useState(true)
|
||||
|
||||
useEffect(() => {
|
||||
// Check if iframe already exists
|
||||
|
|
@ -88,7 +90,7 @@ const Allocation = () => {
|
|||
|
||||
// Add iframe only if it doesn't exist
|
||||
const iframe = document.createElement('iframe')
|
||||
iframe.src = import.meta.env.VITE_URL_DRAWIO
|
||||
iframe.src = import.meta.env.VITE_URL_DRAWIO ?? ''
|
||||
iframe.style.width = '100%'
|
||||
iframe.style.height = '500px'
|
||||
const drawioDiv = document.getElementById('drawio')
|
||||
|
|
@ -96,7 +98,6 @@ const Allocation = () => {
|
|||
drawioDiv.appendChild(iframe)
|
||||
}
|
||||
|
||||
// Cleanup function to remove iframe when component unmounts
|
||||
return () => {
|
||||
const iframe = document.querySelector('#drawio iframe')
|
||||
if (iframe) {
|
||||
|
|
@ -142,7 +143,14 @@ const Allocation = () => {
|
|||
}, [])
|
||||
return (
|
||||
<div>
|
||||
<div id="drawio"></div>
|
||||
<Box style={{ display: 'flex', alignItems: 'center', margin: '10px' }}>
|
||||
<Switch
|
||||
label="Show Diagram"
|
||||
checked={showDrawio}
|
||||
onChange={(event) => setShowDrawio(event.currentTarget.checked)}
|
||||
/>
|
||||
</Box>
|
||||
<div id="drawio" style={{ display: showDrawio ? 'block' : 'none' }}></div>
|
||||
<div>
|
||||
<Box
|
||||
style={{
|
||||
|
|
|
|||
Loading…
Reference in New Issue