• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

microsoft / BotFramework-Composer / 9116370224

16 May 2024 05:08PM CUT coverage: 54.421%. Remained the same
9116370224

push

github

web-flow
fix: Error when loading exported bot (#9587)

* Update c# runtimes to use the .csproj name

* Update yarn-berry.lock files

* Fix hash

---------

Co-authored-by: Joel Mut <joel.mut@southworks.com>
Co-authored-by: Eugene <EOlonov@gmail.com>

7577 of 18339 branches covered (41.32%)

Branch coverage included in aggregate %.

0 of 1 new or added line in 1 file covered. (0.0%)

19745 of 31866 relevant lines covered (61.96%)

26.54 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/Composer/packages/adaptive-form/src/components/AdaptiveForm.tsx
1
// Copyright (c) Microsoft Corporation.
2
// Licensed under the MIT License.
3

4
/** @jsx jsx */
5
import { jsx, css } from '@emotion/react';
×
6
import React from 'react';
×
7
import { FormErrors, JSONSchema7, UIOptions } from '@bfc/extension-client';
8
import ErrorBoundary from 'react-error-boundary';
×
9
import formatMessage from 'format-message';
×
10
import { FontSizes } from '@fluentui/theme';
×
11

12
import AdaptiveFormContext from '../AdaptiveFormContext';
×
13

14
import { SchemaField } from './SchemaField';
×
15
import FormTitle from './FormTitle';
×
16
import ErrorInfo from './ErrorInfo';
×
17
import { LoadingTimeout } from './LoadingTimeout';
×
18

19
export interface AdaptiveFormProps {
20
  errors?: string | FormErrors | string[] | FormErrors[];
21
  schema?: JSONSchema7;
22
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
  formData?: any;
24
  uiOptions: UIOptions;
25
  focusedTab?: string;
26
  onFocusedTab?: (tab: string) => void;
27
  onChange: (value: any) => void;
28
}
29

30
const schemaLoadErrorStyle = css`
31
  display: flex;
32
  align-items: center;
33
  justify-content: center;
34
  height: 100%;
35
  font-size: ${FontSizes.size14};
36
`;
37

38
export const AdaptiveForm: React.FC<AdaptiveFormProps> = function AdaptiveForm(props) {
×
39
  const { errors, focusedTab, formData, schema, uiOptions, onChange, onFocusedTab } = props;
×
40

41
  if (!formData && !schema) {
×
42
    return (
×
43
      <div css={schemaLoadErrorStyle}>
44
        <LoadingTimeout timeout={2000}>
45
          <p>
46
            {formatMessage('{type} could not be loaded', {
47
              type: formData ? formatMessage('Schema') : formatMessage('Dialog data'),
×
48
            })}
49
          </p>
50
        </LoadingTimeout>
51
      </div>
52
    );
53
  }
54

55
  if (schema) {
×
56
    return (
57
      <ErrorBoundary FallbackComponent={ErrorInfo}>
58
        <AdaptiveFormContext.Provider value={{ focusedTab, onFocusedTab, baseSchema: schema }}>
59
          <FormTitle
60
            formData={formData}
61
            id={formData?.$designer?.id || 'unknown'}
×
62
            schema={schema}
63
            uiOptions={uiOptions}
64
            onChange={(newData) => onChange({ ...formData, ...newData })}
×
65
          />
66
          <SchemaField
67
            isRoot
68
            definitions={schema?.definitions}
×
69
            id={formData?.$designer?.id ? `root-${formData?.$designer?.id}` : 'root'}
×
70
            name="root"
71
            rawErrors={errors}
72
            schema={schema}
73
            uiOptions={uiOptions}
74
            value={formData}
75
            onChange={onChange}
76
          />
77
        </AdaptiveFormContext.Provider>
78
      </ErrorBoundary>
79
    );
80
  }
81
  return null;
×
82
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc