From 56dc99c17d012786cbdc00b2c23866183a01b69f Mon Sep 17 00:00:00 2001 From: Adis Durakovic Date: Fri, 15 Mar 2024 17:13:16 +0100 Subject: [PATCH] chore: workflow --- .github/workflows/build.yml | 2 +- app.go | 4 ++-- build.sh | 2 +- frontend/composables/useHttp.ts | 4 ++-- frontend/composables/useLogs.ts | 7 +++++++ frontend/pages/logs.vue | 3 +++ frontend/pages/settings.vue | 4 +++- frontend/wailsjs/go/models.ts | 6 ++++++ internal/init.go | 2 +- 9 files changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 594d30f..0ba106a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: - name: 'resticity-Linux-${{ github.ref_name }}' platform: 'linux/amd64' os: 'ubuntu-latest' - - name: 'Resticity-Windows-${{ github.ref_name }}' + - name: 'Resticity-Windows-Portable-${{ github.ref_name }}.exe' platform: 'windows/amd64' os: 'windows-latest' # - name: 'Resticity' diff --git a/app.go b/app.go index eb757fe..0d28f42 100644 --- a/app.go +++ b/app.go @@ -133,6 +133,6 @@ func (a *App) SelectFile(title string) string { return "" } -func (a *App) FakeCreateForModels() (internal.SnapshotGroup, internal.Repository, internal.Backup, internal.Config, internal.Schedule, internal.FileDescriptor) { - return internal.SnapshotGroup{}, internal.Repository{}, internal.Backup{}, internal.Config{}, internal.Schedule{}, internal.FileDescriptor{} +func (a *App) FakeCreateForModels() (internal.SnapshotGroup, internal.Repository, internal.Backup, internal.Config, internal.Schedule, internal.FileDescriptor, internal.ScheduleObject) { + return internal.SnapshotGroup{}, internal.Repository{}, internal.Backup{}, internal.Config{}, internal.Schedule{}, internal.FileDescriptor{}, internal.ScheduleObject{} } diff --git a/build.sh b/build.sh index cb05269..8d0e630 100755 --- a/build.sh +++ b/build.sh @@ -21,7 +21,7 @@ case $1 in cd frontend && pnpm install && pnpm build ;; "dev") - $wails dev -ldflags="$LD_FLAGS" -loglevel "Error" + RESTICITY_LOG_LEVEL=debug $wails dev -ldflags="$LD_FLAGS" -loglevel "Error" ;; *) ;; diff --git a/frontend/composables/useHttp.ts b/frontend/composables/useHttp.ts index f2456d0..c4381bf 100644 --- a/frontend/composables/useHttp.ts +++ b/frontend/composables/useHttp.ts @@ -31,9 +31,9 @@ export default class HttpClient { } return res._data } catch (e: any) { - console.log(e) + console.error(e) + useLogs().setServerError(e) this.notifyError(e, notify) - return e.data } } diff --git a/frontend/composables/useLogs.ts b/frontend/composables/useLogs.ts index 0f7c050..ade734a 100644 --- a/frontend/composables/useLogs.ts +++ b/frontend/composables/useLogs.ts @@ -5,6 +5,7 @@ type Log = { export const useLogs = defineStore('useLogs', () => { const out = ref({}) const err = ref({}) + const serverErr = ref([]) function setOut(id: string, data: string) { if (out.value[id] === undefined) { @@ -23,10 +24,16 @@ export const useLogs = defineStore('useLogs', () => { } } + function setServerError(data: string) { + serverErr.value.push(data) + } + return { out, err, setOut, setErr, + serverErr, + setServerError, } }) diff --git a/frontend/pages/logs.vue b/frontend/pages/logs.vue index 409bcf5..37df2b3 100644 --- a/frontend/pages/logs.vue +++ b/frontend/pages/logs.vue @@ -22,6 +22,9 @@

No errors

+

Server errors

+
{{ useLogs().serverErr.join('\n') }}
+

No errors

Archive logs

diff --git a/frontend/pages/settings.vue b/frontend/pages/settings.vue index 361ffb5..f8f729f 100644 --- a/frontend/pages/settings.vue +++ b/frontend/pages/settings.vue @@ -38,7 +38,9 @@
-
Resticity
Version: {{ version }}
Build: {{ build }}
+
+ Resticity
Version: {{ version }}
Build: {{ build }}
Server: {{ `${useRequestURL().protocol}//${useRequestURL().host}` }} +
diff --git a/frontend/wailsjs/go/models.ts b/frontend/wailsjs/go/models.ts index 6e7cbea..c14a918 100755 --- a/frontend/wailsjs/go/models.ts +++ b/frontend/wailsjs/go/models.ts @@ -83,6 +83,12 @@ export namespace internal { + export interface ScheduleObject { + schedule: Schedule; + to_repository?: Repository; + from_repository?: Repository; + backup?: Backup; + } export interface Snapshot { id: string; // Go type: time diff --git a/internal/init.go b/internal/init.go index 6c5212e..85715db 100644 --- a/internal/init.go +++ b/internal/init.go @@ -58,6 +58,6 @@ func SetLogLevel() { if err == nil { log.SetLevel(l) } else { - log.SetLevel(log.WarnLevel) + log.SetLevel(log.ErrorLevel) } }