Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ffb8e4994e | ||
![]() |
5b905bac24 | ||
![]() |
e320156a47 | ||
![]() |
c58dbf34d0 | ||
![]() |
472a446d3a | ||
![]() |
38610471f3 | ||
![]() |
707d88fb7f | ||
![]() |
e5b1dc2052 | ||
![]() |
3d865f47b3 | ||
![]() |
51622ac5fd | ||
![]() |
3e2b95c1c3 | ||
![]() |
fd970b6d1f | ||
![]() |
2e869d1d09 | ||
![]() |
c4fe532e88 | ||
![]() |
838ac4e7c3 | ||
![]() |
b7e3fa435a | ||
![]() |
87d5d769c8 | ||
![]() |
510d2980ac | ||
![]() |
fb43c99920 | ||
![]() |
be1a06a759 | ||
![]() |
4951e2bb34 | ||
![]() |
403f35b87f |
35
.github/workflows/build.yml
vendored
35
.github/workflows/build.yml
vendored
@@ -21,44 +21,51 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set ip Node.js
|
- name: Set ip Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
|
|
||||||
- name: Install dependecies
|
- name: Install dependecies
|
||||||
run: npm install
|
run: npm install
|
||||||
|
|
||||||
|
- name: Install Quasar CLI
|
||||||
|
run: npm install -g @quasar/cli
|
||||||
|
|
||||||
- name: Build Quasar SPA
|
- name: Build Quasar SPA
|
||||||
run: |
|
run: quasar build
|
||||||
npm install -g @quasar/cli quasar build
|
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.24.0'
|
go-version: '1.24.0'
|
||||||
|
cache-dependency-path: backend/go.sum
|
||||||
|
|
||||||
- name: Set up Git credentials for private modules
|
- name: Set up Git credentials for private modules
|
||||||
run: |
|
run: |
|
||||||
git config --global url."https://${{ secrets.GH_PAT }}@github.com/".insteadOf "https://github.com/"
|
git config --global url."https://oauth2:${{ secrets.GH_PAT }}@github.com".insteadOf "https://github.com"
|
||||||
echo "GOPRIVATE=github.com/tecamino/*" >> $GITHUB_ENV
|
env:
|
||||||
|
GH_PAT_FOR_MODULES: ${{ secrets.GH_PAT }}
|
||||||
|
|
||||||
|
- name: Go Mod Tidy & Download
|
||||||
|
working-directory: ./backend
|
||||||
|
run: go mod tidy -v
|
||||||
|
|
||||||
- name: Build go backend binary
|
- name: Build go backend binary
|
||||||
working-directory: ./backend
|
working-directory: ./backend
|
||||||
run: |
|
run: |
|
||||||
mkdir -p build
|
|
||||||
if [ "${{ matrix.goos }}" == "windows" ]; then
|
if [ "${{ matrix.goos }}" == "windows" ]; then
|
||||||
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o build/tecamino-dbm-${{ matrix.goos }}-${{ matrix.goarch }}.exe main.go
|
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ../server-${{ matrix.goos }}-${{ matrix.goarch }}.exe main.go
|
||||||
else
|
else
|
||||||
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o build/tecamino-dbm-${{ matrix.goos }}-${{ matrix.goarch }} main.go
|
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ../server-${{ matrix.goos }}-${{ matrix.goarch }} main.go
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Upload build artifacts
|
- name: Upload build artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: binaries-${{ matrix.goos }}-${{ matrix.goarch }}
|
name: lightcontroller-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||||
path: |
|
path: |
|
||||||
dist/spa
|
./dist/spa
|
||||||
backend/server
|
server-${{ matrix.goos }}-${{ matrix.goarch }}${{ (matrix.goos == 'windows' && '.exe') || '' }}
|
||||||
|
7
.gitignore
vendored
7
.gitignore
vendored
@@ -14,6 +14,7 @@ node_modules
|
|||||||
/src-cordova/www
|
/src-cordova/www
|
||||||
|
|
||||||
# Capacitor related directories and files
|
# Capacitor related directories and files
|
||||||
|
/src-capacitor
|
||||||
/src-capacitor/www
|
/src-capacitor/www
|
||||||
/src-capacitor/node_modules
|
/src-capacitor/node_modules
|
||||||
|
|
||||||
@@ -28,6 +29,7 @@ yarn-error.log*
|
|||||||
*.ntvs*
|
*.ntvs*
|
||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
|
*.scene
|
||||||
|
|
||||||
# local .env files
|
# local .env files
|
||||||
.env.local*
|
.env.local*
|
||||||
@@ -35,5 +37,8 @@ yarn-error.log*
|
|||||||
# local .db files
|
# local .db files
|
||||||
*.db
|
*.db
|
||||||
|
|
||||||
# local .db files
|
# local .log files
|
||||||
*.log
|
*.log
|
||||||
|
|
||||||
|
# golang quasar websever executable
|
||||||
|
backend/server-linux-arm64
|
||||||
|
@@ -1,84 +0,0 @@
|
|||||||
{"level":"info","timestamp":"2025-05-16T11:06:44.126","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-16T11:06:44.144","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T11:07:09.600","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-16T11:07:09.639","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T11:07:30.646","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T11:11:22.786","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T11:14:07.524","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T11:15:05.782","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T11:18:42.471","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T11:20:08.703","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T11:21:05.334","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T11:22:23.537","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T12:02:20.623","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T12:05:45.885","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T12:06:26.735","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T12:13:05.683","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T12:17:21.288","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T12:17:47.981","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T12:21:30.972","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T12:22:40.192","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T13:29:28.096","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T13:55:38.216","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T13:57:06.877","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T13:58:51.985","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T14:06:33.530","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T14:10:23.607","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T14:12:19.664","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T14:14:02.375","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T14:22:41.131","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T14:23:40.824","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T14:24:57.025","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T14:27:28.217","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T14:27:34.492","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-16T14:27:34.502","msg":"error http server listen tcp 0.0.0.0:8088: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T14:27:42.592","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-16T14:27:42.602","msg":"error http server listen tcp 0.0.0.0:8088: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T14:28:06.480","msg":"http listen on ip: 0.0.0.0 port: 8088","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-16T14:28:06.490","msg":"error http server listen tcp 0.0.0.0:8088: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T14:28:12.353","msg":"http listen on ip: 0.0.0.0 port: 8089","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T14:30:40.412","msg":"http listen on ip: 0.0.0.0 port: 8089","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T14:32:45.834","msg":"http listen on ip: 0.0.0.0 port: 8089","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-16T14:34:47.410","msg":"http listen on ip: 0.0.0.0 port: 8089","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:22:40.984","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:22:40.995","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:25:45.901","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:25:45.919","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:26:04.544","msg":"http listen on ip: 127.0.0.1 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:26:04.552","msg":"error http server listen tcp 127.0.0.1:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:26:18.968","msg":"http listen on ip: localhost port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:26:18.998","msg":"error http server listen tcp 127.0.0.1:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:26:37.288","msg":"http listen on ip: 0.0.0.0 port: 8080","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:36:02.157","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:36:02.168","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:36:15.150","msg":"http listen on ip: 0.0.0.0 port: 8080","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:42:12.925","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:42:12.935","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:42:23.735","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:42:23.751","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:42:38.098","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:42:38.114","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:43:08.854","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:43:08.867","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:43:33.337","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:43:33.347","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:43:54.154","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:43:54.164","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:44:32.352","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:44:32.370","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:45:16.468","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:45:16.479","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:45:43.373","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:45:43.383","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:45:49.084","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:45:49.103","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:46:03.457","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:46:03.466","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:46:50.673","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:46:50.682","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:47:04.563","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:47:04.571","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:48:25.067","msg":"http listen on ip: 0.0.0.0 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:48:25.080","msg":"error http server listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-05-23T21:48:32.148","msg":"http listen on ip: 127.0.0.1 port: 80","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-05-23T21:48:32.156","msg":"error http server listen tcp 127.0.0.1:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.","caller":"main"}
|
|
@@ -5,50 +5,49 @@ go 1.24.0
|
|||||||
toolchain go1.24.3
|
toolchain go1.24.3
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/gin-contrib/cors v1.7.5
|
||||||
github.com/gin-gonic/gin v1.10.0
|
github.com/gin-gonic/gin v1.10.0
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.2
|
github.com/golang-jwt/jwt/v5 v5.2.2
|
||||||
github.com/mattn/go-sqlite3 v1.14.28
|
github.com/google/uuid v1.6.0
|
||||||
github.com/tecamino/tecamino-dbm v0.0.10
|
github.com/tecamino/tecamino-dbm v0.0.10
|
||||||
github.com/tecamino/tecamino-logger v0.2.0
|
github.com/tecamino/tecamino-logger v0.2.0
|
||||||
golang.org/x/crypto v0.23.0
|
golang.org/x/crypto v0.36.0
|
||||||
|
modernc.org/sqlite v1.37.1
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/bytedance/sonic v1.11.6 // indirect
|
github.com/bytedance/sonic v1.13.2 // indirect
|
||||||
github.com/bytedance/sonic/loader v0.1.1 // indirect
|
github.com/bytedance/sonic/loader v0.2.4 // indirect
|
||||||
github.com/cloudwego/base64x v0.1.4 // indirect
|
github.com/cloudwego/base64x v0.1.5 // indirect
|
||||||
github.com/cloudwego/iasm v0.2.0 // indirect
|
|
||||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
|
||||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
github.com/gin-contrib/sse v1.0.0 // indirect
|
||||||
github.com/go-playground/locales v0.14.1 // indirect
|
github.com/go-playground/locales v0.14.1 // indirect
|
||||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||||
github.com/go-playground/validator/v10 v10.20.0 // indirect
|
github.com/go-playground/validator/v10 v10.26.0 // indirect
|
||||||
github.com/goccy/go-json v0.10.2 // indirect
|
github.com/goccy/go-json v0.10.5 // indirect
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
|
||||||
github.com/leodido/go-urn v1.4.0 // indirect
|
github.com/leodido/go-urn v1.4.0 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
github.com/ncruces/go-strftime v0.1.9 // indirect
|
github.com/ncruces/go-strftime v0.1.9 // indirect
|
||||||
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||||
go.uber.org/multierr v1.10.0 // indirect
|
go.uber.org/multierr v1.10.0 // indirect
|
||||||
go.uber.org/zap v1.27.0 // indirect
|
go.uber.org/zap v1.27.0 // indirect
|
||||||
golang.org/x/arch v0.8.0 // indirect
|
golang.org/x/arch v0.15.0 // indirect
|
||||||
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
|
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
|
||||||
golang.org/x/net v0.25.0 // indirect
|
golang.org/x/net v0.38.0 // indirect
|
||||||
golang.org/x/sys v0.33.0 // indirect
|
golang.org/x/sys v0.33.0 // indirect
|
||||||
golang.org/x/text v0.15.0 // indirect
|
golang.org/x/text v0.23.0 // indirect
|
||||||
google.golang.org/protobuf v1.34.1 // indirect
|
google.golang.org/protobuf v1.36.6 // indirect
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
modernc.org/libc v1.65.7 // indirect
|
modernc.org/libc v1.65.7 // indirect
|
||||||
modernc.org/mathutil v1.7.1 // indirect
|
modernc.org/mathutil v1.7.1 // indirect
|
||||||
modernc.org/memory v1.11.0 // indirect
|
modernc.org/memory v1.11.0 // indirect
|
||||||
modernc.org/sqlite v1.37.1 // indirect
|
|
||||||
)
|
)
|
||||||
|
108
backend/go.sum
108
backend/go.sum
@@ -1,20 +1,22 @@
|
|||||||
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
github.com/bytedance/sonic v1.13.2 h1:8/H1FempDZqC4VqjptGo14QQlJx8VdZJegxs6wwfqpQ=
|
||||||
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
|
github.com/bytedance/sonic v1.13.2/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=
|
||||||
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
|
|
||||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||||
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
|
github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY=
|
||||||
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
|
||||||
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=
|
||||||
|
github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||||
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||||
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
|
||||||
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
|
||||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
github.com/gin-contrib/cors v1.7.5 h1:cXC9SmofOrRg0w9PigwGlHG3ztswH6bqq4vJVXnvYMk=
|
||||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
github.com/gin-contrib/cors v1.7.5/go.mod h1:4q3yi7xBEDDWKapjT2o1V7mScKDDr8k+jZ0fSquGoy0=
|
||||||
|
github.com/gin-contrib/sse v1.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E=
|
||||||
|
github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0=
|
||||||
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
||||||
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||||
@@ -23,29 +25,33 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
|
|||||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||||
github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8=
|
github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k=
|
||||||
github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
|
||||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
||||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8=
|
github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8=
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
|
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs=
|
||||||
|
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||||
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
|
||||||
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||||
|
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||||
|
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||||
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A=
|
|
||||||
github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
@@ -53,12 +59,14 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
|
|||||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||||
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
|
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
|
||||||
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
||||||
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
|
||||||
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||||
|
github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
|
||||||
|
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
@@ -69,8 +77,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
|||||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/tecamino/tecamino-dbm v0.0.10 h1:+6OTl7yTsqLuYqE8QVB8ski3x0seI5yBFLnuHdVz99k=
|
github.com/tecamino/tecamino-dbm v0.0.10 h1:+6OTl7yTsqLuYqE8QVB8ski3x0seI5yBFLnuHdVz99k=
|
||||||
github.com/tecamino/tecamino-dbm v0.0.10/go.mod h1:8YYOr/jQ9mGVmmNj2NE8HajDvlJAVY3iGOZNfMjd8kA=
|
github.com/tecamino/tecamino-dbm v0.0.10/go.mod h1:8YYOr/jQ9mGVmmNj2NE8HajDvlJAVY3iGOZNfMjd8kA=
|
||||||
github.com/tecamino/tecamino-logger v0.2.0 h1:NPH/Gg9qRhmVoW8b39i1eXu/LEftHc74nyISpcRG+XU=
|
github.com/tecamino/tecamino-logger v0.2.0 h1:NPH/Gg9qRhmVoW8b39i1eXu/LEftHc74nyISpcRG+XU=
|
||||||
@@ -85,41 +93,57 @@ go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
|
|||||||
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||||
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||||
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
golang.org/x/arch v0.15.0 h1:QtOrQd0bTUnhNVNndMpLHNWrDmYzZ2KDqSrEymqInZw=
|
||||||
golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
|
golang.org/x/arch v0.15.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE=
|
||||||
golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
|
||||||
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
|
||||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
|
||||||
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 h1:R84qjqJb5nVJMxqWYb3np9L5ZsaDtB+a39EqjV0JSUM=
|
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 h1:R84qjqJb5nVJMxqWYb3np9L5ZsaDtB+a39EqjV0JSUM=
|
||||||
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0/go.mod h1:S9Xr4PYopiDyqSyp5NjCrhFrqg6A5zA2E/iPHPhqnS8=
|
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0/go.mod h1:S9Xr4PYopiDyqSyp5NjCrhFrqg6A5zA2E/iPHPhqnS8=
|
||||||
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
|
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
|
||||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
|
||||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
|
||||||
|
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||||
|
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
|
||||||
|
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
|
||||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
|
||||||
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||||
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
|
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
|
||||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI=
|
||||||
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
|
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||||
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
modernc.org/cc/v4 v4.26.1 h1:+X5NtzVBn0KgsBCBe+xkDC7twLb/jNVj9FPgiwSQO3s=
|
||||||
|
modernc.org/cc/v4 v4.26.1/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0=
|
||||||
|
modernc.org/ccgo/v4 v4.28.0 h1:rjznn6WWehKq7dG4JtLRKxb52Ecv8OUGah8+Z/SfpNU=
|
||||||
|
modernc.org/ccgo/v4 v4.28.0/go.mod h1:JygV3+9AV6SmPhDasu4JgquwU81XAKLd3OKTUDNOiKE=
|
||||||
|
modernc.org/fileutil v1.3.1 h1:8vq5fe7jdtEvoCf3Zf9Nm0Q05sH6kGx0Op2CPx1wTC8=
|
||||||
|
modernc.org/fileutil v1.3.1/go.mod h1:HxmghZSZVAz/LXcMNwZPA/DRrQZEVP9VX0V4LQGQFOc=
|
||||||
|
modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI=
|
||||||
|
modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito=
|
||||||
modernc.org/libc v1.65.7 h1:Ia9Z4yzZtWNtUIuiPuQ7Qf7kxYrxP1/jeHZzG8bFu00=
|
modernc.org/libc v1.65.7 h1:Ia9Z4yzZtWNtUIuiPuQ7Qf7kxYrxP1/jeHZzG8bFu00=
|
||||||
modernc.org/libc v1.65.7/go.mod h1:011EQibzzio/VX3ygj1qGFt5kMjP0lHb0qCW5/D/pQU=
|
modernc.org/libc v1.65.7/go.mod h1:011EQibzzio/VX3ygj1qGFt5kMjP0lHb0qCW5/D/pQU=
|
||||||
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
|
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
|
||||||
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
|
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
|
||||||
modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
|
modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
|
||||||
modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
|
modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
|
||||||
|
modernc.org/opt v0.1.4 h1:2kNGMRiUjrp4LcaPuLY2PzUfqM/w9N23quVwhKt5Qm8=
|
||||||
|
modernc.org/opt v0.1.4/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns=
|
||||||
|
modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w=
|
||||||
|
modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE=
|
||||||
modernc.org/sqlite v1.37.1 h1:EgHJK/FPoqC+q2YBXg7fUmES37pCHFc97sI7zSayBEs=
|
modernc.org/sqlite v1.37.1 h1:EgHJK/FPoqC+q2YBXg7fUmES37pCHFc97sI7zSayBEs=
|
||||||
modernc.org/sqlite v1.37.1/go.mod h1:XwdRtsE1MpiBcL54+MbKcaDvcuej+IYSMfLN6gSKV8g=
|
modernc.org/sqlite v1.37.1/go.mod h1:XwdRtsE1MpiBcL54+MbKcaDvcuej+IYSMfLN6gSKV8g=
|
||||||
|
modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0=
|
||||||
|
modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A=
|
||||||
|
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
|
||||||
|
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
||||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
|
||||||
|
@@ -2,7 +2,7 @@ package login
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"backend/dbRequest"
|
"backend/dbRequest"
|
||||||
"backend/login/models"
|
"backend/models"
|
||||||
"backend/utils"
|
"backend/utils"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
@@ -2,15 +2,19 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"backend/login"
|
"backend/login"
|
||||||
|
secenes "backend/scenes"
|
||||||
"backend/server"
|
"backend/server"
|
||||||
"backend/utils"
|
"backend/utils"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/gin-contrib/cors"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/tecamino/tecamino-logger/logging"
|
"github.com/tecamino/tecamino-logger/logging"
|
||||||
)
|
)
|
||||||
@@ -44,6 +48,10 @@ func main() {
|
|||||||
Debug: *debug,
|
Debug: *debug,
|
||||||
TerminalOut: true,
|
TerminalOut: true,
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("main new logger", err.Error())
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
//new login manager
|
//new login manager
|
||||||
loginManager, err := login.NewLoginManager(".")
|
loginManager, err := login.NewLoginManager(".")
|
||||||
@@ -52,26 +60,58 @@ func main() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//new scenes handler
|
||||||
|
scenesHandler := secenes.NewScenesHandler("")
|
||||||
|
|
||||||
// new server
|
// new server
|
||||||
s := server.NewServer()
|
s := server.NewServer()
|
||||||
|
|
||||||
|
//get local ip
|
||||||
|
origins := []string{"http://localhost:9000"}
|
||||||
|
origins = append(origins, "http://localhost:9500")
|
||||||
|
|
||||||
|
localIP, err := utils.GetLocalIP()
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("main", fmt.Sprintf("get local ip : %s", err.Error()))
|
||||||
|
} else {
|
||||||
|
origins = append(origins, fmt.Sprintf("http://%s:9000", localIP))
|
||||||
|
origins = append(origins, fmt.Sprintf("http://%s:9500", localIP))
|
||||||
|
}
|
||||||
|
fmt.Println(123, origins)
|
||||||
|
s.Routes.Use(cors.New(cors.Config{
|
||||||
|
AllowOrigins: origins,
|
||||||
|
AllowMethods: []string{"POST", "GET", "DELETE", "OPTIONS"},
|
||||||
|
AllowHeaders: []string{"Origin", "Content-Type"},
|
||||||
|
AllowCredentials: true,
|
||||||
|
}))
|
||||||
|
|
||||||
api := s.Routes.Group("/api")
|
api := s.Routes.Group("/api")
|
||||||
//set routes
|
//set routes
|
||||||
|
api.GET("/loadScenes", scenesHandler.LoadScenes)
|
||||||
api.POST("/login", loginManager.Login)
|
api.POST("/login", loginManager.Login)
|
||||||
api.POST("/user/add", loginManager.AddUser)
|
api.POST("/user/add", loginManager.AddUser)
|
||||||
|
api.POST("/saveScene", scenesHandler.SaveScene)
|
||||||
|
api.POST("/loadScene", scenesHandler.LoadScene)
|
||||||
api.DELETE("/user", loginManager.RemoveUser)
|
api.DELETE("/user", loginManager.RemoveUser)
|
||||||
|
api.DELETE("/deleteScene", scenesHandler.DeleteScene)
|
||||||
|
|
||||||
// Serve static files
|
// Serve static files
|
||||||
s.Routes.StaticFS("/", gin.Dir(*spa, true))
|
s.Routes.StaticFS("/assets", gin.Dir(filepath.Join(*spa, "assets"), true))
|
||||||
s.Routes.NoRoute(func(c *gin.Context) {
|
s.Routes.NoRoute(func(c *gin.Context) {
|
||||||
|
// Disallow fallback for /api paths
|
||||||
|
if strings.HasPrefix(c.Request.URL.Path, "/api") {
|
||||||
|
c.JSON(http.StatusNotFound, gin.H{"error": "API endpoint not found"})
|
||||||
|
return
|
||||||
|
}
|
||||||
// Try to serve file from SPA directory
|
// Try to serve file from SPA directory
|
||||||
filePath := filepath.Join(*spa, c.Request.URL.Path)
|
filePath := filepath.Join(*spa, c.Request.URL.Path)
|
||||||
if _, err := os.Stat(filePath); err == nil {
|
if _, err := os.Stat(filePath); err == nil {
|
||||||
c.File(filePath)
|
c.File(filePath)
|
||||||
} else {
|
return
|
||||||
// Fallback to index.html for SPA routing
|
|
||||||
c.File(filepath.Join(*spa, "index.html"))
|
|
||||||
}
|
}
|
||||||
|
// Fallback to index.html for SPA routing
|
||||||
|
c.File(filepath.Join(*spa, "index.html"))
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
@@ -80,7 +120,6 @@ func main() {
|
|||||||
logger.Error("main", fmt.Sprintf("starting browser error : %s", err.Error()))
|
logger.Error("main", fmt.Sprintf("starting browser error : %s", err.Error()))
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
fmt.Println(3, *ip, *port)
|
|
||||||
// start http server
|
// start http server
|
||||||
logger.Info("main", fmt.Sprintf("http listen on ip: %s port: %d", *ip, *port))
|
logger.Info("main", fmt.Sprintf("http listen on ip: %s port: %d", *ip, *port))
|
||||||
if err := s.ServeHttp(*ip, *port); err != nil {
|
if err := s.ServeHttp(*ip, *port); err != nil {
|
||||||
|
3
backend/models/lightBar.go
Normal file
3
backend/models/lightBar.go
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type LightBar []Value
|
3
backend/models/movingHead.go
Normal file
3
backend/models/movingHead.go
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type MovingHead []Value
|
11
backend/models/scenes.go
Normal file
11
backend/models/scenes.go
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type Scenes []Scene
|
||||||
|
|
||||||
|
type Scene struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Desciption string `json:"description,omitempty"`
|
||||||
|
MovingHead bool `json:"movingHead"`
|
||||||
|
LightBar bool `json:"lightBar"`
|
||||||
|
Values []Value `json:"values,omitempty"`
|
||||||
|
}
|
9
backend/models/value.go
Normal file
9
backend/models/value.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import "github.com/google/uuid"
|
||||||
|
|
||||||
|
type Value struct {
|
||||||
|
Uuid uuid.UUID `json:"uuid"`
|
||||||
|
Path string `json:"path"`
|
||||||
|
Value any `json:"value"`
|
||||||
|
}
|
7
backend/models/values.go
Normal file
7
backend/models/values.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type Values struct {
|
||||||
|
MovingHead *MovingHead `json:"movingHead"`
|
||||||
|
LightBar *LightBar `json:"lightBar"`
|
||||||
|
Value any `json:"value"`
|
||||||
|
}
|
215
backend/scenes/scenes.go
Normal file
215
backend/scenes/scenes.go
Normal file
@@ -0,0 +1,215 @@
|
|||||||
|
package secenes
|
||||||
|
|
||||||
|
import (
|
||||||
|
"backend/models"
|
||||||
|
"backend/utils"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"path/filepath"
|
||||||
|
"sort"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ScenesHandler struct {
|
||||||
|
dir string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewScenesHandler(dir string) *ScenesHandler {
|
||||||
|
if dir == "" {
|
||||||
|
dir = "./scenes"
|
||||||
|
}
|
||||||
|
return &ScenesHandler{
|
||||||
|
dir: dir,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sh *ScenesHandler) SaveScene(c *gin.Context) {
|
||||||
|
body, err := io.ReadAll(c.Request.Body)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var scene models.Scene
|
||||||
|
err = json.Unmarshal(body, &scene)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat(path.Join(sh.dir)); err != nil {
|
||||||
|
err := os.MkdirAll(sh.dir, 0755)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
f, err := os.OpenFile(path.Join(sh.dir, scene.Name+".scene"), os.O_CREATE|os.O_TRUNC|os.O_RDWR, 0644)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
|
||||||
|
_, err = f.Write(body)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"message": fmt.Sprintf("Scene '%s' saved", scene.Name),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sh *ScenesHandler) DeleteScene(c *gin.Context) {
|
||||||
|
body, err := io.ReadAll(c.Request.Body)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var scene models.Scene
|
||||||
|
err = json.Unmarshal(body, &scene)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
err = os.Remove(path.Join(sh.dir, scene.Name+".scene"))
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"message": fmt.Sprintf("Scene '%s' deleted", scene.Name),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sh *ScenesHandler) LoadScenes(c *gin.Context) {
|
||||||
|
sceneMap := make(map[string]models.Scene)
|
||||||
|
|
||||||
|
files, err := utils.FindAllFiles("./scenes", ".scene")
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, f := range files {
|
||||||
|
content, err := os.ReadFile(f)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var scene models.Scene
|
||||||
|
err = json.Unmarshal(content, &scene)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
sceneMap[scene.Name] = scene
|
||||||
|
}
|
||||||
|
|
||||||
|
//sort scenes alphabetacally by name
|
||||||
|
keys := make([]string, 0, len(sceneMap))
|
||||||
|
for key := range sceneMap {
|
||||||
|
keys = append(keys, key)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort keys alphabetically
|
||||||
|
sort.Strings(keys)
|
||||||
|
|
||||||
|
var scenes []models.Scene
|
||||||
|
// Iterate over sorted keys
|
||||||
|
for _, key := range keys {
|
||||||
|
scenes = append(scenes, sceneMap[key])
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, scenes)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sh *ScenesHandler) LoadScene(c *gin.Context) {
|
||||||
|
body, err := io.ReadAll(c.Request.Body)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var scene models.Scene
|
||||||
|
|
||||||
|
err = json.Unmarshal(body, &scene)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
files, err := utils.FindAllFiles("./scenes", ".scene")
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, f := range files {
|
||||||
|
if filepath.Base(f) != scene.Name+".scene" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
content, err := os.ReadFile(f)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.Unmarshal(content, &scene)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.JSON(http.StatusOK, scene)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{
|
||||||
|
"error": fmt.Errorf("scene '%s' not found", scene.Name),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
22
backend/utils/ip.go
Normal file
22
backend/utils/ip.go
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetLocalIP() (string, error) {
|
||||||
|
addrs, err := net.InterfaceAddrs()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, addr := range addrs {
|
||||||
|
if ipNet, ok := addr.(*net.IPNet); ok && !ipNet.IP.IsLoopback() {
|
||||||
|
if ipNet.IP.To4() != nil {
|
||||||
|
return ipNet.IP.String(), nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "", fmt.Errorf("no local IP address found")
|
||||||
|
}
|
@@ -2,7 +2,10 @@ package utils
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/tecamino/tecamino-logger/logging"
|
"github.com/tecamino/tecamino-logger/logging"
|
||||||
@@ -25,6 +28,10 @@ func OpenBrowser(url string, logger *logging.Logger) error {
|
|||||||
{"open", url}, // fallback
|
{"open", url}, // fallback
|
||||||
}
|
}
|
||||||
default: // Linux
|
default: // Linux
|
||||||
|
if os.Getenv("DISPLAY") == "" && os.Getenv("WAYLAND_DISPLAY") == "" && os.Getenv("XDG_SESSION_TYPE") != "wayland" {
|
||||||
|
|
||||||
|
return fmt.Errorf("os is running i headless mode do not start browser")
|
||||||
|
}
|
||||||
commands = [][]string{
|
commands = [][]string{
|
||||||
{"chromium-browser", "--kiosk", url},
|
{"chromium-browser", "--kiosk", url},
|
||||||
{"google-chrome", "--kiosk", url},
|
{"google-chrome", "--kiosk", url},
|
||||||
@@ -44,3 +51,15 @@ func OpenBrowser(url string, logger *logging.Logger) error {
|
|||||||
|
|
||||||
return fmt.Errorf("could not open browser")
|
return fmt.Errorf("could not open browser")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func FindAllFiles(rootDir, fileExtention string) (files []string, err error) {
|
||||||
|
err = filepath.WalkDir(rootDir, func(path string, d fs.DirEntry, err error) error {
|
||||||
|
if d.IsDir() {
|
||||||
|
return nil
|
||||||
|
} else if filepath.Ext(d.Name()) == fileExtention {
|
||||||
|
files = append(files, path)
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
12
package-lock.json
generated
12
package-lock.json
generated
@@ -1,16 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "lightcontrol",
|
"name": "lightcontrol",
|
||||||
"version": "0.0.5",
|
"version": "0.0.14",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "lightcontrol",
|
"name": "lightcontrol",
|
||||||
"version": "0.0.5",
|
"version": "0.0.14",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@quasar/extras": "^1.16.4",
|
"@quasar/extras": "^1.16.4",
|
||||||
"axios": "^1.9.0",
|
"axios": "^1.10.0",
|
||||||
"quasar": "^2.16.0",
|
"quasar": "^2.16.0",
|
||||||
"vue": "^3.4.18",
|
"vue": "^3.4.18",
|
||||||
"vue-router": "^4.0.12"
|
"vue-router": "^4.0.12"
|
||||||
@@ -2312,9 +2312,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/axios": {
|
"node_modules/axios": {
|
||||||
"version": "1.9.0",
|
"version": "1.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.10.0.tgz",
|
||||||
"integrity": "sha512-re4CqKTJaURpzbLHtIi6XpDv20/CnpXOtjRY5/CU32L8gU8ek9UIivcfvSWvmKEngmVbrUtPpdDwWDWL7DNHvg==",
|
"integrity": "sha512-/1xYAC4MP/HEG+3duIhFr4ZQXR4sQXOIe+o6sdqzeykGLx6Upp/1p8MHqhINOvGeP7xyNHe7tsiJByc4SSVUxw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"follow-redirects": "^1.15.6",
|
"follow-redirects": "^1.15.6",
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "lightcontrol",
|
"name": "lightcontrol",
|
||||||
"version": "0.0.4",
|
"version": "0.0.18",
|
||||||
"description": "A Quasar Project",
|
"description": "A Tecamino App",
|
||||||
"productName": "Light Control",
|
"productName": "Light Control",
|
||||||
"author": "A. Zuercher",
|
"author": "A. Zuercher",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@quasar/extras": "^1.16.4",
|
"@quasar/extras": "^1.16.4",
|
||||||
"axios": "^1.9.0",
|
"axios": "^1.10.0",
|
||||||
"quasar": "^2.16.0",
|
"quasar": "^2.16.0",
|
||||||
"vue": "^3.4.18",
|
"vue": "^3.4.18",
|
||||||
"vue-router": "^4.0.12"
|
"vue-router": "^4.0.12"
|
||||||
|
1
src/assets/LOGO_CF-BERN_high_color.svg
Normal file
1
src/assets/LOGO_CF-BERN_high_color.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 7.1 KiB |
31
src/assets/LOGO_CF-ICON_color.svg
Normal file
31
src/assets/LOGO_CF-ICON_color.svg
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Adobe Illustrator 24.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<svg version="1.1" id="Ebene_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
width="246px" height="246px" viewBox="0 0 246 246" style="enable-background:new 0 0 246 246;" xml:space="preserve">
|
||||||
|
<style type="text/css">
|
||||||
|
.st0{fill:#113A68;}
|
||||||
|
.st1{fill:#9E2D29;}
|
||||||
|
.st2{fill:#9B1515;}
|
||||||
|
.st3{fill:#FFFFFF;}
|
||||||
|
</style>
|
||||||
|
<g>
|
||||||
|
<path class="st0" d="M166.6,210.9c-11.6,5-24.4,7.8-37.8,7.8c-52.8,0-95.6-42.8-95.6-95.6c0-2.3,0.1-4.6,0.2-6.8
|
||||||
|
c2.4-1.8,10.8-5.2,31.7-5.2s46.4,3.4,71.6,9.4c-13,22.2-15.9,44.7-7.8,62.2C133.6,192.6,143.9,205.2,166.6,210.9"/>
|
||||||
|
<path class="st0" d="M146.9,103.8C102.4,90.7,61.4,88.5,39.7,88.4c0-0.1,0.1-0.2,0.1-0.2c2.5-1.4,8.9-3.3,22.1-3.3
|
||||||
|
c23.7,0,55.7,5.9,86.9,15.8C148.2,101.7,147.5,102.7,146.9,103.8"/>
|
||||||
|
<path class="st0" d="M168.4,49.9c0.7,7.9-2.7,18.9-10.6,34.4C117.3,69.2,78.9,63.7,55.4,61.7c17.5-21,43.9-34.3,73.4-34.3
|
||||||
|
c7.8,0,15.5,0.9,22.8,2.7l3.8,2.5C164.2,38.3,167.8,43.1,168.4,49.9"/>
|
||||||
|
<path class="st0" d="M209.6,71.8c8.7,13.7,14,29.8,14.7,47c-3.9-2.6-8.2-5.3-13.1-8.3C214,95.5,212.6,82.5,209.6,71.8"/>
|
||||||
|
<path class="st0" d="M206.8,144.8c4.5,2.1,9,4.5,13.2,6.7c-2.2,6.9-5.1,13.5-8.7,19.6c-0.6-4-2.2-7.4-3.5-10.3
|
||||||
|
c-2.5-5.6-4.2-9.3-1.2-15.7C206.8,145,206.8,144.9,206.8,144.8"/>
|
||||||
|
<path class="st0" d="M207.2,125.1c5.4,2.9,11.3,6.2,16.6,9.2c-0.1,1.2-0.3,2.4-0.5,3.7c-5.7-3.5-11.8-7-17.2-9.9
|
||||||
|
C206.4,127.1,206.8,126.1,207.2,125.1"/>
|
||||||
|
<path class="st1" d="M185.2,205.6c41.5-36.8,4.9-39.5,15.9-63.1c-14,12.6-44,47.2-18,64.1C164.7,168.9,207.4,157.8,185.2,205.6"/>
|
||||||
|
<path class="st2" d="M198.1,130.8c9.6,5,24.5,13.5,33.5,20c-9.4-5.4-24.7-13-34.9-17.4c-2,3.9-4.3,7.8-7,11.8
|
||||||
|
c-10.3,15-36.7,44.6-12.5,61.4c-51.2-7.1-57.1-49.2-33.1-86.7c0.8-1.2,1.5-2.4,2.3-3.6c-62.2-16.2-119.6-14.7-119.8,0.3
|
||||||
|
c-14.3-6.8-26.2-20.1-2.1-21.8c9.6-0.7,65.2-2.4,125.1,16.2c3-4.9,5.8-9.6,8.2-13.9c-63.3-21.6-124.4-24-125.5-8.6
|
||||||
|
C18.4,81,7.4,67,31.6,66.7c9.9-0.1,68.5,1.5,129.1,25.3c21.2-39.5,16.4-52.7-2-64.6c21.6,1.5,57.2,37,45.6,86.1
|
||||||
|
c8.8,5.4,22.8,14.1,31,20.7c-8.4-5.5-22.6-13.3-31.7-17.9C202.2,121.1,200.4,125.9,198.1,130.8"/>
|
||||||
|
<path class="st2" d="M185.2,205.6c41.5-36.8,4.9-39.5,15.9-63.1c-14,12.6-44,47.2-18,64.1C164.7,168.9,207.4,157.8,185.2,205.6"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.3 KiB |
1
src/assets/pottershouse.svg
Normal file
1
src/assets/pottershouse.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 233 KiB |
@@ -4,8 +4,8 @@ import { initWebSocket } from 'src/services/websocket';
|
|||||||
|
|
||||||
export default boot(({ app }) => {
|
export default boot(({ app }) => {
|
||||||
const $q = app.config.globalProperties.$q as QVueGlobals;
|
const $q = app.config.globalProperties.$q as QVueGlobals;
|
||||||
const host = window.location.hostname; // gets current domain or IP
|
const host = window.location.hostname;
|
||||||
const port = 8100; // your WebSocket port
|
const port = 8100;
|
||||||
|
|
||||||
const randomId = Math.floor(Math.random() * 10001); // random number from 0 to 10000
|
const randomId = Math.floor(Math.random() * 10001); // random number from 0 to 10000
|
||||||
const ws = initWebSocket(`ws://${host}:${port}/ws?id=q${randomId}`, $q);
|
const ws = initWebSocket(`ws://${host}:${port}/ws?id=q${randomId}`, $q);
|
||||||
|
@@ -10,105 +10,62 @@
|
|||||||
no-transition
|
no-transition
|
||||||
:default-expand-all="false"
|
:default-expand-all="false"
|
||||||
v-model:expanded="expanded"
|
v-model:expanded="expanded"
|
||||||
|
@update:expanded="onExpandedChange"
|
||||||
@lazy-load="onLazyLoad"
|
@lazy-load="onLazyLoad"
|
||||||
>
|
>
|
||||||
<template v-slot:[`default-header`]="props">
|
<template v-slot:[`default-header`]="props">
|
||||||
<div
|
<div
|
||||||
class="row items-center text-blue"
|
class="row items-center text-blue"
|
||||||
@contextmenu.prevent.stop="openContextMenu($event, props.node)"
|
@contextmenu.prevent.stop="openSubMenu($event, props.node.key)"
|
||||||
>
|
>
|
||||||
<div class="row items-center text-blue"></div>
|
<div class="row items-center text-blue"></div>
|
||||||
<div>{{ props.node.path }}</div>
|
<div>{{ props.node.path }}</div>
|
||||||
</div>
|
</div>
|
||||||
<q-popup-edit
|
|
||||||
v-if="props.node.value !== undefined && props.node.value !== ''"
|
|
||||||
v-model="props.node.value"
|
|
||||||
class="q-ml-xl bg-grey text-white"
|
|
||||||
@save="(val) => onValueEdit(val, props.node)"
|
|
||||||
>
|
|
||||||
<template v-slot="scope">
|
|
||||||
<q-input
|
|
||||||
dark
|
|
||||||
color="white"
|
|
||||||
v-model="scope.value"
|
|
||||||
dense
|
|
||||||
autofocus
|
|
||||||
counter
|
|
||||||
@keyup.enter="scope.set"
|
|
||||||
>
|
|
||||||
<template v-slot:append>
|
|
||||||
<q-icon name="edit" />
|
|
||||||
</template>
|
|
||||||
</q-input>
|
|
||||||
</template>
|
|
||||||
</q-popup-edit>
|
|
||||||
</template>
|
</template>
|
||||||
</q-tree>
|
</q-tree>
|
||||||
<sub-menu :node="selectedNode"></sub-menu>
|
<!-- not implemented yet <sub-menu ref="subMenuRef"></sub-menu> -->
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<DataTable :rows="Subscriptions" class="col-8" />
|
<dataTable class="col-8" :rows="getRows()" />
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { watch, onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import DataTable from './dataTable.vue';
|
|
||||||
import type { TreeNode } from 'src/composables/dbm/dbmTree';
|
|
||||||
import {
|
import {
|
||||||
dbmData,
|
type TreeNode,
|
||||||
buildTree,
|
buildTree,
|
||||||
getSubscriptionsByUuid,
|
dbmData,
|
||||||
addChildrentoTree,
|
|
||||||
removeSubtreeByParentKey,
|
removeSubtreeByParentKey,
|
||||||
getAllSubscriptions,
|
|
||||||
} from 'src/composables/dbm/dbmTree';
|
} from 'src/composables/dbm/dbmTree';
|
||||||
|
import DataTable from './DataTable.vue';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { openContextMenu } from 'src/composables/dbm/useContextMenu';
|
|
||||||
import { NotifyResponse } from 'src/composables/notify';
|
import { NotifyResponse } from 'src/composables/notify';
|
||||||
import SubMenu from 'src/components/dbm/SubMenu.vue';
|
|
||||||
import { QCard } from 'quasar';
|
import { QCard } from 'quasar';
|
||||||
import { subscribe, unsubscribe, setValues } from 'src/services/websocket';
|
import { subscribe, unsubscribe } from 'src/services/websocket';
|
||||||
import { onBeforeRouteLeave } from 'vue-router';
|
import { onBeforeRouteLeave } from 'vue-router';
|
||||||
import { api } from 'boot/axios';
|
import { api } from 'boot/axios';
|
||||||
import type { Subs } from 'src/models/Subscribe';
|
// not implemented yet import SubMenu from './SubMenu.vue';
|
||||||
|
import { type Subs, type RawSubs, convertToSubscribes } from 'src/models/Subscribe';
|
||||||
|
import { addSubscriptions, getRows, removeAllSubscriptions } from 'src/models/Subscriptions';
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const expanded = ref<string[]>([]);
|
const expanded = ref<string[]>([]);
|
||||||
const selectedNode = ref<TreeNode | null>(null);
|
|
||||||
const ZERO_UUID = '00000000-0000-0000-0000-000000000000';
|
const ZERO_UUID = '00000000-0000-0000-0000-000000000000';
|
||||||
const Subscriptions = ref<Subs>([]);
|
let lastExpanded: string[] = [];
|
||||||
|
const postQuery = '/json_data';
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const payload = {
|
|
||||||
get: [
|
|
||||||
{
|
|
||||||
path: '.*',
|
|
||||||
query: { depth: 1 },
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
api
|
api
|
||||||
.post('/json_data', payload)
|
.post(postQuery, { get: [{ path: '.*', query: { depth: 1 } }] })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.data.get) {
|
if (res.data.get) buildTree(convertToSubscribes(res.data.get as RawSubs));
|
||||||
dbmData.value = buildTree(res.data.get);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => NotifyResponse($q, err, 'error'));
|
||||||
NotifyResponse($q, err, 'error');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeRouteLeave(() => {
|
onBeforeRouteLeave(() => {
|
||||||
unsubscribe([
|
unsubscribe([{ path: '.*', depth: 0 }]).catch((err) => NotifyResponse($q, err, 'error'));
|
||||||
{
|
|
||||||
path: '.*',
|
|
||||||
depth: 0,
|
|
||||||
},
|
|
||||||
]).catch((err) => {
|
|
||||||
NotifyResponse($q, err, 'error');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function onLazyLoad({
|
function onLazyLoad({
|
||||||
@@ -120,44 +77,11 @@ function onLazyLoad({
|
|||||||
done: (children: TreeNode[]) => void;
|
done: (children: TreeNode[]) => void;
|
||||||
fail: () => void;
|
fail: () => void;
|
||||||
}): void {
|
}): void {
|
||||||
//first unsubsrice nodes
|
api
|
||||||
|
.post(postQuery, { get: [{ uuid: node.key ?? ZERO_UUID, path: '', query: { depth: 2 } }] })
|
||||||
unsubscribe([
|
|
||||||
{
|
|
||||||
path: '.*',
|
|
||||||
depth: 0,
|
|
||||||
},
|
|
||||||
])
|
|
||||||
.then(() => {
|
|
||||||
Subscriptions.value = [];
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
NotifyResponse($q, err, 'error');
|
|
||||||
});
|
|
||||||
|
|
||||||
// now subscribe nodes
|
|
||||||
subscribe([
|
|
||||||
{
|
|
||||||
uuid: node.key ?? ZERO_UUID,
|
|
||||||
path: '',
|
|
||||||
depth: 2,
|
|
||||||
},
|
|
||||||
])
|
|
||||||
.then((resp) => {
|
.then((resp) => {
|
||||||
if (resp?.subscribe) {
|
if (resp?.data.get) done(buildTree(convertToSubscribes(resp?.data.get as RawSubs)));
|
||||||
// Optional: update your internal store too
|
else done([]); // no children returned
|
||||||
addChildrentoTree(resp?.subscribe);
|
|
||||||
|
|
||||||
const toRemove = new Set(
|
|
||||||
resp.subscribe.filter((sub) => sub.uuid !== ZERO_UUID).map((sub) => sub.uuid),
|
|
||||||
);
|
|
||||||
|
|
||||||
Subscriptions.value = getAllSubscriptions().filter((sub) => toRemove.has(sub.uuid));
|
|
||||||
|
|
||||||
done(dbmData.value);
|
|
||||||
} else {
|
|
||||||
done([]); // no children returned
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
NotifyResponse($q, err, 'error');
|
NotifyResponse($q, err, 'error');
|
||||||
@@ -165,52 +89,62 @@ function onLazyLoad({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onValueEdit(newValue: undefined, node: TreeNode) {
|
async function onExpandedChange(newExpanded: readonly string[]) {
|
||||||
console.log(node.value, node.value === undefined);
|
const collapsed = lastExpanded.filter((k) => !newExpanded.includes(k));
|
||||||
const sub = getSubscriptionsByUuid(node.key);
|
const newlyExpanded = newExpanded.filter((k) => !lastExpanded.includes(k));
|
||||||
if (sub) {
|
|
||||||
setValues([
|
try {
|
||||||
{
|
await unsubscribe([{ path: '.*', depth: 0 }])
|
||||||
path: sub.path ?? '',
|
.then(() => {
|
||||||
value: newValue,
|
removeAllSubscriptions();
|
||||||
},
|
})
|
||||||
]).catch((err) => {
|
.catch((err) => NotifyResponse($q, err, 'error'));
|
||||||
NotifyResponse($q, err, 'error');
|
|
||||||
});
|
if (collapsed.length) {
|
||||||
|
collapsed.forEach((key) => {
|
||||||
|
removeSubtreeByParentKey(key);
|
||||||
|
api
|
||||||
|
.post(postQuery, { get: [{ uuid: key, path: '', query: { depth: 2 } }] })
|
||||||
|
.then((resp) => {
|
||||||
|
if (resp?.data.get) {
|
||||||
|
buildTree(resp?.data.get as Subs);
|
||||||
|
subscribe([{ uuid: key, path: '', depth: 2 }]).catch((err) =>
|
||||||
|
NotifyResponse($q, err, 'error'),
|
||||||
|
);
|
||||||
|
addSubscriptions(resp?.data.get as RawSubs);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => NotifyResponse($q, err, 'error'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (newlyExpanded.length) {
|
||||||
|
newlyExpanded.forEach((key) => {
|
||||||
|
api
|
||||||
|
.post(postQuery, { get: [{ uuid: key, path: '', query: { depth: 2 } }] })
|
||||||
|
.then((resp) => {
|
||||||
|
if (resp?.data.get) {
|
||||||
|
buildTree(resp?.data.get as Subs);
|
||||||
|
subscribe([{ uuid: key, path: '', depth: 2 }]).catch((err) =>
|
||||||
|
NotifyResponse($q, err, 'error'),
|
||||||
|
);
|
||||||
|
addSubscriptions(resp?.data.get as RawSubs);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => NotifyResponse($q, err, 'error'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
lastExpanded = [...newExpanded];
|
||||||
|
} catch {
|
||||||
|
console.error('error in expand function');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
const subMenuRef = ref();
|
||||||
expanded,
|
|
||||||
(newVal, oldVal) => {
|
|
||||||
const collapsedKeys = oldVal.filter((key) => !newVal.includes(key));
|
|
||||||
collapsedKeys.forEach((key: string) => {
|
|
||||||
// WebSocket unsubscribe
|
|
||||||
unsubscribe([
|
|
||||||
{
|
|
||||||
uuid: key,
|
|
||||||
path: '.*',
|
|
||||||
depth: 0,
|
|
||||||
},
|
|
||||||
])
|
|
||||||
.then((resp) => {
|
|
||||||
// Remove children of this node from the tree
|
|
||||||
removeSubtreeByParentKey(key);
|
|
||||||
if (resp?.unsubscribe) {
|
|
||||||
const toRemove = new Set(
|
|
||||||
resp.unsubscribe.filter((sub) => sub.uuid !== ZERO_UUID).map((sub) => sub.uuid),
|
|
||||||
);
|
|
||||||
|
|
||||||
Subscriptions.value = Subscriptions.value.filter((sub) => !toRemove.has(sub.uuid));
|
function openSubMenu(event: MouseEvent, uuid: string) {
|
||||||
}
|
subMenuRef.value?.open(event, uuid);
|
||||||
})
|
}
|
||||||
.catch((err) => {
|
|
||||||
NotifyResponse($q, err, 'error');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
{ deep: false },
|
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
@@ -4,50 +4,49 @@
|
|||||||
<q-item clickable v-close-popup @click="handleAction('Add')">
|
<q-item clickable v-close-popup @click="handleAction('Add')">
|
||||||
<q-item-section>Add Datapoint</q-item-section>
|
<q-item-section>Add Datapoint</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item clickable v-close-popup @click="handleAction('Delete')">
|
<q-item
|
||||||
|
:class="disable ? 'text-grey-5' : ''"
|
||||||
|
:clickable="!disable"
|
||||||
|
v-close-popup
|
||||||
|
@click="handleAction('Delete')"
|
||||||
|
>
|
||||||
<q-item-section>Delete Datapoint</q-item-section>
|
<q-item-section>Delete Datapoint</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
</q-list>
|
</q-list>
|
||||||
</q-menu>
|
</q-menu>
|
||||||
|
<AddDialog :dialogLabel="label" width="700px" button-ok-label="Add" ref="addDialog" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
//import { useQuasar } from 'quasar';
|
import AddDialog from 'src/components/dialog/AddDatapoint.vue';
|
||||||
//import { NotifyResponse, NotifyError } from 'src/composables/notify';
|
import { ref } from 'vue';
|
||||||
import { contextMenuState, contextMenuRef } from 'src/composables/dbm/useContextMenu';
|
|
||||||
//import AddDatapoint from 'src/components/dbm/AddDatapoint.vue';
|
|
||||||
//import { send } from 'src/services/websocket';
|
|
||||||
|
|
||||||
//const $q = useQuasar();
|
const ZERO_UUID = '00000000-0000-0000-0000-000000000000';
|
||||||
|
const addDialog = ref();
|
||||||
|
const datapointUuid = ref('');
|
||||||
|
const contextMenuRef = ref();
|
||||||
|
const label = ref('');
|
||||||
|
const disable = ref(false);
|
||||||
|
|
||||||
function handleAction(action: string) {
|
function handleAction(action: string) {
|
||||||
console.log(`Action '${action}' on node:`, contextMenuState.value);
|
|
||||||
|
|
||||||
// Add your actual logic here
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case 'Add':
|
case 'Add':
|
||||||
// send({
|
label.value = 'Add New Datapoint';
|
||||||
// set: [
|
addDialog.value?.open(datapointUuid.value);
|
||||||
// {
|
break;
|
||||||
// uuid: contextMenuState.value?.key,
|
case 'Delete':
|
||||||
// path: 'New',
|
label.value = 'Remove Datapoint';
|
||||||
// type: 'BIT',
|
addDialog.value?.open(datapointUuid.value);
|
||||||
// value: true,
|
break;
|
||||||
// create: true,
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// })
|
|
||||||
// .then((response) => {
|
|
||||||
// if (response?.set) {
|
|
||||||
// console.log(response);
|
|
||||||
// } else {
|
|
||||||
// NotifyResponse($q, response);
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// .catch((err) => {
|
|
||||||
// NotifyError($q, err);
|
|
||||||
// });
|
|
||||||
console.log(4);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const open = (event: MouseEvent, uuid: string) => {
|
||||||
|
if (uuid === ZERO_UUID) disable.value = true;
|
||||||
|
event.preventDefault();
|
||||||
|
datapointUuid.value = uuid;
|
||||||
|
contextMenuRef.value?.show(event);
|
||||||
|
};
|
||||||
|
|
||||||
|
defineExpose({ open });
|
||||||
</script>
|
</script>
|
||||||
|
@@ -1,36 +1,82 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="q-pa-md">
|
<div class="q-pa-md">
|
||||||
<q-table
|
<q-table
|
||||||
v-if="props.rows.length > 0"
|
v-if="tableRows.length > 0"
|
||||||
style="height: 600px"
|
style="height: 600px"
|
||||||
flat
|
flat
|
||||||
bordered
|
bordered
|
||||||
:title="props.rows[0]?.path"
|
:title="props.rows[0]?.path"
|
||||||
:rows="props.rows ?? []"
|
:rows="rows"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
row-key="path"
|
row-key="path"
|
||||||
virtual-scroll
|
virtual-scroll
|
||||||
:rows-per-page-options="[0]"
|
:rows-per-page-options="[0]"
|
||||||
|
>
|
||||||
|
<template v-slot:body-cell-value="props">
|
||||||
|
<q-td :props="props" @click="openDialog(props.row)">
|
||||||
|
<div :class="['cursor-pointer', 'q-mx-sm']">
|
||||||
|
{{ props.row.value }}
|
||||||
|
</div>
|
||||||
|
</q-td>
|
||||||
|
</template>
|
||||||
|
<template v-slot:body-cell-drivers="props">
|
||||||
|
<q-td :props="props" @click="openDialog(props.row, 'driver')">
|
||||||
|
<div v-if="props.row.type !== 'none'" :class="['cursor-pointer']">
|
||||||
|
<q-icon size="sm" name="cell_tower" :color="props.row.drivers ? 'blue-5' : 'grey-4'" />
|
||||||
|
</div>
|
||||||
|
</q-td>
|
||||||
|
</template>
|
||||||
|
</q-table>
|
||||||
|
<UpdateDialog
|
||||||
|
dialogLabel="Update Value"
|
||||||
|
width="400px"
|
||||||
|
button-ok-label="Write"
|
||||||
|
ref="updateDialog"
|
||||||
|
v-model:datapoint="dialogValue"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import UpdateDialog from 'src/components/dialog/UpdateValueDialog.vue';
|
||||||
import type { QTableProps } from 'quasar';
|
import type { QTableProps } from 'quasar';
|
||||||
import type { Subscribe } from 'src/models/Subscribe';
|
import type { Subscribe } from 'src/models/Subscribe';
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
import type { Subs } from 'src/models/Subscribe';
|
||||||
|
|
||||||
|
const updateDialog = ref();
|
||||||
|
const dialogValue = ref();
|
||||||
|
|
||||||
|
const openDialog = (sub: Subscribe, type?: string) => {
|
||||||
|
updateDialog.value?.open(sub, type);
|
||||||
|
};
|
||||||
|
|
||||||
// we generate lots of rows here
|
// we generate lots of rows here
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
rows: Subscribe[];
|
rows: Subs;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const tableRows = computed(() => [...props.rows]);
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{ name: 'path', label: 'Path', field: 'path', align: 'left' },
|
{ name: 'path', label: 'Path', field: 'path', align: 'left' },
|
||||||
|
{
|
||||||
|
name: 'type',
|
||||||
|
label: 'Type',
|
||||||
|
field: 'type',
|
||||||
|
align: 'left',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'value',
|
name: 'value',
|
||||||
label: 'Value',
|
label: 'Value',
|
||||||
field: 'value',
|
field: 'value',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
|
// {. not implemented yet
|
||||||
|
// name: 'drivers',
|
||||||
|
// label: 'Drivers',
|
||||||
|
// field: 'drivers',
|
||||||
|
// align: 'center',
|
||||||
|
// },
|
||||||
] as QTableProps['columns'];
|
] as QTableProps['columns'];
|
||||||
</script>
|
</script>
|
||||||
|
101
src/components/dialog/AddDatapoint.vue
Normal file
101
src/components/dialog/AddDatapoint.vue
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
<template>
|
||||||
|
<DialogFrame ref="Dialog" :width="props.width">
|
||||||
|
<q-card-section
|
||||||
|
v-if="props.dialogLabel"
|
||||||
|
class="text-bold text-left q-mb-none q-pb-none"
|
||||||
|
:class="'text-' + props.labelColor"
|
||||||
|
>{{ props.dialogLabel }}
|
||||||
|
</q-card-section>
|
||||||
|
<q-form ref="addForm" @submit="onSubmit" class="q-gutter-md">
|
||||||
|
<q-input
|
||||||
|
class="q-pa-md"
|
||||||
|
filled
|
||||||
|
v-model="path"
|
||||||
|
label=""
|
||||||
|
:rules="[(val) => !!val || 'Path is required']"
|
||||||
|
>
|
||||||
|
<template #prepend>
|
||||||
|
<div class="column">
|
||||||
|
<span class="text-caption text-primary non-editable-prefix">Path *</span>
|
||||||
|
<span class="text-body2 text-grey-6 non-editable-prefix">{{ staticPrefix }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
<DataTypes class="q-ma-md" flat></DataTypes>
|
||||||
|
<q-btn no-caps class="q-ma-lg" type="submit" color="primary">{{ props.buttonOkLabel }}</q-btn>
|
||||||
|
</q-form>
|
||||||
|
</DialogFrame>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import DialogFrame from 'src/vueLib/dialog/DialogFrame.vue';
|
||||||
|
import { api } from 'boot/axios';
|
||||||
|
import { NotifyResponse } from 'src/composables/notify';
|
||||||
|
import DataTypes from 'src/vueLib/buttons/DataTypes.vue';
|
||||||
|
//import datatype from 'src/vueLib/buttons/DataType.vue';
|
||||||
|
|
||||||
|
const $q = useQuasar();
|
||||||
|
const Dialog = ref();
|
||||||
|
const path = ref('');
|
||||||
|
const staticPrefix = ref('');
|
||||||
|
//const radio = ref('bool');
|
||||||
|
const addForm = ref();
|
||||||
|
|
||||||
|
const open = (uuid: string) => {
|
||||||
|
Dialog.value?.open();
|
||||||
|
getDatapoint(uuid);
|
||||||
|
};
|
||||||
|
|
||||||
|
function validate() {
|
||||||
|
addForm.value.validate().then((success: undefined) => {
|
||||||
|
if (success) {
|
||||||
|
console.log(909);
|
||||||
|
// yay, models are correct
|
||||||
|
} else {
|
||||||
|
console.log(910);
|
||||||
|
// oh no, user has filled in
|
||||||
|
// at least one invalid value
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
buttonOkLabel: {
|
||||||
|
type: String,
|
||||||
|
default: 'OK',
|
||||||
|
},
|
||||||
|
labelColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'primary',
|
||||||
|
},
|
||||||
|
dialogLabel: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: '300px',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
function onSubmit() {
|
||||||
|
validate();
|
||||||
|
console.log('submit', props);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDatapoint(uuid: string) {
|
||||||
|
api
|
||||||
|
.post('/json_data', { get: [{ uuid: uuid, query: { depth: 1 } }] })
|
||||||
|
.then((resp) => {
|
||||||
|
if (resp.data.get) {
|
||||||
|
staticPrefix.value = resp.data.get[0].path;
|
||||||
|
if (staticPrefix.value !== '') staticPrefix.value += ':';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => NotifyResponse($q, err, 'error'));
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({ open });
|
||||||
|
</script>
|
89
src/components/dialog/OkDialog.vue
Normal file
89
src/components/dialog/OkDialog.vue
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
<template>
|
||||||
|
<q-dialog v-model="internalShowDialog">
|
||||||
|
<q-card :style="'width:' + props.width">
|
||||||
|
<q-card-section
|
||||||
|
v-if="props.dialogLabel"
|
||||||
|
class="text-h6 text-center"
|
||||||
|
:class="'text-' + props.labelColor"
|
||||||
|
>{{ props.dialogLabel }}</q-card-section
|
||||||
|
>
|
||||||
|
<q-card-section v-if="props.text" class="text-center" style="white-space: pre-line">{{
|
||||||
|
props.text
|
||||||
|
}}</q-card-section>
|
||||||
|
<q-card-actions align="right" class="text-primary">
|
||||||
|
<q-btn v-if="props.buttonCancelLabel" flat :label="props.buttonCancelLabel" v-close-popup>
|
||||||
|
</q-btn>
|
||||||
|
<q-btn
|
||||||
|
v-if="props.buttonOkLabel"
|
||||||
|
flat
|
||||||
|
:label="props.buttonOkLabel"
|
||||||
|
v-close-popup
|
||||||
|
@click="closeDialog"
|
||||||
|
>
|
||||||
|
</q-btn>
|
||||||
|
</q-card-actions>
|
||||||
|
</q-card>
|
||||||
|
</q-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, watch } from 'vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
showDialog: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
buttonOkLabel: {
|
||||||
|
type: String,
|
||||||
|
default: 'OK',
|
||||||
|
},
|
||||||
|
labelColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'primary',
|
||||||
|
},
|
||||||
|
dialogLabel: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
buttonCancelLabel: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: '300px',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:showDialog', 'confirmed', 'cancel']);
|
||||||
|
const internalShowDialog = ref(props.showDialog);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.showDialog,
|
||||||
|
(newValue) => {
|
||||||
|
console.log('watch showDialog', newValue);
|
||||||
|
internalShowDialog.value = newValue;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
watch(internalShowDialog, (newValue) => {
|
||||||
|
console.log('watch internalShowDialog', newValue);
|
||||||
|
emit('update:showDialog', newValue);
|
||||||
|
if (!newValue) {
|
||||||
|
console.log('emit cancel');
|
||||||
|
emit('cancel');
|
||||||
|
} else {
|
||||||
|
console.log('emit confirmed');
|
||||||
|
emit('confirmed');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function closeDialog() {
|
||||||
|
internalShowDialog.value = false;
|
||||||
|
emit('update:showDialog', false);
|
||||||
|
}
|
||||||
|
</script>
|
126
src/components/dialog/UpdateValueDialog.vue
Normal file
126
src/components/dialog/UpdateValueDialog.vue
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
<template>
|
||||||
|
<DialogFrame ref="Dialog" :width="props.width">
|
||||||
|
<q-card-section
|
||||||
|
v-if="props.dialogLabel"
|
||||||
|
class="text-bold text-left q-mb-none q-pb-none"
|
||||||
|
:class="'text-' + props.labelColor"
|
||||||
|
>{{ props.dialogLabel + ': ' + props.datapoint?.path }}</q-card-section
|
||||||
|
>
|
||||||
|
<q-card-section>
|
||||||
|
<q-input
|
||||||
|
class="q-px-md q-ma-sm"
|
||||||
|
label="current value"
|
||||||
|
dense
|
||||||
|
filled
|
||||||
|
readonly
|
||||||
|
v-model="inputValue as string | number"
|
||||||
|
></q-input>
|
||||||
|
<q-input
|
||||||
|
class="q-px-md q-mx-sm"
|
||||||
|
label="new value"
|
||||||
|
dense
|
||||||
|
filled
|
||||||
|
@keyup.enter="write"
|
||||||
|
v-model="writeValue as string | number"
|
||||||
|
></q-input>
|
||||||
|
</q-card-section>
|
||||||
|
<q-card-section v-if="props.text" class="text-center" style="white-space: pre-line">{{
|
||||||
|
props.text
|
||||||
|
}}</q-card-section>
|
||||||
|
<q-card-actions align="left" class="text-primary">
|
||||||
|
<q-btn v-if="props.buttonCancelLabel" flat :label="props.buttonCancelLabel" v-close-popup>
|
||||||
|
</q-btn>
|
||||||
|
<q-btn
|
||||||
|
class="q-mb-xl q-ml-lg q-mt-none"
|
||||||
|
v-if="props.buttonOkLabel"
|
||||||
|
color="primary"
|
||||||
|
:label="props.buttonOkLabel"
|
||||||
|
@click="write"
|
||||||
|
>
|
||||||
|
</q-btn>
|
||||||
|
</q-card-actions>
|
||||||
|
</DialogFrame>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, watch } from 'vue';
|
||||||
|
import DialogFrame from 'src/vueLib/dialog/DialogFrame.vue';
|
||||||
|
import type { Subscribe } from 'src/models/Subscribe';
|
||||||
|
import type { PropType } from 'vue';
|
||||||
|
import { setValues } from 'src/services/websocket';
|
||||||
|
import { NotifyResponse } from 'src/composables/notify';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
|
const $q = useQuasar();
|
||||||
|
const Dialog = ref();
|
||||||
|
const writeValue = ref();
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
buttonOkLabel: {
|
||||||
|
type: String,
|
||||||
|
default: 'OK',
|
||||||
|
},
|
||||||
|
labelColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'primary',
|
||||||
|
},
|
||||||
|
dialogLabel: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
buttonCancelLabel: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: '300px',
|
||||||
|
},
|
||||||
|
datapoint: Object as PropType<Subscribe>,
|
||||||
|
});
|
||||||
|
|
||||||
|
const inputValue = ref(props.datapoint?.value);
|
||||||
|
|
||||||
|
const open = (sub: Subscribe, type?: string) => {
|
||||||
|
Dialog.value?.open();
|
||||||
|
switch (type) {
|
||||||
|
case 'driver':
|
||||||
|
console.log(9, sub.drivers);
|
||||||
|
writeValue.value = sub.drivers;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
writeValue.value = sub.value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.datapoint?.value,
|
||||||
|
(newVal) => {
|
||||||
|
inputValue.value = newVal;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
function write() {
|
||||||
|
setValues([{ uuid: props.datapoint?.uuid ?? '', value: writeValue.value ?? undefined }])
|
||||||
|
.then((resp) => {
|
||||||
|
if (resp?.set) {
|
||||||
|
resp.set.forEach((set) => {
|
||||||
|
inputValue.value = set.value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => NotifyResponse($q, err));
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({ open });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.outercard {
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
@@ -18,7 +18,7 @@
|
|||||||
reverse
|
reverse
|
||||||
v-model="light.Brightness"
|
v-model="light.Brightness"
|
||||||
:min="0"
|
:min="0"
|
||||||
:max="100"
|
:max="255"
|
||||||
:step="1"
|
:step="1"
|
||||||
color="black"
|
color="black"
|
||||||
style="opacity: 0.5"
|
style="opacity: 0.5"
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
reverse
|
reverse
|
||||||
v-model="light.Red"
|
v-model="light.Red"
|
||||||
:min="0"
|
:min="0"
|
||||||
:max="100"
|
:max="255"
|
||||||
:step="1"
|
:step="1"
|
||||||
label
|
label
|
||||||
color="red"
|
color="red"
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
reverse
|
reverse
|
||||||
v-model="light.Green"
|
v-model="light.Green"
|
||||||
:min="0"
|
:min="0"
|
||||||
:max="100"
|
:max="255"
|
||||||
:step="1"
|
:step="1"
|
||||||
label
|
label
|
||||||
color="green"
|
color="green"
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
reverse
|
reverse
|
||||||
v-model="light.Blue"
|
v-model="light.Blue"
|
||||||
:min="0"
|
:min="0"
|
||||||
:max="100"
|
:max="255"
|
||||||
:step="1"
|
:step="1"
|
||||||
label
|
label
|
||||||
color="blue"
|
color="blue"
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
reverse
|
reverse
|
||||||
v-model="light.White"
|
v-model="light.White"
|
||||||
:min="0"
|
:min="0"
|
||||||
:max="100"
|
:max="255"
|
||||||
:step="1"
|
:step="1"
|
||||||
label
|
label
|
||||||
color="grey"
|
color="grey"
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
reverse
|
reverse
|
||||||
v-model="light.Amber"
|
v-model="light.Amber"
|
||||||
:min="0"
|
:min="0"
|
||||||
:max="100"
|
:max="255"
|
||||||
:step="1"
|
:step="1"
|
||||||
label
|
label
|
||||||
color="amber"
|
color="amber"
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
reverse
|
reverse
|
||||||
v-model="light.Purple"
|
v-model="light.Purple"
|
||||||
:min="0"
|
:min="0"
|
||||||
:max="100"
|
:max="255"
|
||||||
:step="1"
|
:step="1"
|
||||||
label
|
label
|
||||||
color="purple"
|
color="purple"
|
||||||
|
@@ -3,22 +3,35 @@
|
|||||||
<div class="row q-ma-xs">
|
<div class="row q-ma-xs">
|
||||||
<div class="column items-center q-mr-md" :style="{ height: containerSize + 'px' }">
|
<div class="column items-center q-mr-md" :style="{ height: containerSize + 'px' }">
|
||||||
<div class="column justify-between items-center" :style="{ height: containerSize + 'px' }">
|
<div class="column justify-between items-center" :style="{ height: containerSize + 'px' }">
|
||||||
<q-item-label class="text-black text-bold q-mb-none">Tilt</q-item-label>
|
<q-item-label
|
||||||
|
@click="toggleTilt = !toggleTilt"
|
||||||
|
:class="[
|
||||||
|
'cursor-pointer',
|
||||||
|
'text-bold',
|
||||||
|
'clickable-text-effect',
|
||||||
|
'q-mb-none',
|
||||||
|
`text-black`,
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
{{ toggleTilt ? 'Tilt Fine' : 'Tilt' }}</q-item-label
|
||||||
|
>
|
||||||
<q-btn
|
<q-btn
|
||||||
:size="buttonSize"
|
:size="buttonSize"
|
||||||
round
|
round
|
||||||
color="positive"
|
color="positive"
|
||||||
icon="add_circle_outline"
|
icon="add_circle_outline"
|
||||||
class="q-mb-md"
|
class="q-mb-md"
|
||||||
@click="reverseTilt ? substractTiltOne : addTiltOne"
|
@click="reverseTilt ? substractTilt : addTilt"
|
||||||
v-touch-repeat:300:300:300:300:50.mouse="reverseTilt ? substractTiltOne : addTiltOne"
|
v-touch-repeat:0:300:300:300:300:50:50:50:20.mouse="
|
||||||
|
reverseTilt ? substractTilt : addTilt
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
<q-slider
|
<q-slider
|
||||||
vertical
|
vertical
|
||||||
:reverse="!props.reverseTilt"
|
:reverse="!props.reverseTilt"
|
||||||
v-model="tilt"
|
v-model="tilt"
|
||||||
:min="0"
|
:min="0"
|
||||||
:max="100"
|
:max="255"
|
||||||
:step="1"
|
:step="1"
|
||||||
label
|
label
|
||||||
class="col"
|
class="col"
|
||||||
@@ -31,9 +44,9 @@
|
|||||||
round
|
round
|
||||||
color="negative"
|
color="negative"
|
||||||
icon="remove_circle_outline"
|
icon="remove_circle_outline"
|
||||||
@click="reverseTilt ? addTiltOne : substractTiltOne"
|
@click="reverseTilt ? addTilt : substractTilt"
|
||||||
v-touch-repeat:300:300:300:300:50:50:50:50:20.mouse="
|
v-touch-repeat:0:300:300:300:300:50:50:50:20.mouse="
|
||||||
reverseTilt ? addTiltOne : substractTiltOne
|
reverseTilt ? addTilt : substractTilt
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -49,7 +62,11 @@
|
|||||||
>
|
>
|
||||||
<div class="marker" :style="markerStyle" :class="{ crosshair: dragging }"></div>
|
<div class="marker" :style="markerStyle" :class="{ crosshair: dragging }"></div>
|
||||||
</div>
|
</div>
|
||||||
<q-item-label class="q-ma-sm text-black text-bold">Pan</q-item-label>
|
<q-item-label
|
||||||
|
@click="togglePan = !togglePan"
|
||||||
|
:class="['cursor-pointer', 'text-bold', 'clickable-text-effect', 'q-mt-lg', `text-black`]"
|
||||||
|
>{{ togglePan ? 'Pan Fine' : 'Pan' }}</q-item-label
|
||||||
|
>
|
||||||
|
|
||||||
<div class="q-gutter-sm row items-center full-width">
|
<div class="q-gutter-sm row items-center full-width">
|
||||||
<q-btn
|
<q-btn
|
||||||
@@ -58,9 +75,9 @@
|
|||||||
round
|
round
|
||||||
color="negative"
|
color="negative"
|
||||||
icon="remove_circle_outline"
|
icon="remove_circle_outline"
|
||||||
@click="reversePan ? addPanOne : substractPanOne"
|
@click="reversePan ? addPan : substractPan"
|
||||||
v-touch-repeat:300:300:300:300:50:50:50:50:20.mouse="
|
v-touch-repeat:0:300:300:300:300:50:50:50:50:20.mouse="
|
||||||
reversePan ? addPanOne : substractPanOne
|
reversePan ? addPan : substractPan
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<q-slider
|
<q-slider
|
||||||
@@ -68,7 +85,7 @@
|
|||||||
:reverse="props.reversePan"
|
:reverse="props.reversePan"
|
||||||
v-model="pan"
|
v-model="pan"
|
||||||
:min="0"
|
:min="0"
|
||||||
:max="100"
|
:max="255"
|
||||||
:step="1"
|
:step="1"
|
||||||
label
|
label
|
||||||
color="black"
|
color="black"
|
||||||
@@ -80,8 +97,8 @@
|
|||||||
round
|
round
|
||||||
color="positive"
|
color="positive"
|
||||||
icon="add_circle_outline"
|
icon="add_circle_outline"
|
||||||
@click="reversePan ? substractPanOne : addPanOne"
|
@click="reversePan ? substractPan : addPan"
|
||||||
v-touch-repeat:300:300:300:300:50.mouse="reversePan ? substractPanOne : addPanOne"
|
v-touch-repeat:0:300:300:300:300:50:50:50:20.mouse="reversePan ? substractPan : addPan"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -90,18 +107,53 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { addOne, substractOne } from 'src/utils/number-helpers';
|
||||||
import { ref, computed, onMounted, onUnmounted } from 'vue';
|
import { ref, computed, onMounted, onUnmounted } from 'vue';
|
||||||
|
import { updateValue } from 'src/composables/dbm/dbmTree';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
reversePan: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
reverseTilt: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
panPath: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
panPath2: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
tiltPath: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
tiltPath2: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const $q = useQuasar();
|
||||||
|
|
||||||
|
const togglePan = ref(false);
|
||||||
|
const toggleTilt = ref(false);
|
||||||
const pad = ref<HTMLElement | null>(null);
|
const pad = ref<HTMLElement | null>(null);
|
||||||
const dragging = ref(false);
|
const dragging = ref(false);
|
||||||
const containerSize = ref(0);
|
const containerSize = ref(0);
|
||||||
|
|
||||||
const pan = defineModel<number>('pan', { default: 0 });
|
const pan = updateValue(props.panPath, $q, togglePan, props.panPath2);
|
||||||
const tilt = defineModel<number>('tilt', { default: 0 });
|
const tilt = updateValue(props.tiltPath, $q, toggleTilt, props.tiltPath2);
|
||||||
const props = defineProps<{
|
|
||||||
reversePan: boolean;
|
const scaleFactor = computed(() => containerSize.value / 255);
|
||||||
reverseTilt: boolean;
|
// 200px → 2, 400px → 4, etc.
|
||||||
}>();
|
|
||||||
const buttonSize = computed(() => (containerSize.value <= 200 ? 'sm' : 'md'));
|
const buttonSize = computed(() => (containerSize.value <= 200 ? 'sm' : 'md'));
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -120,16 +172,12 @@ onMounted(() => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const scaleFactor = computed(() => containerSize.value / 100);
|
|
||||||
// 200px → 2, 400px → 4, etc.
|
|
||||||
|
|
||||||
const markerStyle = computed(() => {
|
const markerStyle = computed(() => {
|
||||||
const scale = scaleFactor.value;
|
const scale = scaleFactor.value;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
position: 'absolute' as const,
|
position: 'absolute' as const,
|
||||||
top: `${scale * (props.reverseTilt ? tilt.value : 100 - tilt.value)}px`,
|
top: `${scale * (props.reverseTilt ? tilt.value : 255 - tilt.value)}px`,
|
||||||
left: `${scale * (props.reversePan ? 100 - pan.value : pan.value)}px`,
|
left: `${scale * (props.reversePan ? 255 - pan.value : pan.value)}px`,
|
||||||
width: '12px',
|
width: '12px',
|
||||||
height: '12px',
|
height: '12px',
|
||||||
borderRadius: '50%',
|
borderRadius: '50%',
|
||||||
@@ -191,35 +239,27 @@ function updatePosition(e: MouseEvent | Touch) {
|
|||||||
const newY = Math.min(Math.max(0, e.clientY - rect.top), rect.height);
|
const newY = Math.min(Math.max(0, e.clientY - rect.top), rect.height);
|
||||||
|
|
||||||
pan.value = props.reversePan
|
pan.value = props.reversePan
|
||||||
? Math.round((1 - newX / rect.width) * 100)
|
? Math.round((1 - newX / rect.width) * 255)
|
||||||
: Math.round((newX / rect.width) * 100);
|
: Math.round((newX / rect.width) * 255);
|
||||||
tilt.value = props.reverseTilt
|
tilt.value = props.reverseTilt
|
||||||
? Math.round((newY / rect.height) * 100)
|
? Math.round((newY / rect.height) * 255)
|
||||||
: Math.round(100 - (newY / rect.height) * 100);
|
: Math.round(255 - (newY / rect.height) * 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addTiltOne() {
|
function addTilt() {
|
||||||
if (tilt.value <= 255) {
|
addOne(tilt, 255);
|
||||||
tilt.value++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function substractTiltOne() {
|
function substractTilt() {
|
||||||
if (tilt.value >= 0) {
|
substractOne(tilt, 0);
|
||||||
tilt.value--;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addPanOne() {
|
function addPan() {
|
||||||
if (pan.value <= 255) {
|
addOne(pan, 255);
|
||||||
pan.value++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function substractPanOne() {
|
function substractPan() {
|
||||||
if (pan.value >= 0) {
|
substractOne(pan, 0);
|
||||||
pan.value--;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@@ -12,46 +12,46 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<LightSlider
|
<LightSlider
|
||||||
title="Dimmer"
|
mainTitle="Dimmer"
|
||||||
:dbm-path="'LightBar:Brightness'"
|
dbm-path="LightBar:Brightness"
|
||||||
:opacity="0.5"
|
:opacity="0.5"
|
||||||
class="q-ma-sm"
|
class="q-ma-sm"
|
||||||
></LightSlider>
|
></LightSlider>
|
||||||
<LightSlider
|
<LightSlider
|
||||||
title="Strobe"
|
mainTitle="Strobe"
|
||||||
:dbm-path="'LightBar:Strobe'"
|
dbm-path="LightBar:Strobe"
|
||||||
:opacity="0.5"
|
:opacity="0.5"
|
||||||
class="q-ma-sm"
|
class="q-ma-sm"
|
||||||
></LightSlider>
|
></LightSlider>
|
||||||
<LightSlider
|
<LightSlider
|
||||||
title="Program"
|
mainTitle="Program"
|
||||||
:dbm-path="'LightBar:Program'"
|
dbm-path="LightBar:Program"
|
||||||
:opacity="0.5"
|
:opacity="0.5"
|
||||||
class="q-ma-sm"
|
class="q-ma-sm"
|
||||||
></LightSlider>
|
></LightSlider>
|
||||||
<LightSlider
|
<LightSlider
|
||||||
title="Program Speed"
|
mainTitle="Program Speed"
|
||||||
:dbm-path="'LightBar:Program:Speed'"
|
dbm-path="LightBar:Program:Speed"
|
||||||
:opacity="0.8"
|
:opacity="0.8"
|
||||||
class="q-ma-sm"
|
class="q-ma-sm"
|
||||||
></LightSlider>
|
></LightSlider>
|
||||||
<LightSlider
|
<LightSlider
|
||||||
title="Red"
|
mainTitle="Red"
|
||||||
:dbm-path="'LightBar:Red'"
|
dbm-path="LightBar:Red"
|
||||||
color="red"
|
color="red"
|
||||||
:opacity="0.8"
|
:opacity="0.8"
|
||||||
class="q-ma-sm"
|
class="q-ma-sm"
|
||||||
></LightSlider>
|
></LightSlider>
|
||||||
<LightSlider
|
<LightSlider
|
||||||
title="Green"
|
mainTitle="Green"
|
||||||
:dbm-path="'LightBar:Green'"
|
dbm-path="LightBar:Green"
|
||||||
:opacity="0.8"
|
:opacity="0.8"
|
||||||
color="green"
|
color="green"
|
||||||
class="q-ma-sm"
|
class="q-ma-sm"
|
||||||
></LightSlider>
|
></LightSlider>
|
||||||
<LightSlider
|
<LightSlider
|
||||||
title="Blue"
|
mainTitle="Blue"
|
||||||
:dbm-path="'LightBar:Blue'"
|
dbm-path="LightBar:Blue"
|
||||||
:opacity="0.8"
|
:opacity="0.8"
|
||||||
color="blue"
|
color="blue"
|
||||||
class="q-ma-sm"
|
class="q-ma-sm"
|
||||||
@@ -67,51 +67,38 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
import LightSlider from './LightSlider.vue';
|
||||||
import { ref, onMounted, onUnmounted } from 'vue';
|
import { ref, onMounted, onUnmounted } from 'vue';
|
||||||
import { subscribe, unsubscribe } from 'src/services/websocket';
|
import { unsubscribe, subscribeToPath } from 'src/services/websocket';
|
||||||
import SettingDialog from 'src/components/lights/SettingDomeLight.vue';
|
import SettingDialog from 'src/components/lights/SettingDomeLight.vue';
|
||||||
import { NotifyResponse } from 'src/composables/notify';
|
import { NotifyResponse } from 'src/composables/notify';
|
||||||
import { updateValue, buildTree, dbmData } from 'src/composables/dbm/dbmTree';
|
import { updateValue } from 'src/composables/dbm/dbmTree';
|
||||||
import LightSlider from './LightSlider.vue';
|
import { removeAllSubscriptions } from 'src/models/Subscriptions';
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const settings = ref(false);
|
const settings = ref(false);
|
||||||
const brightness = updateValue('LightBar:Brightness', $q);
|
const brightness = updateValue('LightBar:Brightness', $q);
|
||||||
const state = updateValue('LightBar:State', $q);
|
const state = updateValue('LightBar:State', $q);
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
subscribe([
|
subscribeToPath($q, 'LightBar:.*');
|
||||||
{
|
|
||||||
path: 'LightBar:.*',
|
|
||||||
depth: 0,
|
|
||||||
},
|
|
||||||
])
|
|
||||||
.then((response) => {
|
|
||||||
if (response?.subscribe) {
|
|
||||||
dbmData.value = buildTree(response.subscribe ?? []);
|
|
||||||
} else {
|
|
||||||
NotifyResponse($q, response);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
NotifyResponse($q, err, 'error');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
unsubscribe([
|
unsubscribe([
|
||||||
{
|
{
|
||||||
path: '.*',
|
path: 'LightBar',
|
||||||
depth: 0,
|
depth: 0,
|
||||||
},
|
},
|
||||||
]).catch((err) => {
|
]).catch((err) => {
|
||||||
NotifyResponse($q, err, 'error');
|
NotifyResponse($q, err, 'error');
|
||||||
});
|
});
|
||||||
|
removeAllSubscriptions();
|
||||||
});
|
});
|
||||||
|
|
||||||
function changeState() {
|
function changeState() {
|
||||||
if (brightness.value === 0) {
|
if (brightness.value === 0) {
|
||||||
if (state.value === 0) {
|
if (state.value === 0) {
|
||||||
brightness.value = 100;
|
brightness.value = 255;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
brightness.value = state.value;
|
brightness.value = state.value;
|
||||||
|
@@ -1,14 +1,22 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :class="'column items-center ' + props.class">
|
<div :class="'column items-center ' + props.class">
|
||||||
<q-item-label :class="['text-bold', `text-${textColor}`]"><p v-html="title"></p></q-item-label>
|
<q-item-label v-if="!toggleHighLow" :class="['text-bold', `text-${textColor}`]"
|
||||||
|
><p v-html="mainTitle"></p>
|
||||||
|
</q-item-label>
|
||||||
|
<q-item-label
|
||||||
|
v-else
|
||||||
|
@click="toggle = !toggle"
|
||||||
|
:class="['cursor-pointer', 'text-bold', 'clickable-text-effect', `text-${textColor}`]"
|
||||||
|
><p v-html="toggle ? secondTitle : mainTitle"></p>
|
||||||
|
</q-item-label>
|
||||||
<q-btn
|
<q-btn
|
||||||
size="sm"
|
size="sm"
|
||||||
class="q-mb-sm"
|
class="q-mb-md"
|
||||||
round
|
round
|
||||||
color="positive"
|
color="positive"
|
||||||
icon="add_circle_outline"
|
icon="add_circle_outline"
|
||||||
@click="addOne"
|
@click="reverse ? add : substract"
|
||||||
v-touch-repeat:300:300:300:300:50:50:50:50:20.mouse="addOne"
|
v-touch-repeat:0:300:300:300:300:50:50:50:50:20.mouse="reverse ? add : substract"
|
||||||
/>
|
/>
|
||||||
<div>
|
<div>
|
||||||
<q-slider
|
<q-slider
|
||||||
@@ -29,20 +37,30 @@
|
|||||||
round
|
round
|
||||||
color="negative"
|
color="negative"
|
||||||
icon="remove_circle_outline"
|
icon="remove_circle_outline"
|
||||||
@click="substractOne"
|
@click="reverse ? substract : add"
|
||||||
v-touch-repeat:300:300:300:300:50:50:50:50:20.mouse="substractOne"
|
v-touch-repeat:0:300:300:300:300:50:50:50:50:20.mouse="reverse ? substract : add"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { updateValue } from 'src/composables/dbm/dbmTree';
|
import { updateValue } from 'src/composables/dbm/dbmTree';
|
||||||
|
import { addOne, substractOne } from 'src/utils/number-helpers';
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
title: {
|
toggleHighLow: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
mainTitle: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
secondTitle: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
@@ -77,7 +95,7 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
max: {
|
max: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 100,
|
default: 255,
|
||||||
},
|
},
|
||||||
vertical: {
|
vertical: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -105,17 +123,35 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const localValue = updateValue(props.dbmPath, $q, props.dbmPath2, props.dbmPath3, props.dbmValue3);
|
const toggle = ref(false);
|
||||||
|
const localValue = updateValue(
|
||||||
|
props.dbmPath,
|
||||||
|
$q,
|
||||||
|
toggle,
|
||||||
|
props.dbmPath2,
|
||||||
|
props.dbmPath3,
|
||||||
|
props.dbmValue3,
|
||||||
|
);
|
||||||
|
|
||||||
function addOne() {
|
function add() {
|
||||||
if (localValue.value <= 255) {
|
addOne(localValue, 255);
|
||||||
localValue.value++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function substractOne() {
|
function substract() {
|
||||||
if (localValue.value >= 0) {
|
substractOne(localValue, 0);
|
||||||
localValue.value--;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.clickable-text-effect {
|
||||||
|
cursor: pointer;
|
||||||
|
color: #040303; /* Static text color */
|
||||||
|
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
|
||||||
|
/* Add hover effect here if you want it part of this class */
|
||||||
|
transition: text-shadow 0.2s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clickable-text-effect:hover {
|
||||||
|
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@@ -21,49 +21,59 @@ select
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<LightSlider
|
<LightSlider
|
||||||
title="Dimmer"
|
mainTitle="Dimmer"
|
||||||
:dbm-path="'MovingHead:Brightness'"
|
second-title="Dimmer Fine"
|
||||||
:dbm-path2="'MovingHead:BrightnessFine'"
|
:toggle-high-low="true"
|
||||||
:dbm-path3="'MovingHead:Strobe'"
|
dbm-path="MovingHead:Brightness"
|
||||||
|
dbm-path2="MovingHead:BrightnessFine"
|
||||||
|
dbm-path3="MovingHead:Strobe"
|
||||||
:dbm-value3="255"
|
:dbm-value3="255"
|
||||||
:opacity="0.5"
|
:opacity="0.5"
|
||||||
class="q-ma-md"
|
class="q-ma-md"
|
||||||
/>
|
/>
|
||||||
<LightSlider
|
<LightSlider
|
||||||
title="Red"
|
mainTitle="Red"
|
||||||
:dbm-path="'MovingHead:Red'"
|
second-title="Red Fine"
|
||||||
:dbm-path2="'MovingHead:RedFine'"
|
:toggle-high-low="true"
|
||||||
|
dbm-path="MovingHead:Red"
|
||||||
|
dbm-path2="MovingHead:RedFine"
|
||||||
:opacity="0.8"
|
:opacity="0.8"
|
||||||
color="red"
|
color="red"
|
||||||
class="q-ma-md"
|
class="q-ma-md"
|
||||||
/>
|
/>
|
||||||
<LightSlider
|
<LightSlider
|
||||||
title="Green"
|
mainTitle="Green"
|
||||||
:dbm-path="'MovingHead:Green'"
|
second-title="Green Fine"
|
||||||
:dbm-path2="'MovingHead:GreenFine'"
|
:toggle-high-low="true"
|
||||||
|
dbm-path="MovingHead:Green"
|
||||||
|
dbm-path2="MovingHead:GreenFine"
|
||||||
:opacity="0.8"
|
:opacity="0.8"
|
||||||
color="green"
|
color="green"
|
||||||
class="q-ma-md"
|
class="q-ma-md"
|
||||||
/>
|
/>
|
||||||
<LightSlider
|
<LightSlider
|
||||||
title="Blue"
|
mainTitle="Blue"
|
||||||
:dbm-path="'MovingHead:Blue'"
|
second-title="Blue Fine"
|
||||||
:dbm-path2="'MovingHead:BlueFine'"
|
:toggle-high-low="true"
|
||||||
|
dbm-path="MovingHead:Blue"
|
||||||
|
dbm-path2="MovingHead:BlueFine"
|
||||||
:opacity="0.8"
|
:opacity="0.8"
|
||||||
color="blue"
|
color="blue"
|
||||||
class="q-ma-md"
|
class="q-ma-md"
|
||||||
/>
|
/>
|
||||||
<LightSlider
|
<LightSlider
|
||||||
title="White"
|
mainTitle="White"
|
||||||
:dbm-path="'MovingHead:White'"
|
second-title="White Fine"
|
||||||
:dbm-path2="'MovingHead:WhiteFine'"
|
:toggle-high-low="true"
|
||||||
|
dbm-path="MovingHead:White"
|
||||||
|
dbm-path2="MovingHead:WhiteFine"
|
||||||
:opacity="0.3"
|
:opacity="0.3"
|
||||||
color="grey"
|
color="grey"
|
||||||
class="q-ma-md"
|
class="q-ma-md"
|
||||||
/>
|
/>
|
||||||
<LightSlider
|
<LightSlider
|
||||||
title="Zoom"
|
mainTitle="Zoom"
|
||||||
:dbm-path="'MovingHead:Zoom'"
|
dbm-path="MovingHead:Zoom"
|
||||||
:opacity="1"
|
:opacity="1"
|
||||||
color="black"
|
color="black"
|
||||||
class="q-ma-md"
|
class="q-ma-md"
|
||||||
@@ -71,9 +81,11 @@ select
|
|||||||
<div>
|
<div>
|
||||||
<DragPad
|
<DragPad
|
||||||
class="q-ma-md"
|
class="q-ma-md"
|
||||||
v-model:pan="pan"
|
pan-path="MovingHead:Pan"
|
||||||
|
pan-path2="MovingHead:PanFine"
|
||||||
v-model:reverse-pan="settings.reversePan"
|
v-model:reverse-pan="settings.reversePan"
|
||||||
v-model:tilt="tilt"
|
tilt-path="MovingHead:Tilt"
|
||||||
|
tilt-path2="MovingHead:TiltFine"
|
||||||
v-model:reverse-tilt="settings.reverseTilt"
|
v-model:reverse-tilt="settings.reverseTilt"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -92,19 +104,18 @@ select
|
|||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import LightSlider from './LightSlider.vue';
|
import LightSlider from './LightSlider.vue';
|
||||||
import { NotifyResponse } from 'src/composables/notify';
|
import { NotifyResponse } from 'src/composables/notify';
|
||||||
import { computed, onMounted, onUnmounted, ref } from 'vue';
|
import { onBeforeUpdate, computed, onMounted, onUnmounted, ref } from 'vue';
|
||||||
import { subscribe, unsubscribe, setValues } from 'src/services/websocket';
|
import { subscribeToPath, unsubscribe, setValues } from 'src/services/websocket';
|
||||||
import { LocalStorage } from 'quasar';
|
import { LocalStorage } from 'quasar';
|
||||||
import { getSubscriptionsByPath, buildTree, dbmData } from 'src/composables/dbm/dbmTree';
|
import { updateValue } from 'src/composables/dbm/dbmTree';
|
||||||
import DragPad from 'src/components/lights/DragPad.vue';
|
import DragPad from 'src/components/lights/DragPad.vue';
|
||||||
import SettingDialog from './SettingMovingHead.vue';
|
import SettingDialog from './SettingMovingHead.vue';
|
||||||
import type { Settings } from 'src/models/MovingHead';
|
import type { Settings } from 'src/models/MovingHead';
|
||||||
|
import { findSubscriptionByPath, removeAllSubscriptions } from 'src/models/Subscriptions';
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const brightness = updateBrightnessValue('MovingHead:Brightness');
|
const brightness = updateBrightnessValue('MovingHead:Brightness');
|
||||||
const pan = updateValue('MovingHead:Pan', true);
|
const state = updateValue('MovingHead:State', $q);
|
||||||
const tilt = updateValue('MovingHead:Tilt', true);
|
|
||||||
const state = updateValue('MovingHead:State');
|
|
||||||
const settings = ref<Settings>({
|
const settings = ref<Settings>({
|
||||||
show: false,
|
show: false,
|
||||||
reversePan: false,
|
reversePan: false,
|
||||||
@@ -115,24 +126,11 @@ const settings = ref<Settings>({
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
settings.value.reversePan = LocalStorage.getItem('reversePan') ?? false;
|
settings.value.reversePan = LocalStorage.getItem('reversePan') ?? false;
|
||||||
settings.value.reverseTilt = LocalStorage.getItem('reverseTilt') ?? false;
|
settings.value.reverseTilt = LocalStorage.getItem('reverseTilt') ?? false;
|
||||||
|
subscribeToPath($q, 'MovingHead:.*');
|
||||||
|
});
|
||||||
|
|
||||||
subscribe([
|
onBeforeUpdate(() => {
|
||||||
{
|
subscribeToPath($q, 'MovingHead:.*');
|
||||||
path: 'MovingHead:.*',
|
|
||||||
depth: 0,
|
|
||||||
},
|
|
||||||
])
|
|
||||||
.then((response) => {
|
|
||||||
console.log(response);
|
|
||||||
if (response?.subscribe) {
|
|
||||||
dbmData.value = buildTree(response.subscribe ?? []);
|
|
||||||
} else {
|
|
||||||
NotifyResponse($q, response);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
NotifyResponse($q, err, 'error');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
@@ -144,12 +142,13 @@ onUnmounted(() => {
|
|||||||
]).catch((err) => {
|
]).catch((err) => {
|
||||||
NotifyResponse($q, err, 'error');
|
NotifyResponse($q, err, 'error');
|
||||||
});
|
});
|
||||||
|
removeAllSubscriptions();
|
||||||
});
|
});
|
||||||
|
|
||||||
function changeState() {
|
function changeState() {
|
||||||
if (brightness.value === 0) {
|
if (brightness.value === 0) {
|
||||||
if (state.value === 0) {
|
if (state.value === 0) {
|
||||||
brightness.value = 100;
|
brightness.value = 255;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
brightness.value = state.value;
|
brightness.value = state.value;
|
||||||
@@ -159,39 +158,17 @@ function changeState() {
|
|||||||
brightness.value = 0;
|
brightness.value = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateValue(path: string, isDouble = false) {
|
|
||||||
return computed({
|
|
||||||
get() {
|
|
||||||
const sub = getSubscriptionsByPath(path);
|
|
||||||
const value = sub ? Number(sub.value ?? 0) : 0;
|
|
||||||
return isDouble ? Math.round((100 / 255) * value) : Math.round((100 / 255) * value);
|
|
||||||
},
|
|
||||||
set(val) {
|
|
||||||
const baseValue = Math.round((255 / 100) * val);
|
|
||||||
const setPaths = [{ path, value: baseValue }];
|
|
||||||
|
|
||||||
if (isDouble) {
|
|
||||||
setPaths.push({ path: `${path}Fine`, value: baseValue });
|
|
||||||
}
|
|
||||||
|
|
||||||
setValues(setPaths)
|
|
||||||
.then((response) => NotifyResponse($q, response))
|
|
||||||
.catch((err) => console.error(`Failed to update ${path.split(':')[1]}:`, err));
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateBrightnessValue(path: string) {
|
function updateBrightnessValue(path: string) {
|
||||||
return computed({
|
return computed({
|
||||||
get() {
|
get() {
|
||||||
const sub = getSubscriptionsByPath(path);
|
const sub = findSubscriptionByPath(path);
|
||||||
const value = sub ? Number(sub.value ?? 0) : 0;
|
if (!sub) return 0;
|
||||||
return Math.round((100 / 255) * value);
|
if (!sub.value) return 0;
|
||||||
|
return Number(sub.value);
|
||||||
},
|
},
|
||||||
set(val) {
|
set(val) {
|
||||||
const baseValue = Math.round((255 / 100) * val);
|
const setPaths = [{ path, value: val }];
|
||||||
const setPaths = [{ path, value: baseValue }];
|
setPaths.push({ path: `${path}Fine`, value: val });
|
||||||
setPaths.push({ path: `${path}Fine`, value: baseValue });
|
|
||||||
setPaths.push({ path: `MovingHead:Strobe`, value: 255 });
|
setPaths.push({ path: `MovingHead:Strobe`, value: 255 });
|
||||||
|
|
||||||
setValues(setPaths)
|
setValues(setPaths)
|
||||||
|
361
src/components/scenes/ScenesPage.vue
Normal file
361
src/components/scenes/ScenesPage.vue
Normal file
@@ -0,0 +1,361 @@
|
|||||||
|
<template>
|
||||||
|
<!-- new edit scene dialog-->
|
||||||
|
<q-dialog v-model="showDialog" persistent>
|
||||||
|
<q-card style="min-width: 350px">
|
||||||
|
<q-card-section>
|
||||||
|
<div class="text-primary text-h6">{{ dialogLabel }}</div>
|
||||||
|
</q-card-section>
|
||||||
|
|
||||||
|
<q-card-section class="q-pt-none">
|
||||||
|
<q-input
|
||||||
|
class="q-mb-md"
|
||||||
|
dense
|
||||||
|
v-model="newScene.name"
|
||||||
|
placeholder="Name"
|
||||||
|
autofocus
|
||||||
|
:rules="[(val) => !!val || 'Field is required']"
|
||||||
|
@keyup.enter="saveScene"
|
||||||
|
/>
|
||||||
|
<q-input
|
||||||
|
dense
|
||||||
|
v-model="newScene.description"
|
||||||
|
placeholder="Description"
|
||||||
|
autofocus
|
||||||
|
@keyup.enter="saveScene"
|
||||||
|
/>
|
||||||
|
<div class="q-py-md">
|
||||||
|
<div class="q-gutter-sm">
|
||||||
|
<q-checkbox v-model="newScene.movingHead" label="Moving Head" />
|
||||||
|
<q-checkbox v-model="newScene.lightBar" label="Light Bar" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</q-card-section>
|
||||||
|
|
||||||
|
<q-card-actions align="right" class="text-primary">
|
||||||
|
<q-btn flat label="Cancel" v-close-popup />
|
||||||
|
<q-btn flat :label="dialogLabel" @click="saveScene()" />
|
||||||
|
</q-card-actions>
|
||||||
|
</q-card>
|
||||||
|
</q-dialog>
|
||||||
|
<Dialog
|
||||||
|
dialogLabel="Duplicate Scene"
|
||||||
|
:text="`Scene '${newScene.name}' exists already`"
|
||||||
|
:show-dialog="existsAlready"
|
||||||
|
v-on:update:show-dialog="existsAlready = $event"
|
||||||
|
/>
|
||||||
|
<q-list
|
||||||
|
bordered
|
||||||
|
v-if="scenes?.length > 0"
|
||||||
|
class="q-mx-auto"
|
||||||
|
style="max-width: 100%; max-width: 500px"
|
||||||
|
>
|
||||||
|
<q-btn
|
||||||
|
rounded
|
||||||
|
color="primary"
|
||||||
|
:class="['q-ma-md', 'text-bold', 'text-white']"
|
||||||
|
@click="openDialog('add')"
|
||||||
|
>Add New Scene</q-btn
|
||||||
|
>
|
||||||
|
<q-item class="row">
|
||||||
|
<q-item-section :class="['text-black', 'text-bold', 'col-5']">Name</q-item-section>
|
||||||
|
<q-item-section :class="['text-black', 'text-left', 'text-bold', 'text-left']"
|
||||||
|
>Description</q-item-section
|
||||||
|
>
|
||||||
|
</q-item>
|
||||||
|
<q-item
|
||||||
|
v-for="(item, index) in scenes"
|
||||||
|
:key="item.name"
|
||||||
|
bordered
|
||||||
|
style="border: 0.1px solid lightgray; border-radius: 5px; margin-bottom: 1px"
|
||||||
|
>
|
||||||
|
<q-item-section
|
||||||
|
@click="openDialog('load', item)"
|
||||||
|
:class="['text-black', 'text-left', 'cursor-pointer']"
|
||||||
|
style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis"
|
||||||
|
>{{ item.name }}</q-item-section
|
||||||
|
>
|
||||||
|
<q-item-section
|
||||||
|
@click="openDialog('load', item)"
|
||||||
|
:class="['text-black', 'text-left', 'cursor-pointer']"
|
||||||
|
left
|
||||||
|
style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis"
|
||||||
|
>{{ item.description }}</q-item-section
|
||||||
|
>
|
||||||
|
<q-item-section top side>
|
||||||
|
<div class="text-grey-8 q-gutter-xs">
|
||||||
|
<q-btn size="12px" flat dense round icon="delete" @click="removeScene(item.name)" />
|
||||||
|
<q-btn
|
||||||
|
size="12px"
|
||||||
|
flat
|
||||||
|
dense
|
||||||
|
round
|
||||||
|
icon="more_vert"
|
||||||
|
@click="openDialog('edit', item, index)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</q-list>
|
||||||
|
<!-- Fallback if list is empty -->
|
||||||
|
<div v-else class="q-pa-md text-grey text-center">
|
||||||
|
<div>No scenes available</div>
|
||||||
|
<q-btn
|
||||||
|
rounded
|
||||||
|
color="primary"
|
||||||
|
:class="['q-ma-md', 'text-bold', 'text-white']"
|
||||||
|
@click="openDialog('add')"
|
||||||
|
>Add First Scene</q-btn
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { NotifyDialog } from 'src/composables/notify';
|
||||||
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
import type { Scene } from 'src/models/Scene';
|
||||||
|
import type { Set } from 'src/models/Set';
|
||||||
|
import axios from 'axios';
|
||||||
|
import { api } from 'boot/axios';
|
||||||
|
import { NotifyResponse } from 'src/composables/notify';
|
||||||
|
import Dialog from 'src/components/dialog/OkDialog.vue';
|
||||||
|
import { setValues } from 'src/services/websocket';
|
||||||
|
const $q = useQuasar();
|
||||||
|
const showDialog = ref(false);
|
||||||
|
const dialog = ref('');
|
||||||
|
const existsAlready = ref(false);
|
||||||
|
const editIndex = ref(-1);
|
||||||
|
const dialogLabel = ref('');
|
||||||
|
const newScene = reactive<Scene>({
|
||||||
|
name: '',
|
||||||
|
movingHead: false,
|
||||||
|
lightBar: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const scenes = ref<Scene[]>([]);
|
||||||
|
const host = window.location.hostname;
|
||||||
|
const port = 9500;
|
||||||
|
const baseURL = `http://${host}:${port}`;
|
||||||
|
|
||||||
|
const quasarApi = axios.create({
|
||||||
|
baseURL: baseURL,
|
||||||
|
timeout: 10000,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
quasarApi
|
||||||
|
.get('/api/loadScenes')
|
||||||
|
.then((resp) => {
|
||||||
|
if (resp.data) {
|
||||||
|
scenes.value = resp.data;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
NotifyResponse($q, err.response.data.error, 'error');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function removeScene(name: string) {
|
||||||
|
dialog.value = '';
|
||||||
|
NotifyDialog($q, 'Delete', 'Do you want to delete scene: ' + name, 'YES', 'NO')
|
||||||
|
.then((res) => {
|
||||||
|
if (res) {
|
||||||
|
scenes.value = scenes.value.filter((s) => s.name !== name);
|
||||||
|
|
||||||
|
quasarApi
|
||||||
|
.delete('/api/deleteScene', {
|
||||||
|
data: { name },
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
if (res.data) {
|
||||||
|
NotifyResponse($q, res.data, 'warning');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
NotifyResponse($q, err.response.data.error, 'error');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => NotifyResponse($q, err.resp, 'warning'));
|
||||||
|
}
|
||||||
|
|
||||||
|
function openDialog(dialogType: string, scene?: Scene, index?: number) {
|
||||||
|
switch (dialogType) {
|
||||||
|
case 'add':
|
||||||
|
dialog.value = 'add';
|
||||||
|
dialogLabel.value = 'Add Scene';
|
||||||
|
newScene.name = '';
|
||||||
|
newScene.movingHead = true;
|
||||||
|
newScene.lightBar = true;
|
||||||
|
showDialog.value = true;
|
||||||
|
break;
|
||||||
|
case 'edit':
|
||||||
|
if (!scene) return;
|
||||||
|
if (index === undefined) return;
|
||||||
|
dialog.value = 'edit';
|
||||||
|
dialogLabel.value = 'Update Scene';
|
||||||
|
editIndex.value = index;
|
||||||
|
Object.assign(newScene, JSON.parse(JSON.stringify(scene)));
|
||||||
|
showDialog.value = true;
|
||||||
|
break;
|
||||||
|
case 'load':
|
||||||
|
if (!scene) return;
|
||||||
|
dialog.value = 'load';
|
||||||
|
dialogLabel.value = 'Load Scene';
|
||||||
|
quasarApi
|
||||||
|
.post('/api/loadScene', scene)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.data) {
|
||||||
|
Object.assign(newScene, JSON.parse(JSON.stringify(res.data)));
|
||||||
|
showDialog.value = true;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => NotifyResponse($q, err.response.data.error, 'error'));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
showDialog.value = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const saveScene = async () => {
|
||||||
|
const sendValues = [];
|
||||||
|
|
||||||
|
if (!newScene.name) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const exists = scenes.value.some(
|
||||||
|
(item, index) => item.name === newScene.name && index !== editIndex.value,
|
||||||
|
);
|
||||||
|
|
||||||
|
switch (dialog.value) {
|
||||||
|
case 'add':
|
||||||
|
if (exists) {
|
||||||
|
existsAlready.value = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newScene.movingHead) {
|
||||||
|
sendValues.push({
|
||||||
|
path: 'MovingHead',
|
||||||
|
query: { depth: 0 },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newScene.lightBar) {
|
||||||
|
sendValues.push({
|
||||||
|
path: 'LightBar',
|
||||||
|
query: { depth: 0 },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sendValues.length > 0) {
|
||||||
|
try {
|
||||||
|
const res = await api.post('/json_data', { get: sendValues });
|
||||||
|
newScene.values = res.data.get;
|
||||||
|
} catch (err) {
|
||||||
|
NotifyResponse($q, err as Error, 'error');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newScene.values = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
scenes.value = [...scenes.value, JSON.parse(JSON.stringify(newScene))];
|
||||||
|
|
||||||
|
// Sort alphabetically by scene name
|
||||||
|
scenes.value.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
|
|
||||||
|
quasarApi
|
||||||
|
.post('/api/saveScene', JSON.stringify(newScene))
|
||||||
|
.then((res) => {
|
||||||
|
if (res.data) {
|
||||||
|
NotifyResponse($q, res.data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
NotifyResponse($q, err.response.data.error, 'error');
|
||||||
|
});
|
||||||
|
scenes.value = [...scenes.value];
|
||||||
|
break;
|
||||||
|
case 'edit':
|
||||||
|
if (exists) {
|
||||||
|
existsAlready.value = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newScene.movingHead) {
|
||||||
|
sendValues.push({
|
||||||
|
path: 'MovingHead',
|
||||||
|
query: { depth: 0 },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newScene.lightBar) {
|
||||||
|
sendValues.push({
|
||||||
|
path: 'LightBar',
|
||||||
|
query: { depth: 0 },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sendValues.length > 0) {
|
||||||
|
try {
|
||||||
|
const res = await api.post('/json_data', { get: sendValues });
|
||||||
|
newScene.values = res.data.get;
|
||||||
|
} catch (err) {
|
||||||
|
NotifyResponse($q, err as Error, 'error');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newScene.values = [];
|
||||||
|
}
|
||||||
|
scenes.value.splice(editIndex.value, 1, JSON.parse(JSON.stringify(newScene)));
|
||||||
|
scenes.value.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
|
scenes.value = [...scenes.value];
|
||||||
|
|
||||||
|
quasarApi
|
||||||
|
.post('/api/saveScene', JSON.stringify(newScene))
|
||||||
|
.then((res) => {
|
||||||
|
if (res.data) {
|
||||||
|
NotifyResponse($q, res.data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
NotifyResponse($q, err.response.data.error, 'error');
|
||||||
|
});
|
||||||
|
scenes.value = [...scenes.value];
|
||||||
|
break;
|
||||||
|
case 'load':
|
||||||
|
{
|
||||||
|
const setPaths = <Set[]>[];
|
||||||
|
|
||||||
|
if (newScene.movingHead) {
|
||||||
|
newScene.values?.forEach((element) => {
|
||||||
|
if (element.path && element.path.includes('MovingHead')) {
|
||||||
|
setPaths.push({ path: element.path, value: element.value });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newScene.lightBar) {
|
||||||
|
newScene.values?.forEach((element) => {
|
||||||
|
if (element.path && element.path.includes('LightBar')) {
|
||||||
|
setPaths.push({ path: element.path, value: element.value });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setValues(setPaths)
|
||||||
|
.then((response) => {
|
||||||
|
NotifyResponse($q, response);
|
||||||
|
})
|
||||||
|
.catch((err) => console.error(`Failed to load scene ${newScene.name}`, err));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog.value = '';
|
||||||
|
showDialog.value = false;
|
||||||
|
};
|
||||||
|
</script>
|
@@ -1,98 +1,76 @@
|
|||||||
import type { Subs } from 'src/models/Subscribe';
|
import { reactive, computed, type Ref } from 'vue';
|
||||||
import { ref, nextTick, computed } from 'vue';
|
|
||||||
import { setValues } from 'src/services/websocket';
|
|
||||||
import { NotifyResponse } from 'src/composables/notify';
|
|
||||||
import type { QVueGlobals } from 'quasar';
|
import type { QVueGlobals } from 'quasar';
|
||||||
|
import type { Subs } from 'src/models/Subscribe';
|
||||||
|
import { NotifyResponse } from '../notify';
|
||||||
|
import { setValues } from 'src/services/websocket';
|
||||||
|
import { findSubscriptionByPath } from 'src/models/Subscriptions';
|
||||||
|
|
||||||
const Subscriptions = ref<Subs>([]);
|
export const dbmData = reactive<TreeNode[]>([]);
|
||||||
|
//export const reactiveValues = new Map<string, Ref<string | number | boolean | null>>();
|
||||||
|
|
||||||
export const dbmData = ref<TreeNode[]>([]);
|
export type TreeNode = {
|
||||||
|
|
||||||
export interface TreeNode {
|
|
||||||
path: string | undefined;
|
path: string | undefined;
|
||||||
key?: string; // optional: useful for QTree's node-key
|
key?: string; // optional: useful for QTree's node-key
|
||||||
value?: string | number | boolean | undefined;
|
|
||||||
lazy: boolean;
|
lazy: boolean;
|
||||||
children?: TreeNode[];
|
children?: TreeNode[];
|
||||||
}
|
};
|
||||||
|
|
||||||
|
type TreeMap = {
|
||||||
|
[key: string]: {
|
||||||
|
__children: TreeMap;
|
||||||
|
uuid?: string;
|
||||||
|
value?: string | number | boolean | null;
|
||||||
|
lazy: boolean;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const root: TreeMap = {};
|
||||||
|
|
||||||
export function buildTree(subs: Subs): TreeNode[] {
|
export function buildTree(subs: Subs): TreeNode[] {
|
||||||
type TreeMap = {
|
for (const { path, uuid, value, hasChild } of subs) {
|
||||||
[key: string]: {
|
if (!path) continue;
|
||||||
__children: TreeMap;
|
|
||||||
uuid?: string;
|
|
||||||
value?: string | undefined;
|
|
||||||
lazy: boolean;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const root: TreeMap = {};
|
const parts = path.split(':');
|
||||||
|
|
||||||
Subscriptions.value = subs;
|
|
||||||
|
|
||||||
for (const item of subs) {
|
|
||||||
const pathParts = item.path?.split(':') ?? [];
|
|
||||||
let current = root;
|
let current = root;
|
||||||
|
|
||||||
for (let i = 0; i < pathParts.length; i++) {
|
parts.forEach((part, idx) => {
|
||||||
const part = pathParts[i];
|
if (!part) return;
|
||||||
|
|
||||||
if (!part) continue;
|
|
||||||
|
|
||||||
if (!current[part]) {
|
if (!current[part]) {
|
||||||
current[part] = { __children: {}, lazy: true };
|
current[part] = { __children: {}, lazy: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optionally attach uuid only at the final part
|
if (idx === parts.length - 1 && uuid) {
|
||||||
if (i === pathParts.length - 1 && item.uuid) {
|
if (current[part].uuid === uuid) return;
|
||||||
current[part].uuid = item.uuid;
|
|
||||||
current[part].value = item.value !== undefined ? String(item.value) : '';
|
current[part].uuid = uuid;
|
||||||
current[part].lazy = item.hasChild ?? false;
|
current[part].value = value?.value ?? null;
|
||||||
|
current[part].lazy = hasChild ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
current = current[part].__children;
|
current = current[part].__children;
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function convert(map: TreeMap): TreeNode[] {
|
function mapToTree(map: TreeMap): TreeNode[] {
|
||||||
return Object.entries(map).map(([path, node]) => ({
|
return Object.entries(map).map(([key, node]) => ({
|
||||||
path,
|
path: key,
|
||||||
key: node.uuid ?? path, // `key` is used by QTree
|
key: node.uuid ?? key,
|
||||||
value: node.value,
|
value: node.value,
|
||||||
lazy: node.lazy,
|
lazy: node.lazy,
|
||||||
children: convert(node.__children),
|
children: mapToTree(node.__children),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
const newTree = [
|
||||||
{
|
{
|
||||||
path: 'DBM',
|
path: 'DBM',
|
||||||
key: '00000000-0000-0000-0000-000000000000',
|
key: '00000000-0000-0000-0000-000000000000',
|
||||||
lazy: true,
|
lazy: true,
|
||||||
children: convert(root),
|
children: mapToTree(root),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
return dbmData.splice(0, dbmData.length, ...newTree);
|
||||||
|
|
||||||
export function getTreeElementByPath(path: string) {
|
|
||||||
return dbmData.value.find((s) => s.path === path);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getSubscriptionsByUuid(uid: string | undefined) {
|
|
||||||
return Subscriptions.value.find((s) => s.uuid === uid);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function addChildrentoTree(subs: Subs) {
|
|
||||||
const ZERO_UUID = '00000000-0000-0000-0000-000000000000';
|
|
||||||
const existingIds = new Set(Subscriptions.value.map((sub) => sub.uuid));
|
|
||||||
const newSubs = subs
|
|
||||||
.filter((sub) => sub.uuid !== ZERO_UUID) // Skip UUIDs with all zeroes
|
|
||||||
.filter((sub) => !existingIds.has(sub.uuid));
|
|
||||||
|
|
||||||
Subscriptions.value.push(...newSubs);
|
|
||||||
|
|
||||||
void nextTick(() => {
|
|
||||||
dbmData.value = buildTree(Subscriptions.value);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function removeSubtreeByParentKey(parentKey: string) {
|
export function removeSubtreeByParentKey(parentKey: string) {
|
||||||
@@ -110,40 +88,35 @@ export function removeSubtreeByParentKey(parentKey: string) {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
removeChildrenAndMarkLazy(dbmData, parentKey);
|
||||||
removeChildrenAndMarkLazy(dbmData.value, parentKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getSubscriptionsByPath(path: string | undefined) {
|
|
||||||
return Subscriptions.value.find((s) => s.path === path);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getAllSubscriptions() {
|
|
||||||
return Subscriptions.value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateValue(
|
export function updateValue(
|
||||||
path1: string,
|
path1: string,
|
||||||
$q: QVueGlobals,
|
$q: QVueGlobals,
|
||||||
|
toggle?: Ref<boolean>,
|
||||||
path2?: string,
|
path2?: string,
|
||||||
path3?: string,
|
path3?: string,
|
||||||
value3?: number,
|
value3?: number,
|
||||||
) {
|
) {
|
||||||
return computed({
|
return computed({
|
||||||
get() {
|
get() {
|
||||||
const sub = getSubscriptionsByPath(path1);
|
const sub = findSubscriptionByPath(toggle?.value && path2 ? path2 : path1);
|
||||||
const value = sub ? Number(sub.value ?? 0) : 0;
|
return sub?.value ? Number(sub.value ?? 0) : 0;
|
||||||
return Math.round((100 / 255) * value);
|
|
||||||
},
|
},
|
||||||
set(val) {
|
set(val) {
|
||||||
const baseValue = Math.round((255 / 100) * val);
|
const baseValue = val;
|
||||||
const setPaths = [{ path: path1, value: baseValue }];
|
const setPaths = [];
|
||||||
if (path2) {
|
if (toggle?.value && path2) {
|
||||||
setPaths.push({ path: path2, value: baseValue });
|
setPaths.push({ path: path2, value: baseValue });
|
||||||
|
} else {
|
||||||
|
setPaths.push({ path: path1, value: baseValue });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path3) {
|
if (path3) {
|
||||||
setPaths.push({ path: path3, value: value3 ? value3 : baseValue });
|
setPaths.push({ path: path3, value: value3 ? value3 : baseValue });
|
||||||
}
|
}
|
||||||
|
|
||||||
setValues(setPaths)
|
setValues(setPaths)
|
||||||
.then((response) => NotifyResponse($q, response))
|
.then((response) => NotifyResponse($q, response))
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
@@ -1,12 +0,0 @@
|
|||||||
import { ref } from 'vue';
|
|
||||||
import type { TreeNode } from './dbmTree';
|
|
||||||
|
|
||||||
export const contextMenuRef = ref();
|
|
||||||
|
|
||||||
export const contextMenuState = ref<TreeNode | undefined>();
|
|
||||||
|
|
||||||
export function openContextMenu(event: MouseEvent, node: undefined) {
|
|
||||||
event.preventDefault();
|
|
||||||
contextMenuState.value = node;
|
|
||||||
contextMenuRef.value?.show(event);
|
|
||||||
}
|
|
@@ -16,7 +16,7 @@ export function NotifyResponse(
|
|||||||
icon = 'warning';
|
icon = 'warning';
|
||||||
break;
|
break;
|
||||||
case 'error':
|
case 'error':
|
||||||
color = 'orange';
|
color = 'red';
|
||||||
icon = 'error';
|
icon = 'error';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -26,8 +26,9 @@ export function NotifyResponse(
|
|||||||
if (message === '') {
|
if (message === '') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
color = typeof response === 'string' ? response : response?.error ? 'red' : color;
|
|
||||||
icon = typeof response === 'string' ? response : response?.error ? 'error' : icon;
|
color = typeof response === 'string' ? color : response?.error ? 'red' : color;
|
||||||
|
icon = typeof response === 'string' ? icon : response?.error ? 'error' : icon;
|
||||||
$q?.notify({
|
$q?.notify({
|
||||||
message: message,
|
message: message,
|
||||||
color: color,
|
color: color,
|
||||||
@@ -37,3 +38,30 @@ export function NotifyResponse(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function NotifyDialog(
|
||||||
|
$q: QVueGlobals,
|
||||||
|
title: string,
|
||||||
|
text: string,
|
||||||
|
okText?: string,
|
||||||
|
cancelText?: string,
|
||||||
|
) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
$q.dialog({
|
||||||
|
title: title,
|
||||||
|
message: text,
|
||||||
|
persistent: true,
|
||||||
|
ok: okText ?? 'OK',
|
||||||
|
cancel: cancelText ?? 'CANCEL',
|
||||||
|
})
|
||||||
|
.onOk(() => {
|
||||||
|
resolve(true);
|
||||||
|
})
|
||||||
|
.onCancel(() => {
|
||||||
|
resolve(false);
|
||||||
|
})
|
||||||
|
.onDismiss(() => {
|
||||||
|
resolve(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@@ -2,21 +2,30 @@
|
|||||||
<q-layout view="lHh Lpr lFf">
|
<q-layout view="lHh Lpr lFf">
|
||||||
<q-header elevated>
|
<q-header elevated>
|
||||||
<q-toolbar>
|
<q-toolbar>
|
||||||
|
<q-img
|
||||||
|
:src="logo"
|
||||||
|
alt="Logo"
|
||||||
|
style="width: 40px; height: 40px; background-color: var(--q-primary)"
|
||||||
|
class="q-mr-sm"
|
||||||
|
/>
|
||||||
<q-btn flat dense round icon="menu" aria-label="Menu" @click="toggleLeftDrawer" />
|
<q-btn flat dense round icon="menu" aria-label="Menu" @click="toggleLeftDrawer" />
|
||||||
|
|
||||||
<q-toolbar-title> Light Control </q-toolbar-title>
|
<q-toolbar-title> Light Control </q-toolbar-title>
|
||||||
|
|
||||||
<div>Version {{ version }}</div>
|
<div>Version {{ version }}</div>
|
||||||
|
<q-btn dense icon="refresh" square class="q-px-md q-ml-md" @click="refresh" />
|
||||||
</q-toolbar>
|
</q-toolbar>
|
||||||
</q-header>
|
</q-header>
|
||||||
|
|
||||||
<q-drawer v-model="leftDrawerOpen" bordered>
|
<q-drawer v-model="leftDrawerOpen" bordered>
|
||||||
<q-list>
|
<q-list>
|
||||||
<q-item to="/" clickable v-ripple>
|
<q-item to="/" exact clickable v-ripple @click="closeDrawer">
|
||||||
<q-item-section>Home</q-item-section>
|
<q-item-section>Home</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
<q-item to="/scenes" clickable v-ripple @click="closeDrawer">
|
||||||
<q-item to="/data" clickable v-ripple>
|
<q-item-section>Scenes</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item to="/data" clickable v-ripple @click="closeDrawer">
|
||||||
<q-item-section>Data</q-item-section>
|
<q-item-section>Data</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
</q-list>
|
</q-list>
|
||||||
@@ -28,6 +37,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import logo from 'src/assets/LOGO_CF-ICON_color.svg';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { version } from '../..//package.json';
|
import { version } from '../..//package.json';
|
||||||
|
|
||||||
@@ -36,4 +46,12 @@ const leftDrawerOpen = ref(false);
|
|||||||
function toggleLeftDrawer() {
|
function toggleLeftDrawer() {
|
||||||
leftDrawerOpen.value = !leftDrawerOpen.value;
|
leftDrawerOpen.value = !leftDrawerOpen.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closeDrawer() {
|
||||||
|
leftDrawerOpen.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function refresh() {
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
3
src/models/Pong.ts
Normal file
3
src/models/Pong.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export interface PongMessage {
|
||||||
|
type: 'pong';
|
||||||
|
}
|
@@ -1,8 +1,16 @@
|
|||||||
export type Publish = {
|
export type Publish = {
|
||||||
event: string;
|
event: string;
|
||||||
uuid?: string;
|
uuid: string;
|
||||||
path?: string;
|
path: string;
|
||||||
type?: string;
|
type: string;
|
||||||
value?: undefined;
|
value: string | number | boolean | null;
|
||||||
};
|
};
|
||||||
export type Pubs = Publish[];
|
export type Pubs = Publish[];
|
||||||
|
|
||||||
|
import { updateSubscriptionValue } from './Subscriptions';
|
||||||
|
|
||||||
|
export function publishToSubscriptions(pubs: Pubs) {
|
||||||
|
pubs.forEach((pub) => {
|
||||||
|
updateSubscriptionValue(pub.uuid, pub.value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
import type { Gets } from './Get';
|
import type { Gets } from './Get';
|
||||||
import type { Sets } from './Set';
|
import type { Sets } from './Set';
|
||||||
import type { Subs } from './Subscribe';
|
import type { RawSubs } from './Subscribe';
|
||||||
import type { Pubs } from './Publish';
|
import type { Pubs } from './Publish';
|
||||||
|
|
||||||
export type Response = {
|
export type Response = {
|
||||||
get?: Gets;
|
get?: Gets;
|
||||||
set?: Sets;
|
set?: Sets;
|
||||||
subscribe?: Subs;
|
subscribe?: RawSubs;
|
||||||
unsubscribe?: Subs;
|
unsubscribe?: RawSubs;
|
||||||
publish?: Pubs;
|
publish?: Pubs;
|
||||||
error?: boolean;
|
error?: boolean;
|
||||||
message?: string;
|
message?: string;
|
||||||
|
9
src/models/Scene.ts
Normal file
9
src/models/Scene.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import type { Value } from './Value';
|
||||||
|
|
||||||
|
export interface Scene {
|
||||||
|
name: string;
|
||||||
|
description?: string;
|
||||||
|
movingHead: boolean;
|
||||||
|
lightBar: boolean;
|
||||||
|
values?: Value[];
|
||||||
|
}
|
@@ -1,8 +1,8 @@
|
|||||||
export type Set = {
|
export type Set = {
|
||||||
uuid?: string | undefined;
|
uuid?: string | undefined;
|
||||||
path: string;
|
path?: string;
|
||||||
type?: string;
|
type?: string;
|
||||||
value: number | boolean | undefined;
|
value: string | number | boolean | undefined;
|
||||||
create?: boolean;
|
create?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -1,9 +1,46 @@
|
|||||||
|
import { ref } from 'vue';
|
||||||
|
import type { Ref } from 'vue';
|
||||||
|
|
||||||
export type Subscribe = {
|
export type Subscribe = {
|
||||||
uuid?: string | undefined;
|
uuid?: string;
|
||||||
path?: string | undefined;
|
path?: string;
|
||||||
depth?: number;
|
depth?: number;
|
||||||
value?: string | number | boolean | undefined;
|
type?: string;
|
||||||
|
drivers?: object | undefined;
|
||||||
|
value?: Ref<string | number | boolean | null | undefined>;
|
||||||
hasChild?: boolean;
|
hasChild?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Subs = Subscribe[];
|
export type Subs = Subscribe[];
|
||||||
|
|
||||||
|
export type RawSubscribe = {
|
||||||
|
uuid?: string;
|
||||||
|
path?: string;
|
||||||
|
depth?: number;
|
||||||
|
value?: string | number | boolean | null;
|
||||||
|
hasChild?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type RawSubs = RawSubscribe[];
|
||||||
|
|
||||||
|
export function convertToSubscribe(raw: RawSubscribe): Subscribe {
|
||||||
|
return {
|
||||||
|
...raw,
|
||||||
|
value: ref(raw.value ?? null),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function convertToSubscribes(rawList: RawSubs): Subs {
|
||||||
|
const subs = rawList.map(convertToSubscribe);
|
||||||
|
return subs as Subs;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function convertToRaw(sub: Subscribe): RawSubscribe {
|
||||||
|
return {
|
||||||
|
...(sub.uuid !== undefined ? { uuid: sub.uuid } : {}),
|
||||||
|
...(sub.path !== undefined ? { path: sub.path } : {}),
|
||||||
|
...(sub.depth !== undefined ? { depth: sub.depth } : {}),
|
||||||
|
...(sub.value?.value !== undefined ? { value: sub.value.value } : {}),
|
||||||
|
...(sub.hasChild !== undefined ? { hasChild: sub.hasChild } : {}),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
67
src/models/Subscriptions.ts
Normal file
67
src/models/Subscriptions.ts
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
import type { Ref } from 'vue';
|
||||||
|
import { reactive, ref } from 'vue';
|
||||||
|
import { convertToSubscribe } from 'src/models/Subscribe';
|
||||||
|
import type { Subs, Subscribe, RawSubs } from 'src/models/Subscribe';
|
||||||
|
|
||||||
|
const EMPTYUUID = '00000000-0000-0000-0000-000000000000';
|
||||||
|
export const Subscriptions = reactive<Record<string, Subscribe>>({});
|
||||||
|
|
||||||
|
export type TableSubscription = {
|
||||||
|
path: string;
|
||||||
|
value: Ref<string | number | boolean | null | undefined>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function getRows(): Subs {
|
||||||
|
return Object.values(Subscriptions).map((sub) => {
|
||||||
|
sub.path = sub.path?.split(':').pop() ?? '';
|
||||||
|
if (!sub.type) sub.type = 'None';
|
||||||
|
else sub.type = sub.type.toLowerCase();
|
||||||
|
return sub;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addSubscriptions(subs: RawSubs) {
|
||||||
|
subs.forEach((sub) => addSubscription(convertToSubscribe(sub)));
|
||||||
|
}
|
||||||
|
|
||||||
|
function addSubscription(sub: Subscribe) {
|
||||||
|
if (EMPTYUUID === sub.uuid) {
|
||||||
|
sub.path = 'DBM';
|
||||||
|
}
|
||||||
|
if (!sub.uuid) return;
|
||||||
|
Subscriptions[sub.uuid] = sub;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateSubscription(sub: Subscribe) {
|
||||||
|
if (!sub.uuid) return;
|
||||||
|
Subscriptions[sub.uuid] = sub;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateSubscriptionValue(
|
||||||
|
uuid: string,
|
||||||
|
value: string | number | boolean | null | undefined,
|
||||||
|
) {
|
||||||
|
if (!uuid) return;
|
||||||
|
if (!Subscriptions[uuid]) return;
|
||||||
|
Subscriptions[uuid].value = ref(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function removeSubscriptions(subs: RawSubs) {
|
||||||
|
subs.forEach((sub) => {
|
||||||
|
removeSubscription(sub.path);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function removeAllSubscriptions() {
|
||||||
|
Object.keys(Subscriptions).forEach((key) => delete Subscriptions[key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeSubscription(uuid: string | undefined) {
|
||||||
|
if (uuid === undefined) return;
|
||||||
|
if (!Subscriptions || Subscriptions[uuid] === undefined) return;
|
||||||
|
delete Subscriptions[uuid];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function findSubscriptionByPath(path: string): Subscribe | undefined {
|
||||||
|
return Object.values(Subscriptions).find((sub) => sub.path === path);
|
||||||
|
}
|
7
src/models/Value.ts
Normal file
7
src/models/Value.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import type { UUID } from 'crypto';
|
||||||
|
|
||||||
|
export interface Value {
|
||||||
|
uuid?: UUID;
|
||||||
|
path: string;
|
||||||
|
value: number | string | undefined;
|
||||||
|
}
|
@@ -10,6 +10,7 @@ import { NotifyResponse } from 'src/composables/notify';
|
|||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
||||||
function saveDBM() {
|
function saveDBM() {
|
||||||
api
|
api
|
||||||
.get('saveData')
|
.get('saveData')
|
||||||
|
@@ -5,8 +5,9 @@ const routes: RouteRecordRaw[] = [
|
|||||||
path: '/',
|
path: '/',
|
||||||
component: () => import('layouts/MainLayout.vue'),
|
component: () => import('layouts/MainLayout.vue'),
|
||||||
children: [
|
children: [
|
||||||
{ path: '', component: () => import('pages/IndexPage.vue') },
|
{ path: '', component: () => import('pages/MainPage.vue') },
|
||||||
{ path: '/data', component: () => import('pages/DataPage.vue') },
|
{ path: '/data', component: () => import('pages/DataPage.vue') },
|
||||||
|
{ path: '/scenes', component: () => import('components/scenes/ScenesPage.vue') },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@@ -1,22 +1,42 @@
|
|||||||
import type { Response } from 'src/models/Response';
|
import type { Response } from 'src/models/Response';
|
||||||
import type { Publish } from 'src/models/Publish';
|
import { publishToSubscriptions } from 'src/models/Publish';
|
||||||
import type { Request } from 'src/models/Request';
|
import type { Request } from 'src/models/Request';
|
||||||
import type { QVueGlobals } from 'quasar';
|
import type { QVueGlobals } from 'quasar';
|
||||||
import {
|
import { ref } from 'vue';
|
||||||
getAllSubscriptions,
|
import { NotifyResponse } from 'src/composables/notify';
|
||||||
buildTree,
|
import { type Subs } from 'src/models/Subscribe';
|
||||||
dbmData,
|
|
||||||
getSubscriptionsByUuid,
|
|
||||||
} from 'src/composables/dbm/dbmTree';
|
|
||||||
import { ref, reactive } from 'vue';
|
|
||||||
import type { Subs } from 'src/models/Subscribe';
|
|
||||||
import type { Sets } from 'src/models/Set';
|
import type { Sets } from 'src/models/Set';
|
||||||
|
import type { PongMessage } from 'src/models/Pong';
|
||||||
|
import { addSubscriptions } from 'src/models/Subscriptions';
|
||||||
const pendingResponses = new Map<string, (data: Response | undefined) => void>();
|
const pendingResponses = new Map<string, (data: Response | undefined) => void>();
|
||||||
export const lastKnownValues = reactive(new Map<string, string>());
|
//const lastKnownValues: Record<string, string> = reactive({});
|
||||||
|
|
||||||
export let socket: WebSocket | null = null;
|
export let socket: WebSocket | null = null;
|
||||||
const isConnected = ref(false);
|
const isConnected = ref(false);
|
||||||
|
let lastPongTime = Date.now();
|
||||||
|
|
||||||
|
function pingLoop(interval: number = 5000) {
|
||||||
|
// Start sending ping every 5 seconds
|
||||||
|
setInterval(() => {
|
||||||
|
if (!socket || socket.readyState !== WebSocket.OPEN) return;
|
||||||
|
|
||||||
|
// If no pong received in last 10 seconds, close
|
||||||
|
if (Date.now() - lastPongTime > interval + 10000) {
|
||||||
|
console.warn('No pong response, closing socket...');
|
||||||
|
socket.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
socket.send(JSON.stringify({ type: 'ping' }));
|
||||||
|
}, interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isPong(msg: PongMessage | undefined | null) {
|
||||||
|
if (msg?.type === 'pong') {
|
||||||
|
lastPongTime = Date.now();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
export function initWebSocket(url: string, $q?: QVueGlobals) {
|
export function initWebSocket(url: string, $q?: QVueGlobals) {
|
||||||
const connect = () => {
|
const connect = () => {
|
||||||
@@ -25,6 +45,8 @@ export function initWebSocket(url: string, $q?: QVueGlobals) {
|
|||||||
socket.onopen = () => {
|
socket.onopen = () => {
|
||||||
console.log('WebSocket connected');
|
console.log('WebSocket connected');
|
||||||
isConnected.value = true;
|
isConnected.value = true;
|
||||||
|
// Start sending ping every 5 seconds
|
||||||
|
pingLoop(5000);
|
||||||
};
|
};
|
||||||
socket.onclose = () => {
|
socket.onclose = () => {
|
||||||
isConnected.value = false;
|
isConnected.value = false;
|
||||||
@@ -49,43 +71,21 @@ export function initWebSocket(url: string, $q?: QVueGlobals) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
socket.onmessage = (event) => {
|
socket.onmessage = (event) => {
|
||||||
const message = JSON.parse(event.data);
|
if (typeof event.data === 'string') {
|
||||||
const id = message.id;
|
const message = JSON.parse(event.data);
|
||||||
|
|
||||||
if (id && pendingResponses.has(id)) {
|
// Handle pong
|
||||||
pendingResponses.get(id)?.(message); // resolve the promise
|
if (isPong(message)) return;
|
||||||
pendingResponses.delete(id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (message.publish) {
|
const id = message.id;
|
||||||
let changed = false;
|
if (id && pendingResponses.has(id)) {
|
||||||
|
pendingResponses.get(id)?.(message); // resolve the promise
|
||||||
|
pendingResponses.delete(id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
(message.publish as Publish[]).forEach((pub) => {
|
if (message.publish) {
|
||||||
const uuid = pub.uuid;
|
publishToSubscriptions(message.publish);
|
||||||
const value = pub.value ?? '';
|
|
||||||
|
|
||||||
if (uuid === undefined) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const oldValue = lastKnownValues.get(String(uuid));
|
|
||||||
if (oldValue !== value) {
|
|
||||||
lastKnownValues.set(uuid, value); // this is now reactive
|
|
||||||
|
|
||||||
const existing = getSubscriptionsByUuid(pub.uuid);
|
|
||||||
if (existing) {
|
|
||||||
existing.value = value;
|
|
||||||
} else {
|
|
||||||
getAllSubscriptions()?.push({ value, uuid: uuid });
|
|
||||||
}
|
|
||||||
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (changed) {
|
|
||||||
dbmData.value = buildTree(getAllSubscriptions()); // rebuild reactive tree
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -127,6 +127,25 @@ function waitForSocketConnection(): Promise<void> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function subscribeToPath(q: QVueGlobals, path: string) {
|
||||||
|
subscribe([
|
||||||
|
{
|
||||||
|
path: path,
|
||||||
|
depth: 0,
|
||||||
|
},
|
||||||
|
])
|
||||||
|
.then((response) => {
|
||||||
|
if (response?.subscribe) {
|
||||||
|
addSubscriptions(response.subscribe);
|
||||||
|
} else {
|
||||||
|
NotifyResponse(q, response);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
NotifyResponse(q, err, 'error');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export function subscribe(data: Subs): Promise<Response | undefined> {
|
export function subscribe(data: Subs): Promise<Response | undefined> {
|
||||||
return send({ subscribe: data });
|
return send({ subscribe: data });
|
||||||
}
|
}
|
||||||
|
50
src/utils/number-helpers.ts
Normal file
50
src/utils/number-helpers.ts
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import type { Ref } from 'vue';
|
||||||
|
|
||||||
|
export function separate16BitUint(value: number): { highByte: number; lowByte: number } {
|
||||||
|
// Ensure the value is treated as a 16-bit unsigned integer
|
||||||
|
// (optional, but good for clarity and safety if 'value' might be outside 0-65535)
|
||||||
|
const normalizedValue = value & 0xffff; // Mask to ensure it's within 16 bits
|
||||||
|
|
||||||
|
// Extract the low byte (least significant 8 bits)
|
||||||
|
// This is simply the value modulo 256, or bitwise AND with 0xFF
|
||||||
|
const lowByte = normalizedValue & 0xff;
|
||||||
|
|
||||||
|
// Extract the high byte (most significant 8 bits)
|
||||||
|
// Right shift by 8 bits to move the high byte into the low byte's position,
|
||||||
|
// then mask with 0xFF to get just those 8 bits.
|
||||||
|
const highByte = (normalizedValue >> 8) & 0xff;
|
||||||
|
|
||||||
|
return { highByte, lowByte };
|
||||||
|
}
|
||||||
|
|
||||||
|
export function combineBytesTo16BitUint(highByte: number, lowByte: number): number {
|
||||||
|
// Ensure both bytes are within the 0-255 range for safety
|
||||||
|
const safeHighByte = highByte & 0xff;
|
||||||
|
const safeLowByte = lowByte & 0xff;
|
||||||
|
|
||||||
|
// Shift the high byte 8 bits to the left to place it in the higher position.
|
||||||
|
// Example: if highByte is 0xA4 (10100100), after shifting it becomes 0xA400 (1010010000000000).
|
||||||
|
const shiftedHighByte = safeHighByte << 8;
|
||||||
|
|
||||||
|
// Combine the shifted high byte with the low byte using a bitwise OR.
|
||||||
|
// Example: if shiftedHighByte is 0xA400 and lowByte is 0x78 (01111000),
|
||||||
|
// the result is 0xA478 (1010010001111000).
|
||||||
|
const combinedValue = shiftedHighByte | safeLowByte;
|
||||||
|
|
||||||
|
// Optional: Mask the result to ensure it's strictly within the 16-bit unsigned range (0 to 65535).
|
||||||
|
// This is good practice as JavaScript numbers are 64-bit floats, and this ensures
|
||||||
|
// the value wraps correctly if intermediate operations somehow exceeded 16 bits.
|
||||||
|
return combinedValue & 0xffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addOne(val: Ref<number>, limit: number) {
|
||||||
|
if (val.value < limit) {
|
||||||
|
val.value++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function substractOne(val: Ref<number>, limit: number) {
|
||||||
|
if (val.value > limit) {
|
||||||
|
val.value--;
|
||||||
|
}
|
||||||
|
}
|
32
src/vueLib/buttons/DataTypes.vue
Normal file
32
src/vueLib/buttons/DataTypes.vue
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<template>
|
||||||
|
<q-card>
|
||||||
|
<div class="text-primary q-ma-md">Datatypes *</div>
|
||||||
|
<div>
|
||||||
|
<div class="row q-gutter-sm q-ml-sm">
|
||||||
|
<q-card-section class="items-between">
|
||||||
|
<RadioButton class="q-ma-xs" v-model:opt="datatype" text="None" hint="none">
|
||||||
|
</RadioButton>
|
||||||
|
<RadioButton class="q-ma-xs" v-model:opt="datatype" text="String" hint="Text">
|
||||||
|
</RadioButton>
|
||||||
|
<RadioButton class="q-ma-xs" v-model:opt="datatype" text="Bool" hint="On / Off">
|
||||||
|
</RadioButton>
|
||||||
|
</q-card-section>
|
||||||
|
<RadioButton v-model:opt="datatype" text="Uint8" hint="0 - 255"> </RadioButton>
|
||||||
|
<RadioButton v-model:opt="datatype" text="Uint16" hint="0 - 65535"> </RadioButton>
|
||||||
|
<RadioButton v-model:opt="datatype" text="Uint32" hint="0 - 429496..."> </RadioButton>
|
||||||
|
<RadioButton v-model:opt="datatype" text="Int8" hint="-128 - 127"> </RadioButton>
|
||||||
|
<RadioButton v-model:opt="datatype" text="Int16" hint="-32768 - 3..."> </RadioButton>
|
||||||
|
<RadioButton v-model:opt="datatype" text="Int32" hint="-21474836..."> </RadioButton>
|
||||||
|
<RadioButton v-model:opt="datatype" text="Int32" hint="-2^63 - (2^...)"> </RadioButton>
|
||||||
|
<RadioButton v-model:opt="datatype" text="double" hint="1.7E 1/- 3..."> </RadioButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</q-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import RadioButton from './RadioButton.vue';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
const datatype = ref('none');
|
||||||
|
</script>
|
31
src/vueLib/buttons/RadioButton.vue
Normal file
31
src/vueLib/buttons/RadioButton.vue
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<template>
|
||||||
|
<q-btn style="border-radius: 8px" no-caps
|
||||||
|
><q-radio v-model="opt" :val="props.text"></q-radio>
|
||||||
|
<div class="column items-start q-mx-md">
|
||||||
|
<div class="text-body1 text-black">{{ props.text }}</div>
|
||||||
|
<div class="text-caption text-grey">{{ props.hint }}</div>
|
||||||
|
</div>
|
||||||
|
</q-btn>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { watch, ref } from 'vue';
|
||||||
|
|
||||||
|
const opt = defineModel('opt');
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
text: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
hint: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const localOption = ref('');
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:option']);
|
||||||
|
|
||||||
|
watch(localOption, (val) => emit('update:option', val));
|
||||||
|
</script>
|
65
src/vueLib/dialog/DialogFrame.vue
Normal file
65
src/vueLib/dialog/DialogFrame.vue
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<template>
|
||||||
|
<q-dialog
|
||||||
|
ref="dialogRef"
|
||||||
|
:maximized="minMaxState"
|
||||||
|
:full-width="minMaxState"
|
||||||
|
:no-focus="!minMaxState"
|
||||||
|
:no-refocus="!minMaxState"
|
||||||
|
:seamless="!minMaxState"
|
||||||
|
>
|
||||||
|
<q-card class="layout" :style="cardStyle" v-touch-pan.mouse.prevent.stop="handlePan">
|
||||||
|
<div class="row justify-end q-mx-sm q-mt-xs">
|
||||||
|
<q-btn dense flat :icon="minMaxIcon" size="md" @click="minMax()"></q-btn>
|
||||||
|
<q-btn dense flat icon="close" size="md" v-close-popup></q-btn>
|
||||||
|
</div>
|
||||||
|
<q-separator color="black" class="q-my-none" />
|
||||||
|
<slot />
|
||||||
|
</q-card>
|
||||||
|
</q-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
|
||||||
|
const dialogRef = ref();
|
||||||
|
const open = () => dialogRef.value?.show();
|
||||||
|
|
||||||
|
const minMaxIcon = ref('fullscreen');
|
||||||
|
const minMaxState = ref(false);
|
||||||
|
function minMax() {
|
||||||
|
if (minMaxState.value) {
|
||||||
|
minMaxIcon.value = 'fullscreen';
|
||||||
|
} else {
|
||||||
|
minMaxIcon.value = 'fullscreen_exit';
|
||||||
|
}
|
||||||
|
minMaxState.value = !minMaxState.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: '300px',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const position = ref({ x: 0, y: 0 });
|
||||||
|
|
||||||
|
// This makes the dialog draggable
|
||||||
|
const handlePan = (details: { delta: { x: number; y: number } }) => {
|
||||||
|
position.value.x += details.delta.x;
|
||||||
|
position.value.y += details.delta.y;
|
||||||
|
};
|
||||||
|
|
||||||
|
const cardStyle = computed(() => ({
|
||||||
|
width: props.width,
|
||||||
|
transform: `translate(${position.value.x}px, ${position.value.y}px)`,
|
||||||
|
}));
|
||||||
|
|
||||||
|
defineExpose({ open });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.layout {
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
Reference in New Issue
Block a user