File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/components/PushAudienceDialog Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ export default class PushAudienceDialog extends React.Component {
5555 audienceName : '' ,
5656 audienceSize : undefined ,
5757 approximate : false ,
58+ errorMessage : undefined ,
5859 } ;
5960 }
6061
@@ -91,6 +92,10 @@ export default class PushAudienceDialog extends React.Component {
9192 }
9293
9394 handleAddCondition ( ) {
95+ if ( ! this . props . schema || ! Object . keys ( this . props . schema ) . length ) {
96+ this . setState ( { errorMessage : 'You first need to create the Installation class before adding conditions to an audience.' } ) ;
97+ return ;
98+ }
9499 let available = Filters . availableFilters ( this . props . schema , this . state . filters ) ;
95100 let field = Object . keys ( available ) [ 0 ] ;
96101 this . setState ( ( { filters } ) => ( {
@@ -258,9 +263,9 @@ export default class PushAudienceDialog extends React.Component {
258263 </ div >
259264 { futureUseSegment }
260265 < FormNote
261- show = { Boolean ( this . props . errorMessage && this . props . errorMessage . length > 0 ) }
266+ show = { Boolean ( ( this . props . errorMessage && this . props . errorMessage . length > 0 ) || ( this . state . errorMessage && this . state . errorMessage . length > 0 ) ) }
262267 color = 'red' >
263- { this . props . errorMessage }
268+ { this . props . errorMessage || this . state . errorMessage }
264269 </ FormNote >
265270 </ Modal >
266271 ) ;
You can’t perform that action at this time.
0 commit comments