Skip to content

Commit

Permalink
Add demo instance info to the server info api
Browse files Browse the repository at this point in the history
Signed-off-by: Wei-Chun, Chang <wcchang@infuseai.io>
  • Loading branch information
wcchang1115 committed Apr 11, 2024
1 parent 2791d62 commit 0c8e53f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
8 changes: 2 additions & 6 deletions js/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,8 @@ function NavBar() {
);
})}
<Spacer />
{!isDemoSite && (
<>
<StateImporter />
<StateExporter />
</>
)}
{!isDemoSite && <StateImporter />}
<StateExporter />
<Box p="8px" mr="10px" color="gray.500">
{version}
</Box>
Expand Down
1 change: 1 addition & 0 deletions js/src/lib/api/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export interface ServerInfoResult {
base: LineageData;
current: LineageData;
};
demo: boolean;
}

export async function getServerInfo(): Promise<ServerInfoResult> {
Expand Down
4 changes: 1 addition & 3 deletions js/src/lib/hooks/LineageGraphContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ export function LineageGraphContextProvider({ children }: LineageGraphProps) {

const errorMessage = error?.message;
const lineage = data?.lineage;
const isDemoSite =
!!lineage?.current?.metadata.pr_url &&
lineage.current.metadata.pr_url.includes("cloud.datarecce.io");
const isDemoSite = data?.demo;

return (
<>
Expand Down
3 changes: 3 additions & 0 deletions recce/server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import json
import logging
import os
import uuid
from contextlib import asynccontextmanager
from dataclasses import dataclass
Expand Down Expand Up @@ -109,12 +110,14 @@ async def health_check(request: Request):
@app.get("/api/info")
async def get_info():
dbt_context = default_dbt_context()
demo = os.environ.get('DEMO', False)
try:
return {
'lineage': {
'base': dbt_context.get_lineage(base=True),
'current': dbt_context.get_lineage(base=False),
},
'demo': bool(demo)
}
except Exception as e:
raise HTTPException(status_code=400, detail=str(e))
Expand Down

0 comments on commit 0c8e53f

Please sign in to comment.