-
Notifications
You must be signed in to change notification settings - Fork 244
UI: Add data source detail page #620
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
e539c29
Added button for data source
ahlag 6f54a42
Added action to dataSourceList
ahlag 2f70ec8
Added path for dataSource
ahlag d16c1d1
Added fetchDataSources
ahlag 4c83a08
Added fetchDataSource api
ahlag 88c08f6
Fixed URI bug
ahlag 11b4443
Checking dataSourceId's API
ahlag bd366a3
Added dataSource API endpoint in registry
ahlag 4068fe7
Added localhost dev environment variables
ahlag e5880da
Added dataSourceDetails
ahlag 845f3ba
Removed console log
ahlag 8a9b97a
Added api endpoint in purview
ahlag a8ab481
Added project tag
ahlag 6e58b85
Fixed indent
ahlag d9605bc
Linted
ahlag 21a5f6a
Removed client id
ahlag e8c94b5
Added RBAC datasource api
ahlag 3d3e3d7
Added RBAC datasource api
ahlag d19ba40
Fixed arguments
ahlag 65d4879
Fixed json
ahlag File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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; | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.