|
|
@@ -285,7 +285,7 @@ func NotebookShow(ctx *context.Context) { |
|
|
|
datasetDownload := make([]models.DatasetDownload, 0) |
|
|
|
if ctx.IsSigned { |
|
|
|
if task.Uuid != "" && task.UserID == ctx.User.ID { |
|
|
|
datasetDownload = GetCloudBrainDataSetInfo(task.Uuid, true) |
|
|
|
datasetDownload = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, true) |
|
|
|
} |
|
|
|
} |
|
|
|
user, err := models.GetUserByID(task.UserID) |
|
|
@@ -331,34 +331,43 @@ func NotebookShow(ctx *context.Context) { |
|
|
|
ctx.HTML(200, tplModelArtsNotebookShow) |
|
|
|
} |
|
|
|
|
|
|
|
func GetCloudBrainDataSetInfo(uuid string, isNeedDown bool) []models.DatasetDownload { |
|
|
|
func GetCloudBrainDataSetInfo(uuid string, datasetname string, isNeedDown bool) []models.DatasetDownload { |
|
|
|
datasetDownload := make([]models.DatasetDownload, 0) |
|
|
|
|
|
|
|
uuidList := strings.Split(uuid, ";") |
|
|
|
for _, uuidStr := range uuidList { |
|
|
|
datasetnameList := strings.Split(datasetname, ";") |
|
|
|
for i, uuidStr := range uuidList { |
|
|
|
name := "" |
|
|
|
link := "" |
|
|
|
isDelete := false |
|
|
|
attachment, err := models.GetAttachmentByUUID(uuidStr) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetAttachmentByUUID failed:%v", err.Error()) |
|
|
|
return datasetDownload |
|
|
|
} |
|
|
|
dataset, err := models.GetDatasetByID(attachment.DatasetID) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetDatasetByID failed:%v", err.Error()) |
|
|
|
return datasetDownload |
|
|
|
} |
|
|
|
repo, err := models.GetRepositoryByID(dataset.RepoID) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetRepositoryByID failed:%v", err.Error()) |
|
|
|
return datasetDownload |
|
|
|
name = datasetnameList[i] |
|
|
|
isDelete = true |
|
|
|
} else { |
|
|
|
name = attachment.Name |
|
|
|
dataset, err := models.GetDatasetByID(attachment.DatasetID) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetDatasetByID failed:%v", err.Error()) |
|
|
|
} else { |
|
|
|
repo, err := models.GetRepositoryByID(dataset.RepoID) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetRepositoryByID failed:%v", err.Error()) |
|
|
|
} else { |
|
|
|
link = repo.Link() + "/datasets" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
url := "" |
|
|
|
if isNeedDown { |
|
|
|
url = attachment.S3DownloadURL() |
|
|
|
} |
|
|
|
datasetDownload = append(datasetDownload, models.DatasetDownload{ |
|
|
|
DatasetName: attachment.Name, |
|
|
|
DatasetName: name, |
|
|
|
DatasetDownloadLink: url, |
|
|
|
RepositoryLink: repo.Link() + "/datasets", |
|
|
|
RepositoryLink: link, |
|
|
|
IsDelete: isDelete, |
|
|
|
}) |
|
|
|
} |
|
|
|
return datasetDownload |
|
|
@@ -1810,7 +1819,7 @@ func TrainJobShow(ctx *context.Context) { |
|
|
|
} else { |
|
|
|
VersionListTasks[i].Parameters = "" |
|
|
|
} |
|
|
|
datasetList = append(datasetList, GetCloudBrainDataSetInfo(task.Uuid, false)) |
|
|
|
datasetList = append(datasetList, GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false)) |
|
|
|
VersionListTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain) |
|
|
|
VersionListTasks[i].CanModify = cloudbrain.CanModifyJob(ctx, &task.Cloudbrain) |
|
|
|
} |
|
|
@@ -2526,7 +2535,7 @@ func InferenceJobShow(ctx *context.Context) { |
|
|
|
ctx.Data["displayJobName"] = task.DisplayJobName |
|
|
|
ctx.Data["task"] = task |
|
|
|
ctx.Data["canDownload"] = cloudbrain.CanModifyJob(ctx, task) |
|
|
|
ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, false) |
|
|
|
ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false) |
|
|
|
tempUids := []int64{} |
|
|
|
tempUids = append(tempUids, task.UserID) |
|
|
|
JobCreater, err := models.GetUserNamesByIDs(tempUids) |
|
|
|