Skip to content

Commit 00c8d09

Browse files
committed
Merge branch 'main' into publish/refactor-wave1
* main: (22 commits) fix: Added missing dependencies to /types and /extensions packages. (#4436) fix: Updated publish extensions to use updated APIs (#5346) docs: Supported/Recommended OS Documentation (#5330) chore: suppress/fix lgtm alerts (#4678) v1.3.0 release: update changelog release: update changelog github user map RC5 (#5327) fix: security analysis failed because of [email protected] (#5326) fix: undo failed after click create trigger and remove trigger (#5325) fix: LG diagnostics mismatch by update reference in cache (#5323) fix: Start panel open on start/restart operation (#5322) fix sentence wrap bug (#5310) fix: use dropdown for LUIS region in skill bot settings (#5318) chore: Updated to latest lib (#5316) feat: provisioning in app (#4221) surface dotnet build error on runtime (#5314) fix: runtime throw exception when there is no cosmosdb config (#5313) chore: Remove onnxruntime.pdb from Publishing (#5291) fix UX bug in setting page (#5306) ...
2 parents c85045b + 4fff914 commit 00c8d09

File tree

171 files changed

+15396
-7501
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+15396
-7501
lines changed

Composer/cypress/integration/Publish.spec.ts

Lines changed: 0 additions & 63 deletions
This file was deleted.

Composer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,4 @@
126126
"wait-on": "^5.2.0",
127127
"wsrun": "^5.2.0"
128128
}
129-
}
129+
}

