@@ -47,10 +47,10 @@ const classes = {
4747 helpIcon : `${ PREFIX } -helpIcon` ,
4848 htmlTooltip : `${ PREFIX } -htmlTooltip` ,
4949 buttonSection : `${ PREFIX } -buttonSection` ,
50- emptyBox : `${ PREFIX } -emptyBox`
50+ emptyBox : `${ PREFIX } -emptyBox` ,
51+ shareAPIPaper : `${ PREFIX } -shareAPIPaper`
5152}
5253
53-
5454const Root = styled ( 'div' ) ( (
5555 {
5656 theme
@@ -62,6 +62,11 @@ const Root = styled('div')((
6262
6363 [ `& .${ classes . emptyBox } ` ] : {
6464 marginTop : theme . spacing ( 2 ) ,
65+ } ,
66+
67+ [ `& .${ classes . shareAPIPaper } ` ] : {
68+ padding : theme . spacing ( 2 ) ,
69+ marginTop : theme . spacing ( 2 ) ,
6570 }
6671} ) ) ;
6772
@@ -175,28 +180,44 @@ function ShareAPI(props) {
175180 defaultMessage = 'Share API'
176181 />
177182 </ Typography >
178- < SharedOrganizations
179- api = { api }
180- organizations = { organizations }
181- visibleOrganizations = { visibleOrganizations }
182- setVisibleOrganizations = { setVisibleOrganizations }
183- selectionMode = { selectionMode }
184- setSelectionMode = { setSelectionMode }
185- />
186- { ( api . gatewayVendor === 'wso2' ) &&
187- (
188- < >
189- { organizations ?. list ?. length > 0 && selectionMode !== "none" &&
190- < OrganizationSubscriptionPoliciesManage
191- api = { api }
192- organizations = { organizations . list }
193- visibleOrganizations = { visibleOrganizations }
194- organizationPolicies = { organizationPolicies }
195- setOrganizationPolicies = { setOrganizationPolicies }
196- selectionMode = { selectionMode }
197- />
198- }
199- </ >
183+ { organizations ?. list ?. length === 0 ? (
184+ < Paper className = { classes . shareAPIPaper } >
185+ < Box display = 'flex' alignItems = 'center' >
186+ < FormLabel component = 'legend' style = { { marginTop : 8 , marginBottom : 8 } } >
187+ < FormattedMessage
188+ id = 'Apis.Details.Configuration.components.Share.API.no.organizations'
189+ defaultMessage = 'No organizations are currently registered under your current organization to share the API.'
190+ />
191+ </ FormLabel >
192+ </ Box >
193+ </ Paper >
194+ ) : (
195+ < div >
196+ < SharedOrganizations
197+ api = { api }
198+ organizations = { organizations }
199+ visibleOrganizations = { visibleOrganizations }
200+ setVisibleOrganizations = { setVisibleOrganizations }
201+ selectionMode = { selectionMode }
202+ setSelectionMode = { setSelectionMode }
203+ subValidationDisablingAllowed = { settings . allowSubscriptionValidationDisabling }
204+ />
205+ { ( api . gatewayVendor === 'wso2' ) &&
206+ (
207+ < >
208+ { organizations ?. list ?. length > 0 && selectionMode !== "none" &&
209+ < OrganizationSubscriptionPoliciesManage
210+ api = { api }
211+ organizations = { organizations . list }
212+ visibleOrganizations = { visibleOrganizations }
213+ organizationPolicies = { organizationPolicies }
214+ setOrganizationPolicies = { setOrganizationPolicies }
215+ selectionMode = { selectionMode }
216+ />
217+ }
218+ </ >
219+ ) }
220+ </ div >
200221 ) }
201222 { ( api . gatewayVendor === 'wso2' ) && (
202223 < Grid
@@ -211,7 +232,7 @@ function ShareAPI(props) {
211232 type = 'submit'
212233 variant = 'contained'
213234 color = 'primary'
214- disabled = { updateInProgress || api . isRevision
235+ disabled = { organizations ?. list ?. length === 0 || updateInProgress || api . isRevision
215236 || isRestricted ( [ 'apim:api_create' , 'apim:api_publish' ] , api ) }
216237 onClick = { ( ) => handleShareAPISave ( ) }
217238 id = 'share-api-save-btn'
0 commit comments