Add per-entity import actions in empty states and make buttons non-submitting

This commit is contained in:
Stu Leak 2025-12-04 12:45:56 -05:00
parent 0c01fec88c
commit 4f14d3b032
5 changed files with 32 additions and 27 deletions

View File

@ -14,10 +14,10 @@ import (
"strings"
"time"
"git.leaktechnologies.dev/stu/Goondex/internal/config"
"git.leaktechnologies.dev/stu/Goondex/internal/db"
import_service "git.leaktechnologies.dev/stu/Goondex/internal/import"
"git.leaktechnologies.dev/stu/Goondex/internal/model"
"git.leaktechnologies.dev/stu/Goondex/internal/config"
"git.leaktechnologies.dev/stu/Goondex/internal/scraper/adultemp"
"git.leaktechnologies.dev/stu/Goondex/internal/scraper/tpdb"
"git.leaktechnologies.dev/stu/Goondex/internal/sync"
@ -1391,14 +1391,14 @@ func (s *Server) handleAPISettingsKeys(w http.ResponseWriter, r *http.Request) {
case http.MethodGet:
keys := config.GetAPIKeys()
resp := map[string]interface{}{
"tpdbConfigured": keys.TPDBAPIKey != "",
"aeConfigured": keys.AEAPIKey != "",
"stashdbConfigured": keys.StashDBAPIKey != "",
"stashdbEndpoint": keys.StashDBEndpoint,
"tpdb_api_key": keys.TPDBAPIKey, // local-only UI; if you prefer, mask these
"ae_api_key": keys.AEAPIKey,
"stashdb_api_key": keys.StashDBAPIKey,
"stashdb_endpoint": keys.StashDBEndpoint, // duplicate for UI convenience
"tpdbConfigured": keys.TPDBAPIKey != "",
"aeConfigured": keys.AEAPIKey != "",
"stashdbConfigured": keys.StashDBAPIKey != "",
"stashdbEndpoint": keys.StashDBEndpoint,
"tpdb_api_key": keys.TPDBAPIKey, // local-only UI; if you prefer, mask these
"ae_api_key": keys.AEAPIKey,
"stashdb_api_key": keys.StashDBAPIKey,
"stashdb_endpoint": keys.StashDBEndpoint, // duplicate for UI convenience
}
json.NewEncoder(w).Encode(APIResponse{
Success: true,

View File

@ -96,12 +96,12 @@
<p class="hero-subtitle">Full-library sync with seamless enrichment</p>
<div class="hero-actions">
<button class="btn" onclick="bulkImportAll()">
<button type="button" class="btn" onclick="bulkImportAll()">
Full Import
<div class="hoverEffect"><div></div></div>
</button>
<button class="btn-secondary" onclick="syncAll()">
<button type="button" class="btn-secondary" onclick="syncAll()">
Sync Library
<div class="hoverEffect"><div></div></div>
</button>
@ -182,23 +182,23 @@
</p>
<div class="import-buttons">
<button class="btn" onclick="bulkImportAll()">
<button type="button" class="btn" onclick="bulkImportAll()">
Import Everything
<div class="hoverEffect"><div></div></div>
</button>
<button class="btn-secondary" onclick="bulkImportPerformers()">
<button type="button" class="btn-secondary" onclick="bulkImportPerformers()">
Import Performers
<div class="hoverEffect"><div></div></div>
</button>
<button class="btn-secondary" onclick="bulkImportStudios()">
<button type="button" class="btn-secondary" onclick="bulkImportStudios()">
Import Studios
<div class="hoverEffect"><div></div></div>
</button>
<button class="btn-secondary" onclick="bulkImportScenes()">
<button type="button" class="btn-secondary" onclick="bulkImportScenes()">
Import Scenes
<div class="hoverEffect"><div></div></div>
</button>
<button class="btn-secondary" onclick="syncAll()">
<button type="button" class="btn-secondary" onclick="syncAll()">
Sync All
<div class="hoverEffect"><div></div></div>
</button>

View File

@ -68,7 +68,8 @@
<div class="empty-import-actions">
<p class="hint">Import performers from Adult Empire without the CLI.</p>
<div class="action-buttons">
<button type="button" class="btn" onclick="aeImportPerformerByName()">Import performer by name</button>
<button type="button" class="btn" onclick="bulkImportPerformers()">Import all performers</button>
<button type="button" class="btn btn-secondary" onclick="aeImportPerformerByName()">Import performer by name</button>
<button type="button" class="btn btn-secondary" onclick="aeImportPerformerByURL()">Import performer by URL</button>
</div>
<div id="ae-status" class="status-banner"></div>

View File

@ -51,11 +51,13 @@
{{else}}
<div class="empty-state">
<p>No scenes found.</p>
{{if .Query}}
<p>Try a different search term or <a href="/scenes">view all scenes</a>.</p>
{{else}}
<p>Import scenes using the dashboard or CLI: <code>./goondex import scene "title"</code></p>
{{end}}
<div class="empty-import-actions">
<p class="hint">Import scenes now.</p>
<div class="action-buttons">
<button type="button" class="btn" onclick="bulkImportScenes()">Import all scenes</button>
</div>
<div id="scene-import-status" class="status-banner"></div>
</div>
</div>
{{end}}
</main>

View File

@ -43,11 +43,13 @@
{{else}}
<div class="empty-state">
<p>No studios found.</p>
{{if .Query}}
<p>Try a different search term or <a href="/studios">view all studios</a>.</p>
{{else}}
<p>Import studios using the dashboard or CLI: <code>./goondex import studio "name"</code></p>
{{end}}
<div class="empty-import-actions">
<p class="hint">Import studios now.</p>
<div class="action-buttons">
<button type="button" class="btn" onclick="bulkImportStudios()">Import all studios</button>
</div>
<div id="studio-import-status" class="status-banner"></div>
</div>
</div>
{{end}}
</main>