From 8b2c1c81060b1681a392899beedbd4d606b6140c Mon Sep 17 00:00:00 2001 From: Alderamin <126297468+Alderamin49ly@users.noreply.github.com> Date: Tue, 28 Nov 2023 08:28:16 -0500 Subject: [PATCH] feat: add option to show all heatmaps in scene list (#1517) Co-authored-by: Alderamin --- pkg/api/options.go | 2 ++ pkg/config/config.go | 1 + pkg/config/state.go | 1 + ui/src/store/optionsWeb.js | 3 ++ .../views/options/sections/InterfaceWeb.vue | 13 +++++++++ ui/src/views/scenes/SceneCard.vue | 28 +++++++++++-------- 6 files changed, 36 insertions(+), 12 deletions(-) diff --git a/pkg/api/options.go b/pkg/api/options.go index 62e7607ba..6262806b5 100644 --- a/pkg/api/options.go +++ b/pkg/api/options.go @@ -56,6 +56,7 @@ type RequestSaveOptionsWeb struct { ShowSubtitlesFile bool `json:"showSubtitlesFile"` SceneTrailerlist bool `json:"sceneTrailerlist"` ShowScriptHeatmap bool `json:"showScriptHeatmap"` + ShowAllHeatmaps bool `json:"showAllHeatmaps"` UpdateCheck bool `json:"updateCheck"` IsAvailOpacity int `json:"isAvailOpacity"` } @@ -381,6 +382,7 @@ func (i ConfigResource) saveOptionsWeb(req *restful.Request, resp *restful.Respo config.Config.Web.ShowSubtitlesFile = r.ShowSubtitlesFile config.Config.Web.SceneTrailerlist = r.SceneTrailerlist config.Config.Web.ShowScriptHeatmap = r.ShowScriptHeatmap + config.Config.Web.ShowAllHeatmaps = r.ShowAllHeatmaps config.Config.Web.UpdateCheck = r.UpdateCheck config.Config.Web.IsAvailOpacity = r.IsAvailOpacity config.SaveConfig() diff --git a/pkg/config/config.go b/pkg/config/config.go index 612f10cf9..1f0e7ddb6 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -42,6 +42,7 @@ type ObjectConfig struct { ShowSubtitlesFile bool `default:"true" json:"showSubtitlesFile"` SceneTrailerlist bool `default:"true" json:"sceneTrailerlist"` ShowScriptHeatmap bool `default:"true" json:"showScriptHeatmap"` + ShowAllHeatmaps bool `default:"false" json:"showAllHeatmaps"` UpdateCheck bool `default:"true" json:"updateCheck"` IsAvailOpacity int `default:"40" json:"isAvailOpacity"` } `json:"web"` diff --git a/pkg/config/state.go b/pkg/config/state.go index b465e65f7..4e68eba0a 100644 --- a/pkg/config/state.go +++ b/pkg/config/state.go @@ -25,6 +25,7 @@ type ObjectState struct { ShowSubtitlesFile bool `json:"showSubtitlesFile"` SceneTrailerlist bool `json:"sceneTrailerlist"` ShowScriptHeatmap bool `json:"showScriptHeatmap"` + ShowAllHeatmaps bool `json:"showAllHeatmaps"` UpdateCheck bool `json:"updateCheck"` IsAvailOpacity int `json:"isAvailOpacity"` } `json:"web"` diff --git a/ui/src/store/optionsWeb.js b/ui/src/store/optionsWeb.js index a1cfb1b5c..999cf4063 100644 --- a/ui/src/store/optionsWeb.js +++ b/ui/src/store/optionsWeb.js @@ -18,6 +18,7 @@ const state = { updateCheck: true, isAvailOpacity: 40, showScriptHeatmap: false, + showAllHeatmaps: false, updateCheck: true } } @@ -43,6 +44,7 @@ const actions = { state.web.showSubtitlesFile = data.config.web.showSubtitlesFile state.web.sceneTrailerlist = data.config.web.sceneTrailerlist state.web.showScriptHeatmap = data.config.web.showScriptHeatmap + state.web.showAllHeatmaps = data.config.web.showAllHeatmaps state.web.updateCheck = data.config.web.updateCheck state.web.isAvailOpacity = data.config.web.isAvailOpacity state.loading = false @@ -66,6 +68,7 @@ const actions = { state.web.showSubtitlesFile = data.showSubtitlesFile state.web.sceneTrailerlist = data.sceneTrailerlist state.web.showScriptHeatmap = data.showScriptHeatmap + state.web.showAllHeatmaps = data.showAllHeatmaps state.web.updateCheck = data.updateCheck state.web.isAvailOpacity = data.isAvailOpacity state.loading = false diff --git a/ui/src/views/options/sections/InterfaceWeb.vue b/ui/src/views/options/sections/InterfaceWeb.vue index 83f86eeff..a4dd8d656 100644 --- a/ui/src/views/options/sections/InterfaceWeb.vue +++ b/ui/src/views/options/sections/InterfaceWeb.vue @@ -80,6 +80,11 @@ show Script Heatmap + + + show All Heatmaps + +
@@ -188,6 +193,14 @@ export default { this.$store.state.optionsWeb.web.showScriptHeatmap = value } }, + AllHeatmaps: { + get () { + return this.$store.state.optionsWeb.web.showAllHeatmaps + }, + set (value) { + this.$store.state.optionsWeb.web.showAllHeatmaps = value + } + }, updateCheck: { get () { return this.$store.state.optionsWeb.web.updateCheck diff --git a/ui/src/views/scenes/SceneCard.vue b/ui/src/views/scenes/SceneCard.vue index bee487a18..2a596fe49 100644 --- a/ui/src/views/scenes/SceneCard.vue +++ b/ui/src/views/scenes/SceneCard.vue @@ -41,9 +41,9 @@ {{item.duration}}m
-
-
- +
+
+
@@ -168,17 +168,21 @@ export default { getHeatmapURL (fileId) { return `/api/dms/heatmap/${fileId}` }, - getFunscript() { - if (this.item.file !== null) { - let script; - if (script = this.item.file.find((a) => a.type === 'script' && a.has_heatmap && a.is_selected_script)) { - return script - } - if (script = this.item.file.find((a) => a.type === 'script' && a.has_heatmap)) { - return script + getFunscripts (showAll) { + if (showAll) { + return this.item.file !== null && this.item.file.filter(a => a.type === 'script' && a.has_heatmap); + } else { + if (this.item.file !== null) { + let script; + if (script = this.item.file.find((a) => a.type === 'script' && a.has_heatmap && a.is_selected_script)) { + return [script] + } + if (script = this.item.file.find((a) => a.type === 'script' && a.has_heatmap)) { + return [script] + } } + return false; } - return false; } } }