diff --git a/admin/api/settings.go b/admin/api/settings.go
index dc3e3562..db6e1c4c 100644
--- a/admin/api/settings.go
+++ b/admin/api/settings.go
@@ -32,8 +32,14 @@ func getROSettings(_ httprouter.Params, body []byte) (interface{}, error) {
syncMtd = sync.GlobalImporter.Kind()
}
+ var syncId *string
+ if sync.GlobalImporter != nil {
+ syncId = sync.GlobalImporter.Id()
+ }
+
return map[string]interface{}{
"sync-type": reflect.TypeOf(sync.GlobalImporter).Name(),
+ "sync-id": syncId,
"sync": syncMtd,
}, nil
}
diff --git a/admin/static/views/settings.html b/admin/static/views/settings.html
index 483ea536..4e1da13a 100644
--- a/admin/static/views/settings.html
+++ b/admin/static/views/settings.html
@@ -241,7 +241,9 @@
- Synchronisation
-
+
+ - ID
+ - {{ configro['sync-id'] }}
diff --git a/admin/sync/file.go b/admin/sync/file.go
index deb8c0bc..eb6a3bef 100644
--- a/admin/sync/file.go
+++ b/admin/sync/file.go
@@ -19,6 +19,8 @@ import (
type Importer interface {
// Kind returns information about the Importer, for human interrest.
Kind() string
+ // Id returns information about the current state (commit id, ...).
+ Id() *string
// init performs the importer initialization.
Init() error
// sync tries to pull the latest modification of the underlying storage.
diff --git a/admin/sync/full.go b/admin/sync/full.go
index a841d0ac..d684d276 100644
--- a/admin/sync/full.go
+++ b/admin/sync/full.go
@@ -44,6 +44,9 @@ func SpeedySyncDeep(i Importer) (errs map[string][]string) {
if err := i.Sync(); err != nil {
errs["_sync"] = []string{err.Error()}
+ if _id := i.Id(); _id != nil {
+ errs["_sync"] = append(errs["_sync"], *_id)
+ }
}
errs["_date"] = []string{fmt.Sprintf("%v", startTime)}
diff --git a/admin/sync/importer_cloud.go b/admin/sync/importer_cloud.go
index 5cbf1731..718f3905 100644
--- a/admin/sync/importer_cloud.go
+++ b/admin/sync/importer_cloud.go
@@ -38,6 +38,10 @@ func (i CloudImporter) Kind() string {
return "cloud file importer: " + i.baseDAV.String()
}
+func (i CloudImporter) Id() *string {
+ return nil
+}
+
func (i CloudImporter) Init() error {
return nil
}
diff --git a/admin/sync/importer_git.go b/admin/sync/importer_git.go
index b5d56cee..df7e23a8 100644
--- a/admin/sync/importer_git.go
+++ b/admin/sync/importer_git.go
@@ -51,7 +51,7 @@ func NewGitImporter(li LocalImporter, remote string) GitImporter {
}
}
-func (i GitImporter) Kind() string {
+func (i GitImporter) Id() *string {
var gitinfo string
r, err := git.PlainOpen(i.li.Base)
if err == nil {
@@ -61,7 +61,7 @@ func (i GitImporter) Kind() string {
}
}
- return "git originated from " + i.Remote + " on " + i.li.Kind() + ", currently on commit " + gitinfo
+ return &gitinfo
}
func (i GitImporter) Init() error {
diff --git a/admin/sync/importer_git_common.go b/admin/sync/importer_git_common.go
index bcd6fe34..faf7b25c 100644
--- a/admin/sync/importer_git_common.go
+++ b/admin/sync/importer_git_common.go
@@ -37,3 +37,7 @@ func (i GitImporter) listDir(filename string) ([]string, error) {
func (i GitImporter) stat(filename string) (os.FileInfo, error) {
return i.li.stat(filename)
}
+
+func (i GitImporter) Kind() string {
+ return "git originated from " + i.Remote + " on " + i.li.Kind()
+}
diff --git a/admin/sync/importer_gitbin.go b/admin/sync/importer_gitbin.go
index 2aa1889c..eb83c2e0 100644
--- a/admin/sync/importer_gitbin.go
+++ b/admin/sync/importer_gitbin.go
@@ -25,7 +25,7 @@ func NewGitImporter(li LocalImporter, remote string) GitImporter {
}
}
-func (i GitImporter) Kind() string {
+func (i GitImporter) Id() *string {
cmdshow := exec.Command("git", "-C", i.li.Base, "show")
var outshow bytes.Buffer
cmdshow.Stdout = &outshow
@@ -43,7 +43,7 @@ func (i GitImporter) Kind() string {
}
}
- return "git originated from " + i.Remote + " on " + i.li.Kind() + ", currently on commit " + commit
+ return &commit
}
func (i GitImporter) Init() error {
diff --git a/admin/sync/importer_localfs.go b/admin/sync/importer_localfs.go
index e088cbb6..63f82df2 100644
--- a/admin/sync/importer_localfs.go
+++ b/admin/sync/importer_localfs.go
@@ -26,6 +26,10 @@ func (i LocalImporter) Kind() string {
}
}
+func (i LocalImporter) Id() *string {
+ return nil
+}
+
func (i LocalImporter) Init() error {
if f, err := os.Stat(i.Base); os.IsNotExist(err) {
if err = os.Mkdir(i.Base, 0751); err != nil {