LucaVivona commited on
Commit
98da231
β€’
1 Parent(s): c2ebfb9

fix error handel with props

Browse files
README.md CHANGED
@@ -120,8 +120,12 @@ def InterLauncher(name, interface, listen=2000, **kwargs):
120
 
121
  ### Frontend πŸ–₯️
122
  - Node Menu
 
 
123
  - Dynamic adjust the size of node
 
124
  - Delete node Button
 
125
  - Link to gradio to host it in seprate tab
126
  - Refresh Button to refresh the iframe if need be
127
  - fixed some bugs from ``+ button`` for catching errors and wrong inputs
@@ -130,6 +134,7 @@ def InterLauncher(name, interface, listen=2000, **kwargs):
130
  - Examples: (https://hf.space/embed/marcop/musika/+, https://hf.space/embed/stabilityai/stable-diffusion/+)
131
 
132
 
 
133
  ![Node Menu](images/new_feature.png)
134
 
135
  ### In The Works 🚧
 
120
 
121
  ### Frontend πŸ–₯️
122
  - Node Menu
123
+ - Save Board Button
124
+ - When the pages refreshes it loads the last saved board
125
  - Dynamic adjust the size of node
126
+ - Draggable bottom to expand height
127
  - Delete node Button
128
+ - Delete All Nodes if removed from Gradio-Flow
129
  - Link to gradio to host it in seprate tab
130
  - Refresh Button to refresh the iframe if need be
131
  - fixed some bugs from ``+ button`` for catching errors and wrong inputs
 
134
  - Examples: (https://hf.space/embed/marcop/musika/+, https://hf.space/embed/stabilityai/stable-diffusion/+)
135
 
136
 
137
+
138
  ![Node Menu](images/new_feature.png)
139
 
140
  ### In The Works 🚧
frontend/src/components/Navagation/navbar.js CHANGED
@@ -12,15 +12,15 @@ export default class Navbar extends Component{
12
  this.deleteNode = props.onDelete
13
  this.state = {open : true,
14
  menu : [],
15
- colour : props.colour,
16
  text : "",
17
  name : "",
18
- emoji : props.emoji,
19
  mode : false,
20
  modal : false,
21
  error : false
22
  }
23
- this.fetch_classes()
24
  }
25
 
26
 
@@ -161,10 +161,6 @@ export default class Navbar extends Component{
161
  * @param {*} d integer variable of the diffence between the current menu and new menu updated ment
162
  */
163
  hanelTabs = (e, d) => {
164
- if (e.length === this.state.colour.length){
165
- this.setState({open : this.state.open, menu : e, text: this.state.text, name: this.state.name, colour : this.state.colour, emoji : this.state.emoji, error : this.state.error, modal : this.state.modal })
166
- return
167
- }
168
  // if less then 0 we must remove colour's and emoji's
169
  // get index of the object
170
  // remove
@@ -181,7 +177,6 @@ export default class Navbar extends Component{
181
  this.setState({open : this.state.open, menu : e, text: this.state.text, name: this.state.name, colour : c, emoji : j, error : this.state.error, modal : this.state.modal })
182
  }else{
183
  //append new colours
184
-
185
  for(var i =0; i < d; i++){
186
  c.push(random_colour(i === 0 ? null : c[i-1]));
187
  j.push(random_emoji(i === 0 ? null : c[i-1]));
@@ -216,12 +211,12 @@ export default class Navbar extends Component{
216
  subComponents(item, index){
217
 
218
  return(<>
219
- <li key={`${item.name}-${item.port}`} onDragStart={(event) => this.onDragStart(event, 'custom', item, index)}
220
  className={` text-white text-md flex flex-col text-center items-center cursor-grab shadow-lg
221
  p-5 px-2 mt-4 rounded-md ${ this.state.open ? `hover:animate-pulse ${this.state.colour[index] === null ? "" : this.state.colour[index]} ` : `hidden`} break-all -z-20`} draggable>
222
 
223
- <div className=" absolute -mt-2 text-4xl opacity-60 z-10 ">{`${this.state.emoji[index] === null ? "" : this.state.emoji[index]}`}</div>
224
- <h4 className={` max-w-full font-sans text-blue-50 leading-tight font-bold text-xl flex-1 z-20 ${this.state.open ? "" : "hidden"}`} style={{"textShadow" : "0px 1px 2px rgba(0, 0, 0, 0.25)"}} >{`${item.name}`} </h4>
225
 
226
  </li >
227
 
@@ -230,6 +225,7 @@ export default class Navbar extends Component{
230
 
231
 
232
  render(){
 
233
  return (<div>
234
 
235
  <div className={`z-10 flex-1 float-left bg-white dark:bg-stone-900 h-screen p-5 pt-8 ${this.state.open ? "lg:w-72 md:64 sm:w-60" : "w-10"} duration-300 absolute shadow-2xl border-black border-r-[1px] dark:border-white dark:text-white`}>
@@ -295,14 +291,14 @@ export default class Navbar extends Component{
295
  <br/>
296
  <h1 className=" underline pb-3 font-bold text-lg">πŸ€” Possible Things That could of happen <br/></h1>
297
  <ul className="font-bold">
298
- <li>- The input was empty</li>
299
- <li>- The connection was forbidden</li>
300
- <li>- The name was already taken</li>
301
- <li>- The link you gave did not pass the regex</li>
302
  <ul className="px-6">
303
- <li>- http://localhost:xxxx</li>
304
- <li>- http://xxxxx.gradio.app</li>
305
- <li>- https://hf.space/embed/$user/$space_name/+</li>
306
  </ul>
307
  <li>- link already exist within the menu</li>
308
  </ul>
 
12
  this.deleteNode = props.onDelete
13
  this.state = {open : true,
14
  menu : [],
15
+ colour : props.colour || [],
16
  text : "",
17
  name : "",
18
+ emoji : props.emoji || [],
19
  mode : false,
20
  modal : false,
21
  error : false
22
  }
23
+
24
  }
25
 
26
 
 
161
  * @param {*} d integer variable of the diffence between the current menu and new menu updated ment
162
  */
163
  hanelTabs = (e, d) => {
 
 
 
 
164
  // if less then 0 we must remove colour's and emoji's
165
  // get index of the object
166
  // remove
 
177
  this.setState({open : this.state.open, menu : e, text: this.state.text, name: this.state.name, colour : c, emoji : j, error : this.state.error, modal : this.state.modal })
178
  }else{
179
  //append new colours
 
180
  for(var i =0; i < d; i++){
181
  c.push(random_colour(i === 0 ? null : c[i-1]));
182
  j.push(random_emoji(i === 0 ? null : c[i-1]));
 
211
  subComponents(item, index){
212
 
213
  return(<>
214
+ <li key={`${index}-li`} onDragStart={(event) => this.onDragStart(event, 'custom', item, index)}
215
  className={` text-white text-md flex flex-col text-center items-center cursor-grab shadow-lg
216
  p-5 px-2 mt-4 rounded-md ${ this.state.open ? `hover:animate-pulse ${this.state.colour[index] === null ? "" : this.state.colour[index]} ` : `hidden`} break-all -z-20`} draggable>
217
 
218
+ <div key={`${index}-div`} className=" absolute -mt-2 text-4xl opacity-60 z-10 ">{`${this.state.emoji[index] === null ? "" : this.state.emoji[index]}`}</div>
219
+ <h4 key={`${index}-h4`} className={` max-w-full font-sans text-blue-50 leading-tight font-bold text-xl flex-1 z-20 ${this.state.open ? "" : "hidden"}`} style={{"textShadow" : "0px 1px 2px rgba(0, 0, 0, 0.25)"}} >{`${item.name}`} </h4>
220
 
221
  </li >
222
 
 
225
 
226
 
227
  render(){
228
+ this.fetch_classes()
229
  return (<div>
230
 
231
  <div className={`z-10 flex-1 float-left bg-white dark:bg-stone-900 h-screen p-5 pt-8 ${this.state.open ? "lg:w-72 md:64 sm:w-60" : "w-10"} duration-300 absolute shadow-2xl border-black border-r-[1px] dark:border-white dark:text-white`}>
 
291
  <br/>
292
  <h1 className=" underline pb-3 font-bold text-lg">πŸ€” Possible Things That could of happen <br/></h1>
293
  <ul className="font-bold">
294
+ <li key={"error_1"}>- The input was empty</li>
295
+ <li key={"error_2"}>- The connection was forbidden</li>
296
+ <li key={"error_3"}>- The name was already taken</li>
297
+ <li key={"error_4"}>- The link you gave did not pass the regex</li>
298
  <ul className="px-6">
299
+ <li key={"error_5"}>- http://localhost:xxxx</li>
300
+ <li key={"error_6"}>- http://xxxxx.gradio.app</li>
301
+ <li key={"error_7"}>- https://hf.space/embed/$user/$space_name/+</li>
302
  </ul>
303
  <li>- link already exist within the menu</li>
304
  </ul>
makefile CHANGED
@@ -12,5 +12,5 @@ wipe:
12
  make down && make rm
13
  build:
14
  docker compose build
15
- environment:
16
  docker exec -it backend bash
 
12
  make down && make rm
13
  build:
14
  docker compose build
15
+ env:
16
  docker exec -it backend bash