@@ -24,6 +24,7 @@ import { AuthHelper } from "../../../../auth/AuthHelper";
24
24
import { EUIAdminPortalResourcePaths } from "../../../../utils/Globals" ;
25
25
import { EditNewBusinessGroupSharingListForm } from "./EditNewBusinessGroupSharingListForm" ;
26
26
import { TAPManagedAssetDisplay_BusinessGroupSharingList } from "../../../../displayServices/APManagedAssetDisplayService" ;
27
+ import APBusinessGroupsDisplayService from "../../../../displayServices/APBusinessGroupsDisplayService" ;
27
28
28
29
import '../../../../components/APComponents.css' ;
29
30
import "../ManageApiProducts.css" ;
@@ -44,7 +45,7 @@ export const EditNewAccessAndStateForm: React.FC<IEditNewAccessAndStateFormProps
44
45
type TManagedObjectFormData = {
45
46
accessLevel : APIProductAccessLevel ;
46
47
lifecycleState : EAPLifecycleState ;
47
- owningBusinessGroupId : string ;
48
+ owningBusinessGroupId ? : string ;
48
49
} ;
49
50
type TManagedObjectFormDataEnvelope = {
50
51
businessGroupSharingList : TAPManagedAssetDisplay_BusinessGroupSharingList ; /** not managed by form */
@@ -55,7 +56,7 @@ export const EditNewAccessAndStateForm: React.FC<IEditNewAccessAndStateFormProps
55
56
const fd : TManagedObjectFormData = {
56
57
accessLevel : mo . apAccessLevel ,
57
58
lifecycleState : mo . apLifecycleInfo . apLifecycleState ,
58
- owningBusinessGroupId : mo . apBusinessGroupInfo . apOwningBusinessGroupEntityId . id ,
59
+ owningBusinessGroupId : ( mo . apBusinessGroupInfo . apOwningBusinessGroupEntityId . id === APBusinessGroupsDisplayService . get_recovered_BusinessGroupId ( ) ? undefined : mo . apBusinessGroupInfo . apOwningBusinessGroupEntityId . id ) ,
59
60
} ;
60
61
return {
61
62
businessGroupSharingList : mo . apBusinessGroupInfo . apBusinessGroupSharingList ,
@@ -73,6 +74,7 @@ export const EditNewAccessAndStateForm: React.FC<IEditNewAccessAndStateFormProps
73
74
const mo : TManagedObject = props . apApiProductDisplay_AccessAndState ;
74
75
const fd : TManagedObjectFormData = formDataEnvelope . formData ;
75
76
77
+ if ( fd . owningBusinessGroupId === undefined ) throw new Error ( `${ logName } : fd.owningBusinessGroupId === undefined` ) ;
76
78
const apOwningMemberOfBusinessGroupDisplay : TAPMemberOfBusinessGroupDisplay | undefined = APMemberOfService . find_ApMemberOfBusinessGroupDisplay_From_ApMemberOfBusinessGroupDisplayTreeNodeList ( {
77
79
apMemberOfBusinessGroupDisplayTreeNodeList : apMemberOfBusinessGroupDisplayTreeNodeList ,
78
80
businessGroupId : fd . owningBusinessGroupId
@@ -174,7 +176,7 @@ export const EditNewAccessAndStateForm: React.FC<IEditNewAccessAndStateFormProps
174
176
{ ...field }
175
177
options = { apMemberOfBusinessGroupTreeTableNodeList }
176
178
onChange = { ( e ) => { field . onChange ( e . value ) ; } }
177
- placeholder = "Select Business Group"
179
+ // placeholder="Select Business Group"
178
180
filter = { true }
179
181
selectionMode = "single"
180
182
className = { classNames ( { 'p-invalid' : fieldState . invalid } ) }
@@ -209,9 +211,9 @@ export const EditNewAccessAndStateForm: React.FC<IEditNewAccessAndStateFormProps
209
211
if ( apMemberOfBusinessGroupDisplayTreeNodeList === undefined ) throw new Error ( `${ logName } : apMemberOfBusinessGroupDisplayTreeNodeList === undefined` ) ;
210
212
const uniqueKey_EditNewBusinessGroupSharingListForm = ComponentName + '_EditNewBusinessGroupSharingListForm' ;
211
213
212
- const _owningBusinessGroupId : string = managedObjectUseForm . watch ( 'formData.owningBusinessGroupId' ) ;
214
+ const _owningBusinessGroupId : string | undefined = managedObjectUseForm . watch ( 'formData.owningBusinessGroupId' ) ;
213
215
// catch the first render
214
- const owningBusinessGroupId : string = _owningBusinessGroupId === undefined ? managedObjectFormDataEnvelope . formData . owningBusinessGroupId : _owningBusinessGroupId ;
216
+ const owningBusinessGroupId : string | undefined = _owningBusinessGroupId === undefined ? managedObjectFormDataEnvelope . formData . owningBusinessGroupId : _owningBusinessGroupId ;
215
217
216
218
return (
217
219
< div className = "card p-mt-4" >
@@ -281,7 +283,7 @@ export const EditNewAccessAndStateForm: React.FC<IEditNewAccessAndStateFormProps
281
283
uniqueKeyPrefix = { uniqueKey_EditNewBusinessGroupSharingListForm }
282
284
apManagedAssetDisplay_BusinessGroupSharingList = { managedObjectFormDataEnvelope . businessGroupSharingList }
283
285
apMemberOfBusinessGroupDisplayTreeNodeList = { apMemberOfBusinessGroupDisplayTreeNodeList }
284
- apExcludeBusinessGroupIdList = { [ owningBusinessGroupId ] }
286
+ apExcludeBusinessGroupIdList = { owningBusinessGroupId === undefined ? [ ] : [ owningBusinessGroupId ] }
285
287
onChange = { onChange_EditNewBusinessGroupSharingList }
286
288
/>
287
289
</ div >
0 commit comments