diff --git a/object/site.go b/object/site.go index 6b3b5b9..2e4e6e3 100644 --- a/object/site.go +++ b/object/site.go @@ -24,12 +24,13 @@ import ( ) type Node struct { - Name string `json:"name"` - Version string `json:"version"` - Diff string `json:"diff"` - Pid int `json:"pid"` - Status string `json:"status"` - Message string `json:"message"` + Name string `json:"name"` + Version string `json:"version"` + Diff string `json:"diff"` + Pid int `json:"pid"` + Status string `json:"status"` + Message string `json:"message"` + Provider string `json:"provider"` } type Site struct { @@ -255,7 +256,7 @@ func (site *Site) checkNodes() error { diff = site.Nodes[0].Diff } - pid, err := run.CreateRepo(site.Name, !ok, diff) + pid, err := run.CreateRepo(site.Name, !ok, diff, node.Provider) if err != nil { return err } diff --git a/run/cdn.go b/run/cdn.go index ce93f1b..a4614e1 100644 --- a/run/cdn.go +++ b/run/cdn.go @@ -84,6 +84,10 @@ func updateHtml(domainUrl string, buildDir string) { } func gitUploadCdn(providerName string, siteName string) error { + if providerName == "" { + return nil + } + fmt.Printf("gitUploadCdn(): [%s]\n", siteName) path := GetRepoPath(siteName) diff --git a/run/git_test.go b/run/git_test.go index 303bafd..ef14d83 100644 --- a/run/git_test.go +++ b/run/git_test.go @@ -33,7 +33,7 @@ func TestGitGetDiff(t *testing.T) { //diff := GitDiff("F:/github_repos/casdoor") //println(diff) - pid, err := CreateRepo("casdoor_test", true, "") + pid, err := CreateRepo("casdoor_test", true, "", "") if err != nil { panic(err) } diff --git a/run/run.go b/run/run.go index ba9d15f..d49fbdd 100644 --- a/run/run.go +++ b/run/run.go @@ -26,7 +26,7 @@ func isTargetRepo(siteName string) bool { return strings.HasPrefix(siteName, "cc_") || strings.Count(siteName, "_") == 2 } -func CreateRepo(siteName string, needStart bool, diff string) (int, error) { +func CreateRepo(siteName string, needStart bool, diff string, providerName string) (int, error) { path := GetRepoPath(siteName) if !util.FileExist(path) { originalName := getOriginalName(siteName) @@ -67,6 +67,11 @@ func CreateRepo(siteName string, needStart bool, diff string) (int, error) { if err != nil { return 0, err } + + err = gitUploadCdn(providerName, siteName) + if err != nil { + return 0, err + } } err = updateBatFile(siteName) @@ -113,6 +118,11 @@ func CreateRepo(siteName string, needStart bool, diff string) (int, error) { if err != nil { return 0, err } + + err = gitUploadCdn(providerName, siteName) + if err != nil { + return 0, err + } } if affected { diff --git a/web/src/NodeTable.js b/web/src/NodeTable.js index 7736282..f07586e 100644 --- a/web/src/NodeTable.js +++ b/web/src/NodeTable.js @@ -93,7 +93,7 @@ class NodeTable extends React.Component { title: "Version", dataIndex: "version", key: "version", - width: "300px", + width: "160px", render: (text, record, index) => { if (text === "") { return null; @@ -174,6 +174,19 @@ class NodeTable extends React.Component { dataIndex: "message", key: "message", }, + { + title: "Provider", + dataIndex: "provider", + key: "provider", + width: "250px", + render: (text, record, index) => { + return ( + { + this.updateField(table, index, "provider", e.target.value); + }} /> + ); + }, + }, { title: "Action", key: "action",