-
Notifications
You must be signed in to change notification settings - Fork 2
Stored Query Tab #303
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
Open
tiffneybare
wants to merge
11
commits into
main
Choose a base branch
from
stored-query
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Stored Query Tab #303
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
763fb0d
Adding tab to dataset page
4374f7f
Adding stored query tab
010fce3
More adjustments to fix error
c89a69b
changing file to typescript
b86a51c
Fixing more issues
08d0266
adding storedquery component
b9f1f35
Adding tab
939cfb1
Removing medicaid url
dc82f98
Merge branch 'main' into stored-query
9091a1c
making changes based on eng review
59770bf
Merge branch 'main' into stored-query
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import React from 'react'; | ||
| type DatasetStoredQueryProps = { | ||
| id: String; | ||
| rootUrl: String; | ||
| apiUrl: string; | ||
| additionalParams: { | ||
| ACA: string, | ||
| } | ||
| }; | ||
|
|
||
|
|
||
| const StoredQueryViewer = ({ id }: DatasetStoredQueryProps) => { | ||
|
|
||
|
|
||
| useEffect(() => { | ||
| if (!id) return; | ||
| setLoading(true); | ||
| fetch(`/api/1/stored-query/items/${id}`) | ||
| .then((response) => { | ||
| if (!response.ok) throw new Error('Network response was not ok'); | ||
| return response.json(); | ||
| }) | ||
| .then((json) => { | ||
| setData(json); | ||
| setLoading(false); | ||
| }) | ||
| .catch((err) => { | ||
| setError(err.message); | ||
| setLoading(false); | ||
| }); | ||
| }, [id]); | ||
|
|
||
| if (loading) return <div>Loading...</div>; | ||
| if (error) return <div>Error: {error}</div>; | ||
| if (!data) return <div>No data found.</div>; | ||
|
|
||
| return ( | ||
| <div> | ||
| Hello | ||
| <h2>{data.storedQuery?.title}</h2> | ||
| <p>{data.storedQuery?.description}</p> | ||
| {/* Render more fields as needed */} | ||
| <pre>{JSON.stringify(data, null, 2)}</pre> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default StoredQueryViewer; | ||
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,65 @@ | ||
| import React, { useEffect, useState } from 'react'; | ||
| import TransformedDate from '../TransformedDate'; | ||
|
|
||
| interface StoredQuery { | ||
| title?: string; | ||
| description?: string; | ||
| uuid?: string; | ||
| identifier?: string; | ||
| modified?: string; | ||
| } | ||
|
|
||
| interface StoredQueryApiResponse { | ||
| storedQuery?: StoredQuery; | ||
| } | ||
|
|
||
| interface StoredQueryViewerProps { | ||
| id: string; | ||
| } | ||
|
|
||
| const StoredQueryViewer: React.FC<StoredQueryViewerProps> = ({ id }) => { | ||
| const [loading, setLoading] = useState<boolean>(false); | ||
| const [data, setData] = useState<StoredQueryApiResponse | null>(null); | ||
| const [error, setError] = useState<string | null>(null); | ||
|
|
||
| useEffect(() => { | ||
| if (!id) return; | ||
| setLoading(true); | ||
| fetch(`/api/1/stored-query/items/${id}`) | ||
| .then((response) => { | ||
| if (!response.ok) throw new Error('Network response was not ok'); | ||
| return response.json(); | ||
| }) | ||
| .then((json: StoredQueryApiResponse) => { | ||
| setData(json); | ||
| setLoading(false); | ||
| }) | ||
| .catch((err: Error) => { | ||
| setError(err.message); | ||
| setLoading(false); | ||
| }); | ||
| }, [id]); | ||
|
|
||
| if (loading) return <div>Loading...</div>; | ||
| if (error) return <div>Error: {error}</div>; | ||
| if (!data) return <div>No data found.</div>; | ||
| const storedQueryUrl = `/stored-query/${data.storedQuery?.uuid}`; | ||
| return ( | ||
| <li className="dc-c-list-item ds-u-padding-top--4"> | ||
| <div className="dc-c-searchlist-item ds-u-border-bottom--1 ds-u-padding-bottom--3"> | ||
| <div className="ds-l-row ds-u-align-items--start"> | ||
| <span id={`dataset-${data.storedQuery?.identifier}-updated-date`} className="ds-l-col--12 ds-u-text-align--left ds-text-heading--sm ds-u-padding-top--0"> | ||
| Updated <TransformedDate date={data.storedQuery?.modified} /> | ||
| </span> | ||
| <h2 className="ds-l-col--12 ds-text-heading--2xl"><a href={storedQueryUrl} target="_blank">{data.storedQuery?.title}</a></h2> | ||
| </div> | ||
| <div className="ds-l-row"> | ||
| <div className="ds-l-col--12"> | ||
| <p>{data.storedQuery?.description}</p></div> | ||
| </div> | ||
| </div> | ||
| </li> | ||
| ); | ||
| }; | ||
|
|
||
| export default StoredQueryViewer; |
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
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.