Spaces:
Configuration error
Configuration error
zack
commited on
Commit
·
ac09650
1
Parent(s):
8571aa7
🔧 Modify importer component
Browse files
frontend/src/components/Modal/importer.js
CHANGED
|
@@ -2,12 +2,21 @@ import { Modal, Icon, Message} from 'semantic-ui-react'
|
|
| 2 |
import {ReactComponent as Gradio} from '../../../src/images/gradio.svg'
|
| 3 |
import {ReactComponent as Streamlit} from '../../../src/images/streamlit.svg'
|
| 4 |
import {ReactComponent as Exit} from '../../../src/images/exit.svg'
|
|
|
|
| 5 |
import { useState } from 'react'
|
| 6 |
import {BsSearch} from 'react-icons/bs';
|
| 7 |
|
| 8 |
export default function Import(props){
|
| 9 |
const [tab, setTab] = useState("gradio")
|
| 10 |
const [subTab, setSubTab] = useState(0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
return (<div>
|
| 13 |
<Modal
|
|
@@ -28,6 +37,11 @@ export default function Import(props){
|
|
| 28 |
props.catch ? props.handelError(false) : props.handelError(props.catch) }}>
|
| 29 |
<button id="services-tab" data-tabs-target="#Streamlit" type="button" role="tab" aria-controls="services" aria-selected="false" className={`inline-block p-4 rounded-tl-lg ${ tab === "streamlit" ? 'bg-gray-200' : 'hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700 focus:bg-gray-700'}`}><Streamlit className=" w-20 h-10"/></button>
|
| 30 |
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
</ul>
|
| 32 |
<div className='absolute right-5 top-5 z-20 mr-5'
|
| 33 |
onClick={()=>{
|
|
@@ -83,7 +97,42 @@ export default function Import(props){
|
|
| 83 |
<Shared type="streamlit" textHandler={props.textHandler} appendHandler={props.appendHandler} handelError={props.handelError} catch={props.catch}/>
|
| 84 |
</div>
|
| 85 |
}
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
</Modal>
|
| 88 |
</div>)
|
| 89 |
}
|
|
|
|
| 2 |
import {ReactComponent as Gradio} from '../../../src/images/gradio.svg'
|
| 3 |
import {ReactComponent as Streamlit} from '../../../src/images/streamlit.svg'
|
| 4 |
import {ReactComponent as Exit} from '../../../src/images/exit.svg'
|
| 5 |
+
import {ReactComponent as Proxmox} from '../../../src/images/proxmox.svg'
|
| 6 |
import { useState } from 'react'
|
| 7 |
import {BsSearch} from 'react-icons/bs';
|
| 8 |
|
| 9 |
export default function Import(props){
|
| 10 |
const [tab, setTab] = useState("gradio")
|
| 11 |
const [subTab, setSubTab] = useState(0)
|
| 12 |
+
const [embedUrl, setEmbedUrl] = useState("");
|
| 13 |
+
const [vmid, setVmid] = useState('');
|
| 14 |
+
const [node, setNode] = useState('');
|
| 15 |
+
|
| 16 |
+
const handleProxmoxSubmit = async (e) => {
|
| 17 |
+
e.preventDefault();
|
| 18 |
+
props.onAddProxmoxVnc({ vmid, node });
|
| 19 |
+
};
|
| 20 |
|
| 21 |
return (<div>
|
| 22 |
<Modal
|
|
|
|
| 37 |
props.catch ? props.handelError(false) : props.handelError(props.catch) }}>
|
| 38 |
<button id="services-tab" data-tabs-target="#Streamlit" type="button" role="tab" aria-controls="services" aria-selected="false" className={`inline-block p-4 rounded-tl-lg ${ tab === "streamlit" ? 'bg-gray-200' : 'hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700 focus:bg-gray-700'}`}><Streamlit className=" w-20 h-10"/></button>
|
| 39 |
</li>
|
| 40 |
+
<li className="" onClick={()=>{
|
| 41 |
+
setTab("proxmox")
|
| 42 |
+
props.catch ? props.handelError(false) : props.handelError(props.catch) }}>
|
| 43 |
+
<button id="proxmox-tab" data-tabs-target="#Proxmox" type="button" role="tab" aria-controls="proxmox" aria-selected={tab === "proxmox" ? "true" : "false"} className={`inline-block p-4 rounded-tl-lg ${ tab === "proxmox" ? 'bg-gray-200' : 'hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700 focus:bg-gray-700'}`}><Proxmox className=" w-20 h-10"/></button>
|
| 44 |
+
</li>
|
| 45 |
</ul>
|
| 46 |
<div className='absolute right-5 top-5 z-20 mr-5'
|
| 47 |
onClick={()=>{
|
|
|
|
| 97 |
<Shared type="streamlit" textHandler={props.textHandler} appendHandler={props.appendHandler} handelError={props.handelError} catch={props.catch}/>
|
| 98 |
</div>
|
| 99 |
}
|
| 100 |
+
{ tab === "proxmox" &&
|
| 101 |
+
<div className='w-full bg-white'>
|
| 102 |
+
<form onSubmit={handleProxmoxSubmit} className="p-5">
|
| 103 |
+
<input
|
| 104 |
+
type="text"
|
| 105 |
+
placeholder="VM ID"
|
| 106 |
+
className="input input-bordered input-primary w-full max-w-xs"
|
| 107 |
+
value={vmid}
|
| 108 |
+
onChange={(e) => setVmid(e.target.value)}
|
| 109 |
+
/>
|
| 110 |
+
<input
|
| 111 |
+
type="text"
|
| 112 |
+
placeholder="Node"
|
| 113 |
+
className="input input-bordered input-primary w-full max-w-xs mt-2"
|
| 114 |
+
value={node}
|
| 115 |
+
onChange={(e) => setNode(e.target.value)}
|
| 116 |
+
/>
|
| 117 |
+
<button className="btn btn-primary mt-2" type="submit">
|
| 118 |
+
Create Proxmox VNC
|
| 119 |
+
</button>
|
| 120 |
+
</form>
|
| 121 |
+
</div>
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
<div className='embed-form p-5'>
|
| 125 |
+
<input
|
| 126 |
+
type="text"
|
| 127 |
+
placeholder="Embed URL"
|
| 128 |
+
className="input input-bordered input-primary w-full max-w-xs"
|
| 129 |
+
value={embedUrl}
|
| 130 |
+
onChange={(e) => setEmbedUrl(e.target.value)}
|
| 131 |
+
/>
|
| 132 |
+
<button className="btn btn-primary mt-2" onClick={() => props.onAddEmbed({ url: embedUrl, type: 'embed' })}>
|
| 133 |
+
Add Embed
|
| 134 |
+
</button>
|
| 135 |
+
</div>
|
| 136 |
</Modal>
|
| 137 |
</div>)
|
| 138 |
}
|