Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -74,9 +74,15 @@ class Container extends React.Component<Props, ComponentState> {

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[] {
Expand All @@ -98,18 +104,6 @@ class Container extends React.Component<Props, ComponentState> {
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'
}
]
}
Expand Down Expand Up @@ -150,10 +144,10 @@ class Container extends React.Component<Props, ComponentState> {
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,
Expand All @@ -166,8 +160,7 @@ class Container extends React.Component<Props, ComponentState> {
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
Expand Down Expand Up @@ -381,7 +374,7 @@ class Container extends React.Component<Props, ComponentState> {
const enumValueObj = enumValuesObjs[index]

if (newValue.length > 0) {
// Create new EnumValue if needed
// Create new EnumValue if needed
if (!enumValueObj) {
enumValuesObjs[index] = { enumValue: newValue }
}
Expand Down Expand Up @@ -545,10 +538,10 @@ class Container extends React.Component<Props, ComponentState> {
.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
})
Expand Down