Skip to content

Commit df7df33

Browse files
committed
Initial development
1 parent abee03d commit df7df33

23 files changed

+11347
-0
lines changed

.gitignore

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Project
2+
node_modules/
3+
/tailon
4+
/gin-bin
5+
6+
### Editors ###
7+
*~
8+
\#*\#
9+
.\#*
10+
[._]*.s[a-v][a-z]
11+
[._]*.sw[a-p]
12+
[._]s[a-rt-v][a-z]
13+
[._]ss[a-gi-z]
14+
[._]sw[a-p]
15+
16+
### Go ###
17+
# Binaries for programs and plugins
18+
*.exe
19+
*.exe~
20+
*.dll
21+
*.so
22+
*.dylib
23+
24+
# Test binary, build with `go test -c`
25+
*.test
26+
27+
# Output of the go coverage tool, specifically when used with LiteIDE
28+
*.out
29+

README.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Tailon-next
2+
3+
The next iteration of the [tailon] log file viewer and [wtee] pipe viewer.
4+
__Currently under slow but steady development__.
5+
6+
## What's new?
7+
8+
Tailon-next is a full rewrite of the original tailon with the following goals in mind:
9+
10+
* Make maintenance easier for me.
11+
* Remove unwanted features and fix poor design choices.
12+
* Learn more stuff.
13+
14+
In terms of tech, the following has changed:
15+
16+
* Backend from Python+Tornado to Go.
17+
* Frontend from a very-custom and specific Typescript solution to a simple ES5 + vue.js
18+
(mostly for data-binding).
19+
* Simplified asset pipeline (a short Makefile).
20+
* Config file is now toml.
21+
22+
## License
23+
24+
Tailon is released under the terms of the [Apache 2.0 License].
25+
26+
[tailon]: https://github.com/gvalkov/tailon
27+
[wtee]: https://github.com/gvalkov/wtee
28+
[Apache 2.0 License]: LICENSE

filelister.go

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package main
2+
3+
import (
4+
"os"
5+
"path"
6+
"path/filepath"
7+
"time"
8+
)
9+
10+
type ListEntry struct {
11+
Path string `json:"path"`
12+
Alias string `json:"alias"`
13+
Size int64 `json:"size"`
14+
ModTime time.Time `json:"mtime"`
15+
Exists bool `json:"exists"`
16+
}
17+
18+
func fileInfo(path string) *ListEntry {
19+
entry := ListEntry{}
20+
entry.Path = path
21+
22+
info, err := os.Stat(path)
23+
if !os.IsNotExist(err) {
24+
entry.Exists = true
25+
entry.Size = info.Size()
26+
entry.ModTime = info.ModTime()
27+
}
28+
29+
return &entry
30+
}
31+
32+
func createListing(filespecs []FileSpec) map[string][]*ListEntry {
33+
res := make(map[string][]*ListEntry)
34+
35+
for _, spec := range filespecs {
36+
group := "__default__"
37+
if spec.Group != "" {
38+
group = spec.Group
39+
}
40+
41+
switch spec.Type {
42+
case "file":
43+
entry := fileInfo(spec.Path)
44+
if spec.Alias != "" {
45+
entry.Alias = spec.Alias
46+
} else {
47+
entry.Alias = entry.Path
48+
}
49+
res[group] = append(res[group], entry)
50+
case "glob":
51+
matches, _ := filepath.Glob(spec.Path)
52+
for _, match := range matches {
53+
entry := fileInfo(match)
54+
if spec.Alias != "" {
55+
entry.Alias = path.Join(spec.Alias, path.Base(entry.Path))
56+
} else {
57+
cwd, _ := os.Getwd()
58+
rel, _ := filepath.Rel(cwd, entry.Path)
59+
entry.Alias = rel
60+
}
61+
res[group] = append(res[group], entry)
62+
}
63+
}
64+
}
65+
66+
return res
67+
}

frontend/Makefile

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
CMD_TYPESCRIPT := node_modules/typescript/bin/tsc
2+
CMD_POSTCSS := node_modules/postcss-cli/bin/postcss
3+
CMD_NODESASS := node_modules/node-sass/bin/node-sass
4+
5+
DISTDIR ?= dist
6+
7+
EXTERNAL_JS := \
8+
node_modules/vue/dist/vue.js \
9+
node_modules/vue-multiselect/dist/vue-multiselect.min.js \
10+
node_modules/sockjs-client/dist/sockjs.js \
11+
node_modules/html5shiv/dist/html5shiv.js \
12+
node_modules/@fortawesome/fontawesome-free/js/all.js \
13+
node_modules/vue-loading-overlay/dist/vue-loading.min.js
14+
15+
EXTERNAL_CSS := \
16+
node_modules/normalize-css/normalize.css \
17+
node_modules/vue-multiselect/dist/vue-multiselect.min.css \
18+
node_modules/vue-loading-overlay/dist/vue-loading.min.css
19+
20+
INTERNAL_JS := \
21+
js/util.js \
22+
js/main.js
23+
24+
INTERNAL_CSS := \
25+
scss/vars.scss \
26+
scss/main.scss
27+
28+
ALL_TARGETS := \
29+
$(DISTDIR)/3rdparty.js \
30+
$(DISTDIR)/3rdparty.css \
31+
$(DISTDIR)/main.css \
32+
$(DISTDIR)/main.js
33+
34+
35+
all: $(ALL_TARGETS)
36+
37+
clean:
38+
-rm -f $(ALL_TARGETS)
39+
40+
$(DISTDIR)/3rdparty.js: $(EXTERNAL_JS)
41+
@cat $(EXTERNAL_JS) > $@
42+
43+
$(DISTDIR)/main.js: $(INTERNAL_JS)
44+
cat $(INTERNAL_JS) > $@
45+
46+
$(DISTDIR)/main.css: $(INTERNAL_CSS)
47+
$(CMD_NODESASS) --quiet --output-style compressed scss/main.scss > $@
48+
49+
$(DISTDIR)/3rdparty.css: $(EXTERNAL_CSS)
50+
@cat $? > $@
51+
52+
watch:
53+
@echo $(INTERNAL_CSS) $(EXTERNAL_CSS) $(EXTERNAL_JS) $(INTERNAL_JS) | tr ' ' '\n' | entr make
54+
55+
56+
.PHONY: all clean watch

frontend/dist/favicon.ico

14.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)