mirror of https://github.com/h44z/wg-portal.git
				
				
				
			Add Interface column in user profile and fix sorting
This commit is contained in:
		
							parent
							
								
									8de4da8984
								
							
						
					
					
						commit
						20b71b4e1f
					
				|  | @ -34,6 +34,7 @@ | ||||||
|                     <th scope="col"><a href="?sort=pubKey">Public Key <i class="fa fa-fw {{.Session.GetSortIcon "userpeers" "pubKey"}}"></i></a></th> |                     <th scope="col"><a href="?sort=pubKey">Public Key <i class="fa fa-fw {{.Session.GetSortIcon "userpeers" "pubKey"}}"></i></a></th> | ||||||
|                     <th scope="col"><a href="?sort=mail">E-Mail <i class="fa fa-fw {{.Session.GetSortIcon "userpeers" "mail"}}"></i></a></th> |                     <th scope="col"><a href="?sort=mail">E-Mail <i class="fa fa-fw {{.Session.GetSortIcon "userpeers" "mail"}}"></i></a></th> | ||||||
|                     <th scope="col"><a href="?sort=ip">IP's <i class="fa fa-fw {{.Session.GetSortIcon "userpeers" "ip"}}"></i></a></th> |                     <th scope="col"><a href="?sort=ip">IP's <i class="fa fa-fw {{.Session.GetSortIcon "userpeers" "ip"}}"></i></a></th> | ||||||
|  |                     <th scope="col"><a href="?sort=device">Interface <i class="fa fa-fw {{.Session.GetSortIcon "userpeers" "device"}}"></i></a></th> | ||||||
|                     <th scope="col"><a href="?sort=handshake">Handshake <i class="fa fa-fw {{.Session.GetSortIcon "userpeers" "handshake"}}"></i></a></th> |                     <th scope="col"><a href="?sort=handshake">Handshake <i class="fa fa-fw {{.Session.GetSortIcon "userpeers" "handshake"}}"></i></a></th> | ||||||
|                     {{if eq $.UserManagePeers true}} |                     {{if eq $.UserManagePeers true}} | ||||||
|                     <th scope="col"></th> |                     <th scope="col"></th> | ||||||
|  | @ -53,6 +54,7 @@ | ||||||
|                         <td>{{$p.PublicKey}}</td> |                         <td>{{$p.PublicKey}}</td> | ||||||
|                         <td>{{$p.Email}}</td> |                         <td>{{$p.Email}}</td> | ||||||
|                         <td>{{$p.IPsStr}}</td> |                         <td>{{$p.IPsStr}}</td> | ||||||
|  |                         <td>{{$p.DeviceName}}</td> | ||||||
|                         <td><span data-toggle="tooltip" data-placement="left" title="" data-original-title="{{$p.LastHandshakeTime}}">{{$p.LastHandshake}}</span></td> |                         <td><span data-toggle="tooltip" data-placement="left" title="" data-original-title="{{$p.LastHandshakeTime}}">{{$p.LastHandshake}}</span></td> | ||||||
|                         {{if eq $.UserManagePeers true}} |                         {{if eq $.UserManagePeers true}} | ||||||
|                         <td> |                         <td> | ||||||
|  |  | ||||||
|  | @ -128,8 +128,8 @@ func (s *Server) GetUserIndex(c *gin.Context) { | ||||||
| 			s.GetHandleError(c, http.StatusInternalServerError, "sort error", "failed to save session") | 			s.GetHandleError(c, http.StatusInternalServerError, "sort error", "failed to save session") | ||||||
| 			return | 			return | ||||||
| 		} | 		} | ||||||
| 		c.Redirect(http.StatusSeeOther, "/admin") | 		/*c.Redirect(http.StatusSeeOther, "/admin") | ||||||
| 		return | 		return*/ | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	peers := s.peers.GetSortedPeersForEmail(currentSession.SortedBy["userpeers"], currentSession.SortDirection["userpeers"], currentSession.Email) | 	peers := s.peers.GetSortedPeersForEmail(currentSession.SortedBy["userpeers"], currentSession.SortDirection["userpeers"], currentSession.Email) | ||||||
|  |  | ||||||
|  | @ -731,6 +731,9 @@ func sortPeers(sortKey string, sortDirection string, peers []Peer) { | ||||||
| 		case "endpoint": | 		case "endpoint": | ||||||
| 			sortValueLeft = peers[i].Endpoint | 			sortValueLeft = peers[i].Endpoint | ||||||
| 			sortValueRight = peers[j].Endpoint | 			sortValueRight = peers[j].Endpoint | ||||||
|  | 		case "device": | ||||||
|  | 			sortValueLeft = peers[i].DeviceName | ||||||
|  | 			sortValueRight = peers[j].DeviceName | ||||||
| 		case "handshake": | 		case "handshake": | ||||||
| 			if peers[i].Peer == nil { | 			if peers[i].Peer == nil { | ||||||
| 				return true | 				return true | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue