Skip to content

Commit

Permalink
Merge branch 'beyackle/addAriaRegions' of https://github.com/microsof…
Browse files Browse the repository at this point in the history
…t/BotFramework-Composer into beyackle/addAriaRegions
  • Loading branch information
beyackle committed May 7, 2020
2 parents 924ee75 + 6405ad1 commit d00f750
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import formatMessage from 'format-message';
import React from 'react';
import get from 'lodash/get';
import { FlowSchema, FlowWidget } from '@bfc/extension';
import { FixedInfo, SingleLineDiv, ListOverview } from '@bfc/ui-shared';
import { FixedInfo, SingleLineDiv, ListOverview, PropertyAssignment } from '@bfc/ui-shared';

import { ObiColors } from '../constants/ElementColors';

Expand Down Expand Up @@ -130,23 +130,15 @@ export const defaultFlowSchema: FlowSchema = {
},
[SDKKinds.SetProperty]: {
widget: 'ActionCard',
body: data => `${data.property || '?'} : ${data.value || '?'}`,
body: data => <PropertyAssignment property={data.property} value={data.value} />,
},
[SDKKinds.SetProperties]: {
widget: 'ActionCard',
body: data => (
<ListOverview
items={data.assignments}
itemPadding={8}
renderItem={({ property, value }) => {
const v = typeof value === 'object' ? JSON.stringify(value) : value;
const content = `${property} : ${v}`;
return (
<SingleLineDiv height={16} title={content}>
{content}
</SingleLineDiv>
);
}}
renderItem={({ property, value }) => <PropertyAssignment property={property} value={value} />}
/>
),
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import React, { FC } from 'react';

import { SingleLineDiv } from '../styled';

type Expression = string;
type AssignmentValue = string | number | boolean | Expression | object | any[];

export interface PropertyAssignmentProps {
property: string;
value?: AssignmentValue;
}

const AssignmentOpt = ':';
const NullValuePlaceholder = '?';

const serializeAssignmentValue = (value?: AssignmentValue): string | number | boolean => {
if (typeof value === 'object') {
return JSON.stringify(value);
}
return value ?? NullValuePlaceholder;
};

export const PropertyAssignment: FC<PropertyAssignmentProps> = ({ property, value }) => {
const valueStr = serializeAssignmentValue(value);
const content = `${property} ${AssignmentOpt} ${valueStr}`;
return (
<SingleLineDiv height={16} title={content}>
{content}
</SingleLineDiv>
);
};
1 change: 1 addition & 0 deletions Composer/packages/lib/ui-shared/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
// Licensed under the MIT License.

export * from './ListOverview';
export * from './PropertyAssignment';
2 changes: 1 addition & 1 deletion Composer/plugins/localPublish/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class LocalPublisher implements PublishPlugin<PublishConfig> {

private getManifestSrcDir = (srcDir: string) => path.resolve(srcDir, 'manifests');

private getManifestDstDir = (botId: string) => path.resolve(this.getBotRuntimeDir(botId), 'wwwroot', 'manifests');
private getManifestDstDir = (botId: string) => path.resolve(this.getBotRuntimeDir(botId), 'azurewebapp', 'wwwroot', 'manifests');

private getDownloadPath = (botId: string, version: string) =>
path.resolve(this.getHistoryDir(botId), `${version}.zip`);
Expand Down

0 comments on commit d00f750

Please sign in to comment.