|
@@ -98,28 +98,9 @@ func MyList(ctx *context.Context) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func Create(ctx *context.Context) { |
|
|
func Create(ctx *context.Context) { |
|
|
log.Debug("[dataset] Create...\n") |
|
|
|
|
|
ctx.HTML(200, tplCreate) |
|
|
ctx.HTML(200, tplCreate) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// func handleCreateError(ctx *context.Context, owner *models.User, err error, name string, tpl base.TplName, form interface{}) { |
|
|
|
|
|
// switch { |
|
|
|
|
|
// case models.IsErrReachLimitOfRepo(err): |
|
|
|
|
|
// ctx.RenderWithErr(ctx.Tr("repo.form.reach_limit_of_creation", owner.MaxCreationLimit()), tpl, form) |
|
|
|
|
|
// case models.IsErrRepoAlreadyExist(err): |
|
|
|
|
|
// ctx.Data["Err_RepoName"] = true |
|
|
|
|
|
// ctx.RenderWithErr(ctx.Tr("form.repo_name_been_taken"), tpl, form) |
|
|
|
|
|
// case models.IsErrNameReserved(err): |
|
|
|
|
|
// ctx.Data["Err_RepoName"] = true |
|
|
|
|
|
// ctx.RenderWithErr(ctx.Tr("repo.form.name_reserved", err.(models.ErrNameReserved).Name), tpl, form) |
|
|
|
|
|
// case models.IsErrNamePatternNotAllowed(err): |
|
|
|
|
|
// ctx.Data["Err_RepoName"] = true |
|
|
|
|
|
// ctx.RenderWithErr(ctx.Tr("repo.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), tpl, form) |
|
|
|
|
|
// default: |
|
|
|
|
|
// ctx.ServerError(name, err) |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
func CreatePost(ctx *context.Context, form auth.CreateDatasetForm) { |
|
|
func CreatePost(ctx *context.Context, form auth.CreateDatasetForm) { |
|
|
ctx.Data["Title"] = ctx.Tr("new_dataset") |
|
|
ctx.Data["Title"] = ctx.Tr("new_dataset") |
|
|
|
|
|
|
|
@@ -146,10 +127,6 @@ func CreatePost(ctx *context.Context, form auth.CreateDatasetForm) { |
|
|
UserID: ctxUser.ID, |
|
|
UserID: ctxUser.ID, |
|
|
Status: int32(status), |
|
|
Status: int32(status), |
|
|
} |
|
|
} |
|
|
// if !opts.IsValid() { |
|
|
|
|
|
// ctx.RenderWithErr(ctx.Tr("repo.template.one_item"), tplCreate, form) |
|
|
|
|
|
// return |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
if err = models.CreateDataset(&opts); err != nil { |
|
|
if err = models.CreateDataset(&opts); err != nil { |
|
|
log.Error("%v", err) |
|
|
log.Error("%v", err) |
|
@@ -160,8 +137,6 @@ func CreatePost(ctx *context.Context, form auth.CreateDatasetForm) { |
|
|
attachmentUUIDs = form.Files |
|
|
attachmentUUIDs = form.Files |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
log.Error("%v", attachmentUUIDs) |
|
|
|
|
|
|
|
|
|
|
|
if err = models.AddDatasetAttachments(opts.ID, attachmentUUIDs); err != nil { |
|
|
if err = models.AddDatasetAttachments(opts.ID, attachmentUUIDs); err != nil { |
|
|
log.Error("%v", err) |
|
|
log.Error("%v", err) |
|
|
} |
|
|
} |
|
@@ -171,8 +146,6 @@ func CreatePost(ctx *context.Context, form auth.CreateDatasetForm) { |
|
|
ctx.Redirect(setting.AppSubURL + "/datasets/" + com.ToStr(opts.ID)) |
|
|
ctx.Redirect(setting.AppSubURL + "/datasets/" + com.ToStr(opts.ID)) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// handleCreateError(ctx, ctxUser, err, "CreatePost", tplCreate, &form) |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func Show(ctx *context.Context) { |
|
|
func Show(ctx *context.Context) { |
|
@@ -195,7 +168,7 @@ func Show(ctx *context.Context) { |
|
|
ctx.HTML(200, tplShow) |
|
|
ctx.HTML(200, tplShow) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// EditRelease render release edit page |
|
|
|
|
|
|
|
|
// EditDataset render release edit page |
|
|
func EditDataset(ctx *context.Context) { |
|
|
func EditDataset(ctx *context.Context) { |
|
|
ctx.Data["Title"] = ctx.Tr("dataset.edit_dataset") |
|
|
ctx.Data["Title"] = ctx.Tr("dataset.edit_dataset") |
|
|
ctx.Data["PageIsEditDataset"] = true |
|
|
ctx.Data["PageIsEditDataset"] = true |
|
|