diff --git a/src/components/modals/EntityCreatorEditor/EntityCreatorContainer.tsx b/src/components/modals/EntityCreatorEditor/EntityCreatorContainer.tsx index a7659954..7bdeb541 100644 --- a/src/components/modals/EntityCreatorEditor/EntityCreatorContainer.tsx +++ b/src/components/modals/EntityCreatorEditor/EntityCreatorContainer.tsx @@ -1,5 +1,5 @@ /** - * Copyright (c) Microsoft Corporation. All rights reserved. + * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import * as React from 'react' @@ -74,9 +74,15 @@ class Container extends React.Component { constructor(props: Props) { super(props) - this.state = { ...initState, entityTypeVal: CLM.EntityType.LUIS, entityResolverVal: this.NONE_RESOLVER } + this.state = { + ...initState, + entityTypeVal: CLM.EntityType.LUIS, + entityResolverVal: this.NONE_RESOLVER, + } this.staticEntityOptions = this.getStaticEntityOptions(this.props.intl) + this.entityOptions = this.staticEntityOptions this.staticResolverOptions = this.getStaticResolverOptions(this.props.intl) + this.entityOptions = this.staticResolverOptions } getStaticEntityOptions(intl: InjectedIntl): CLDropdownOption[] { @@ -98,18 +104,6 @@ class Container extends React.Component { text: Util.formatMessageId(intl, FM.ENTITYCREATOREDITOR_ENTITYOPTION_ENUM), itemType: OF.DropdownMenuItemType.Normal, style: 'clDropdown--command' - }, - { - key: 'divider', - text: '-', - itemType: OF.DropdownMenuItemType.Divider, - style: 'clDropdown--normal' - }, - { - key: 'Header', - text: 'Pre-Trained', - itemType: OF.DropdownMenuItemType.Header, - style: 'clDropdown--normal' } ] } @@ -150,10 +144,10 @@ class Container extends React.Component { style: 'clDropdown--normal' })) + this.resolverOptions = [...this.staticResolverOptions, ...localePreBuiltOptions] + if (nextProps.entity === null) { - const filteredPreBuiltOptions = localePreBuiltOptions.filter(entityOption => !nextProps.entities.some(e => !e.doNotMemorize && e.entityType === entityOption.key)) - this.entityOptions = [...this.staticEntityOptions, ...filteredPreBuiltOptions] - this.resolverOptions = [...this.staticResolverOptions, ...localePreBuiltOptions] + this.entityOptions = [...this.staticEntityOptions] this.setState({ ...initState, @@ -166,8 +160,7 @@ class Container extends React.Component { enumValues: this.initEnumValues(undefined) }); } else { - this.entityOptions = [...this.staticEntityOptions, ...localePreBuiltOptions] - this.resolverOptions = [...this.staticResolverOptions, ...localePreBuiltOptions] + this.entityOptions = [...this.staticResolverOptions, ...localePreBuiltOptions] const entityType = nextProps.entity.entityType const isPrebuilt = CLM.isPrebuilt(nextProps.entity) const resolverType = nextProps.entity.resolverType === null ? this.NONE_RESOLVER : nextProps.entity.resolverType @@ -381,7 +374,7 @@ class Container extends React.Component { const enumValueObj = enumValuesObjs[index] if (newValue.length > 0) { - // Create new EnumValue if needed + // Create new EnumValue if needed if (!enumValueObj) { enumValuesObjs[index] = { enumValue: newValue } } @@ -545,10 +538,10 @@ class Container extends React.Component { .some(condition => condition.entityId === entity.entityId && condition.valueId === enumValue.enumValueId) - + const usedToSetValue = (a.actionType === CLM.ActionTypes.SET_ENTITY) - && a.entityId === entity.entityId - && a.enumValueId === enumValue.enumValueId + && a.entityId === entity.entityId + && a.enumValueId === enumValue.enumValueId return usedAsCondition || usedToSetValue })