From 763fb0d91e285283f4deb7bd3eb90352beef8f2c Mon Sep 17 00:00:00 2001
From: Tiffney Bare <63624-tbare@users.noreply.drupalcode.org>
Date: Tue, 8 Jul 2025 15:55:10 -0500
Subject: [PATCH 1/9] Adding tab to dataset page
---
src/templates/Dataset/index.tsx | 17 ++++++++++++++++-
src/types/dataset.ts | 6 ++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/templates/Dataset/index.tsx b/src/templates/Dataset/index.tsx
index 8c4b2bf3..40ba0b31 100644
--- a/src/templates/Dataset/index.tsx
+++ b/src/templates/Dataset/index.tsx
@@ -12,6 +12,7 @@ import SearchItemIcon from '../../assets/icons/searchItem';
import DatasetOverview from '../../components/DatasetOverviewTab';
import DatasetAPI from '../../components/DatasetAPITab';
import DataDictionary from '../../components/DatasetDataDictionaryTab';
+import StoredQuery from '../../components/StoredQueryTab';
import { DatasetDictionaryItemType, DatasetPageType, DatasetDictionaryType, DistributionType, ResourceType, ColumnType } from '../../types/dataset';
import TransformedDate from '../../components/TransformedDate';
import { getFormatType } from '../../utilities/format';
@@ -142,7 +143,7 @@ const Dataset = ({
}, [distribution, window.location.hash])
const displayDataDictionaryTab = ((distribution.data && distribution.data.describedBy && distribution.data.describedByType === 'application/vnd.tableschema+json') || (datasetSitewideDictionary && datasetSitewideDictionary.length > 0)) as boolean;
-
+
return (
<>
{dataset.error ? (
@@ -245,6 +246,20 @@ const Dataset = ({
)}
+ { distribution && distribution.data && (
+
+
+ Stored Query
+
+ }
+ className={ borderlessTabs ? 'ds-u-border--0 ds-u-padding-x--0' : '' }
+ >
+
+
+ )}
)}
diff --git a/src/types/dataset.ts b/src/types/dataset.ts
index 771a0306..5f7e4ffd 100644
--- a/src/types/dataset.ts
+++ b/src/types/dataset.ts
@@ -111,6 +111,12 @@ export type DatasetOverviewPropsType = {
metadataMapping: any, //TODO
}
+export type DatasetStoredQuery = {
+ dataset: DatasetType,
+ resource: ResourceType,
+ distributions: DistributionType[],
+}
+
export type DatasetDictionaryItemType = {
format: string,
name: string,
From 4374f7fdfbc4ff8c57ca51dc4990a98bbfaca53a Mon Sep 17 00:00:00 2001
From: Tiffney Bare <63624-tbare@users.noreply.drupalcode.org>
Date: Tue, 8 Jul 2025 16:20:47 -0500
Subject: [PATCH 2/9] Adding stored query tab
---
src/components/StoredQueryTab/index.jsx | 47 +++++++++++++++++++++++++
src/templates/Dataset/index.tsx | 13 +++----
2 files changed, 54 insertions(+), 6 deletions(-)
create mode 100644 src/components/StoredQueryTab/index.jsx
diff --git a/src/components/StoredQueryTab/index.jsx b/src/components/StoredQueryTab/index.jsx
new file mode 100644
index 00000000..ca0b5575
--- /dev/null
+++ b/src/components/StoredQueryTab/index.jsx
@@ -0,0 +1,47 @@
+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
Loading...
;
+ if (error) return Error: {error}
;
+ if (!data) return No data found.
;
+
+ return (
+
+
{data.storedQuery?.title}
+
{data.storedQuery?.description}
+ {/* Render more fields as needed */}
+
{JSON.stringify(data, null, 2)}
+
+ );
+};
+
+export default StoredQueryViewer;
diff --git a/src/templates/Dataset/index.tsx b/src/templates/Dataset/index.tsx
index 40ba0b31..7b1b2147 100644
--- a/src/templates/Dataset/index.tsx
+++ b/src/templates/Dataset/index.tsx
@@ -234,32 +234,33 @@ const Dataset = ({
)}
{ distribution && distribution.data && (
- API
+ Stored Query
}
className={ borderlessTabs ? 'ds-u-border--0 ds-u-padding-x--0' : '' }
>
-
+
)}
{ distribution && distribution.data && (
- Stored Query
+ API
}
className={ borderlessTabs ? 'ds-u-border--0 ds-u-padding-x--0' : '' }
>
-
+
)}
+
)}
From 010fce36928a5490c7bb043e3a4dfaae3071e061 Mon Sep 17 00:00:00 2001
From: Tiffney Bare <63624-tbare@users.noreply.drupalcode.org>
Date: Tue, 8 Jul 2025 16:36:42 -0500
Subject: [PATCH 3/9] More adjustments to fix error
---
src/components/StoredQueryTab/index.jsx | 6 +-----
src/templates/Dataset/index.tsx | 2 +-
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/components/StoredQueryTab/index.jsx b/src/components/StoredQueryTab/index.jsx
index ca0b5575..87454eac 100644
--- a/src/components/StoredQueryTab/index.jsx
+++ b/src/components/StoredQueryTab/index.jsx
@@ -1,11 +1,7 @@
import React from 'react';
+
type DatasetStoredQueryProps = {
id: String;
- rootUrl: String;
- apiUrl: string;
- additionalParams: {
- ACA: string,
- }
};
diff --git a/src/templates/Dataset/index.tsx b/src/templates/Dataset/index.tsx
index 7b1b2147..ec6da8bd 100644
--- a/src/templates/Dataset/index.tsx
+++ b/src/templates/Dataset/index.tsx
@@ -232,7 +232,7 @@ const Dataset = ({
{!displayDataDictionaryTab && There is no Data Dictionary associated with this dataset.
}
)}
- { distribution && distribution.data && (
+ { id (
Date: Tue, 8 Jul 2025 16:46:36 -0500
Subject: [PATCH 4/9] changing file to typescript
---
.../StoredQueryTab/{index.jsx => index.tsx} | 24 +++++++++++++------
1 file changed, 17 insertions(+), 7 deletions(-)
rename src/components/StoredQueryTab/{index.jsx => index.tsx} (57%)
diff --git a/src/components/StoredQueryTab/index.jsx b/src/components/StoredQueryTab/index.tsx
similarity index 57%
rename from src/components/StoredQueryTab/index.jsx
rename to src/components/StoredQueryTab/index.tsx
index 87454eac..e2918490 100644
--- a/src/components/StoredQueryTab/index.jsx
+++ b/src/components/StoredQueryTab/index.tsx
@@ -1,12 +1,22 @@
-import React from 'react';
+import React, { useEffect, useState } from 'react';
-type DatasetStoredQueryProps = {
- id: String;
-};
+interface StoredQuery {
+ title?: string;
+ description?: string;
+}
+interface StoredQueryApiResponse {
+ storedQuery?: StoredQuery;
+}
-const StoredQueryViewer = ({ id }: DatasetStoredQueryProps) => {
+interface StoredQueryViewerProps {
+ id: string;
+}
+const StoredQueryViewer: React.FC = ({ id }) => {
+ const [loading, setLoading] = useState(false);
+ const [data, setData] = useState(null);
+ const [error, setError] = useState(null);
useEffect(() => {
if (!id) return;
@@ -16,11 +26,11 @@ const StoredQueryViewer = ({ id }: DatasetStoredQueryProps) => {
if (!response.ok) throw new Error('Network response was not ok');
return response.json();
})
- .then((json) => {
+ .then((json: StoredQueryApiResponse) => {
setData(json);
setLoading(false);
})
- .catch((err) => {
+ .catch((err: Error) => {
setError(err.message);
setLoading(false);
});
From b86a51cc68a4fae1c0c9735f32dc92d8d6599e26 Mon Sep 17 00:00:00 2001
From: Tiffney Bare <63624-tbare@users.noreply.drupalcode.org>
Date: Tue, 8 Jul 2025 16:51:15 -0500
Subject: [PATCH 5/9] Fixing more issues
---
src/templates/Dataset/index.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/templates/Dataset/index.tsx b/src/templates/Dataset/index.tsx
index ec6da8bd..ce1439a9 100644
--- a/src/templates/Dataset/index.tsx
+++ b/src/templates/Dataset/index.tsx
@@ -232,7 +232,7 @@ const Dataset = ({
{!displayDataDictionaryTab && There is no Data Dictionary associated with this dataset.
}
)}
- { id (
+ { (
Date: Wed, 30 Jul 2025 12:12:01 -0500
Subject: [PATCH 6/9] adding storedquery component
---
src/components/StoredQueryTab/index.jsx | 48 +++++++++++++++++++++++++
src/templates/Dataset/index.tsx | 2 --
2 files changed, 48 insertions(+), 2 deletions(-)
create mode 100644 src/components/StoredQueryTab/index.jsx
diff --git a/src/components/StoredQueryTab/index.jsx b/src/components/StoredQueryTab/index.jsx
new file mode 100644
index 00000000..c3b0ccbd
--- /dev/null
+++ b/src/components/StoredQueryTab/index.jsx
@@ -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 Loading...
;
+ if (error) return Error: {error}
;
+ if (!data) return No data found.
;
+
+ return (
+
+ Hello
+
{data.storedQuery?.title}
+
{data.storedQuery?.description}
+ {/* Render more fields as needed */}
+
{JSON.stringify(data, null, 2)}
+
+ );
+};
+
+export default StoredQueryViewer;
diff --git a/src/templates/Dataset/index.tsx b/src/templates/Dataset/index.tsx
index ce1439a9..7127dc24 100644
--- a/src/templates/Dataset/index.tsx
+++ b/src/templates/Dataset/index.tsx
@@ -232,7 +232,6 @@ const Dataset = ({
{!displayDataDictionaryTab && There is no Data Dictionary associated with this dataset.
}
)}
- { (
- )}
{ distribution && distribution.data && (
Date: Wed, 30 Jul 2025 16:45:55 -0500
Subject: [PATCH 7/9] Adding tab
---
src/components/StoredQueryTab/index.tsx | 28 ++++++++++++++++++-------
src/templates/Dataset/index.tsx | 7 ++++++-
src/types/dataset.ts | 1 +
3 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/src/components/StoredQueryTab/index.tsx b/src/components/StoredQueryTab/index.tsx
index e2918490..31512f7c 100644
--- a/src/components/StoredQueryTab/index.tsx
+++ b/src/components/StoredQueryTab/index.tsx
@@ -1,8 +1,12 @@
import React, { useEffect, useState } from 'react';
+import TransformedDate from '../TransformedDate';
interface StoredQuery {
title?: string;
description?: string;
+ uuid?: string;
+ identifier?: string;
+ modified?: string;
}
interface StoredQueryApiResponse {
@@ -21,7 +25,7 @@ const StoredQueryViewer: React.FC = ({ id }) => {
useEffect(() => {
if (!id) return;
setLoading(true);
- fetch(`/api/1/stored-query/items/${id}`)
+ fetch(`https://medicaid.ddev.site/api/1/stored-query/items/${id}`)
.then((response) => {
if (!response.ok) throw new Error('Network response was not ok');
return response.json();
@@ -39,14 +43,22 @@ const StoredQueryViewer: React.FC = ({ id }) => {
if (loading) return Loading...
;
if (error) return Error: {error}
;
if (!data) return No data found.
;
-
+const storedQueryUrl = `/stored-query/${data.storedQuery?.uuid}`;
return (
-
-
{data.storedQuery?.title}
-
{data.storedQuery?.description}
- {/* Render more fields as needed */}
-
{JSON.stringify(data, null, 2)}
-
+
+
+
+
+
+
{data.storedQuery?.description}
+
+
+
);
};
diff --git a/src/templates/Dataset/index.tsx b/src/templates/Dataset/index.tsx
index 7127dc24..d48c1248 100644
--- a/src/templates/Dataset/index.tsx
+++ b/src/templates/Dataset/index.tsx
@@ -54,6 +54,7 @@ const Dataset = ({
dataDictionaryBanner = false,
disableTableControls = false,
hideDataDictionary = false,
+ hideStoredQuery = false,
customDescription,
updateAriaLive,
showRowLimitNotice = false
@@ -232,18 +233,21 @@ const Dataset = ({
{!displayDataDictionaryTab && There is no Data Dictionary associated with this dataset.
}
)}
+ {!hideStoredQuery && (
-
+
Stored Query
}
className={ borderlessTabs ? 'ds-u-border--0 ds-u-padding-x--0' : '' }
>
+
+ )}
{ distribution && distribution.data && (
+ console.log("id", id)
)}
diff --git a/src/types/dataset.ts b/src/types/dataset.ts
index 5f7e4ffd..59bad249 100644
--- a/src/types/dataset.ts
+++ b/src/types/dataset.ts
@@ -70,6 +70,7 @@ export type DatasetPageType = {
dataDictionaryBanner: boolean,
disableTableControls: boolean,
hideDataDictionary: boolean,
+ hideStoredQuery: boolean,
customDescription?: Function,
updateAriaLive?: Function,
showRowLimitNotice?: boolean,
From 939cfb1acb6cc9b00623b553cf4d2b8e9bc75592 Mon Sep 17 00:00:00 2001
From: Tiffney Bare <63624-tbare@users.noreply.drupalcode.org>
Date: Wed, 30 Jul 2025 16:58:41 -0500
Subject: [PATCH 8/9] Removing medicaid url
---
src/components/StoredQueryTab/index.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/StoredQueryTab/index.tsx b/src/components/StoredQueryTab/index.tsx
index 31512f7c..269a2c7c 100644
--- a/src/components/StoredQueryTab/index.tsx
+++ b/src/components/StoredQueryTab/index.tsx
@@ -25,7 +25,7 @@ const StoredQueryViewer: React.FC = ({ id }) => {
useEffect(() => {
if (!id) return;
setLoading(true);
- fetch(`https://medicaid.ddev.site/api/1/stored-query/items/${id}`)
+ fetch(`/api/1/stored-query/items/${id}`)
.then((response) => {
if (!response.ok) throw new Error('Network response was not ok');
return response.json();
From 9091a1cc5334db3e835c55b4a2bbab9f4eb42c19 Mon Sep 17 00:00:00 2001
From: Tiffney Bare <63624-tbare@users.noreply.drupalcode.org>
Date: Fri, 15 Aug 2025 09:56:20 -0500
Subject: [PATCH 9/9] making changes based on eng review
---
src/components/StoredQueryTab/index.jsx | 48 -------------------------
src/templates/Dataset/index.tsx | 3 +-
2 files changed, 1 insertion(+), 50 deletions(-)
delete mode 100644 src/components/StoredQueryTab/index.jsx
diff --git a/src/components/StoredQueryTab/index.jsx b/src/components/StoredQueryTab/index.jsx
deleted file mode 100644
index c3b0ccbd..00000000
--- a/src/components/StoredQueryTab/index.jsx
+++ /dev/null
@@ -1,48 +0,0 @@
-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 Loading...
;
- if (error) return Error: {error}
;
- if (!data) return No data found.
;
-
- return (
-
- Hello
-
{data.storedQuery?.title}
-
{data.storedQuery?.description}
- {/* Render more fields as needed */}
-
{JSON.stringify(data, null, 2)}
-
- );
-};
-
-export default StoredQueryViewer;
diff --git a/src/templates/Dataset/index.tsx b/src/templates/Dataset/index.tsx
index d48c1248..bdc1ede0 100644
--- a/src/templates/Dataset/index.tsx
+++ b/src/templates/Dataset/index.tsx
@@ -54,7 +54,7 @@ const Dataset = ({
dataDictionaryBanner = false,
disableTableControls = false,
hideDataDictionary = false,
- hideStoredQuery = false,
+ hideStoredQuery = true,
customDescription,
updateAriaLive,
showRowLimitNotice = false
@@ -259,7 +259,6 @@ const Dataset = ({
}
className={ borderlessTabs ? 'ds-u-border--0 ds-u-padding-x--0' : '' }
>
- console.log("id", id)
)}