@gen3/frontend 0.10.99 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +79 -68
- package/dist/cjs/index.js.map +1 -1
- package/dist/dts/features/CohortBuilder/ExplorerTable/ExplorerTable.d.ts.map +1 -1
- package/dist/dts/features/CohortBuilder/ExplorerTable/ExplorerTable.js.map +1 -1
- package/dist/dts/features/CohortDiscovery/ChartsAndFacetsPanel.d.ts +9 -1
- package/dist/dts/features/CohortDiscovery/ChartsAndFacetsPanel.d.ts.map +1 -1
- package/dist/dts/features/CohortDiscovery/ChartsAndFacetsPanel.js +7 -9
- package/dist/dts/features/CohortDiscovery/ChartsAndFacetsPanel.js.map +1 -1
- package/dist/dts/features/CohortDiscovery/IndexPanel.js +5 -8
- package/dist/dts/features/CohortDiscovery/IndexPanel.js.map +1 -1
- package/dist/dts/features/CohortDiscovery/api/analysisApiCohortDiscovery.d.ts.map +1 -1
- package/dist/dts/features/CohortDiscovery/api/analysisApiCohortDiscovery.js.map +1 -1
- package/dist/dts/features/CohortDiscovery/constants.d.ts +2 -0
- package/dist/dts/features/CohortDiscovery/constants.d.ts.map +1 -0
- package/dist/dts/features/CohortDiscovery/constants.js +4 -0
- package/dist/dts/features/CohortDiscovery/constants.js.map +1 -0
- package/dist/dts/features/CohortDiscovery/queryApi.d.ts +10 -0
- package/dist/dts/features/CohortDiscovery/queryApi.d.ts.map +1 -1
- package/dist/dts/features/CohortDiscovery/queryApi.js +21 -3
- package/dist/dts/features/CohortDiscovery/queryApi.js.map +1 -1
- package/dist/dts/features/Study/index.d.ts +5 -1
- package/dist/dts/features/Study/index.d.ts.map +1 -1
- package/dist/dts/features/Study/index.js +5 -1
- package/dist/dts/features/Study/index.js.map +1 -1
- package/dist/esm/index.js +77 -70
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +32 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -15508,83 +15508,26 @@ const createFacetPanel = (facet, chartType, valueLabel, hooks)=>{
|
|
|
15508
15508
|
return null;
|
|
15509
15509
|
};
|
|
15510
15510
|
|
|
15511
|
-
const useGraphQLData = (url, body, skip)=>{
|
|
15512
|
-
// Create a fetcher function that handles the GraphQL POST request
|
|
15513
|
-
const fetcher = async (fetchUrl, fetchBody)=>{
|
|
15514
|
-
const headers = new Headers({
|
|
15515
|
-
Accept: 'application/json',
|
|
15516
|
-
'Content-Type': 'application/json'
|
|
15517
|
-
});
|
|
15518
|
-
if (process.env.NODE_ENV === 'development') {
|
|
15519
|
-
// NOTE: This cookie can only be accessed from the client side
|
|
15520
|
-
// in development mode. Otherwise, the cookie is set as httpOnly
|
|
15521
|
-
const accessToken = cookiesNext.getCookie('credentials_token');
|
|
15522
|
-
if (accessToken) {
|
|
15523
|
-
headers.set('Authorization', `Bearer ${accessToken}`);
|
|
15524
|
-
}
|
|
15525
|
-
}
|
|
15526
|
-
const response = await fetch(fetchUrl, {
|
|
15527
|
-
method: 'POST',
|
|
15528
|
-
headers: headers,
|
|
15529
|
-
body: JSON.stringify(fetchBody)
|
|
15530
|
-
});
|
|
15531
|
-
if (!response.ok) {
|
|
15532
|
-
throw new Error(`Error ${response.status}: ${response.statusText}`);
|
|
15533
|
-
}
|
|
15534
|
-
return await response.json();
|
|
15535
|
-
};
|
|
15536
|
-
// Use SWR with the fetcher
|
|
15537
|
-
const { data, error, isLoading, mutate } = useSWR(!skip ? [
|
|
15538
|
-
url,
|
|
15539
|
-
body
|
|
15540
|
-
] : null, ([fetchUrl, fetchBody])=>fetcher(fetchUrl, fetchBody), {
|
|
15541
|
-
revalidateOnFocus: false
|
|
15542
|
-
});
|
|
15543
|
-
// Format error to match your ErrorDetails interface
|
|
15544
|
-
const formattedError = error ? {
|
|
15545
|
-
status: error.message.match(/\d+/)?.[0] || 'Unknown',
|
|
15546
|
-
message: error.message
|
|
15547
|
-
} : null;
|
|
15548
|
-
return {
|
|
15549
|
-
data,
|
|
15550
|
-
isLoading,
|
|
15551
|
-
isSuccess: !!data && !error,
|
|
15552
|
-
isError: !!error,
|
|
15553
|
-
error: formattedError,
|
|
15554
|
-
mutate
|
|
15555
|
-
};
|
|
15556
|
-
};
|
|
15557
|
-
const useRoundedAggsQuery = ({ type, fields, filters, accessibility = core.Accessibility.ALL }, { skip } = {
|
|
15558
|
-
skip: false
|
|
15559
|
-
})=>{
|
|
15560
|
-
const response = useGraphQLData('/api/analysis/cohortDiscovery', core.buildGetAggregationQuery(type, fields, filters, accessibility, false), skip);
|
|
15561
|
-
return {
|
|
15562
|
-
...response,
|
|
15563
|
-
data: response?.data?.data ? core.processHistogramResponse(response?.data.data?._aggregation[type] ?? {}) : {}
|
|
15564
|
-
};
|
|
15565
|
-
};
|
|
15566
|
-
|
|
15567
15511
|
const NUM_COLS = 2; // TODO: add to config
|
|
15568
15512
|
/**
|
|
15569
15513
|
* CartsAndFacetsPanel component
|
|
15570
15514
|
*
|
|
15571
15515
|
* @param {string} index - The index type used for querying data.
|
|
15516
|
+
* @param data
|
|
15517
|
+
* @param isLoading
|
|
15518
|
+
* @param isError
|
|
15519
|
+
* @param isSuccess
|
|
15572
15520
|
* @param {Array} facets - The list of facets to be rendered.
|
|
15573
15521
|
* @returns {JSX.Element} The rendered component showing facets.
|
|
15574
|
-
*/ const ChartsAndFacetsPanel = ({ index, facets })=>{
|
|
15522
|
+
*/ const ChartsAndFacetsPanel = ({ index, data, isLoading, isError, isSuccess, facets })=>{
|
|
15575
15523
|
const cohortFilters = useAppSelector((state)=>selectCurrentCohortIndexFilters(state, index));
|
|
15576
|
-
const { data, isSuccess, isLoading: isAggsQueryFetching, isError: isAggsQueryError } = useRoundedAggsQuery({
|
|
15577
|
-
type: index,
|
|
15578
|
-
fields: facets.map((x)=>x.field),
|
|
15579
|
-
filters: cohortFilters
|
|
15580
|
-
});
|
|
15581
15524
|
const getEnumFacetData = useDeepCompare.useDeepCompareCallback((field)=>{
|
|
15582
15525
|
return {
|
|
15583
15526
|
data: processBucketData(data?.[field]),
|
|
15584
15527
|
enumFilters: field in cohortFilters.root ? core.extractEnumFilterValue(cohortFilters.root[field]) : undefined,
|
|
15585
15528
|
isSuccess: isSuccess,
|
|
15586
|
-
isFetching:
|
|
15587
|
-
isError:
|
|
15529
|
+
isFetching: isLoading,
|
|
15530
|
+
isError: isError
|
|
15588
15531
|
};
|
|
15589
15532
|
}, [
|
|
15590
15533
|
cohortFilters,
|
|
@@ -16123,6 +16066,67 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
|
|
|
16123
16066
|
});
|
|
16124
16067
|
};
|
|
16125
16068
|
|
|
16069
|
+
process.env.GEN3_COHORT_DISCOVERY_API || `${core.GEN3_API}/api/auth/analysis/cohortDiscovery`;
|
|
16070
|
+
|
|
16071
|
+
const useGraphQLData = (url, body, skip)=>{
|
|
16072
|
+
// Create a fetcher function that handles the GraphQL POST request
|
|
16073
|
+
const csrfToken = core.useCoreSelector((state)=>core.selectCSRFToken(state));
|
|
16074
|
+
const fetcher = async (fetchUrl, fetchBody)=>{
|
|
16075
|
+
const headers = new Headers({
|
|
16076
|
+
Accept: 'application/json',
|
|
16077
|
+
'Content-Type': 'application/json',
|
|
16078
|
+
'X-CSRF-Token': csrfToken ?? ''
|
|
16079
|
+
});
|
|
16080
|
+
if (process.env.NODE_ENV === 'development') {
|
|
16081
|
+
// NOTE: This cookie can only be accessed from the client side
|
|
16082
|
+
// in development mode. Otherwise, the cookie is set as httpOnly
|
|
16083
|
+
const accessToken = cookiesNext.getCookie('credentials_token');
|
|
16084
|
+
if (accessToken) {
|
|
16085
|
+
headers.set('Authorization', `Bearer ${accessToken}`);
|
|
16086
|
+
}
|
|
16087
|
+
}
|
|
16088
|
+
const response = await fetch(fetchUrl, {
|
|
16089
|
+
method: 'POST',
|
|
16090
|
+
headers: headers,
|
|
16091
|
+
body: JSON.stringify(fetchBody)
|
|
16092
|
+
});
|
|
16093
|
+
if (!response.ok) {
|
|
16094
|
+
throw new Error(`Error ${response.status}: ${response.statusText}`);
|
|
16095
|
+
}
|
|
16096
|
+
return await response.json();
|
|
16097
|
+
};
|
|
16098
|
+
// Use SWR with the fetcher
|
|
16099
|
+
const { data, error, isLoading, mutate } = useSWR(!skip ? [
|
|
16100
|
+
url,
|
|
16101
|
+
body
|
|
16102
|
+
] : null, ([fetchUrl, fetchBody])=>fetcher(fetchUrl, fetchBody), {
|
|
16103
|
+
revalidateOnFocus: false
|
|
16104
|
+
});
|
|
16105
|
+
// Format error to match your ErrorDetails interface
|
|
16106
|
+
const formattedError = error ? {
|
|
16107
|
+
status: error.message.match(/\d+/)?.[0] || 'Unknown',
|
|
16108
|
+
message: error.message
|
|
16109
|
+
} : null;
|
|
16110
|
+
return {
|
|
16111
|
+
data,
|
|
16112
|
+
isLoading,
|
|
16113
|
+
isSuccess: !!data && !error,
|
|
16114
|
+
isError: !!error,
|
|
16115
|
+
error: formattedError,
|
|
16116
|
+
mutate
|
|
16117
|
+
};
|
|
16118
|
+
};
|
|
16119
|
+
const COHORT_DISCOVERY_LIMIT$1 = process.env.NEXT_PUBLIC_GEN3_COHORT_DISCOVERY_LIMIT ? Number(process.env.NEXT_PUBLIC_GEN3_COHORT_DISCOVERY_LIMIT) : 100;
|
|
16120
|
+
const useUnsecureRoundedAggsQuery = ({ type, fields, filters, accessibility = core.Accessibility.ALL }, { skip } = {
|
|
16121
|
+
skip: false
|
|
16122
|
+
})=>{
|
|
16123
|
+
const response = useGraphQLData(`${core.GEN3_GUPPY_API}/graphql`, core.buildGetAggregationQuery(type, fields, filters, accessibility, false), skip);
|
|
16124
|
+
return {
|
|
16125
|
+
...response,
|
|
16126
|
+
data: response?.data?.data ? core.processHistogramResponse(core.roundHistogramResponse(response?.data?.data._aggregation[type], COHORT_DISCOVERY_LIMIT$1)) : {}
|
|
16127
|
+
};
|
|
16128
|
+
};
|
|
16129
|
+
|
|
16126
16130
|
const CohortQueryExpression = ({ index })=>{
|
|
16127
16131
|
const currentCohortId = useAppSelector((state)=>selectCurrentCohortId(state));
|
|
16128
16132
|
const currentCohortName = useAppSelector((state)=>selectCurrentCohortName(state));
|
|
@@ -16196,13 +16200,12 @@ const IndexPanel = ({ dataConfig, tabs, tabTitle, emptySelection, indexResources
|
|
|
16196
16200
|
facetDefinitions
|
|
16197
16201
|
]);
|
|
16198
16202
|
const cohortFilters = useAppSelector((state)=>selectCurrentCohortIndexFilters(state, index));
|
|
16199
|
-
const
|
|
16200
|
-
const { data, isSuccess, isError: isAggsQueryError } = useRoundedAggsQuery({
|
|
16203
|
+
const { data, isSuccess, isLoading: isAggsQueryFetching, isError: isAggsQueryError } = useUnsecureRoundedAggsQuery({
|
|
16201
16204
|
type: index,
|
|
16202
|
-
fields:
|
|
16205
|
+
fields: fields,
|
|
16203
16206
|
filters: cohortFilters
|
|
16204
16207
|
}, {
|
|
16205
|
-
skip:
|
|
16208
|
+
skip: fields.length === 0
|
|
16206
16209
|
});
|
|
16207
16210
|
const updateFields = useDeepCompare.useDeepCompareCallback((field, checked)=>{
|
|
16208
16211
|
if (!checked) {
|
|
@@ -16288,6 +16291,10 @@ const IndexPanel = ({ dataConfig, tabs, tabTitle, emptySelection, indexResources
|
|
|
16288
16291
|
remoteSupportService: remoteSupportService
|
|
16289
16292
|
}),
|
|
16290
16293
|
selectedFacets.length > 0 ? /*#__PURE__*/ jsxRuntime.jsx(ChartsAndFacetsPanel, {
|
|
16294
|
+
data: data,
|
|
16295
|
+
isLoading: isAggsQueryFetching,
|
|
16296
|
+
isError: isAggsQueryError,
|
|
16297
|
+
isSuccess: isSuccess,
|
|
16291
16298
|
index: index,
|
|
16292
16299
|
facets: activeFieldDefinitions
|
|
16293
16300
|
}) : /*#__PURE__*/ jsxRuntime.jsx(core$1.Center, {
|
|
@@ -25639,9 +25646,13 @@ exports.ReactECharts = ReactECharts;
|
|
|
25639
25646
|
exports.ResourcesFilters = ResourcesFilters;
|
|
25640
25647
|
exports.SPECIAL_CASE_FIELDS = SPECIAL_CASE_FIELDS;
|
|
25641
25648
|
exports.SessionExpiredModal = SessionExpiredModal;
|
|
25649
|
+
exports.SinglePageStudyDetailsPanel = SinglePageStudyDetailsPanel;
|
|
25642
25650
|
exports.StaticNotebookIFrame = StaticNotebookIFrame;
|
|
25643
25651
|
exports.StaticNotebookViewer = StaticNotebookViewer;
|
|
25652
|
+
exports.StudyDetailsPanel = StudyDetailsPanel;
|
|
25644
25653
|
exports.StudyGroup = StudyGroup;
|
|
25654
|
+
exports.StudyGroupPanel = StudyGroupPanel;
|
|
25655
|
+
exports.StudyProvider = StudyProvider;
|
|
25645
25656
|
exports.SubmissionPage = SubmissionPage;
|
|
25646
25657
|
exports.SubmissionPageGetServerSideProps = SubmissionPageGetServerSideProps;
|
|
25647
25658
|
exports.TabbedCohortBuilder = TabbedCohortBuilder;
|