mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-01-08 00:22:19 +01:00
Working for data import tool
This commit is contained in:
@@ -76,6 +76,19 @@ class FileUploadController extends ScalatraServlet with FileUploadSupport with R
|
||||
} getOrElse BadRequest
|
||||
}
|
||||
|
||||
post("/import") {
|
||||
session.get(Keys.Session.LoginAccount).collect { case loginAccount: Account if loginAccount.isAdmin =>
|
||||
execute({ (file, fileId) =>
|
||||
// TODO Import data here!!
|
||||
println("********")
|
||||
println(fileId)
|
||||
println(file.getName)
|
||||
println("********")
|
||||
}, _ => true)
|
||||
}
|
||||
redirect("/admin/data")
|
||||
}
|
||||
|
||||
private def collaboratorsOnly(owner: String, repository: String, loginAccount: Account)(action: => Any): Any = {
|
||||
implicit val session = Database.getSession(request)
|
||||
loginAccount match {
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading strong">Import</div>
|
||||
<div class="panel-body">
|
||||
<form class="form form-horizontal" action="@path/admin/import" method="POST" enctype="multipart/form-data">
|
||||
<input type="file" name="importFile">
|
||||
<form class="form form-horizontal" action="@path/upload/import" method="POST" enctype="multipart/form-data">
|
||||
<input type="file" name="file">
|
||||
<input type="submit" class="btn btn-success pull-right" value="Import">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user