Skip to content

Commit

Permalink
Implemented: page generator should link to parent objects in the sta…
Browse files Browse the repository at this point in the history
…tistics section #158
  • Loading branch information
rizen committed Jan 14, 2025
1 parent 9308027 commit 2367a73
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
1 change: 1 addition & 0 deletions ving/docs/change-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ outline: deep
* NOTE: User's describe() now exposes the link for the avatar in links.avatarImage.href instead of meta.avatarUrl. This is a breaking change.
* Implemented: apis should use plurals #183
* 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.
* Implemented: page generator should link to parent objects in the statistics section #158

### 2025-01-12
* Removed pulumi from the project.
Expand Down
26 changes: 20 additions & 6 deletions ving/generator/nuxtpages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,16 @@ const viewProps = (schema) => {
`;
}
else if (prop.type == 'id') {
out += `
<div><b>${makeLabel(prop.name)}</b>: {{${schema.kind.toLowerCase()}.props?.${prop.name}}} <CopyToClipboard :text="${schema.kind.toLowerCase()}.props?.${prop.name}" size="xs" /></div>
`;
if (prop.relation?.type == 'parent') {
out += `
<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>
`;
}
else {
out += `
<div><b>${makeLabel(prop.name)}</b>: {{${schema.kind.toLowerCase()}.props?.${prop.name}}} <CopyToClipboard :text="${schema.kind.toLowerCase()}.props?.${prop.name}" size="xs" /></div>
`;
}
}
else if (prop.type != 'virtual') {
out += `
Expand Down Expand Up @@ -312,9 +319,16 @@ const statProps = (schema) => {
`;
}
else if (prop.type == 'id') {
out += `
<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>
`;
if (prop.relation?.type == 'parent') {
out += `
<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>
`;
}
else {
out += `
<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>
`;
}
}
else if (prop.type != 'virtual') {
out += `
Expand Down

0 comments on commit 2367a73

Please sign in to comment.