Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update ui for new schema #1775

Merged
merged 2 commits into from
Dec 17, 2019
Merged
Show file tree
Hide file tree
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
Expand Up @@ -36,6 +36,9 @@
"Microsoft.DeleteProperty": {
"title": "Delete a Property"
},
"Microsoft.DeleteProperties": {
"title": "Delete Properties"
},
"Microsoft.EditArray": {
"title": "Edit an Array Property"
},
Expand Down Expand Up @@ -128,6 +131,9 @@
"Microsoft.SetProperty": {
"title": "Set a Property"
},
"Microsoft.setProperties": {
"title": "Set Properties"
},
"Microsoft.SwitchCondition": {
"title": "Branch: Switch"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,14 @@ export const UserInput: React.FC<UserInputProps> = props => {
</div>
{getSchema('outputFormat') && (
<div css={field}>
<SelectWidget
<TextWidget
onChange={onChange('outputFormat')}
schema={getSchema('outputFormat')}
id={idSchema.outputFormat.__id}
value={formData.outputFormat}
label={formatMessage('Output Format')}
formContext={props.formContext}
rawErrors={errorSchema.outputFormat && errorSchema.outputFormat.__errors}
options={{ enumOptions: getOptions(getSchema('outputFormat')) }}
/>
</div>
)}
Expand Down
64 changes: 57 additions & 7 deletions Composer/packages/extensions/obiformeditor/src/schema/uischema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const uiSchema: { [key in SDKTypes]?: UiSchema } = {
options: {
'ui:field': 'CustomObjectField',
},
'ui:order': ['dialog', 'property', '*'],
'ui:order': ['dialog', 'options', 'resultProperty', 'includeActivity', '*'],
},
[SDKTypes.CancelAllDialogs]: {
eventValue: {
Expand All @@ -78,11 +78,6 @@ export const uiSchema: { [key in SDKTypes]?: UiSchema } = {
'ui:field': 'StepsField',
},
},
[SDKTypes.EmitEvent]: {
eventValue: {
'ui:field': 'CustomObjectField',
},
},
[SDKTypes.Foreach]: {
'ui:order': ['itemsProperty', 'actions', '*'],
'ui:hidden': ['actions'],
Expand All @@ -103,6 +98,31 @@ export const uiSchema: { [key in SDKTypes]?: UiSchema } = {
[SDKTypes.IfCondition]: {
'ui:hidden': ['actions', 'elseActions', ...globalHidden],
},
[SDKTypes.SetProperties]: {
assignments: {
'ui:options': {
object: true,
},
items: {
'ui:options': {
hideDescription: true,
inline: true,
},
property: {
'ui:options': {
hideLabel: true,
transparentBorder: true,
},
},
value: {
'ui:options': {
hideLabel: true,
transparentBorder: true,
},
},
},
},
},
[SDKTypes.OnActivity]: {
...triggerUiSchema,
},
Expand Down Expand Up @@ -177,7 +197,29 @@ export const uiSchema: { [key in SDKTypes]?: UiSchema } = {
'ui:order': ['connectionName', '*'],
},
[SDKTypes.QnAMakerDialog]: {
'ui:hidden': ['strictFilters'],
strictFilters: {
'ui:options': {
object: true,
},
items: {
'ui:options': {
hideDescription: true,
inline: true,
},
name: {
'ui:options': {
hideLabel: true,
transparentBorder: true,
},
},
value: {
'ui:options': {
hideLabel: true,
transparentBorder: true,
},
},
},
},
},
[SDKTypes.ReplaceDialog]: {
dialog: {
Expand All @@ -187,6 +229,14 @@ export const uiSchema: { [key in SDKTypes]?: UiSchema } = {
'ui:field': 'CustomObjectField',
},
'ui:hidden': [...globalHidden],
'ui:order': ['dialog', 'options', 'includeActivity', '*'],
},
[SDKTypes.RepeatDialog]: {
options: {
'ui:field': 'CustomObjectField',
},
'ui:hidden': [...globalHidden],
'ui:order': ['options', 'includeActivity', '*'],
},
[SDKTypes.SwitchCondition]: {
cases: {
Expand Down
139 changes: 131 additions & 8 deletions Composer/packages/lib/shared/src/appschema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,13 @@ export const appschema: OBISchema = {
description: 'One or more options that are passed to the dialog that is called.',
additionalProperties: true,
},
includeActivity: {
type: 'boolean',
title: 'Include Activity',
description: 'When set to true, dialog that is called can process the current activity.',
default: false,
examples: [false],
},
resultProperty: {
$role: 'expression',
title: 'Property',
Expand Down Expand Up @@ -610,6 +617,12 @@ export const appschema: OBISchema = {
default: 'true',
examples: ['true'],
},
outputFormat: {
$role: 'expression',
type: 'string',
title: 'Output format',
description: 'confirm output format.',
},
defaultLocale: {
type: 'string',
title: 'Default Locale',
Expand Down Expand Up @@ -806,6 +819,12 @@ export const appschema: OBISchema = {
default: 'true',
examples: ['true'],
},
outputFormat: {
$role: 'expression',
type: 'string',
title: 'Output format',
description: 'Date time output format.',
},
defaultLocale: {
type: 'string',
title: 'Default locale',
Expand Down Expand Up @@ -838,6 +857,26 @@ export const appschema: OBISchema = {
},
},
},
'Microsoft.DeleteProperties': {
$role: 'unionType(Microsoft.IDialog)',
title: 'Delete Properties',
description: 'Delete multiple properties and any value it holds.',
type: 'object',
properties: {
...$properties(SDKTypes.SetProperties),
properties: {
type: 'array',
title: 'Properties',
description: 'Properties to delete.',
items: {
$role: 'expression',
title: 'Property',
description: 'Property to delete.',
type: 'string',
},
},
},
},
'Microsoft.DimensionEntityRecognizer': {
$role: 'unionType(Microsoft.EntityRecognizers)',
title: 'Dimension Entity Recognizer',
Expand Down Expand Up @@ -949,10 +988,10 @@ export const appschema: OBISchema = {
// ],
},
eventValue: {
type: 'object',
$role: 'expression',
type: 'string',
title: 'Event value',
description: 'Value to emit with the event (optional).',
additionalProperties: true,
},
bubbleEvent: {
type: 'boolean',
Expand Down Expand Up @@ -1291,6 +1330,16 @@ export const appschema: OBISchema = {
description: 'Delete a property and any value it holds.',
$ref: '#/definitions/Microsoft.DeleteProperty',
},
{
title: 'Microsoft.DeleteProperty',
description: 'Delete a property and any value it holds.',
$ref: '#/definitions/Microsoft.DeleteProperty',
},
{
title: 'Microsoft.DeleteProperties',
description: 'Delete multiple properties and any value it holds.',
$ref: '#/definitions/Microsoft.DeleteProperties',
},
{
title: 'Microsoft.EditActions',
description: 'Edit the current list of actions.',
Expand Down Expand Up @@ -1382,6 +1431,11 @@ export const appschema: OBISchema = {
description: 'Set property to a value.',
$ref: '#/definitions/Microsoft.SetProperty',
},
{
title: 'Microsoft.SetProperties',
description: 'Set one or more property values.',
$ref: '#/definitions/Microsoft.SetProperties',
},
{
title: 'Microsoft.SwitchCondition',
description: 'Execute different actions based on the value of a property.',
Expand Down Expand Up @@ -1865,11 +1919,10 @@ export const appschema: OBISchema = {
examples: ['true'],
},
outputFormat: {
$role: 'expression',
type: 'string',
enum: ['float', 'integer'],
title: 'Output format',
description: 'Number output format.',
default: 'float',
},
defaultLocale: {
type: 'string',
Expand Down Expand Up @@ -2543,12 +2596,30 @@ export const appschema: OBISchema = {
},
strictFilters: {
type: 'array',
title: 'Strict Filter Property',
description: 'Memory property that holds strict filters to use when calling the QnA Maker KB.',
title: 'Strict Filters',
description: 'Metadata filters to use when calling the QnA Maker KB.',
items: {
type: 'object',
properties: {
name: {
type: 'string',
title: 'Name',
maximum: 100,
},
value: {
type: 'string',
title: 'Value',
maximum: 100,
},
},
},
},
top: {
type: 'number',
title: 'Top',
description: 'The number of answers you want to retrieve.',
default: 3,
},
},
},
'Microsoft.RandomSelector': {
Expand Down Expand Up @@ -2627,6 +2698,19 @@ export const appschema: OBISchema = {
description: 'Repeat current dialog.',
properties: {
...$properties(SDKTypes.RepeatDialog),
options: {
type: 'object',
title: 'Options',
description: 'One or more options that are passed to the dialog that is called.',
additionalProperties: true,
},
includeActivity: {
type: 'boolean',
title: 'Include Activity',
description: 'When set to true, dialog that is called can process the current activity.',
default: false,
examples: [false],
},
},
},
'Microsoft.ReplaceDialog': {
Expand All @@ -2648,6 +2732,13 @@ export const appschema: OBISchema = {
description: 'One or more options that are passed to the dialog that is called.',
additionalProperties: true,
},
includeActivity: {
type: 'boolean',
title: 'Include Activity',
description: 'When set to true, dialog that is called can process the current activity.',
default: false,
examples: [false],
},
},
},
'Microsoft.SendActivity': {
Expand Down Expand Up @@ -2688,6 +2779,39 @@ export const appschema: OBISchema = {
},
},
},
'Microsoft.SetProperties': {
$role: 'unionType(Microsoft.IDialog)',
title: 'Set properties',
description: 'Set one or more property values.',
type: 'object',
properties: {
...$properties(SDKTypes.SetProperties),
assignments: {
type: 'array',
title: 'Assignments',
description: 'Property value assignments to set.',
items: {
type: 'object',
properties: {
property: {
$role: 'expression',
title: 'Property',
description: 'Property (named location to store information).',
examples: ['user.age'],
type: 'string',
},
value: {
$role: 'expression',
title: 'Value',
description: 'New value or expression.',
examples: ['"milk"', 'dialog.favColor', 'dialog.favColor == "red"'],
type: 'string',
},
},
},
},
},
},
'Microsoft.StaticActivityTemplate': {
$role: 'unionType(Microsoft.IActivityTemplate)',
title: 'Microsoft Static Activity Template',
Expand Down Expand Up @@ -2864,11 +2988,10 @@ export const appschema: OBISchema = {
examples: ['true'],
},
outputFormat: {
$role: 'expression',
type: 'string',
enum: ['none', 'trim', 'lowercase', 'uppercase'],
title: 'Output format',
description: 'Format of output.',
default: 'none',
},
},
},
Expand Down
6 changes: 6 additions & 0 deletions Composer/packages/lib/shared/src/labelMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export const ConceptLabels: { [key in ConceptLabelKey]?: LabelOverride } = {
[SDKTypes.DeleteProperty]: {
title: formatMessage('Delete a property'),
},
[SDKTypes.DeleteProperties]: {
title: formatMessage('Delete properties'),
},
[SDKTypes.EditActions]: {
title: formatMessage('Modify this dialog'),
},
Expand Down Expand Up @@ -221,6 +224,9 @@ export const ConceptLabels: { [key in ConceptLabelKey]?: LabelOverride } = {
[SDKTypes.SetProperty]: {
title: formatMessage('Set a property'),
},
[SDKTypes.SetProperties]: {
title: formatMessage('Set properties'),
},
[SDKTypes.SwitchCondition]: {
title: formatMessage('Branch: switch (multiple options)'),
},
Expand Down
Loading