remove feed url from publisher dashboard
This commit is contained in:
parent
e4a5246ab3
commit
2147d9c999
3 changed files with 27 additions and 11 deletions
|
|
@ -93,7 +93,9 @@ def operational_snapshot(*, snapshot: Mapping[str, str] | None = None) -> Render
|
|||
]
|
||||
|
||||
|
||||
def _source_feed_row(source_feed: Mapping[str, object]) -> tuple[Node, ...]:
|
||||
def _source_feed_row(
|
||||
source_feed: Mapping[str, object], *, show_feed_url: bool
|
||||
) -> tuple[Node, ...]:
|
||||
last_updated_iso = source_feed.get("last_updated_iso")
|
||||
last_updated = (
|
||||
h.time(
|
||||
|
|
@ -117,6 +119,19 @@ def _source_feed_row(source_feed: Mapping[str, object]) -> tuple[Node, ...]:
|
|||
if next_run_iso is not None
|
||||
else h.p(class_="font-medium text-slate-900")[str(source_feed["next_run"])]
|
||||
)
|
||||
feed_url_cells = (
|
||||
(
|
||||
h.div(class_="min-w-64")[
|
||||
inline_link(
|
||||
href=str(source_feed["feed_href"]),
|
||||
label=str(source_feed["feed_href"]),
|
||||
tone="amber",
|
||||
)
|
||||
],
|
||||
)
|
||||
if show_feed_url
|
||||
else ()
|
||||
)
|
||||
return (
|
||||
h.div[
|
||||
h.div(class_="font-semibold text-slate-950")[str(source_feed["source"])],
|
||||
|
|
@ -124,13 +139,7 @@ def _source_feed_row(source_feed: Mapping[str, object]) -> tuple[Node, ...]:
|
|||
str(source_feed["slug"])
|
||||
],
|
||||
],
|
||||
h.div(class_="min-w-64")[
|
||||
inline_link(
|
||||
href=str(source_feed["feed_href"]),
|
||||
label=str(source_feed["feed_href"]),
|
||||
tone="amber",
|
||||
)
|
||||
],
|
||||
*feed_url_cells,
|
||||
status_badge(
|
||||
label=str(source_feed["feed_status_label"]),
|
||||
tone=str(source_feed["feed_status_tone"]),
|
||||
|
|
@ -150,15 +159,20 @@ def published_feeds_table(
|
|||
source_feeds: tuple[Mapping[str, object], ...] | None = None,
|
||||
manage_sources_href: str | None = "/admin/sources",
|
||||
show_heading: bool = True,
|
||||
show_feed_url: bool = True,
|
||||
) -> Renderable:
|
||||
rows = tuple(_source_feed_row(source_feed) for source_feed in (source_feeds or ()))
|
||||
rows = tuple(
|
||||
_source_feed_row(source_feed, show_feed_url=show_feed_url)
|
||||
for source_feed in (source_feeds or ())
|
||||
)
|
||||
feed_url_headers = ("Feed URL",) if show_feed_url else ()
|
||||
return table_section(
|
||||
eyebrow="Published feeds" if show_heading else None,
|
||||
title="Published feeds" if show_heading else None,
|
||||
empty_message="No feeds have been published yet.",
|
||||
headers=(
|
||||
"Source",
|
||||
"Feed URL",
|
||||
*feed_url_headers,
|
||||
"Status",
|
||||
"Last updated",
|
||||
"Next run",
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ def publisher_page(
|
|||
source_feeds=source_feeds,
|
||||
manage_sources_href=None,
|
||||
show_heading=False,
|
||||
show_feed_url=False,
|
||||
),
|
||||
live_work_section(
|
||||
running_executions=running_executions,
|
||||
|
|
|
|||
|
|
@ -1149,7 +1149,8 @@ def test_render_publisher_shows_published_feeds_with_publisher_actions(
|
|||
|
||||
assert body.count("Published feeds") == 1
|
||||
assert "Publisher source" in body
|
||||
assert 'href="/feeds/publisher-source/feed.rss"' in body
|
||||
assert "Feed URL" not in body
|
||||
assert 'href="/feeds/publisher-source/feed.rss"' not in body
|
||||
assert "Available" in body
|
||||
assert "Next run" in body
|
||||
assert "Disk usage" not in body
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue