Browse Source

Merge pull request 'cb-task' (#114) from cb-task into develop

Reviewed-by: stardust <denglf@pcl.ac.cn>
master
yuyuanshifu 4 years ago
parent
commit
8c79423a10
6 changed files with 14 additions and 5 deletions
  1. +2
    -0
      custom/conf/app.ini.sample
  2. +3
    -1
      models/repo.go
  3. +4
    -0
      modules/setting/setting.go
  4. +3
    -3
      routers/repo/cloudbrain.go
  5. +1
    -1
      templates/repo/cloudbrain/new.tmpl
  6. +1
    -0
      web_src/js/components/MinioUploader.vue

+ 2
- 0
custom/conf/app.ini.sample View File

@@ -1055,6 +1055,8 @@ DEBUG_SERVER_HOST = http://192.168.202.73/
USER = cW4cMtH24eoWPE7X USER = cW4cMtH24eoWPE7X
PWD = 4BPmgvK2hb2Eywwyp4YZRY4B7yQf4DA.C PWD = 4BPmgvK2hb2Eywwyp4YZRY4B7yQf4DA.C
JOB_TYPE = debug_openi JOB_TYPE = debug_openi
GIT_USER = opendata
GIT_PASSWORD = pa%40123456


[decompress] [decompress]
HOST = http://192.168.207.34:39987 HOST = http://192.168.207.34:39987


+ 3
- 1
models/repo.go View File

@@ -1386,9 +1386,11 @@ func GetRepositoriesByForkID(forkID int64) ([]*Repository, error) {
func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err error) { func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err error) {
repo.LowerName = strings.ToLower(repo.Name) repo.LowerName = strings.ToLower(repo.Name)


if len(repo.Description) > 255 {
/*if len(repo.Description) > 255 {
repo.Description = repo.Description[:255] repo.Description = repo.Description[:255]
} }

*/
if len(repo.Website) > 255 { if len(repo.Website) > 255 {
repo.Website = repo.Website[:255] repo.Website = repo.Website[:255]
} }


+ 4
- 0
modules/setting/setting.go View File

@@ -438,6 +438,8 @@ var (
JobPath string JobPath string
JobType string JobType string
DebugServerHost string DebugServerHost string
GitUser string
GitPassword string
) )


// DateLang transforms standard language locale name to corresponding value in datetime plugin. // DateLang transforms standard language locale name to corresponding value in datetime plugin.
@@ -1113,6 +1115,8 @@ func NewContext() {
JobPath = sec.Key("JOB_PATH").MustString("/datasets/minio/data/opendata/jobs/") JobPath = sec.Key("JOB_PATH").MustString("/datasets/minio/data/opendata/jobs/")
DebugServerHost = sec.Key("DEBUG_SERVER_HOST").MustString("http://192.168.202.73") DebugServerHost = sec.Key("DEBUG_SERVER_HOST").MustString("http://192.168.202.73")
JobType = sec.Key("JOB_TYPE").MustString("debug_openi") JobType = sec.Key("JOB_TYPE").MustString("debug_openi")
GitUser = sec.Key("GIT_USER").MustString("opendata")
GitPassword = sec.Key("GIT_PASSWORD").MustString("pa%40123456")
} }


func loadInternalToken(sec *ini.Section) string { func loadInternalToken(sec *ini.Section) string {


+ 3
- 3
routers/repo/cloudbrain.go View File

@@ -90,11 +90,10 @@ func CloudBrainNew(ctx *context.Context) {


for i,payload := range result.Payload { for i,payload := range result.Payload {
if strings.HasPrefix(result.Payload[i].Place,"192.168") { if strings.HasPrefix(result.Payload[i].Place,"192.168") {
result.Payload[i].PlaceView = payload.Place[strings.Index(payload.Place, "/"): len(payload.Place)-1]
result.Payload[i].PlaceView = payload.Place[strings.Index(payload.Place, "/"): len(payload.Place)]
} else { } else {
result.Payload[i].PlaceView = payload.Place result.Payload[i].PlaceView = payload.Place
} }

} }


ctx.Data["images"] = result.Payload ctx.Data["images"] = result.Payload
@@ -261,7 +260,8 @@ func downloadCode(repo *models.Repository, codePath string) error {
return err return err
} }


command := "git clone " + repo.CloneLink().HTTPS + " " + codePath
repoAddr := repo.CloneLink().HTTPS
command := "git clone " + repoAddr[: strings.Index(repoAddr, ":") + 3] + setting.GitUser + ":" + setting.GitPassword + "@" + repoAddr[strings.Index(repoAddr, ":") + 3 :] + " " + codePath
cmd := exec.Command("/bin/bash", "-c", command) cmd := exec.Command("/bin/bash", "-c", command)
output, err := cmd.Output() output, err := cmd.Output()
log.Info(string(output)) log.Info(string(output))


+ 1
- 1
templates/repo/cloudbrain/new.tmpl View File

@@ -44,7 +44,7 @@
<label>代码存放路径</label> <label>代码存放路径</label>
<input name="code_path" id="cloudbrain_code_path" value="{{.code_path}}" tabindex="3" autofocus required maxlength="255" readonly="readonly"> <input name="code_path" id="cloudbrain_code_path" value="{{.code_path}}" tabindex="3" autofocus required maxlength="255" readonly="readonly">
</div> </div>
<div class="inline required field">
<div class="inline required field" hidden>
<label>启动命令</label> <label>启动命令</label>
<textarea name="command" rows="10" readonly="readonly">{{.command}}</textarea> <textarea name="command" rows="10" readonly="readonly">{{.command}}</textarea>
</div> </div>


+ 1
- 0
web_src/js/components/MinioUploader.vue View File

@@ -399,6 +399,7 @@ export default {
loadNext(); loadNext();
fileReader.onload = async (e) => { fileReader.onload = async (e) => {
await uploadChunk(e); await uploadChunk(e);
fileReader.abort();
currentChunk++; currentChunk++;
if (currentChunk < chunks) { if (currentChunk < chunks) {
console.log( console.log(


Loading…
Cancel
Save