Skip to content

Commit

Permalink
include get_latest_version, is_running_outdated_version
Browse files Browse the repository at this point in the history
Signed-off-by: Huong Nguyen <[email protected]>
  • Loading branch information
Huong Nguyen committed Jan 17, 2025
1 parent 15ab3e8 commit 3dd6315
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
9 changes: 5 additions & 4 deletions package/kedro_viz/api/rest/responses/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
and utility functions for the `/version` REST endpoint"""

from kedro_viz import __version__
from pydantic import BaseModel, ConfigDict
from kedro_viz.integrations.pypi import get_latest_version, is_running_outdated_version
from pydantic import ConfigDict
from kedro_viz.api.rest.responses.base import BaseAPIResponse

class VersionAPIResponse(BaseAPIResponse):
Expand All @@ -22,15 +23,15 @@ class VersionAPIResponse(BaseAPIResponse):
json_schema_extra={
"installed": __version__,
"isOutdated": False,
"latest": "0.5.0" # how do i check the latest version?
"latest": "0.0.0"
}
)

def get_version_response():
"""API response for `/api/version`."""
installed_version = __version__
latest_version = "0.5.0" # how do i check the latest version?
is_outdated = installed_version != latest_version
latest_version = get_latest_version()
is_outdated = is_running_outdated_version(installed_version, latest_version)

return VersionAPIResponse(
installed=installed_version,
Expand Down
2 changes: 1 addition & 1 deletion package/kedro_viz/api/rest/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def get_single_pipeline_data(registered_pipeline_id: str):
response_model=VersionAPIResponse,
)

asyn def get_version():
async def get_version():
return get_version_response()


Expand Down
7 changes: 0 additions & 7 deletions src/components/wrapper/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ export const Wrapper = ({ displayGlobalNavigation, theme }) => {
checkKedroVizVersion();
}, []);

// useEffect(() => {
// if (versionData) {
// setIsOutdated(versionData.version.isOutdated);
// setLatestVersion(versionData.version.latest);
// }
// }, [versionData]);

return (
<div
className={classnames('kedro-pipeline kedro', {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export async function deployViz(inputValues) {
}

export async function getVersion() {
const request = await fetch(`api/version`, {
const request = await fetch(`${pathRoot}/version`, {
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
Expand Down

0 comments on commit 3dd6315

Please sign in to comment.