mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 21:50:28 +08:00 
			
		
		
		
	
		
			
	
	
		
			42 lines
		
	
	
		
			890 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			42 lines
		
	
	
		
			890 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 
								 | 
							
								// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								package db
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import (
							 | 
						||
| 
								 | 
							
									"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
							 | 
						||
| 
								 | 
							
									"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/db/dbnodeutils"
							 | 
						||
| 
								 | 
							
									"github.com/iwind/TeaGo/maps"
							 | 
						||
| 
								 | 
							
								)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								type NodeAction struct {
							 | 
						||
| 
								 | 
							
									actionutils.ParentAction
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								func (this *NodeAction) Init() {
							 | 
						||
| 
								 | 
							
									this.Nav("", "", "node")
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								func (this *NodeAction) RunGet(params struct {
							 | 
						||
| 
								 | 
							
									NodeId int64
							 | 
						||
| 
								 | 
							
								}) {
							 | 
						||
| 
								 | 
							
									node, err := dbnodeutils.InitNode(this.Parent(), params.NodeId)
							 | 
						||
| 
								 | 
							
									if err != nil {
							 | 
						||
| 
								 | 
							
										this.ErrorPage(err)
							 | 
						||
| 
								 | 
							
										return
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									this.Data["node"] = maps.Map{
							 | 
						||
| 
								 | 
							
										"id":          node.Id,
							 | 
						||
| 
								 | 
							
										"isOn":        node.IsOn,
							 | 
						||
| 
								 | 
							
										"name":        node.Name,
							 | 
						||
| 
								 | 
							
										"database":    node.Database,
							 | 
						||
| 
								 | 
							
										"host":        node.Host,
							 | 
						||
| 
								 | 
							
										"port":        node.Port,
							 | 
						||
| 
								 | 
							
										"username":    node.Username,
							 | 
						||
| 
								 | 
							
										"password":    node.Password,
							 | 
						||
| 
								 | 
							
										"description": node.Description,
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									this.Show()
							 | 
						||
| 
								 | 
							
								}
							 |