@@ -66,14 +66,26 @@ const styles = {
66
66
const getVariantName = (
67
67
eventBasedObject : gdEventsBasedObject | null ,
68
68
customObjectConfiguration : gdCustomObjectConfiguration
69
- ) =>
69
+ ) : string =>
70
70
eventBasedObject &&
71
71
eventBasedObject
72
72
. getVariants ( )
73
73
. hasVariantNamed ( customObjectConfiguration . getVariantName ( ) )
74
74
? customObjectConfiguration . getVariantName ( )
75
75
: '' ;
76
76
77
+ const getVariant = (
78
+ eventBasedObject : gdEventsBasedObject ,
79
+ customObjectConfiguration : gdCustomObjectConfiguration
80
+ ) : gdEventsBasedObjectVariant => {
81
+ const variantName = getVariantName ( eventBasedObject , customObjectConfiguration ) ;
82
+ const variants = eventBasedObject . getVariants ( ) ;
83
+ return variantName
84
+ ? variants . getVariant ( variantName )
85
+ : eventBasedObject . getDefaultVariant ( ) ;
86
+ }
87
+
88
+
77
89
type Props = EditorProps ;
78
90
79
91
const CustomObjectPropertiesEditor = ( props : Props ) => {
@@ -229,6 +241,7 @@ const CustomObjectPropertiesEditor = (props: Props) => {
229
241
project
230
242
) ;
231
243
newVariant . setName ( uniqueNewName ) ;
244
+ newVariant . setAssetStoreId ( '' ) ;
232
245
customObjectConfiguration . setVariantName ( uniqueNewName ) ;
233
246
setNewVariantDialogOpen ( false ) ;
234
247
forceUpdate ( ) ;
@@ -330,6 +343,12 @@ const CustomObjectPropertiesEditor = (props: Props) => {
330
343
< FlatButton
331
344
label = { < Trans > Edit</ Trans > }
332
345
onClick = { editVariant }
346
+ disabled = {
347
+ ! eventBasedObject || getVariant (
348
+ eventBasedObject ,
349
+ customObjectConfiguration
350
+ ) . getAssetStoreId ( ) !== ''
351
+ }
333
352
/>
334
353
< FlatButton
335
354
label = { < Trans > Duplicate</ Trans > }
0 commit comments