Skip to content

Commit e615335

Browse files
authored
feat: vite swr refactoring (#32)
* feat: backend implementation * fix: calculate total movies * fix: open correct db file * feat: initial ui implementation * feat: add pagination + initial movie component * feat: complete movie component visual implementations * feat: fix movie feature (initial implementation) * fix: add missing table drop commands * feat: convert table from fts4 to fts5 * feat: implement fix movie feature * feat: implement search * feat: improve loading state ui * feat: use keepPreviousData instead of useState to de-duplicate data * feat: implement copy movie feature * refactor dto name * feat: implement set movie score feature * feat: implement set watched feature * feat: implement footer view * feat: implement import feature * feat: implement prune feature * feat: implement duplicates feature * chore: remove unused features * feat: implement covers feature * chore: remove logging * fix: check for existing ws connection before writing to it * feat: no need to create new array * feat: initial Makefile * chore: update readme * chore: remove prev code * fix: runtime display * feat: complete Makefile * chore: update screenshots and last iteration branch
1 parent 882b833 commit e615335

File tree

192 files changed

+9062
-15354
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+9062
-15354
lines changed

.cix.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.gitignore

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ node_modules
1818
**/_vendor/pkg/
1919
**/vendor
2020

21-
server/server
22-
server/mediagui
23-
scanner/scanner
24-
server/importer
25-
server/agentx
21+
mediagui
22+
importer
23+
agentx
24+
agent

CHANGES

Lines changed: 0 additions & 187 deletions
This file was deleted.

Makefile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#
2+
# Makefile to perform "live code reloading" after changes to .go files.
3+
#
4+
# To start live reloading run the following command:
5+
# $ make serve
6+
#
7+
8+
mb_date := $(shell date '+%Y.%m.%d')
9+
mb_hash := $(shell git rev-parse --short HEAD)
10+
11+
# binary name to kill/restart
12+
PROG = mediagui
13+
14+
# targets not associated with files
15+
.PHONY: default build test coverage clean kill restart serve
16+
17+
# default targets to run when only running `make`
18+
default: test
19+
20+
# clean up
21+
clean:
22+
go clean
23+
24+
protobuf:
25+
protoc --go_out=. --go_opt=paths=source_relative --go-drpc_out=. --go-drpc_opt=paths=source_relative import.proto
26+
27+
local: clean
28+
pushd ./ui && npm run build && popd
29+
go build fmt
30+
go build -ldflags "-X main.Version=$(mb_date)-$(mb_hash)" -v -o ${PROG}
31+
go build -ldflags "-X main.Version=$(mb_date)-$(mb_hash)" -v -o agentx agent.go
32+
33+
release: clean
34+
pushd ./ui && npm run build && popd
35+
go build fmt
36+
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.Version=$(mb_date)-$(mb_hash)" -v -o ${PROG}
37+
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.Version=$(mb_date)-$(mb_hash)" -v -o agentx agent.go
38+
39+
# run unit tests with code coverage
40+
test:
41+
go test -v
42+
43+
# generate code coverage report
44+
coverage: test
45+
go build test -coverprofile=.coverage.out
46+
go build tool cover -html=.coverage.out
47+
48+
# attempt to kill running server
49+
kill:
50+
-@killall -9 $(PROG) 2>/dev/null || true
51+
52+
# attempt to build and start server
53+
restart:
54+
@make kill
55+
@make build; (if [ "$$?" -eq 0 ]; then (env GIN_MODE=debug ./${PROG} &); fi)
56+
57+
publish: build
58+
cp ./${PROG} ~/bin

README.md

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,52 @@ Movies View
1616

1717
**mediaGUI**'s main objective is to be rewritten whenever I want to learn a new technology.
1818

19-
- 1st Iteration [(code)](https://github.com/jbrodriguez/mediabase/)<br />
20-
The project's first name was [mediabase](http://www.apertoire.net/introducing-mediabase) <br />
21-
To learn:
19+
- 1st Iteration [(code)](https://github.com/jbrodriguez/mediabase/)<br />
20+
The project's first name was [mediabase](http://www.apertoire.net/introducing-mediabase) <br />
21+
To learn:
2222

23-
- [go](https://golang.org/)
24-
- [AngularJS 1](https://angularjs.org/)
23+
- [go](https://golang.org/)
24+
- [AngularJS 1](https://angularjs.org/)
2525

26-
- 2nd Iteration [(code)](https://github.com/jbrodriguez/mediagui/tree/0.5.8/) <br />
27-
I renamed the project to **mediaGUI** <br />
28-
To learn:
26+
- 2nd Iteration [(code)](https://github.com/jbrodriguez/mediagui/tree/0.5.8/) <br />
27+
I renamed the project to **mediaGUI** <br />
28+
To learn:
2929

30-
- [go-micro](https://github.com/micro/go-micro/): microservices in go
31-
- [react](http://facebook.github.io/react/)
32-
- [ffux](https://github.com/milankinen/ffux/): A functional approach to state management
33-
- [flexboxgrid-sass](https://github.com/hugeinc/flexboxgrid-sass/)
30+
- [go-micro](https://github.com/micro/go-micro/): microservices in go
31+
- [react](http://facebook.github.io/react/)
32+
- [ffux](https://github.com/milankinen/ffux/): A functional approach to state management
33+
- [flexboxgrid-sass](https://github.com/hugeinc/flexboxgrid-sass/)
3434

35-
- 3rd Iteration [(code)](https://github.com/jbrodriguez/mediagui/tree/3.8.0/) <br />
36-
To learn:
35+
- 3rd Iteration [(code)](https://github.com/jbrodriguez/mediagui/tree/3.8.0/) <br />
36+
To learn:
3737

38-
- [vuejs](https://vuejs.org/) - [tachyons-sass](https://github.com/tachyons-css/tachyons-sass)
38+
- [vuejs](https://vuejs.org/) - [tachyons-sass](https://github.com/tachyons-css/tachyons-sass)
3939

40-
- 4th Iteration [(code)](https://github.com/jbrodriguez/mediagui/tree/4.2.0/) <br />
41-
To learn:
40+
- 4th Iteration [(code)](https://github.com/jbrodriguez/mediagui/tree/4.2.0/) <br />
41+
To learn:
4242

43-
- [vue-cli](https://cli.vuejs.org/)
44-
- [vuex modules](https://vuex.vuejs.org/guide/modules.html)
43+
- [vue-cli](https://cli.vuejs.org/)
44+
- [vuex modules](https://vuex.vuejs.org/guide/modules.html)
4545

46-
- 5th Iteration [(code)](https://github.com/jbrodriguez/mediagui/) <br />
47-
To learn:
48-
- [gRPC](https://gprc.io/)
46+
- 5th Iteration [(code)](https://github.com/jbrodriguez/mediagui/tree/2023.11.22-882b833) <br />
47+
To learn:
48+
49+
- [gRPC](https://gprc.io/)
50+
51+
- 6th Iteration [(code)](https://github.com/jbrodriguez/mediagui/) <br />
52+
To learn:
53+
54+
- [swr](https://swr.vercel.app/)
4955

5056
## Summary
5157

58+
### 6th Iteration
59+
60+
- update stack to vitejs
61+
- modernize go code
62+
- i touch this project sparingly, so I'm switching back to react for easier maintenance
63+
- swr for data fetching
64+
5265
### 5th Iteration
5366

5467
gRPC is easier to work with than go-micro (+consul).
@@ -71,8 +84,8 @@ vuejs is a pleasure to work with.
7184

7285
Its main assets are:
7386

74-
- [vue-cli](https://github.com/vuejs/vue-cli): creates a starter project, you just need to start coding and not worry about tooling
75-
- [vuex](https://github.com/vuejs/vuex): opinionated and easy state management
87+
- [vue-cli](https://github.com/vuejs/vue-cli): creates a starter project, you just need to start coding and not worry about tooling
88+
- [vuex](https://github.com/vuejs/vuex): opinionated and easy state management
7689

7790
The combination of vue-cli/vuex takes away a lot of the guess work that you generally find in redux (how to structure the app, etc.).
7891

VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

server/agent.go renamed to agent.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build agent
12
// +build agent
23

34
package main
@@ -26,6 +27,7 @@ var (
2627

2728
type mediaAgentServer struct {
2829
host string
30+
pb.UnimplementedMediaAgentServer
2931
}
3032

3133
// Scan -
@@ -129,12 +131,10 @@ func main() {
129131
log.Fatalf("failed to listen: %v", err)
130132
}
131133

132-
log.Printf("Started MediaAgent v%s listening on %s", Version, address)
133-
134-
var opts []grpc.ServerOption
135-
grpcServer := grpc.NewServer(opts...)
136-
137-
pb.RegisterMediaAgentServer(grpcServer, newServer())
138-
139-
grpcServer.Serve(lis)
134+
grpcServer := grpc.NewServer()
135+
pb.RegisterMediaAgentServer(grpcServer, &mediaAgentServer{})
136+
log.Printf("started mediaagent v%s listening on %s", Version, address)
137+
if err := grpcServer.Serve(lis); err != nil {
138+
log.Fatalf("failed to serve: %s", err)
139+
}
140140
}

0 commit comments

Comments
 (0)