forked from feathr-ai/feathr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI: Add data source detail page (feathr-ai#620)
UI: Add data source detail page
- Loading branch information
1 parent
1544999
commit 8497219
Showing
11 changed files
with
249 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
REACT_APP_AZURE_TENANT_ID=common | ||
REACT_APP_API_ENDPOINT=http://127.0.0.1:8000 | ||
REACT_APP_ENABLE_RBAC=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
import React from "react"; | ||
import { LoadingOutlined } from "@ant-design/icons"; | ||
import { useNavigate, useParams } from "react-router-dom"; | ||
import { Alert, Button, Card, Col, Row, Spin, Typography } from "antd"; | ||
import { QueryStatus, useQuery } from "react-query"; | ||
import { AxiosError } from "axios"; | ||
import { fetchDataSource } from "../../api"; | ||
import { DataSource, DataSourceAttributes } from "../../models/model"; | ||
|
||
const { Title } = Typography; | ||
|
||
type DataSourceKeyProps = { dataSource: DataSource }; | ||
const DataSourceKey = ({ dataSource }: DataSourceKeyProps) => { | ||
const keys = dataSource.attributes; | ||
return ( | ||
<> | ||
{keys && ( | ||
<Col span={24}> | ||
<Card className="card"> | ||
<Title level={4}>Data Source Attributes</Title> | ||
<div className="dataSource-container"> | ||
<p>Name: {keys.name}</p> | ||
<p>Type: {keys.type}</p> | ||
<p>Path: {keys.path}</p> | ||
<p>Preprocessing: {keys.preprocessing}</p> | ||
<p>Event Timestamp Column: {keys.eventTimestampColumn}</p> | ||
<p>Timestamp Format: {keys.timestampFormat}</p> | ||
<p>Qualified Name: {keys.qualifiedName}</p> | ||
<p>Tags: {JSON.stringify(keys.tags)}</p> | ||
</div> | ||
</Card> | ||
</Col> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
type Params = { | ||
project: string; | ||
dataSourceId: string; | ||
}; | ||
|
||
const DataSourceDetails = () => { | ||
const { project, dataSourceId } = useParams() as Params; | ||
const navigate = useNavigate(); | ||
const loadingIcon = <LoadingOutlined style={{ fontSize: 24 }} spin />; | ||
const { status, error, data } = useQuery<DataSource, AxiosError>( | ||
["dataSourceId", dataSourceId], | ||
() => fetchDataSource(project, dataSourceId) | ||
); | ||
|
||
const render = (status: QueryStatus): JSX.Element => { | ||
switch (status) { | ||
case "error": | ||
return ( | ||
<Card> | ||
<Alert | ||
message="Error" | ||
description={error?.message} | ||
type="error" | ||
showIcon | ||
/> | ||
</Card> | ||
); | ||
case "idle": | ||
return ( | ||
<Card> | ||
<Spin indicator={loadingIcon} /> | ||
</Card> | ||
); | ||
case "loading": | ||
return ( | ||
<Card> | ||
<Spin indicator={loadingIcon} /> | ||
</Card> | ||
); | ||
case "success": | ||
if (data === undefined) { | ||
return ( | ||
<Card> | ||
<Alert | ||
message="Error" | ||
description="Data does not exist..." | ||
type="error" | ||
showIcon | ||
/> | ||
</Card> | ||
); | ||
} else { | ||
return ( | ||
<> | ||
<Button type="link" onClick={() => navigate(-1)}> | ||
dataSource list {">"} | ||
</Button> | ||
<Card> | ||
<Title level={3}>{data.attributes.name}</Title> | ||
<div> | ||
<Row> | ||
<DataSourceKey dataSource={data} /> | ||
</Row> | ||
</div> | ||
</Card> | ||
</> | ||
); | ||
} | ||
} | ||
}; | ||
|
||
return <div className="page">{render(status)}</div>; | ||
}; | ||
|
||
export default DataSourceDetails; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,3 +56,7 @@ | |
.feature-container p { | ||
break-inside: avoid-column; | ||
} | ||
|
||
.dataSource-container { | ||
column-count: 1; | ||
} |