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_iso = source_feed.get("last_updated_iso")
|
||||||
last_updated = (
|
last_updated = (
|
||||||
h.time(
|
h.time(
|
||||||
|
|
@ -117,13 +119,8 @@ def _source_feed_row(source_feed: Mapping[str, object]) -> tuple[Node, ...]:
|
||||||
if next_run_iso is not None
|
if next_run_iso is not None
|
||||||
else h.p(class_="font-medium text-slate-900")[str(source_feed["next_run"])]
|
else h.p(class_="font-medium text-slate-900")[str(source_feed["next_run"])]
|
||||||
)
|
)
|
||||||
return (
|
feed_url_cells = (
|
||||||
h.div[
|
(
|
||||||
h.div(class_="font-semibold text-slate-950")[str(source_feed["source"])],
|
|
||||||
h.p(class_="mt-0.5 font-mono text-[11px] text-slate-500")[
|
|
||||||
str(source_feed["slug"])
|
|
||||||
],
|
|
||||||
],
|
|
||||||
h.div(class_="min-w-64")[
|
h.div(class_="min-w-64")[
|
||||||
inline_link(
|
inline_link(
|
||||||
href=str(source_feed["feed_href"]),
|
href=str(source_feed["feed_href"]),
|
||||||
|
|
@ -131,6 +128,18 @@ def _source_feed_row(source_feed: Mapping[str, object]) -> tuple[Node, ...]:
|
||||||
tone="amber",
|
tone="amber",
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
)
|
||||||
|
if show_feed_url
|
||||||
|
else ()
|
||||||
|
)
|
||||||
|
return (
|
||||||
|
h.div[
|
||||||
|
h.div(class_="font-semibold text-slate-950")[str(source_feed["source"])],
|
||||||
|
h.p(class_="mt-0.5 font-mono text-[11px] text-slate-500")[
|
||||||
|
str(source_feed["slug"])
|
||||||
|
],
|
||||||
|
],
|
||||||
|
*feed_url_cells,
|
||||||
status_badge(
|
status_badge(
|
||||||
label=str(source_feed["feed_status_label"]),
|
label=str(source_feed["feed_status_label"]),
|
||||||
tone=str(source_feed["feed_status_tone"]),
|
tone=str(source_feed["feed_status_tone"]),
|
||||||
|
|
@ -150,15 +159,20 @@ def published_feeds_table(
|
||||||
source_feeds: tuple[Mapping[str, object], ...] | None = None,
|
source_feeds: tuple[Mapping[str, object], ...] | None = None,
|
||||||
manage_sources_href: str | None = "/admin/sources",
|
manage_sources_href: str | None = "/admin/sources",
|
||||||
show_heading: bool = True,
|
show_heading: bool = True,
|
||||||
|
show_feed_url: bool = True,
|
||||||
) -> Renderable:
|
) -> 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(
|
return table_section(
|
||||||
eyebrow="Published feeds" if show_heading else None,
|
eyebrow="Published feeds" if show_heading else None,
|
||||||
title="Published feeds" if show_heading else None,
|
title="Published feeds" if show_heading else None,
|
||||||
empty_message="No feeds have been published yet.",
|
empty_message="No feeds have been published yet.",
|
||||||
headers=(
|
headers=(
|
||||||
"Source",
|
"Source",
|
||||||
"Feed URL",
|
*feed_url_headers,
|
||||||
"Status",
|
"Status",
|
||||||
"Last updated",
|
"Last updated",
|
||||||
"Next run",
|
"Next run",
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ def publisher_page(
|
||||||
source_feeds=source_feeds,
|
source_feeds=source_feeds,
|
||||||
manage_sources_href=None,
|
manage_sources_href=None,
|
||||||
show_heading=False,
|
show_heading=False,
|
||||||
|
show_feed_url=False,
|
||||||
),
|
),
|
||||||
live_work_section(
|
live_work_section(
|
||||||
running_executions=running_executions,
|
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 body.count("Published feeds") == 1
|
||||||
assert "Publisher source" in body
|
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 "Available" in body
|
||||||
assert "Next run" in body
|
assert "Next run" in body
|
||||||
assert "Disk usage" not in body
|
assert "Disk usage" not in body
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue