Fix monitoring and removal: restore artist list OOB, improve feed reload script
This commit is contained in:
@@ -91,13 +91,15 @@ public class ArtistController {
|
|||||||
results = artistService.search(query);
|
results = artistService.search(query);
|
||||||
}
|
}
|
||||||
var searchHtml = searchResultsTemplate.data("artists", results).render();
|
var searchHtml = searchResultsTemplate.data("artists", results).render();
|
||||||
return Response.ok(searchHtml + feedReloadScript()).build();
|
var allArtists = artistService.findAll();
|
||||||
|
var listHtml = artistListTemplate.data("artists", allArtists).render();
|
||||||
|
return Response.ok(searchHtml + listHtml + feedReloadScript()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PATCH
|
@PATCH
|
||||||
@Path("/{mbid}/monitor")
|
@Path("/{mbid}/monitor")
|
||||||
@Produces(MediaType.TEXT_HTML)
|
@Produces(MediaType.TEXT_HTML)
|
||||||
public TemplateInstance updateMonitoring(
|
public Response updateMonitoring(
|
||||||
@PathParam("mbid") String mbid,
|
@PathParam("mbid") String mbid,
|
||||||
@QueryParam("type") String type) {
|
@QueryParam("type") String type) {
|
||||||
var existing = artistService.findByMbid(mbid)
|
var existing = artistService.findByMbid(mbid)
|
||||||
@@ -110,11 +112,9 @@ public class ArtistController {
|
|||||||
type.equals("other") ? !existing.otherMonitored() : existing.otherMonitored()
|
type.equals("other") ? !existing.otherMonitored() : existing.otherMonitored()
|
||||||
);
|
);
|
||||||
artistService.updateMonitoring(mbid, flags);
|
artistService.updateMonitoring(mbid, flags);
|
||||||
var result = feedService.getFeedEntries(1);
|
var allArtists = artistService.findAll();
|
||||||
return feedEntriesTemplate
|
var listHtml = artistListTemplate.data("artists", allArtists).render();
|
||||||
.data("entries", result.entries())
|
return Response.ok(listHtml + feedReloadScript()).build();
|
||||||
.data("hasMore", result.hasMore())
|
|
||||||
.data("nextPage", 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -147,6 +147,6 @@ public class ArtistController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String feedReloadScript() {
|
private String feedReloadScript() {
|
||||||
return "<script>htmx.ajax('GET','/api/artists/feed-table',{target:'#feed-entries',swap:'innerHTML'})<\\/script>";
|
return "<script>setTimeout(function(){var e=document.getElementById('feed-entries');if(e)htmx.ajax('GET','/api/artists/feed-table',{target:'#feed-entries',swap:'innerHTML'})},200)</" + "script>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
<input type="checkbox" class="checkbox checkbox-xs checkbox-primary"
|
<input type="checkbox" class="checkbox checkbox-xs checkbox-primary"
|
||||||
{#if artist.albumMonitored}checked{/if}
|
{#if artist.albumMonitored}checked{/if}
|
||||||
hx-patch="/api/artists/{artist.mbid}/monitor?type=album"
|
hx-patch="/api/artists/{artist.mbid}/monitor?type=album"
|
||||||
hx-target="#feed-entries"
|
hx-target="#artist-list"
|
||||||
hx-swap="innerHTML">
|
hx-swap="innerHTML">
|
||||||
<span class="label-text text-xs" style="color:var(--p)">Album</span>
|
<span class="label-text text-xs" style="color:var(--p)">Album</span>
|
||||||
</label>
|
</label>
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
<input type="checkbox" class="checkbox checkbox-xs checkbox-secondary"
|
<input type="checkbox" class="checkbox checkbox-xs checkbox-secondary"
|
||||||
{#if artist.singleMonitored}checked{/if}
|
{#if artist.singleMonitored}checked{/if}
|
||||||
hx-patch="/api/artists/{artist.mbid}/monitor?type=single"
|
hx-patch="/api/artists/{artist.mbid}/monitor?type=single"
|
||||||
hx-target="#feed-entries"
|
hx-target="#artist-list"
|
||||||
hx-swap="innerHTML">
|
hx-swap="innerHTML">
|
||||||
<span class="label-text text-xs" style="color:var(--s)">Single</span>
|
<span class="label-text text-xs" style="color:var(--s)">Single</span>
|
||||||
</label>
|
</label>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
<input type="checkbox" class="checkbox checkbox-xs checkbox-accent"
|
<input type="checkbox" class="checkbox checkbox-xs checkbox-accent"
|
||||||
{#if artist.epMonitored}checked{/if}
|
{#if artist.epMonitored}checked{/if}
|
||||||
hx-patch="/api/artists/{artist.mbid}/monitor?type=ep"
|
hx-patch="/api/artists/{artist.mbid}/monitor?type=ep"
|
||||||
hx-target="#feed-entries"
|
hx-target="#artist-list"
|
||||||
hx-swap="innerHTML">
|
hx-swap="innerHTML">
|
||||||
<span class="label-text text-xs" style="color:var(--a)">EP</span>
|
<span class="label-text text-xs" style="color:var(--a)">EP</span>
|
||||||
</label>
|
</label>
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
<input type="checkbox" class="checkbox checkbox-xs"
|
<input type="checkbox" class="checkbox checkbox-xs"
|
||||||
{#if artist.broadcastMonitored}checked{/if}
|
{#if artist.broadcastMonitored}checked{/if}
|
||||||
hx-patch="/api/artists/{artist.mbid}/monitor?type=broadcast"
|
hx-patch="/api/artists/{artist.mbid}/monitor?type=broadcast"
|
||||||
hx-target="#feed-entries"
|
hx-target="#artist-list"
|
||||||
hx-swap="innerHTML">
|
hx-swap="innerHTML">
|
||||||
<span class="label-text text-xs text-base-content/60">Broadcast</span>
|
<span class="label-text text-xs text-base-content/60">Broadcast</span>
|
||||||
</label>
|
</label>
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
<input type="checkbox" class="checkbox checkbox-xs"
|
<input type="checkbox" class="checkbox checkbox-xs"
|
||||||
{#if artist.otherMonitored}checked{/if}
|
{#if artist.otherMonitored}checked{/if}
|
||||||
hx-patch="/api/artists/{artist.mbid}/monitor?type=other"
|
hx-patch="/api/artists/{artist.mbid}/monitor?type=other"
|
||||||
hx-target="#feed-entries"
|
hx-target="#artist-list"
|
||||||
hx-swap="innerHTML">
|
hx-swap="innerHTML">
|
||||||
<span class="label-text text-xs text-base-content/60">Other</span>
|
<span class="label-text text-xs text-base-content/60">Other</span>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
Reference in New Issue
Block a user