Skip to content

Commit 9f56ddf

Browse files
author
manasa
committed
fixed the conflicts
1 parent fbc5d5f commit 9f56ddf

File tree

5 files changed

+19
-95
lines changed

5 files changed

+19
-95
lines changed

packages/react-sdk-components/src/components/template/AdvancedSearch/SearchGroup/persistUtils.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
import { getMappedKey } from '../../DataReference/persistUtils';
2-
31
const SKIP_CACHE_KEY = '';
42

3+
export function getMappedKey(key) {
4+
const mappedKey = PCore.getEnvironmentInfo().getKeyMapping(key);
5+
if (!mappedKey) {
6+
return key;
7+
}
8+
return mappedKey;
9+
}
10+
511
const getComponentStateKey = (getPConnect, propertyName: string) => {
612
const pConnect = getPConnect();
713
const caseID = `.${getMappedKey('pyID')}`; // Enhance this later when use-case arrives for data objects using S&S.
@@ -39,8 +45,7 @@ const setComponentCache = ({
3945
options: ReturnType<typeof getComponentStateOptions>;
4046
}) => {
4147
if (cacheKey !== SKIP_CACHE_KEY) {
42-
// @ts-ignore
43-
PCore.getNavigationUtils().setComponentCache(cacheKey, state, options);
48+
(PCore.getNavigationUtils() as any).setComponentCache(cacheKey, state, options);
4449
}
4550
};
4651

packages/react-sdk-components/src/components/template/DataReference/DataReference.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import React, { PropsWithChildren, ReactElement, useEffect, useMemo, useState }
33
import { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';
44
import { PConnProps } from '../../../types/PConnProps';
55
import useIsMount from './useIsMount';
6-
import componentCachePersistUtils from './persistUtils';
7-
import { getMappedKey } from './persistUtils';
6+
import componentCachePersistUtils from '../AdvancedSearch/SearchGroup/persistUtils';
7+
import { getMappedKey } from '../AdvancedSearch/SearchGroup/persistUtils';
88
import DataReferenceAdvancedSearchContext from './DataReferenceAdvancedSearchContext';
99
import { getFirstChildConfig } from './utils';
1010
import SearchForm from './SearchForm';

packages/react-sdk-components/src/components/template/DataReference/persistUtils.ts

Lines changed: 0 additions & 58 deletions
This file was deleted.

packages/react-sdk-components/src/components/template/ListView/ListView.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ export default function ListView(props: ListViewProps) {
208208

209209
const classes = useStyles();
210210

211+
// Hook to clear the selections and update table in AdvancedSearch template when switching between search views
211212
function useClearSelectionsAndUpdateTable({ getPConnect, uniqueId, viewName }) {
212213
const clearSelectionsAndRefreshList = useCallback(
213214
({ viewName: name, clearSelections }) => {
@@ -423,8 +424,9 @@ export default function ListView(props: ListViewProps) {
423424
[`T${index++}`]: { ...filter[relationalOp][1].condition }
424425
};
425426
if (dashboardFilterPayload.query.filter.logic) {
426-
dashboardFilterPayload.query.filter.logic = `${dashboardFilterPayload.query.filter.logic} ${relationalOp} (T${index - 2
427-
} ${dateRelationalOp} T${index - 1})`;
427+
dashboardFilterPayload.query.filter.logic = `${dashboardFilterPayload.query.filter.logic} ${relationalOp} (T${
428+
index - 2
429+
} ${dateRelationalOp} T${index - 1})`;
428430
} else {
429431
dashboardFilterPayload.query.filter.logic = `(T${index - 2} ${relationalOp} T${index - 1})`;
430432
}
@@ -483,9 +485,9 @@ export default function ListView(props: ListViewProps) {
483485
// getDataAsync isn't returning correct data for the Page(i.e. ListView within a page) case
484486
return !bInForm
485487
? // @ts-ignore - 3rd parameter "context" should be optional in getData method
486-
PCore.getDataApiUtils().getData(referenceList, payload)
488+
PCore.getDataApiUtils().getData(referenceList, payload)
487489
: // @ts-ignore - Argument of type 'null' is not assignable to parameter of type 'object'
488-
PCore.getDataPageUtils().getDataAsync(referenceList, context, payload ? payload.dataViewParameters : dataViewParameters, null, query);
490+
PCore.getDataPageUtils().getDataAsync(referenceList, context, payload ? payload.dataViewParameters : dataViewParameters, null, query);
489491
}
490492

491493
const buildSelect = (fieldDefs, colId, patchQueryFields = [], compositeKeys = []) => {

packages/react-sdk-components/src/components/template/ListView/utils.ts

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,11 @@ export const formatConstants = {
1010
WorkLink: 'WorkLink'
1111
};
1212

13-
function formatPromotedFilters(promotedFilters) {
14-
return Object.entries(promotedFilters).reduce((acc, [field, value]) => {
15-
if (value) {
16-
acc[field] = {
17-
lhs: {
18-
field
19-
},
20-
comparator: 'EQ',
21-
rhs: {
22-
value
23-
}
24-
};
25-
}
26-
return acc;
27-
}, {});
28-
}
29-
3013
class DataApi {
3114
mappedPropertyToOriginalProperty: any;
3215
originalPropertyToMappedProperty: any;
33-
promotedFilters: any;
3416
showRecords: any;
35-
constructor(promotedFilters = undefined, showRecords = true) {
36-
this.promotedFilters = promotedFilters;
17+
constructor(showRecords = true) {
3718
this.showRecords = showRecords;
3819
this.originalPropertyToMappedProperty = {};
3920
this.mappedPropertyToOriginalProperty = {};
@@ -65,10 +46,6 @@ class DataApi {
6546
getOriginalProperty(propertyName) {
6647
return this.mappedPropertyToOriginalProperty[propertyName] ?? propertyName;
6748
}
68-
69-
updatePromotedFilters(promotedFilters, formatRequired = true) {
70-
this.promotedFilters = formatRequired ? formatPromotedFilters(promotedFilters) : promotedFilters;
71-
}
7249
}
7350

7451
export async function getContext(componentConfig) {
@@ -79,7 +56,6 @@ export async function getContext(componentConfig) {
7956
const dataApi = new DataApi();
8057
return {
8158
promisesResponseArray,
82-
updatePromotedFilters: dataApi.updatePromotedFilters,
8359
setPropertyMaps: dataApi.setPropertyMaps,
8460
getMappedProperty: dataApi.getMappedProperty,
8561
getOriginalProperty: dataApi.getOriginalProperty
@@ -707,10 +683,9 @@ export function updatePageFieldsConfig(configFields, parentClassID) {
707683

708684
export const readContextResponse = async (context, params) => {
709685
const { getPConnect, apiContext, setListContext, children, showDynamicFields, referenceList, isDataObject, ref } = params;
710-
const { promisesResponseArray, updatePromotedFilters, setShowRecords, apiContext: otherContext } = context;
686+
const { promisesResponseArray, setShowRecords, apiContext: otherContext } = context;
711687
// eslint-disable-next-line sonarjs/no-unused-collection
712688
const listOfComponents: any[] = [];
713-
ref.updatePromotedFilters = updatePromotedFilters;
714689
ref.setShowRecords = setShowRecords;
715690
const {
716691
data: { fields: metaFields, classID, isQueryable }

0 commit comments

Comments
 (0)