@@ -18,13 +18,15 @@ import {
1818} from './AdvancedViewSourcePart.types' ;
1919import { useStrings } from "../../store/hooks" ;
2020import GroupOwnershipSchema from '../../models/schemas/GroupOwnershipSchema.json' ;
21+ import PlaceMembershipSchema from '../../models/schemas/PlaceMembershipSchema.json' ;
2122import { AppDispatch } from '../../store' ;
2223import {
2324 setIsAdvancedQueryValid ,
2425 updateSourcePart ,
2526} from '../../store/manageMembership.slice' ;
2627import { ISourcePart } from '../../models/ISourcePart' ;
2728import { GroupOwnershipSourcePart } from '../../models/GroupOwnershipSourcePart' ;
29+ import { PlaceMembershipSourcePart } from '../../models/PlaceMembershipSourcePart' ;
2830
2931const getClassNames = classNamesFunction <
3032 IAdvancedViewSourcePartStyleProps ,
@@ -48,7 +50,7 @@ export const AdvancedViewSourcePartBase: React.FunctionComponent<IAdvancedViewSo
4850 const dispatch = useDispatch < AppDispatch > ( ) ;
4951 const [ validationMessage , setValidationMessage ] = useState < React . ReactNode | null > ( null ) ;
5052 const [ localQuery , setLocalQuery ] = useState < string | undefined > ( JSON . stringify ( part . query ) ) ;
51- const schema = GroupOwnershipSchema ;
53+ const schema = part . query . type === 'GroupOwnership' ? GroupOwnershipSchema : PlaceMembershipSchema ;
5254 const ajv = new Ajv ( ) ;
5355
5456 useEffect ( ( ) => {
@@ -88,7 +90,7 @@ export const AdvancedViewSourcePartBase: React.FunctionComponent<IAdvancedViewSo
8890 if ( isValid ) {
8991 const updatedSourcePart : ISourcePart = {
9092 id : part . id ,
91- query : JSON . parse ( localQuery ?? '{}' ) as GroupOwnershipSourcePart
93+ query : JSON . parse ( localQuery ?? '{}' ) as GroupOwnershipSourcePart | PlaceMembershipSourcePart
9294 } ;
9395 dispatch ( updateSourcePart ( updatedSourcePart ) ) ;
9496 setValidationMessage ( strings . ManageMembership . labels . validQuery ) ;
0 commit comments