zack commited on
Commit
83e5165
β€’
1 Parent(s): bf114ee

πŸ”„ update: Adjust Dockerfile and frontend components

Browse files
frontend/Dockerfile CHANGED
@@ -5,4 +5,3 @@ RUN npm install
5
  COPY . .
6
  EXPOSE 3000
7
  CMD ["npm", "start"]
8
-
 
5
  COPY . .
6
  EXPOSE 3000
7
  CMD ["npm", "start"]
 
frontend/src/components/Modal/importer.js CHANGED
@@ -1,8 +1,8 @@
1
  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 {ReactComponent as Proxmox} from '../../../src/images/proxmox.svg'
6
  import { useState } from 'react'
7
  import {BsSearch} from 'react-icons/bs';
8
 
 
1
  import { Modal, Icon, Message} from 'semantic-ui-react'
2
+ import {ReactComponent as Gradio} from '../../images/gradio.svg'
3
+ import {ReactComponent as Streamlit} from '../../images/streamlit.svg'
4
+ import {ReactComponent as Exit} from '../../images/exit.svg'
5
+ import {ReactComponent as Proxmox} from '../../images/proxmox.svg'
6
  import { useState } from 'react'
7
  import {BsSearch} from 'react-icons/bs';
8
 
frontend/src/components/Navagation/navbar.js CHANGED
@@ -60,7 +60,8 @@ export default class Navbar extends Component{
60
  const pattern = {
61
  local : new RegExp('^https?://(localhost)(:[0-9]+)?(/)?$'),
62
  share : new RegExp('^https?://(?:[a-zA-Z0-9]+\\.gradio\\.live)/?$'),
63
- huggingFace: new RegExp('^https?://([a-zA-Z0-9-]+\\.hf\\.space)/?$')
 
64
  }
65
 
66
  if (this.state.name.length > 20 ||
@@ -69,7 +70,8 @@ export default class Navbar extends Component{
69
  this.state.text.includes(" ") ||
70
  (!pattern.local.test(this.state.text) &&
71
  !pattern.share.test(this.state.text) &&
72
- !pattern.hugginFace.test(this.state.text))){
 
73
 
74
  this.setState({
75
  'text': '',
@@ -85,6 +87,26 @@ export default class Navbar extends Component{
85
  }).catch((err)=> this.setState({'text': '','name' : '', 'error' : true,}))
86
  }
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  /**
89
  * error check the user input
90
  * @param {*} bool boolean of the current state of the modal
@@ -239,3 +261,4 @@ export default class Navbar extends Component{
239
  </div>)
240
  }
241
  }
 
 
60
  const pattern = {
61
  local : new RegExp('^https?://(localhost)(:[0-9]+)?(/)?$'),
62
  share : new RegExp('^https?://(?:[a-zA-Z0-9]+\\.gradio\\.live)/?$'),
63
+ huggingFace: new RegExp('^https?://([a-zA-Z0-9-]+\\.hf\\.space)/?$'),
64
+ proxmoxVNC: new RegExp('^wss?://([a-zA-Z0-9-]+\\.yourdomain\\.com)/?$') // Regex pattern for Proxmox VNC URLs
65
  }
66
 
67
  if (this.state.name.length > 20 ||
 
70
  this.state.text.includes(" ") ||
71
  (!pattern.local.test(this.state.text) &&
72
  !pattern.share.test(this.state.text) &&
73
+ !pattern.huggingFace.test(this.state.text) &&
74
+ !pattern.proxmoxVNC.test(this.state.text))){
75
 
76
  this.setState({
77
  'text': '',
 
87
  }).catch((err)=> this.setState({'text': '','name' : '', 'error' : true,}))
88
  }
89
 
90
+ /**
91
+ * Render a tab for the Proxmox VNC that can be dragged into React Flow
92
+ */
93
+ renderProxmoxVncTab = () => {
94
+ // Assuming the Proxmox VNC tab information is stored in the state
95
+ const { proxmoxVncInfo } = this.state;
96
+ if (!proxmoxVncInfo) return null; // If no Proxmox VNC info, don't render anything
97
+
98
+ return (
99
+ <li onDragStart={(event) => this.onDragStart(event, 'proxmoxVNC', proxmoxVncInfo, -1)}
100
+ className="text-white text-md flex flex-col text-center items-center cursor-grab shadow-lg p-5 px-2 mt-4 rounded-md hover:animate-pulse"
101
+ draggable>
102
+ <div className="absolute -mt-2 text-4xl opacity-60 z-10">{random_emoji()}</div>
103
+ <h4 className="max-w-full font-sans text-blue-50 leading-tight font-bold text-xl flex-1 z-20" style={{"textShadow": "0px 1px 2px rgba(0, 0, 0, 0.25)"}}>
104
+ Proxmox VNC
105
+ </h4>
106
+ </li>
107
+ );
108
+ }
109
+
110
  /**
111
  * error check the user input
112
  * @param {*} bool boolean of the current state of the modal
 
261
  </div>)
262
  }
263
  }
264
+
frontend/src/components/ReactFlow/ReactFlowEnv.js CHANGED
@@ -67,6 +67,13 @@ export default function ReactEnviorment() {
67
  });
68
  const data = await response.json();
69
  // Use data.iframe_src to create a new node in React Flow
 
 
 
 
 
 
 
70
  };
71
 
72
  const handleAddEmbed = useCallback((embedData) => {
 
67
  });
68
  const data = await response.json();
69
  // Use data.iframe_src to create a new node in React Flow
70
+ const newNode = {
71
+ id: `proxmox-vnc-${nodes.length + 1}`,
72
+ type: 'custom',
73
+ position: reactFlowInstance.project({ x: 0, y: 0 }),
74
+ data: { label: `Proxmox VM ${vmid}`, url: data.iframe_src },
75
+ };
76
+ setNodes((nds) => nds.concat(newNode));
77
  };
78
 
79
  const handleAddEmbed = useCallback((embedData) => {
frontend/src/images/exit.svg DELETED
frontend/src/images/gradio.svg DELETED
frontend/src/images/logo.svg DELETED
frontend/src/images/streamlit.svg DELETED