@@ -33,8 +33,8 @@ import { filterProductsByBandwidth } from "validations/Products";
33
33
import { subscriptionFieldStyling } from "./SubscriptionFieldStyling" ;
34
34
35
35
export function makeLabel ( subscription : iSubscription , products : Product [ ] , organisations ?: Organization [ ] ) {
36
- const organisation = organisations && organisations . find ( ( org ) => org . uuid === subscription . customer_id ) ;
37
- const organisationName = organisation ? organisation . name : subscription . customer_id . substring ( 0 , 8 ) ;
36
+ const customer = organisations && organisations . find ( ( org ) => org . uuid === subscription . customer_id ) ;
37
+ const customerName = customer ? customer . name : subscription . customer_id . substring ( 0 , 8 ) ;
38
38
const product = subscription . product || productById ( subscription . product_id ! , products ) ;
39
39
const description =
40
40
subscription . description || intl . formatMessage ( { id : "forms.widgets.subscription.missingDescription" } ) ;
@@ -47,7 +47,7 @@ export function makeLabel(subscription: iSubscription, products: Product[], orga
47
47
} else if ( [ "SP" , "SPNL" , "AGGSP" , "AGGSPNL" , "MSC" , "MSCNL" , "IRBSP" ] . includes ( product . tag ) ) {
48
48
let portSubscription = subscription as ServicePortSubscription ;
49
49
const portMode = getPortMode ( portSubscription , products ) ;
50
- return `${ subscription_substring } ${ portMode . toUpperCase ( ) } ${ description . trim ( ) } ${ organisationName } ` ;
50
+ return `${ subscription_substring } ${ portMode . toUpperCase ( ) } ${ description . trim ( ) } ${ customerName } ` ;
51
51
} else {
52
52
return description . trim ( ) ;
53
53
}
@@ -62,6 +62,8 @@ export function getPortMode(subscription: ServicePortSubscription, products: Pro
62
62
declare module "uniforms" {
63
63
interface FilterDOMProps {
64
64
excludedSubscriptionIds : never ;
65
+ customerId : never ;
66
+ customerKey : never ;
65
67
organisationId : never ;
66
68
organisationKey : never ;
67
69
visiblePortMode : never ;
@@ -74,6 +76,8 @@ declare module "uniforms" {
74
76
filterDOMProps . register (
75
77
"productIds" ,
76
78
"excludedSubscriptionIds" ,
79
+ "customerId" ,
80
+ "customerKey" ,
77
81
"organisationId" ,
78
82
"organisationKey" ,
79
83
"visiblePortMode" ,
@@ -88,6 +92,8 @@ export type SubscriptionFieldProps = FieldProps<
88
92
{
89
93
productIds ?: string [ ] ;
90
94
excludedSubscriptionIds ?: string [ ] ;
95
+ customerId ?: string ;
96
+ customerKey ?: string ;
91
97
organisationId ?: string ;
92
98
organisationKey ?: string ;
93
99
visiblePortMode ?: string ;
@@ -117,6 +123,8 @@ function Subscription({
117
123
className = "" ,
118
124
productIds,
119
125
excludedSubscriptionIds,
126
+ customerId,
127
+ customerKey,
120
128
organisationId,
121
129
organisationKey,
122
130
visiblePortMode = "all" ,
@@ -128,6 +136,13 @@ function Subscription({
128
136
intl,
129
137
...props
130
138
} : SubscriptionFieldProps ) {
139
+ if ( organisationId ) {
140
+ customerId = organisationId ;
141
+ }
142
+ if ( organisationKey ) {
143
+ customerKey = organisationKey ;
144
+ }
145
+
131
146
const { theme, organisations, products : allProducts , apiClient, customApiClient } = useContext ( ApplicationContext ) ;
132
147
const { getSubscriptions, clearSubscriptions } = useContext ( SubscriptionsContext ) ;
133
148
@@ -154,10 +169,8 @@ function Subscription({
154
169
155
170
const usedBandwidth = bandwidth || bandwithFromField ;
156
171
157
- // Get value from org field if organisationKey is set.
158
- const usedOrganisationId = organisationKey
159
- ? get ( model , organisationKey , "nonExistingOrgToFilterEverything" )
160
- : organisationId ;
172
+ // Get value from org field if customerKey is set.
173
+ const usedOrganisationId = customerKey ? get ( model , customerKey , "nonExistingOrgToFilterEverything" ) : customerId ;
161
174
162
175
const filteredProductIds = useMemo ( ( ) => {
163
176
let products = allProducts ;
0 commit comments