添加数据到数据库,但无法插入,临时提交保存
This commit is contained in:
@@ -22,23 +22,29 @@ type Config struct {
|
||||
// 数据接收
|
||||
ClusterName string `json:"cluster_name"`
|
||||
Country string `json:"country"`
|
||||
Region string `json:"region"`
|
||||
State string `json:"state"`
|
||||
City string `json:"city"`
|
||||
Contact string `json:"contact"`
|
||||
Timezone string `json:"timezone"`
|
||||
HomePage string `json:"homepage"`
|
||||
DBAddress string `json:"db_address"`
|
||||
Software string `json:"software"`
|
||||
DistroDir string `json:"distro_dir"`
|
||||
|
||||
// 公网设置
|
||||
PublicHostname string `json:"public_hostname"`
|
||||
PublicInterface string `json:"public_interface"`
|
||||
PublicIPAddress string `json:"ip_address"`
|
||||
PublicNetmask string `json:"netmask"`
|
||||
PublicGateway string `json:"gateway"`
|
||||
PublicDomain string `json:"public_domain"`
|
||||
PublicMTU string `json:"public_mtu"`
|
||||
|
||||
// 内网配置
|
||||
PrivateHostname string `json:"private_hostname"`
|
||||
PrivateInterface string `json:"private_interface"`
|
||||
PrivateIPAddress string `json:"private_ip"`
|
||||
PrivateNetmask string `json:"private_mask"`
|
||||
PrivateDomain string `json:"private_domain"`
|
||||
PrivateMTU string `json:"private_mtu"`
|
||||
|
||||
// DNS 配置
|
||||
@@ -101,18 +107,25 @@ func defaultConfig() Config {
|
||||
License: "This test license is for testing purposes only. Do not use it in production.",
|
||||
ClusterName: "cluster.hpc.org",
|
||||
Country: "China",
|
||||
Region: "Beijing",
|
||||
State: "Beijing",
|
||||
City: "Beijing",
|
||||
Contact: "admin@sunhpc.com",
|
||||
Timezone: "Asia/Shanghai",
|
||||
HomePage: "www.sunhpc.com",
|
||||
DBAddress: "/var/lib/sunhpc/sunhpc.db",
|
||||
Software: "/export/sunhpc",
|
||||
DistroDir: "/export/sunhpc",
|
||||
PublicHostname: "cluster.hpc.org",
|
||||
PublicInterface: defaultPublicInterface,
|
||||
PublicIPAddress: "",
|
||||
PublicNetmask: "",
|
||||
PublicGateway: "",
|
||||
PublicDomain: "hpc.org",
|
||||
PublicMTU: "1500",
|
||||
PrivateHostname: "cluster",
|
||||
PrivateInterface: defaultInternalInterface,
|
||||
PrivateIPAddress: "172.16.9.254",
|
||||
PrivateNetmask: "255.255.255.0",
|
||||
PrivateDomain: "local",
|
||||
PrivateMTU: "1500",
|
||||
DNSPrimary: "8.8.8.8",
|
||||
DNSSecondary: "8.8.4.4",
|
||||
@@ -137,20 +150,23 @@ func initialModel() model {
|
||||
page2Comps["Homepage_input"] = NewTextInput("Homepage", cfg.HomePage)
|
||||
page2Comps["ClusterName_input"] = NewTextInput("ClusterName", cfg.ClusterName)
|
||||
page2Comps["Country_input"] = NewTextInput("Country", cfg.Country)
|
||||
page2Comps["Region_input"] = NewTextInput("Region", cfg.Region)
|
||||
page2Comps["State_input"] = NewTextInput("State", cfg.State)
|
||||
page2Comps["City_input"] = NewTextInput("City", cfg.City)
|
||||
page2Comps["Contact_input"] = NewTextInput("Contact", cfg.Contact)
|
||||
page2Comps["Timezone_input"] = NewTextInput("Timezone", cfg.Timezone)
|
||||
page2Comps["DBPath_input"] = NewTextInput("DBPath", cfg.DBAddress)
|
||||
page2Comps["Software_input"] = NewTextInput("Software", cfg.Software)
|
||||
page2Comps["DistroDir_input"] = NewTextInput("DistroDir", cfg.DistroDir)
|
||||
page2Comps["next_btn"] = NewButton("下一步")
|
||||
page2Comps["prev_btn"] = NewButton("上一步")
|
||||
pageComponents[PageData] = page2Comps
|
||||
|
||||
// ------------------ 页面3:公网网络页面 --------------------
|
||||
page3Comps := make(map[string]Focusable)
|
||||
page3Comps["PublicHostname_input"] = NewTextInput("PublicHostname", cfg.PublicHostname)
|
||||
page3Comps["PublicInterface_input"] = NewTextInput("PublicInterface", cfg.PublicInterface)
|
||||
page3Comps["PublicIPAddress_input"] = NewTextInput("PublicIPAddress", cfg.PublicIPAddress)
|
||||
page3Comps["PublicNetmask_input"] = NewTextInput("PublicNetmask", cfg.PublicNetmask)
|
||||
page3Comps["PublicGateway_input"] = NewTextInput("PublicGateway", cfg.PublicGateway)
|
||||
page3Comps["PublicDomain_input"] = NewTextInput("PublicDomain", cfg.PublicDomain)
|
||||
page3Comps["PublicMTU_input"] = NewTextInput("PublicMTU", cfg.PublicMTU)
|
||||
page3Comps["next_btn"] = NewButton("下一步")
|
||||
page3Comps["prev_btn"] = NewButton("上一步")
|
||||
@@ -158,9 +174,11 @@ func initialModel() model {
|
||||
|
||||
// ------------------ 页面4:内网网络页面 --------------------
|
||||
page4Comps := make(map[string]Focusable)
|
||||
page4Comps["PrivateHostname_input"] = NewTextInput("PrivateHostname", cfg.PrivateHostname)
|
||||
page4Comps["PrivateInterface_input"] = NewTextInput("PrivateInterface", cfg.PrivateInterface)
|
||||
page4Comps["PrivateIPAddress_input"] = NewTextInput("PrivateIPAddress", cfg.PrivateIPAddress)
|
||||
page4Comps["PrivateNetmask_input"] = NewTextInput("PrivateNetmask", cfg.PrivateNetmask)
|
||||
page4Comps["PrivateDomain_input"] = NewTextInput("PrivateDomain", cfg.PrivateDomain)
|
||||
page4Comps["PrivateMTU_input"] = NewTextInput("PrivateMTU", cfg.PrivateMTU)
|
||||
page4Comps["next_btn"] = NewButton("下一步")
|
||||
page4Comps["prev_btn"] = NewButton("上一步")
|
||||
@@ -270,14 +288,16 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
m.config.ClusterName = comp.Value()
|
||||
case "Country_input":
|
||||
m.config.Country = comp.Value()
|
||||
case "Region_input":
|
||||
m.config.Region = comp.Value()
|
||||
case "State_input":
|
||||
m.config.State = comp.Value()
|
||||
case "City_input":
|
||||
m.config.City = comp.Value()
|
||||
case "Contact_input":
|
||||
m.config.Contact = comp.Value()
|
||||
case "Timezone_input":
|
||||
m.config.Timezone = comp.Value()
|
||||
case "DBPath_input":
|
||||
m.config.DBAddress = comp.Value()
|
||||
case "Software_input":
|
||||
m.config.Software = comp.Value()
|
||||
case "DistroDir_input":
|
||||
m.config.DistroDir = comp.Value()
|
||||
|
||||
// 页3:公网网络
|
||||
case "PublicInterface_input":
|
||||
|
||||
Reference in New Issue
Block a user