feat(admin): show configured link titles #44

Merged
eleith merged 3 commits from feat/admin-link-titles into main 2026-11-21 02:17:55 +00:00
12 changed files with 42 additions and 21 deletions

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
---
'@goto/web': patch
'@goto/cli': patch
'@goto/worker': patch
---
Show the configured title, when present, in the named link’s Redirect card.
+7
View File
@@ -0,0 +1,7 @@
---
'@goto/web': patch
'@goto/cli': patch
'@goto/worker': patch
---
Show the Details card above the links on the Domain page.
+7
View File
@@ -0,0 +1,7 @@
---
'@goto/web': patch
'@goto/cli': patch
'@goto/worker': patch
---
Remove the hourly worker totals note from the Root details card.
+4
View File
@@ -5,6 +5,7 @@ test.use({ withWorker: true });
const sharedTag = 'Work/100%é';
const tagPath = '/admin/tags/Work%2F100%25%C3%A9';
const docsTitle = 'New hire handbook';
test('shared credentials protect admin pages and sign-out removes access', async ({
page,
@@ -245,10 +246,12 @@ test('shared credentials protect admin pages and sign-out removes access', async
await expect(redirectCard.locator('dt')).toHaveText([
'Domain',
'Path',
'Title',
'Destination',
'Rules',
'Visits'
]);
await expect(redirectCard.getByText(docsTitle, { exact: true })).toBeVisible();
await expect(settingsCard.locator('dt')).toHaveText([
'HTTP status',
'Case insensitive',
@@ -371,6 +374,7 @@ test('shared credentials protect admin pages and sign-out removes access', async
await page.getByRole('link', { name: '/a%2Fb', exact: true }).click();
await expect(page.getByRole('heading', { name: 'Link', exact: true })).toBeVisible();
await expect(page).toHaveTitle('Link — go.example.org/a%2Fb — Goto');
await expect(redirectCard.getByText('Title', { exact: true })).toHaveCount(0);
await expect(page).toHaveURL(
`${appServer.origin}/admin/domains/go.example.org/links/a%252Fb?period=all`
);
+1
View File
@@ -36,6 +36,7 @@ const configuration = {
'/a/b': { url: 'https://example.org/decoded' },
'/a%2Fb': { url: 'https://example.org/literal-percent' },
'/docs': {
title: 'New hire handbook',
url: 'https://example.org/first-domain',
redirect: [
{ if: { language: 'fr', os: 'linux' }, to: 'https://example.org/french-linux' },
@@ -43,15 +43,6 @@
/>
{/if}
{/snippet}
<section>
<h2>Links</h2>
<LinkInventory
label={`Links on ${data.domain}`}
links={data.links}
{timeframe}
collectionEnabled={data.collectionEnabled}
/>
</section>
<section class="admin-info" aria-labelledby="domain-details-heading">
<h2 id="domain-details-heading">Details</h2>
<dl>
@@ -71,6 +62,15 @@
</dd>
</dl>
</section>
<section>
<h2>Links</h2>
<LinkInventory
label={`Links on ${data.domain}`}
links={data.links}
{timeframe}
collectionEnabled={data.collectionEnabled}
/>
</section>
<AnalyticsSection>
<ReportNotice collectionEnabled={data.collectionEnabled} available={data.available} />
<div class="admin-cards">
@@ -68,7 +68,6 @@
<dd>{data.response.forward_query ? 'Yes' : 'No'}</dd>
{/if}
</dl>
<p>Worker totals update hourly; pending visits are not yet included.</p>
</section>
<section id="fallback" class="admin-info" aria-labelledby="fallback-heading">
<h2 id="fallback-heading">Fallback</h2>
@@ -56,6 +56,7 @@ export const load = (async ({ locals, params }) => {
return {
domain,
path,
linkTitle: link.title,
lifetimeVisits,
response,
redirectRules,
@@ -54,6 +54,10 @@
</dd>
<dt>Path</dt>
<dd>{data.path}</dd>
{#if data.linkTitle}
<dt>Title</dt>
<dd>{data.linkTitle}</dd>
{/if}
<dt>Destination</dt>
<dd class:numbered-setting={data.redirectRules.length > 0}>
{#if data.redirectRules.length > 0}
-1
View File
@@ -260,7 +260,6 @@ describe('effective domains', () => {
links: {
'/docs': {
url: 'https://example.com/docs',
title: '/docs',
tags: [],
enabled: true,
status_code: 302,
+1 -3
View File
@@ -19,7 +19,7 @@ export function buildRedirectDomainLookup(
const host = normalizeHost(key)!;
const links: Record<string, PreparedLink> = Object.create(null);
for (const [path, link] of Object.entries(domain.links)) {
links[path] = buildRedirectLink(path, link, domain, configuration, authoredLinkDefaults);
links[path] = buildRedirectLink(link, domain, configuration, authoredLinkDefaults);
}
const caseInsensitivePaths = buildCaseInsensitivePathLookup(links);
let fallbackSource: SettingSource = 'builtin';
@@ -39,7 +39,6 @@ export function buildRedirectDomainLookup(
}
function buildRedirectLink(
path: string,
link: LinkConfiguration,
domain: DomainConfiguration,
configuration: GotoConfiguration,
@@ -47,7 +46,6 @@ function buildRedirectLink(
): PreparedLink {
const prepared: PreparedLink = {
...link,
title: link.title ?? path,
status_code:
link.status_code ??
domain.link_defaults.status_code ??
+1 -7
View File
@@ -17,14 +17,8 @@ export type SettingSource = 'builtin' | 'global' | 'domain' | 'link';
export type PreparedLink = Omit<
LinkConfiguration,
| 'title'
| 'status_code'
| 'forward_query'
| 'case_insensitive'
| 'ignore_trailing_slash'
| 'forward_path'
'status_code' | 'forward_query' | 'case_insensitive' | 'ignore_trailing_slash' | 'forward_path'
> & {
title: string;
status_code: RedirectStatus;
forward_query: boolean;
case_insensitive: boolean;