mirror of
				https://github.com/gnh1201/welsonjs.git
				synced 2025-10-25 01:51:16 +00:00 
			
		
		
		
	fix
This commit is contained in:
		
							parent
							
								
									3bd2e748c7
								
							
						
					
					
						commit
						fa788ce964
					
				
							
								
								
									
										57
									
								
								app/index.js
									
									
									
									
									
								
							
							
						
						
									
										57
									
								
								app/index.js
									
									
									
									
									
								
							|  | @ -9,23 +9,61 @@ var HTTP = require("lib/http"); | |||
| var apiUrl = CONFIG.readConfig("/Config/ApiUrl").first().text; | ||||
| var token, userId; | ||||
| 
 | ||||
| var getAssignedServers = function() { | ||||
|     var assignedServers = []; | ||||
| 
 | ||||
|     var req = HTTP.get(apiUrl + "/netsolid/items/assignedservers", "", { | ||||
|         "Content-Type": "application/x-www-form-urlencoded", | ||||
|         "Authorization": "bearer " + token, | ||||
|         //"Pragma": "no-cache",
 | ||||
|         //"Cache-Control": "no-cache",
 | ||||
|         "If-Modified-Since": "Sat, 1 Jan 2000 00:00:00 GMT" | ||||
|     }); | ||||
|      | ||||
|     var res = JSON.parse(req.responseText); | ||||
| 
 | ||||
|     for (var i = 0; i < res.data.length; i++) { | ||||
|         if (res.data[i].assigned_to == userId) { | ||||
|             assignedServers.push(res.data[i].server); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     return assignedServers; | ||||
| }; | ||||
| 
 | ||||
| var showServers = function() { | ||||
|     OldBrowser.setContent(FILE.readFile("app\\servers.html", "utf-8")); | ||||
| 
 | ||||
|     var req = HTTP.get(apiUrl + "/netsolid/items/assignedservers", "filter[assigned_to][eq]=" + userId, { | ||||
|     var assignedServers = getAssignedServers(); | ||||
|     var req = HTTP.get(apiUrl + "/netsolid/items/servers", "", { | ||||
|         "Content-Type": "application/x-www-form-urlencoded", | ||||
|         "Authorization": "bearer " + token | ||||
|     }); | ||||
|      | ||||
|     alert(req.responseText); | ||||
| 
 | ||||
|     /* | ||||
|     var res = JSON.parse(req.responseText); | ||||
|     var template = $("#listview .template"); | ||||
| 
 | ||||
|     for(var i = 0; i < res.data.length; i++) { | ||||
|         alert(res.data[i].assigned_to); | ||||
|     for (var i = 0; i < res.data.length; i++) { | ||||
|         if (assignedServers.indexOf(res.data[i].id) > -1) { | ||||
|             var entry = template.clone(); | ||||
|             entry.find("a.title").text(res.data[i].ipaddress); | ||||
|             entry.find("div.description").text(res.data[i].name); | ||||
|             entry.appendTo("#listview"); | ||||
|         } | ||||
|     } | ||||
|     */ | ||||
| 
 | ||||
|     template.css("display", "none"); | ||||
| 
 | ||||
|     document.getElementById("btn_logout").onclick = function() { | ||||
|         if (FILE.fileExists("token.txt")) { | ||||
|             token = FILE.deleteFile("token.txt") | ||||
|         } | ||||
|          | ||||
|         if (FILE.fileExists("userid.txt")) { | ||||
|             userId = FILE.deleteFile("userid.txt"); | ||||
|         } | ||||
| 
 | ||||
|         exit(0); | ||||
|     }; | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
|  | @ -64,7 +102,8 @@ if (typeof(token) !== "undefined") { | |||
|             console.log("ok"); | ||||
|             FILE.writeFile("token.txt", res.data.token, "utf-8"); | ||||
|             FILE.writeFile("userid.txt", res.data.user.id, "utf-8"); | ||||
|             showServers(); | ||||
| 
 | ||||
|             window.location.reload(); | ||||
|         } | ||||
|     }; | ||||
| } | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| <div class="panel cell"> | ||||
| <div id="listview" class="panel cell"> | ||||
|     <div class="header">서버 목록</div> | ||||
|     <div class="body"> | ||||
|     <div class="template body"> | ||||
|         <div class="cell"> | ||||
|             <div class="col"> | ||||
|                 <div class="col width-fit mobile-width-fit"><span class="icon icon-bookmark color-blue"></span></div> | ||||
|  | @ -12,68 +12,17 @@ | |||
|                         <span class="icon icon-star color-yellow"></span> | ||||
|                     </span> | ||||
|                     <div class="col width-fill mobile-width-fill"> | ||||
|                         <a class="fatty" href="#">Repo 1</a> | ||||
|                         <a class="title fatty" href="#">Repo 1</a> | ||||
|                     </div> | ||||
|                     <div class="col">This is one of my coolest repos.</div> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
|     <div class="body"> | ||||
|         <div class="cell"> | ||||
|             <div class="col"> | ||||
|                 <div class="col width-fit mobile-width-fit"><span class="icon icon-bookmark color-blue"></span></div> | ||||
|                 <div class="col width-fill mobile-width-fill"> | ||||
|                     <span class="float-right"> | ||||
|                         <span class="text"> | ||||
|                             123 | ||||
|                         </span> | ||||
|                         <span class="icon icon-star color-yellow"></span> | ||||
|                     </span> | ||||
|                     <div class="col width-fill mobile-width-fill"> | ||||
|                         <a class="fatty" href="#">Repo 2</a> | ||||
|                     </div> | ||||
|                     <div class="col">This is one of my coolest repos.</div> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
|     <div class="body"> | ||||
|         <div class="cell"> | ||||
|             <div class="col"> | ||||
|                 <div class="col width-fit mobile-width-fit"><span class="icon icon-bookmark color-blue"></span></div> | ||||
|                 <div class="col width-fill mobile-width-fill"> | ||||
|                     <span class="float-right"> | ||||
|                         <span class="text"> | ||||
|                             123 | ||||
|                         </span> | ||||
|                         <span class="icon icon-star color-yellow"></span> | ||||
|                     </span> | ||||
|                     <div class="col width-fill mobile-width-fill"> | ||||
|                         <a class="fatty" href="#">Repo 3</a> | ||||
|                     </div> | ||||
|                     <div class="col">This is one of my coolest repos.</div> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
|     <div class="body"> | ||||
|         <div class="cell"> | ||||
|             <div class="col"> | ||||
|                 <div class="col width-fit mobile-width-fit"><span class="icon icon-bookmark color-blue"></span></div> | ||||
|                 <div class="col width-fill mobile-width-fill"> | ||||
|                     <span class="float-right"> | ||||
|                         <span class="text"> | ||||
|                             123 | ||||
|                         </span> | ||||
|                         <span class="icon icon-star color-yellow"></span> | ||||
|                     </span> | ||||
|                     <div class="col width-fill mobile-width-fill"> | ||||
|                         <a class="fatty" href="#">Repo 4</a> | ||||
|                     </div> | ||||
|                     <div class="col">This is one of my coolest repos.</div> | ||||
|                     <div class="description col">This is one of my coolest repos.</div> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
| </div> | ||||
| 
 | ||||
| <div class="cell"> | ||||
|     <div class="col"> | ||||
|         <button id="btn_logout" class="button" type="button">로그아웃</button> | ||||
|     </div> | ||||
| </div> | ||||
|  |  | |||
|  | @ -1 +1 @@ | |||
| eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwiZXhwIjoxNjA0NTU1MTU3LCJ0dGwiOjIwLCJ0eXBlIjoiYXV0aCIsImtleSI6Ijg1N2NlZDg1LTMzOWEtNDViNS04YTQ5LTJjOGM0YmE4ZDVmNCIsInByb2plY3QiOiJuZXRzb2xpZCJ9.4VxsLxSeGzyPyICblqlWjmlIWtqCgbeoI8ZyTwQKl6A | ||||
| eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwiZXhwIjoxNjA0NTU4MjExLCJ0dGwiOjIwLCJ0eXBlIjoiYXV0aCIsImtleSI6Ijg1N2NlZDg1LTMzOWEtNDViNS04YTQ5LTJjOGM0YmE4ZDVmNCIsInByb2plY3QiOiJuZXRzb2xpZCJ9.1SzHv4-nbeBhm4qdfNHI3vswEEZvv5J0fqx_pwt1gEE | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user