Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add global version callout component #6673

Merged
merged 15 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion website/docs/docs/collaborate/govern/model-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This functionality is new in v1.5 — if you have thoughts, participate in [the

</VersionBlock>

import VersionsCallout from '/snippets/_version-callout.md';
import VersionsCallout from '/snippets/_model-version-callout.md';

<VersionsCallout />

Expand Down
3 changes: 3 additions & 0 deletions website/docs/docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ pagination_next: null
pagination_prev: null
---


<VersionCallout version="2.5" />

<Snippet path="what-is-dbt-intro" />

dbt compiles and runs your analytics code against your data platform, enabling you and your team to collaborate on a single source of truth for metrics, insights, and business definitions. This single source of truth, combined with the ability to define tests for your data, reduces errors when logic changes, and alerts you when issues arise.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/reference/project-configs/version.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ required: True
keyword: project version, project versioning, dbt project versioning
---

import VersionsCallout from '/snippets/_version-callout.md';
import VersionsCallout from '/snippets/_model-version-callout.md';

<VersionsCallout />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ default_value: {NULL}
id: "dbt_valid_to_current"
---

Available from dbt v1.9 or with [the dbt Cloud "Latest" release track](/docs/dbt-versions/cloud-release-tracks) dbt Cloud.
import VersionCallout from '/snippets/_version-callout.md';

<VersionCallout version="1.9" />

<File name='snapshots/schema.yml'>

Expand Down
2 changes: 1 addition & 1 deletion website/docs/reference/resource-properties/versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ required: no
keyword: governance, model version, model versioning, dbt model versioning
---

import VersionsCallout from '/snippets/_version-callout.md';
import VersionsCallout from '/snippets/_model-version-callout.md';

<VersionsCallout />

Expand Down
8 changes: 8 additions & 0 deletions website/snippets/_model-version-callout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

:::info Model versions, dbt_project.yml versions, and .yml versions
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed this callout from 'version-callout' to the more appropriate 'model-version-callout'.


Take note that [model versions](/docs/collaborate/govern/model-versions) are different from [dbt_project.yml versions](/reference/project-configs/version#dbt_projectyml-versions) and [.yml property file versions](/reference/project-configs/version#yml-property-file-versions).

Model versions is a _feature_ that enables better governance and data model management by allowing you to track changes and updates to models over time. dbt_project.yml versions refer to the compatibility of the dbt project with a specific version of dbt. Version numbers within .yml property files inform how dbt parses those YAML files. The latter two are completely optional starting from dbt v1.5.
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved

:::
7 changes: 2 additions & 5 deletions website/snippets/_version-callout.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
:::tip

:::info Model versions, dbt_project.yml versions, and .yml versions

Take note that [model versions](/docs/collaborate/govern/model-versions) are different from [dbt_project.yml versions](/reference/project-configs/version#dbt_projectyml-versions) and [.yml property file versions](/reference/project-configs/version#yml-property-file-versions).

Model versions is a _feature_ that enables better governance and data model management by allowing you to track changes and updates to models over time. dbt_project.yml versions refer to the compatibility of the dbt project with a specific version of dbt. Version numbers within .yml property files inform how dbt parses those YAML files. The latter two are completely optional starting from dbt v1.5.
<span>Available from dbt v{props.version} or with [the dbt Cloud "Latest" release track](/docs/dbt-versions/cloud-release-tracks) dbt Cloud.</span>

:::
17 changes: 17 additions & 0 deletions website/src/components/versionCallout/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import Admonition from '@theme/Admonition';

const VersionCallout = ({ version }) => (
<div>
<Admonition type="tip" icon="💡" title="Did you know...">
<span>
Available from dbt v{version} or with the{' '}
<a href="/docs/dbt-versions/cloud-release-tracks">
dbt Cloud "Latest" release track
</a>{' '}.
</span>
</Admonition>
</div>
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work with this! One small opportunity for improvement here would be to add an if check if the version prop has been passed in before applying the code to the page. For example if <VersionCallout /> is added to a page without a version, it will still show the callout without a version.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh damn that's such a good flag! Thank you @JKarlavige !

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks again @JKarlavige ! added a

if (!version) {
    return null;
  }

to the const VersionCallout statement and it worked! nothing is displayed if i forget to add the version. thank you again for that awesome tip!


export default VersionCallout;
2 changes: 2 additions & 0 deletions website/src/theme/MDXComponents/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import Lifecycle from '@site/src/components/lifeCycle';
import DetailsToggle from '@site/src/components/detailsToggle';
import Expandable from '@site/src/components/expandable';
import ConfettiTrigger from '@site/src/components/confetti/';
import VersionCallout from '@site/src/components/versionCallout';

const MDXComponents = {
Head,
Expand Down Expand Up @@ -97,5 +98,6 @@ const MDXComponents = {
Expandable: Expandable,
ConfettiTrigger: ConfettiTrigger,
SortableTable: SortableTable,
VersionCallout: VersionCallout,
};
export default MDXComponents;
Loading