|
|
|
@@ -1127,16 +1127,48 @@ func GrampusNotebookShow(ctx *context.Context) { |
|
|
|
task.Parameters = "" |
|
|
|
} |
|
|
|
} |
|
|
|
user, err := models.GetUserByID(task.UserID) |
|
|
|
if err == nil { |
|
|
|
task.User = user |
|
|
|
} |
|
|
|
|
|
|
|
prepareSpec4Show(ctx, task) |
|
|
|
datasetList := make([]NotebookDataset, 0) |
|
|
|
_ = json.Unmarshal([]byte(task.DataUrl), &datasetList) |
|
|
|
|
|
|
|
ctx.Data["task"] = task |
|
|
|
ctx.Data["datasetDownload"] = datasetList |
|
|
|
ctx.Data["datasetDownload"] = getDatasetDownloadInfo(ctx, task) |
|
|
|
ctx.Data["canDownload"] = cloudbrain.CanModifyJob(ctx, task) |
|
|
|
ctx.Data["ai_center"] = cloudbrainService.GetAiCenterShow(task.AiCenter, ctx) |
|
|
|
ctx.HTML(http.StatusOK, tplGrampusNotebookShow) |
|
|
|
} |
|
|
|
|
|
|
|
func getDatasetDownloadInfo(ctx *context.Context, task *models.Cloudbrain) []models.DatasetDownload { |
|
|
|
datasetDownload := make([]models.DatasetDownload, 0) |
|
|
|
if ctx.IsSigned { |
|
|
|
if task.Uuid != "" && task.UserID == ctx.User.ID { |
|
|
|
datasetDownload = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, true) |
|
|
|
} |
|
|
|
} |
|
|
|
datasetObsUrlList := make([]NotebookDataset, 0) |
|
|
|
_ = json.Unmarshal([]byte(task.DataUrl), &datasetObsUrlList) |
|
|
|
|
|
|
|
for _, datasetInfo := range datasetDownload { |
|
|
|
match := false |
|
|
|
for _, datasetObs := range datasetObsUrlList { |
|
|
|
|
|
|
|
if strings.Contains(datasetObs.DatasetUrl, datasetInfo.DatasetName) { |
|
|
|
datasetInfo.DatasetDownloadLink = datasetObs.DatasetUrl |
|
|
|
match = true |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
if !match { |
|
|
|
datasetInfo.DatasetDownloadLink = "" |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return datasetDownload |
|
|
|
} |
|
|
|
|
|
|
|
func GrampusTrainJobShow(ctx *context.Context) { |
|
|
|
ctx.Data["PageIsCloudBrain"] = true |
|
|
|
|
|
|
|
|