From 12fa731593496d306e570df582b110c84845b7eb Mon Sep 17 00:00:00 2001 From: crwxaj <52156245+crwxaj@users.noreply.github.com> Date: Thu, 16 Jun 2022 18:32:26 +0200 Subject: [PATCH] feat: add options to hide buttons in scene list (#738) * configure buttons in scene list * load web option on first load * match button color Co-authored-by: crwxaj --- pkg/api/options.go | 12 +++-- pkg/config/config.go | 9 ++-- pkg/config/state.go | 9 ++-- ui/src/store/optionsWeb.js | 9 ++++ .../views/options/sections/InterfaceWeb.vue | 47 +++++++++++++++++-- ui/src/views/scenes/SceneCard.vue | 9 ++-- ui/src/views/scenes/Scenes.vue | 1 + 7 files changed, 81 insertions(+), 15 deletions(-) diff --git a/pkg/api/options.go b/pkg/api/options.go index 677618998..737a0ade7 100644 --- a/pkg/api/options.go +++ b/pkg/api/options.go @@ -39,9 +39,12 @@ type VersionCheckResponse struct { } type RequestSaveOptionsWeb struct { - TagSort string `json:"tagSort"` - SceneEdit bool `json:"sceneEdit"` - UpdateCheck bool `json:"updateCheck"` + TagSort string `json:"tagSort"` + SceneWatchlist bool `json:"sceneWatchlist"` + SceneFavourite bool `json:"sceneFavourite"` + SceneWatched bool `json:"sceneWatched"` + SceneEdit bool `json:"sceneEdit"` + UpdateCheck bool `json:"updateCheck"` } type RequestSaveOptionsDLNA struct { @@ -229,6 +232,9 @@ func (i ConfigResource) saveOptionsWeb(req *restful.Request, resp *restful.Respo } config.Config.Web.TagSort = r.TagSort + config.Config.Web.SceneWatchlist = r.SceneWatchlist + config.Config.Web.SceneFavourite = r.SceneFavourite + config.Config.Web.SceneWatched = r.SceneWatched config.Config.Web.SceneEdit = r.SceneEdit config.Config.Web.UpdateCheck = r.UpdateCheck config.SaveConfig() diff --git a/pkg/config/config.go b/pkg/config/config.go index f7d304e23..8c6609546 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -18,9 +18,12 @@ type ObjectConfig struct { Password string `default:"" json:"password"` } `json:"security"` Web struct { - TagSort string `default:"by-tag-count" json:"tagSort"` - SceneEdit bool `default:"false" json:"sceneEdit"` - UpdateCheck bool `default:"true" json:"updateCheck"` + TagSort string `default:"by-tag-count" json:"tagSort"` + SceneWatchlist bool `default:"true" json:"sceneWatchlist"` + SceneFavourite bool `default:"true" json:"sceneFavourite"` + SceneWatched bool `default:"false" json:"sceneWatched"` + SceneEdit bool `default:"false" json:"sceneEdit"` + UpdateCheck bool `default:"true" json:"updateCheck"` } `json:"web"` Vendor struct { TPDB struct { diff --git a/pkg/config/state.go b/pkg/config/state.go index ab16ec498..67023af23 100644 --- a/pkg/config/state.go +++ b/pkg/config/state.go @@ -12,9 +12,12 @@ type ObjectState struct { BoundIP []string `json:"bound_ip"` } `json:"server"` Web struct { - TagSort string `json:"tagSort"` - SceneEdit bool `json:"sceneEdit"` - UpdateCheck bool `json:"updateCheck"` + TagSort string `json:"tagSort"` + SceneWatchlist bool `json:"sceneWatchlist"` + SceneFavourite bool `json:"sceneFavourite"` + SceneWatched bool `json:"sceneWatched"` + SceneEdit bool `json:"sceneEdit"` + UpdateCheck bool `json:"updateCheck"` } `json:"web"` DLNA struct { Running bool `json:"running"` diff --git a/ui/src/store/optionsWeb.js b/ui/src/store/optionsWeb.js index db07d61b7..af181c114 100644 --- a/ui/src/store/optionsWeb.js +++ b/ui/src/store/optionsWeb.js @@ -4,6 +4,9 @@ const state = { loading: false, web: { tagSort: 'By Tag Count', + sceneWatchlist: true, + sceneFavourite: true, + sceneWatched: false, sceneEdit: false, updateCheck: true } @@ -18,6 +21,9 @@ const actions = { .json() .then(data => { state.web.tagSort = data.config.web.tagSort + state.web.sceneWatchlist = data.config.web.sceneWatchlist + state.web.sceneFavourite = data.config.web.sceneFavourite + state.web.sceneWatched = data.config.web.sceneWatched state.web.sceneEdit = data.config.web.sceneEdit state.web.updateCheck = data.config.web.updateCheck state.loading = false @@ -29,6 +35,9 @@ const actions = { .json() .then(data => { state.web.tagSort = data.tagSort + state.web.sceneWatchlist = data.sceneWatchlist + state.web.sceneFavourite = data.sceneFavourite + state.web.sceneWatched = data.sceneWatched state.web.sceneEdit = data.sceneEdit state.web.updateCheck = data.updateCheck state.loading = false diff --git a/ui/src/views/options/sections/InterfaceWeb.vue b/ui/src/views/options/sections/InterfaceWeb.vue index 0c7fd6f03..f587d764e 100644 --- a/ui/src/views/options/sections/InterfaceWeb.vue +++ b/ui/src/views/options/sections/InterfaceWeb.vue @@ -18,9 +18,26 @@ - - - Enabled + + + + + show Add/Remove from Watchlist button + + + + + show Add/Remove from Favourites button + + + + + show Toggle Watched Status button + + + + + show Edit Scene button @@ -60,6 +77,30 @@ export default { this.$store.state.optionsWeb.web.tagSort = value } }, + sceneWatchlist: { + get () { + return this.$store.state.optionsWeb.web.sceneWatchlist + }, + set (value) { + this.$store.state.optionsWeb.web.sceneWatchlist = value + } + }, + sceneFavourite: { + get () { + return this.$store.state.optionsWeb.web.sceneFavourite + }, + set (value) { + this.$store.state.optionsWeb.web.sceneFavourite = value + } + }, + sceneWatched: { + get () { + return this.$store.state.optionsWeb.web.sceneWatched + }, + set (value) { + this.$store.state.optionsWeb.web.sceneWatched = value + } + }, sceneEdit: { get () { return this.$store.state.optionsWeb.web.sceneEdit diff --git a/ui/src/views/scenes/SceneCard.vue b/ui/src/views/scenes/SceneCard.vue index 95e5a94bb..bccefdaae 100644 --- a/ui/src/views/scenes/SceneCard.vue +++ b/ui/src/views/scenes/SceneCard.vue @@ -9,6 +9,9 @@
+ + + {{videoFilesCount}} @@ -29,9 +32,9 @@
{{item.title}}
- - - + + + diff --git a/ui/src/views/scenes/Scenes.vue b/ui/src/views/scenes/Scenes.vue index f8fdc8512..55e3b0428 100644 --- a/ui/src/views/scenes/Scenes.vue +++ b/ui/src/views/scenes/Scenes.vue @@ -47,6 +47,7 @@ export default { if (to.query !== undefined) { vm.$store.commit('sceneList/stateFromQuery', to.query) } + vm.$store.dispatch('optionsWeb/load') vm.$store.dispatch('sceneList/load', { offset: 0 }) }) },