Skip to content

Commit 2367a73

Browse files
committed
Implemented: page generator should link to parent objects in the statistics section #158
1 parent 9308027 commit 2367a73

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

ving/docs/change-log.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ outline: deep
1212
* NOTE: User's describe() now exposes the link for the avatar in links.avatarImage.href instead of meta.avatarUrl. This is a breaking change.
1313
* Implemented: apis should use plurals #183
1414
* NOTE: rest endpoints and pages use plurals like /users instead of /user now. This is a breaking change. Update your APIs and pages to use plurals.
15+
* Implemented: page generator should link to parent objects in the statistics section #158
1516

1617
### 2025-01-12
1718
* Removed pulumi from the project.

ving/generator/nuxtpages.mjs

+20-6
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,16 @@ const viewProps = (schema) => {
209209
`;
210210
}
211211
else if (prop.type == 'id') {
212-
out += `
213-
<div><b>${makeLabel(prop.name)}</b>: {{${schema.kind.toLowerCase()}.props?.${prop.name}}} <CopyToClipboard :text="${schema.kind.toLowerCase()}.props?.${prop.name}" size="xs" /></div>
214-
`;
212+
if (prop.relation?.type == 'parent') {
213+
out += `
214+
<div><b>${makeLabel(prop.name)}</b>: <NuxtLink :to="${schema.kind.toLowerCase()}.links?.view?.href">{{${schema.kind.toLowerCase()}.props?.${prop.name}}}</NuxtLink> <CopyToClipboard :text="${schema.kind.toLowerCase()}.props?.${prop.name}" size="xs" /></div>
215+
`;
216+
}
217+
else {
218+
out += `
219+
<div><b>${makeLabel(prop.name)}</b>: {{${schema.kind.toLowerCase()}.props?.${prop.name}}} <CopyToClipboard :text="${schema.kind.toLowerCase()}.props?.${prop.name}" size="xs" /></div>
220+
`;
221+
}
215222
}
216223
else if (prop.type != 'virtual') {
217224
out += `
@@ -312,9 +319,16 @@ const statProps = (schema) => {
312319
`;
313320
}
314321
else if (prop.type == 'id') {
315-
out += `
316-
<div class="mb-4"><b>${makeLabel(prop.name)}</b>: {{${schema.kind.toLowerCase()}.props?.${prop.name}}} <CopyToClipboard :text="${schema.kind.toLowerCase()}.props?.${prop.name}" size="xs" /></div>
317-
`;
322+
if (prop.relation?.type == 'parent') {
323+
out += `
324+
<div class="mb-4"><b>${makeLabel(prop.name)}</b>: <NuxtLink :to="${schema.kind.toLowerCase()}.links?.view?.href">{{${schema.kind.toLowerCase()}.props?.${prop.name}}}</NuxtLink> <CopyToClipboard :text="${schema.kind.toLowerCase()}.props?.${prop.name}" size="xs" /></div>
325+
`;
326+
}
327+
else {
328+
out += `
329+
<div class="mb-4"><b>${makeLabel(prop.name)}</b>: {{${schema.kind.toLowerCase()}.props?.${prop.name}}} <CopyToClipboard :text="${schema.kind.toLowerCase()}.props?.${prop.name}" size="xs" /></div>
330+
`;
331+
}
318332
}
319333
else if (prop.type != 'virtual') {
320334
out += `

0 commit comments

Comments
 (0)