Composer/packages/adaptive-flow/demo/src/components/json-block/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export class JsonBlock extends Component {
3838

3939
onReset() {
4040
this.setState({
41+
// lgtm [js/react/inconsistent-state-update]
4142
displayedText: JSON.stringify(this.state.defaultValue, null, '\t'),
4243
});
4344
}

Composer/packages/adaptive-flow/demo/src/stories/EventsEditorDemo.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ const defaultFile = sampleFileNames[1];
1414

1515
const getEventData = (obiJson) => transformRootDialog(obiJson).ruleGroup;
1616

17-
export class EventsEditorDemo extends Component {
17+
// prettier-ignore
18+
export class EventsEditorDemo extends Component { // lgtm [js/react/unused-or-undefined-state-property]
1819
state = {
1920
selectedFile: defaultFile,
2021
data: getEventData(ObiExamples[defaultFile]),
@@ -42,7 +43,8 @@ export class EventsEditorDemo extends Component {
4243

4344
onFocus(id) {
4445
console.log('focus node', id);
45-
this.setState({
46+
// prettier-ignore
47+
this.setState({ // lgtm [js/react/inconsistent-state-update]
4648
focusPath: this.state.selectedFile + id,
4749
data: getEventData(this.state.data),
4850
});

Composer/packages/adaptive-flow/demo/src/stories/StepEditorDemo.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ const copyJson = (json) => JSON.parse(JSON.stringify(json));
1717

1818
const getStepData = (obiJson) => transformObiRules(obiJson.events[0]).stepGroup;
1919

20-
export class StepEditorDemo extends Component {
20+
// prettier-ignore
21+
export class StepEditorDemo extends Component { // lgtm [js/react/unused-or-undefined-state-property]
2122
state = {
2223
selectedFile: defaultFile,
2324
stepData: getStepData(ObiExamples[defaultFile]),
@@ -45,7 +46,8 @@ export class StepEditorDemo extends Component {
4546

4647
onFocus(id) {
4748
console.log('focus node', id);
48-
this.setState({
49+
// prettier-ignore
50+
this.setState({ // lgtm [js/react/inconsistent-state-update]
4951
focusPath: this.state.selectedFile + id,
5052
stepData: getStepData(copyJson(this.state.stepData)),
5153
});

Composer/packages/adaptive-flow/demo/src/stories/VisualSDKDemo.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ export class VisualSDKDemo extends Component {
3333
}
3434

3535
insertActionPreview($kind) {
36-
this.setState({
36+
// prettier-ignore
37+
this.setState({ // lgtm [js/react/inconsistent-state-update]
3738
actions: [this.factory.create($kind), ...this.state.actions],
3839
});
3940
}

Composer/packages/adaptive-flow/src/adaptive-flow-editor/utils/cursorTracker/calculate/calculateBySchema.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ function handleSwitchCasePrevMoveFilter(
123123
elements: SelectorElement[]
124124
): SelectorElement[] {
125125
const currentElementSelectors = parseSelector(transformDefaultBranch(currentElement.selectedId)) as string[];
126-
let candidateElements = elements;
127126
let swicthPosition = -1;
128127
swicthPosition = currentElementSelectors.lastIndexOf('cases');
129128
const samePath = currentElementSelectors.slice(0, swicthPosition).join('.');
@@ -142,7 +141,7 @@ function handleSwitchCasePrevMoveFilter(
142141
});
143142
const minSwitchCasesElement = parseSelector(transformDefaultBranch(sortedElement[0].selectedId)) as string[];
144143
const minSwitchCasesIndex = Number(minSwitchCasesElement[swicthPosition + 1]);
145-
candidateElements = elements.filter((ele) => {
144+
const candidateElements = elements.filter((ele) => {
146145
const eleSelectors = parseSelector(transformDefaultBranch(ele.selectedId)) as string[];
147146
return Number(eleSelectors[swicthPosition + 1]) === minSwitchCasesIndex;
148147
});
@@ -151,7 +150,6 @@ function handleSwitchCasePrevMoveFilter(
151150

152151
function handleSwitchCaseNextMoveFilter(currentElement: SelectorElement, elements: SelectorElement[]) {
153152
const currentElementSelectors = parseSelector(transformDefaultBranch(currentElement.selectedId)) as string[];
154-
let candidateElements = elements;
155153
let swicthPosition = -1;
156154
if (currentElementSelectors.lastIndexOf('default') > currentElementSelectors.lastIndexOf('cases')) {
157155
swicthPosition = currentElementSelectors.lastIndexOf('default');
@@ -174,7 +172,7 @@ function handleSwitchCaseNextMoveFilter(currentElement: SelectorElement, element
174172
});
175173
const minSwitchCasesElement = parseSelector(transformDefaultBranch(sortedElement[0].selectedId)) as string[];
176174
const minSwitchCasesIndex = Number(minSwitchCasesElement[swicthPosition + 1]);
177-
candidateElements = elements.filter((ele) => {
175+
const candidateElements = elements.filter((ele) => {
178176
const eleSelectors = parseSelector(transformDefaultBranch(ele.selectedId)) as string[];
179177
return Number(eleSelectors[swicthPosition + 1]) === minSwitchCasesIndex;
180178
});

Composer/packages/adaptive-flow/src/adaptive-flow-editor/utils/cursorTracker/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function moveCursor(
1515
): { [key: string]: string | undefined } {
1616
const currentElement = selectableElements.find((element) => element.selectedId === id || element.focusedId === id);
1717
if (!currentElement) return { selected: id, focused: undefined };
18-
let element: SelectorElement = currentElement;
18+
let element: SelectorElement;
1919

2020
// tab move or arrow move
2121
switch (command) {

Composer/packages/adaptive-flow/src/adaptive-flow-editor/utils/cursorTracker/locateElement.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ export function locateNearestElement(
1919
filterAttrs?: string[]
2020
): SelectorElement {
2121
// Get elements that meet the filter criteria
22-
let elementArr = elements.filter(
23-
(element) => !filterAttrs || (filterAttrs && filterAttrs.find((key) => !!element[key]))
24-
);
22+
let elementArr = elements.filter((element) => !filterAttrs || filterAttrs.find((key) => !!element[key]));
2523

2624
elementArr = filterPromptElementsBySchema(currentElement, elementArr, direction);
2725
elementArr = filterElementsByVector(currentElement, elementArr, direction);

Composer/packages/client/__tests__/pages/publish/Publish.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const rootState = {
4747
status: true,
4848
rollback: true,
4949
pull: true,
50+
provision: true,
5051
},
5152
},
5253
],

Composer/packages/client/config/env.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,12 @@ function getClientEnvironment(publicUrl) {
8888
PUBLIC_URL: publicUrl,
8989
GIT_SHA: getGitSha().toString().replace('\n', ''),
9090
SDK_PACKAGE_VERSION: '4.11.0', // TODO: change this when Composer supports custom schema/custom runtime
91-
COMPOSER_VERSION: '1.3.0-rc4',
91+
COMPOSER_VERSION: '1.3.0',
9292
LOCAL_PUBLISH_PATH:
9393
process.env.LOCAL_PUBLISH_PATH || path.resolve(process.cwd(), '../../../extensions/localPublish/hostedBots'),
94+
WEBLOGIN_CLIENTID: process.env.WEBLOGIN_CLIENTID,
95+
WEBLOGIN_TENANTID: process.env.WEBLOGIN_TENANTID,
96+
WEBLOGIN_REDIRECTURL: process.env.WEBLOGIN_REDIRECTURL,
9497
}
9598
);
9699
// Stringify all values so we can feed into Webpack DefinePlugin

Composer/packages/client/config/paths.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
14
'use strict';
25

36
const path = require('path');
@@ -16,6 +19,7 @@ function ensureSlash(inputPath, needsSlash) {
1619
if (hasSlash && !needsSlash) {
1720
return inputPath.substr(0, inputPath.length - 1);
1821
} else if (!hasSlash && needsSlash) {
22+
// lgtm [js/trivial-conditional]
1923
return `${inputPath}/`;
2024
} else {
2125
return inputPath;

Composer/packages/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"@bfc/form-dialogs": "*",
2626
"@bfc/indexers": "*",
2727
"@bfc/shared": "*",
28-
"@bfc/ui-shared": "*",
2928
"@bfc/ui-plugin-composer": "*",
3029
"@bfc/ui-plugin-cross-trained": "*",
3130
"@bfc/ui-plugin-dialog-schema-editor": "*",
@@ -47,6 +46,7 @@
4746
"format-message": "^6.2.3",
4847
"format-message-generate-id": "^6.2.3",
4948
"immer": "^5.2.0",
49+
"jsonwebtoken": "^8.5.1",
5050
"jwt-decode": "^2.2.0",
5151
"lodash": "^4.17.19",
5252
"office-ui-fabric-react": "^7.121.11",

Composer/packages/client/setupProxy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const proxySetting = require(paths.appPackageJson).proxy;
55

66
module.exports = function (app) {
77
const wsProxy = proxy(['/lg-language-server', '/lu-language-server', '/intellisense-language-server'], {
8-
target: proxySetting.replace('/^http/', 'ws'),
8+
target: proxySetting.replace(/^http/, 'ws'),
99
changeOrigin: true,
1010
ws: true,
1111
});
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
/** @jsx jsx */
5+
import { jsx } from '@emotion/core';
6+
import { DialogWrapper, DialogTypes } from '@bfc/ui-shared';
7+
import formatMessage from 'format-message';
8+
import { DialogFooter } from 'office-ui-fabric-react/lib/Dialog';
9+
import { PrimaryButton, DefaultButton } from 'office-ui-fabric-react/lib/Button';
10+
import { TextField } from 'office-ui-fabric-react/lib/TextField';
11+
import { useCallback, useState } from 'react';
12+
13+
import storage from '../../utils/storage';
14+
import { isTokenExpired } from '../../utils/auth';
15+
16+
export interface AuthDialogProps {
17+
needGraph: boolean;
18+
onDismiss: () => void;
19+
next: () => void;
20+
}
21+
export const AuthDialog: React.FC<AuthDialogProps> = (props) => {
22+
const [graphToken, setGraphToken] = useState('');
23+
const [accessToken, setAccessToken] = useState('');
24+
const [tokenError, setTokenError] = useState<string>('');
25+
const [graphError, setGraphError] = useState<string>('');
26+
const isAble = useCallback(() => {
27+
if (!accessToken) {
28+
return false;
29+
} else if (tokenError) {
30+
return false;
31+
}
32+
33+
if (props.needGraph && (!graphToken || graphError)) {
34+
return false;
35+
}
36+
return true;
37+
}, [accessToken, graphToken]);
38+
39+
return (
40+
<DialogWrapper
41+
isBlocking
42+
isOpen
43+
dialogType={DialogTypes.CreateFlow}
44+
subText={formatMessage(
45+
'To perform provisioning and publishing actions, Composer requires access to your Azure and MS Graph accounts. Paste access tokens from the az command line tool using the commands highlighted below.'
46+
)}
47+
title={formatMessage('Provide access tokens')}
48+
onDismiss={props.onDismiss}
49+
>
50+
<TextField
51+
multiline
52+
errorMessage={tokenError}
53+
label={formatMessage('Provide ARM token by running `az account get-access-token`')}
54+
placeholder={formatMessage('Paste token here')}
55+
rows={4}
56+
onChange={(event, newValue) => {
57+
newValue && setAccessToken(newValue);
58+
if (isTokenExpired(newValue || '')) {
59+
setTokenError('Token Expire or token invalid');
60+
} else {
61+
setTokenError('');
62+
}
63+
}}
64+
/>
65+
{props.needGraph ? (
66+
<TextField
67+
multiline
68+
errorMessage={graphError}
69+
label={formatMessage(
70+
'Provide graph token by running `az account get-access-token --resource-type ms-graph`'
71+
)}
72+
placeholder={formatMessage('Paste token here')}
73+
rows={4}
74+
onChange={(event, newValue) => {
75+
newValue && setGraphToken(newValue);
76+
if (isTokenExpired(newValue || '')) {
77+
setGraphError('Token Expire or token invalid');
78+
} else {
79+
setGraphError('');
80+
}
81+
}}
82+
/>
83+
) : null}
84+
<DialogFooter>
85+
<DefaultButton text={formatMessage('Cancel')} onClick={props.onDismiss} />
86+
<PrimaryButton
87+
disabled={!isAble()}
88+
text={formatMessage('Continue')}
89+
onClick={() => {
90+
props.onDismiss();
91+
// cache tokens
92+
storage.set('accessToken', accessToken);
93+
storage.set('graphToken', graphToken);
94+
props.next();
95+
}}
96+
/>
97+
</DialogFooter>
98+
</DialogWrapper>
99+
);
100+
};

0 commit comments

Comments
 (0)