@integry/sdk 4.7.39 → 4.7.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.csm.js +1 -1
- package/dist/umd/index.umd.js +1 -1
- package/package.json +6 -1
- package/.eslintignore +0 -1
- package/.vscode/launch.json +0 -17
- package/CHANGELOG_INTERNAL.md +0 -134
- package/README_INTERNAL.md +0 -176
- package/THIRD_PARTY_LICENSES +0 -525
- package/generateTests.js +0 -80
- package/jest.config.cjs +0 -10
- package/src/components/AddTagButton/index.ts +0 -23
- package/src/components/BasicSelect/index.ts +0 -123
- package/src/components/BasicSelect/styles.module.scss +0 -44
- package/src/components/Button/index.ts +0 -97
- package/src/components/Button/styles.module.scss +0 -152
- package/src/components/CheckboxGroup/Checkbox.ts +0 -104
- package/src/components/CheckboxGroup/index.ts +0 -190
- package/src/components/CheckboxGroup/styles.module.scss +0 -63
- package/src/components/CollapsedMenu/index.ts +0 -104
- package/src/components/CollapsedMenu/styles.module.scss +0 -46
- package/src/components/ConfigureFieldWrapper/index.ts +0 -85
- package/src/components/ConfigureFieldWrapper/styles.module.scss +0 -57
- package/src/components/EditableText/index.ts +0 -121
- package/src/components/EditableText/styles.module.scss +0 -38
- package/src/components/EditableTextArea/index.ts +0 -143
- package/src/components/EditableTextArea/styles.module.scss +0 -91
- package/src/components/ErrorMessage/index.ts +0 -16
- package/src/components/ErrorMessage/styles.module.scss +0 -19
- package/src/components/ErrorPage/index.ts +0 -42
- package/src/components/ErrorPage/styles.module.scss +0 -26
- package/src/components/Footer/index.ts +0 -41
- package/src/components/Footer/styles.module.scss +0 -40
- package/src/components/HTMLContent/index.tsx +0 -205
- package/src/components/HTMLContent/styles.module.scss +0 -3
- package/src/components/InfoBox/index.ts +0 -48
- package/src/components/InfoBox/styles.module.scss +0 -21
- package/src/components/Input/BaseInput/index.ts +0 -170
- package/src/components/Input/BaseInput/styles.module.scss +0 -95
- package/src/components/Input/DateInput/index.ts +0 -103
- package/src/components/Input/DateInput/styles.module.scss +0 -50
- package/src/components/Input/Input/index.ts +0 -225
- package/src/components/Input/Input/styles.module.scss +0 -16
- package/src/components/Input/PasswordInput/index.ts +0 -164
- package/src/components/Input/PasswordInput/styles.module.scss +0 -37
- package/src/components/Input/index.ts +0 -7
- package/src/components/Label/index.ts +0 -61
- package/src/components/Label/styles.module.scss +0 -41
- package/src/components/LargeLoader/index.ts +0 -25
- package/src/components/LargeLoader/styles.module.scss +0 -16
- package/src/components/Listbox/ListBoxItem.ts +0 -57
- package/src/components/Listbox/index.ts +0 -488
- package/src/components/Listbox/styles.module.scss +0 -197
- package/src/components/Loader/index.ts +0 -25
- package/src/components/Loader/styles.module.scss +0 -16
- package/src/components/MediaGallery/MediaGalleryModal.ts +0 -82
- package/src/components/MediaGallery/MediaSlider.ts +0 -76
- package/src/components/MediaGallery/index.ts +0 -92
- package/src/components/MediaGallery/styles.module.scss +0 -156
- package/src/components/MediaUpload/index.ts +0 -233
- package/src/components/MediaUpload/styles.module.scss +0 -118
- package/src/components/Modal/index.ts +0 -87
- package/src/components/Modal/styles.module.scss +0 -441
- package/src/components/MultipurposeField/Dropdown/ListBoxItem.tsx +0 -59
- package/src/components/MultipurposeField/Dropdown/index.tsx +0 -1202
- package/src/components/MultipurposeField/Dropdown/styles.module.scss +0 -215
- package/src/components/MultipurposeField/TagMenu/index.ts +0 -536
- package/src/components/MultipurposeField/TagMenu/styles.module.scss +0 -175
- package/src/components/MultipurposeField/TagOptions/index.tsx +0 -83
- package/src/components/MultipurposeField/TagOptions/styles.module.scss +0 -95
- package/src/components/MultipurposeField/index.tsx +0 -944
- package/src/components/MultipurposeField/styles.module.scss +0 -77
- package/src/components/NewModal/index.ts +0 -69
- package/src/components/NewModal/styles.module.scss +0 -70
- package/src/components/OverflowTooltip/index.tsx +0 -59
- package/src/components/PopUp/ConfirmationPopUp/index.ts +0 -58
- package/src/components/PopUp/ConfirmationPopUp/styles.module.scss +0 -49
- package/src/components/PopUp/SuccessPopUp/index.ts +0 -62
- package/src/components/PopUp/SuccessPopUp/styles.module.scss +0 -38
- package/src/components/RadioGroup/Radio.ts +0 -128
- package/src/components/RadioGroup/index.ts +0 -169
- package/src/components/RadioGroup/styles.module.scss +0 -81
- package/src/components/Search/index.ts +0 -69
- package/src/components/Search/styles.module.scss +0 -149
- package/src/components/TabBar/Tab.ts +0 -33
- package/src/components/TabBar/index.ts +0 -64
- package/src/components/TabBar/styles.module.scss +0 -43
- package/src/components/Tag/index.ts +0 -29
- package/src/components/Tag/styles.module.scss +0 -57
- package/src/components/TagsMenu/index.ts +0 -1697
- package/src/components/TagsMenu/styles.module.scss +0 -350
- package/src/components/TestComponent/index.ts +0 -71
- package/src/components/TestComponent/styles.module.scss +0 -152
- package/src/components/TextArea/index.ts +0 -172
- package/src/components/TextArea/styles.module.scss +0 -72
- package/src/components/TextContent/index.tsx +0 -128
- package/src/components/TextContent/styles.module.scss +0 -6
- package/src/components/ThreeDotLoader/index.ts +0 -39
- package/src/components/ThreeDotLoader/styles.module.scss +0 -41
- package/src/components/TimeInput/index.ts +0 -129
- package/src/components/TimeInput/styles.module.scss +0 -16
- package/src/components/Toggle/index.ts +0 -34
- package/src/components/Toggle/styles.module.scss +0 -56
- package/src/components/Toggle-v2/index.ts +0 -40
- package/src/components/Toggle-v2/styles.module.scss +0 -86
- package/src/components/Tooltip/index.ts +0 -271
- package/src/components/Tooltip/styles.module.scss +0 -105
- package/src/components/form/FunctionField/index.ts +0 -816
- package/src/components/form/FunctionField/styles.module.scss +0 -478
- package/src/components/form/ObjectField/__snapshots__/index.ts.test.tsx.snap +0 -3
- package/src/components/form/ObjectField/index.ts +0 -593
- package/src/components/form/ObjectField/index.ts.test.tsx +0 -213
- package/src/components/form/ObjectField/styles.module.scss +0 -103
- package/src/components/form/index.ts +0 -4
- package/src/contexts/AppContext.ts +0 -12
- package/src/declaration.d.ts +0 -7
- package/src/extensions/HMAC.ts +0 -25
- package/src/extensions/IntegryAPIError.ts +0 -19
- package/src/features/common/AccountDropdown/index.ts +0 -291
- package/src/features/common/AccountDropdown/styles.module.scss +0 -19
- package/src/features/common/ActionForm/index.ts +0 -2602
- package/src/features/common/ActionForm/styles.module.scss +0 -35
- package/src/features/common/AppCard/index.ts +0 -207
- package/src/features/common/AppCard/styles.module.scss +0 -117
- package/src/features/common/AppCardCompact/index.ts +0 -189
- package/src/features/common/AppCardCompact/styles.module.scss +0 -141
- package/src/features/common/AuthSelector/index.ts +0 -537
- package/src/features/common/AuthSelector/styles.module.scss +0 -161
- package/src/features/common/AuthSelectorCompact/index.ts +0 -706
- package/src/features/common/AuthSelectorCompact/styles.module.scss +0 -219
- package/src/features/common/AuthSelectorDropdown/index.ts +0 -704
- package/src/features/common/AuthSelectorDropdown/styles.module.scss +0 -361
- package/src/features/common/AuthSelectorV2/index.ts +0 -336
- package/src/features/common/AuthSelectorV2/styles.module.scss +0 -235
- package/src/features/common/DynamicField/index.ts +0 -402
- package/src/features/common/DynamicField/styles.module.scss +0 -266
- package/src/features/common/DynamicTypedField/index.ts +0 -504
- package/src/features/common/DynamicTypedField/styles.module.scss +0 -135
- package/src/features/common/FunctionForm/index.ts +0 -1095
- package/src/features/common/FunctionForm/styles.module.scss +0 -225
- package/src/features/common/MappingUI/index.ts +0 -649
- package/src/features/common/MappingUI/styles.module.scss +0 -121
- package/src/features/common/MarketplaceAppCard/index.ts +0 -279
- package/src/features/common/MarketplaceAppCard/styles.module.scss +0 -231
- package/src/features/common/MarketplaceAppCardCompact/index.ts +0 -283
- package/src/features/common/MarketplaceAppCardCompact/styles.module.scss +0 -255
- package/src/features/common/NewMappingUI/index.ts +0 -515
- package/src/features/common/NewMappingUI/styles.module.scss +0 -113
- package/src/features/common/RequestAppWidget/RequestAppModal/index.ts +0 -67
- package/src/features/common/RequestAppWidget/RequestAppModal/styles.module.scss +0 -23
- package/src/features/common/RequestAppWidget/index.ts +0 -48
- package/src/features/common/RequestAppWidget/request-app-form.ts +0 -89
- package/src/features/common/RequestAppWidget/styles.module.scss +0 -43
- package/src/features/common/SectionField/index.ts +0 -272
- package/src/features/common/SectionField/styles.module.scss +0 -67
- package/src/features/common/Step/index.ts +0 -827
- package/src/features/common/Step/styles.module.scss +0 -12
- package/src/features/common/StepNavigation/CollapsedSteps.ts +0 -131
- package/src/features/common/StepNavigation/NavItem.ts +0 -111
- package/src/features/common/StepNavigation/index.ts +0 -261
- package/src/features/common/StepNavigation/styles.module.scss +0 -117
- package/src/features/common/Steps/index.ts +0 -1140
- package/src/features/common/Steps/styles.module.scss +0 -314
- package/src/features/containers/AppFlowContainer/AppFlowListing/compactStyles.module.scss +0 -404
- package/src/features/containers/AppFlowContainer/AppFlowListing/flow-instance.tsx +0 -367
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCard.test.tsx +0 -58
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCard.tsx +0 -208
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCardCompact.test.tsx +0 -49
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCardCompact.tsx +0 -421
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowInstanceCompact.tsx +0 -577
- package/src/features/containers/AppFlowContainer/AppFlowListing/index.tsx +0 -83
- package/src/features/containers/AppFlowContainer/AppFlowListing/styles.module.scss +0 -233
- package/src/features/containers/AppFlowContainer/AppFlowWrap/app-page-loader.tsx +0 -45
- package/src/features/containers/AppFlowContainer/AppFlowWrap/index.tsx +0 -1085
- package/src/features/containers/AppFlowContainer/AppFlowWrap/styles.module.scss +0 -465
- package/src/features/containers/AppFlowContainer/Authentication/index.ts +0 -610
- package/src/features/containers/AppFlowContainer/Authentication/styles.module.scss +0 -468
- package/src/features/containers/AppFlowContainer/index.ts +0 -114
- package/src/features/containers/AppPageContainer/AppPage/index.tsx +0 -262
- package/src/features/containers/AppPageContainer/AppPage/styles.module.scss +0 -120
- package/src/features/containers/AppPageContainer/IntegrationCard/index.ts +0 -165
- package/src/features/containers/AppPageContainer/IntegrationCard/styles.module.scss +0 -81
- package/src/features/containers/AppPageContainer/index.tsx +0 -93
- package/src/features/containers/AppPageContainer/styles.module.scss +0 -0
- package/src/features/containers/AppsForFlows/index.ts +0 -161
- package/src/features/containers/AppsForFlows/styles.module.scss +0 -280
- package/src/features/containers/AppsForFlowsCompact/index.ts +0 -161
- package/src/features/containers/AppsForFlowsCompact/styles.module.scss +0 -279
- package/src/features/containers/AuthSetupContainer/AppSelection.ts +0 -73
- package/src/features/containers/AuthSetupContainer/AuthTypeSelection.ts +0 -67
- package/src/features/containers/AuthSetupContainer/Footer.ts +0 -32
- package/src/features/containers/AuthSetupContainer/Header.ts +0 -39
- package/src/features/containers/AuthSetupContainer/PostAdditionPopup.ts +0 -27
- package/src/features/containers/AuthSetupContainer/index.ts +0 -349
- package/src/features/containers/AuthSetupContainer/styles.module.scss +0 -229
- package/src/features/containers/FlowSetupContainer/index.ts +0 -391
- package/src/features/containers/FlowSetupContainer/styles.module.scss +0 -18
- package/src/features/containers/MarkeplaceApps/index.ts +0 -583
- package/src/features/containers/MarkeplaceApps/styles.module.scss +0 -558
- package/src/features/containers/MarketplaceAppsCompact/index.ts +0 -585
- package/src/features/containers/MarketplaceAppsCompact/styles.module.scss +0 -563
- package/src/features/containers/MarketplaceAppsContainer/index.ts +0 -91
- package/src/features/containers/MarketplaceContainer/AppCard/index.ts +0 -91
- package/src/features/containers/MarketplaceContainer/AppCard/styles.module.scss +0 -66
- package/src/features/containers/MarketplaceContainer/AppListing/index.ts +0 -34
- package/src/features/containers/MarketplaceContainer/AppListing/styles.module.scss +0 -10
- package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/index.ts +0 -132
- package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/styles.module.scss +0 -117
- package/src/features/containers/MarketplaceContainer/index.ts +0 -242
- package/src/features/containers/MarketplaceContainer/styles.module.scss +0 -84
- package/src/features/containers/SDKContainer/index.ts +0 -817
- package/src/features/containers/SDKContainer/styles.module.scss +0 -266
- package/src/features/containers/SDKDebugContainer/index.ts +0 -137
- package/src/features/containers/SDKDebugContainer/styles.module.scss +0 -37
- package/src/features/containers/SDKFailedContainer/index.ts +0 -117
- package/src/features/containers/SDKFailedContainer/styles.module.scss +0 -57
- package/src/features/integrations/IntegrationRow/Icons.ts +0 -77
- package/src/features/integrations/IntegrationRow/index.ts +0 -129
- package/src/features/integrations/IntegrationRow/styles.module.scss +0 -62
- package/src/features/integrations/IntegrationsHeader/index.ts +0 -34
- package/src/features/integrations/IntegrationsHeader/styles.module.scss +0 -47
- package/src/features/integrations/IntegrationsList/index.ts +0 -252
- package/src/features/integrations/IntegrationsList/styles.module.scss +0 -67
- package/src/features/templates/Template/index.ts +0 -295
- package/src/features/templates/Template/styles.module.scss +0 -226
- package/src/features/templates/TemplatesView/index.ts +0 -368
- package/src/features/templates/TemplatesView/styles.module.scss +0 -71
- package/src/features/templates/TemplatesViewCompact/index.ts +0 -364
- package/src/features/templates/TemplatesViewCompact/styles.module.scss +0 -141
- package/src/hooks/useAutosizeTextArea.ts +0 -22
- package/src/hooks/useCustomRef.ts +0 -13
- package/src/hooks/useDebounce.ts +0 -17
- package/src/hooks/useElementResize.ts +0 -40
- package/src/hooks/useEventListener.ts +0 -42
- package/src/hooks/useHover.ts +0 -40
- package/src/hooks/useOnClickOutside.ts +0 -32
- package/src/index.ts +0 -2244
- package/src/index.umd.ts +0 -13
- package/src/interfaces/index.ts +0 -938
- package/src/modules/api/index.ts +0 -1325
- package/src/modules/api/responseHandler.ts +0 -38
- package/src/modules/event-emitter/index.ts +0 -72
- package/src/modules/event-emitter/runners/abstract.ts +0 -21
- package/src/modules/event-emitter/runners/default.ts +0 -11
- package/src/modules/event-emitter/runners/ntimes.ts +0 -28
- package/src/modules/event-emitter/types.ts +0 -34
- package/src/store/actionFunctions.ts +0 -1578
- package/src/store/index.ts +0 -17
- package/src/store/initialState.ts +0 -58
- package/src/types/index.ts +0 -320
- package/src/types/preact-compat.d.ts +0 -4
- package/src/types/store.ts +0 -366
- package/src/types/utils.ts +0 -19
- package/src/utils/ActivityOutputUtils.ts +0 -176
- package/src/utils/common.ts +0 -20
- package/src/utils/copyToClipboard.ts +0 -24
- package/src/utils/datetime.ts +0 -101
- package/src/utils/getUrlParam.ts +0 -11
- package/src/utils/isAuthMessage.ts +0 -16
- package/src/utils/isBrowser.ts +0 -1
- package/src/utils/jsonEncodeDecode.ts +0 -15
- package/src/utils/objectUtils.ts +0 -117
- package/src/utils/popup.ts +0 -30
- package/src/utils/searchJson.ts +0 -51
- package/src/utils/stepUtils.ts +0 -45
- package/src/utils/truncate.ts +0 -6
- package/test/setup.ts +0 -1
- package/vitest.config.ts +0 -16
|
@@ -1,367 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-cycle */
|
|
2
|
-
/* eslint-disable @typescript-eslint/quotes */
|
|
3
|
-
import { html } from 'htm/preact';
|
|
4
|
-
import AppContext from '@/contexts/AppContext';
|
|
5
|
-
import { useEffect, useContext, useState } from 'preact/hooks';
|
|
6
|
-
import { Hint } from '@/components/Tooltip';
|
|
7
|
-
import { Loader } from '@/components/Loader';
|
|
8
|
-
|
|
9
|
-
import { Instance } from '@/interfaces';
|
|
10
|
-
import { CollapsedMenu } from '@/components/CollapsedMenu';
|
|
11
|
-
import { EditableText } from '@/components/EditableText';
|
|
12
|
-
import { Toggle } from '@/components/Toggle-v2';
|
|
13
|
-
import { Tag } from '@/components/Tag';
|
|
14
|
-
|
|
15
|
-
import { convertDateToStandard } from '@/utils/datetime';
|
|
16
|
-
|
|
17
|
-
import styles from './styles.module.scss';
|
|
18
|
-
|
|
19
|
-
interface FlowInstanceRowProps {
|
|
20
|
-
instance: Instance;
|
|
21
|
-
onEditInstance: (instance: Instance) => void;
|
|
22
|
-
onDelete?: (instance: Instance) => void;
|
|
23
|
-
isSingleInstance?: boolean;
|
|
24
|
-
}
|
|
25
|
-
interface FlowInstanceProps {
|
|
26
|
-
instances: Instance[];
|
|
27
|
-
onEditInstance: FlowInstanceRowProps['onEditInstance'];
|
|
28
|
-
onDelete: FlowInstanceRowProps['onDelete'];
|
|
29
|
-
updateInstanceName: (instanceId: number, name: string) => void;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const MenuIcon = () =>
|
|
33
|
-
html`<svg
|
|
34
|
-
width="20"
|
|
35
|
-
height="20"
|
|
36
|
-
viewBox="0 0 20 20"
|
|
37
|
-
fill="none"
|
|
38
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
39
|
-
>
|
|
40
|
-
<path
|
|
41
|
-
fill-rule="evenodd"
|
|
42
|
-
clip-rule="evenodd"
|
|
43
|
-
d="M4.5 11C5.32843 11 6 10.3284 6 9.5C6 8.67157 5.32843 8 4.5 8C3.67157 8 3 8.67157 3 9.5C3 10.3284 3.67157 11 4.5 11Z"
|
|
44
|
-
fill="#999999"
|
|
45
|
-
/>
|
|
46
|
-
<path
|
|
47
|
-
fill-rule="evenodd"
|
|
48
|
-
clip-rule="evenodd"
|
|
49
|
-
d="M9.5 11C10.3284 11 11 10.3284 11 9.5C11 8.67157 10.3284 8 9.5 8C8.67157 8 8 8.67157 8 9.5C8 10.3284 8.67157 11 9.5 11Z"
|
|
50
|
-
fill="#999999"
|
|
51
|
-
/>
|
|
52
|
-
<path
|
|
53
|
-
fill-rule="evenodd"
|
|
54
|
-
clip-rule="evenodd"
|
|
55
|
-
d="M14.5 11C15.3284 11 16 10.3284 16 9.5C16 8.67157 15.3284 8 14.5 8C13.6716 8 13 8.67157 13 9.5C13 10.3284 13.6716 11 14.5 11Z"
|
|
56
|
-
fill="#999999"
|
|
57
|
-
/>
|
|
58
|
-
</svg>`;
|
|
59
|
-
|
|
60
|
-
export const InstanceBlockedInfo = (props: { instance: Instance }) => {
|
|
61
|
-
const {
|
|
62
|
-
error_app_name,
|
|
63
|
-
first_error_received_at,
|
|
64
|
-
status,
|
|
65
|
-
usage_limit_reached_at,
|
|
66
|
-
error_code,
|
|
67
|
-
} = props.instance;
|
|
68
|
-
|
|
69
|
-
const convertedTime = first_error_received_at
|
|
70
|
-
? convertDateToStandard(first_error_received_at)
|
|
71
|
-
: '';
|
|
72
|
-
|
|
73
|
-
const getBlockedReason = () => {
|
|
74
|
-
switch (status) {
|
|
75
|
-
case 'AUTH_MISSING':
|
|
76
|
-
// return `Authentication failed. Try to re-authenticate your account and enable the instance.`;
|
|
77
|
-
return `Integration has been blocked because\nof failed authentication. User needs to\nre-authenticate their account and enable\nthe integration.`;
|
|
78
|
-
case 'BLOCKED':
|
|
79
|
-
if (usage_limit_reached_at) {
|
|
80
|
-
return `Integration has been blocked because\nthe user limit has been reached`;
|
|
81
|
-
return `User limit is reached`;
|
|
82
|
-
}
|
|
83
|
-
if (error_code >= 500 && error_code <= 599) {
|
|
84
|
-
return `Integration has been blocked because\nof too many server errors`;
|
|
85
|
-
return error_app_name && convertedTime
|
|
86
|
-
? `Too many server errors from ${error_app_name} since ${convertedTime}. \nYou can try enabling the instance.`
|
|
87
|
-
: `Too many server errors. You can try enabling the instance.`;
|
|
88
|
-
}
|
|
89
|
-
if (error_code >= 400 && error_code <= 499) {
|
|
90
|
-
return `Integration has been blocked because of too many data errors`;
|
|
91
|
-
return error_app_name && convertedTime
|
|
92
|
-
? `Too many errors from ${error_app_name} since ${convertedTime} \ndue to a configuration issue. Try creating a new instance.`
|
|
93
|
-
: `Too many errors due to a configuration issue. Try create a new instance.`;
|
|
94
|
-
}
|
|
95
|
-
return '';
|
|
96
|
-
default:
|
|
97
|
-
return '';
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
const blockedReason = getBlockedReason();
|
|
101
|
-
return blockedReason
|
|
102
|
-
? html`<${Hint}
|
|
103
|
-
dismissOnClick=${false}
|
|
104
|
-
deltaY=${12}
|
|
105
|
-
position="fixed"
|
|
106
|
-
style="display: flex; flex-direction: row; align-items: center; justify-content: flex-start;"
|
|
107
|
-
>
|
|
108
|
-
<svg
|
|
109
|
-
width="16"
|
|
110
|
-
height="16"
|
|
111
|
-
viewBox="0 0 24 24"
|
|
112
|
-
fill="none"
|
|
113
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
114
|
-
>
|
|
115
|
-
<path
|
|
116
|
-
data-hint="${blockedReason}"
|
|
117
|
-
d="M0 12C0 18.6268 5.37184 24 12 24C18.6268 24 24 18.6268 24 12C24 5.37322 18.6282 3.05176e-05 12 3.05176e-05C5.37319 3.05176e-05 0 5.37187 0 12Z"
|
|
118
|
-
fill="#F05C42"
|
|
119
|
-
/>
|
|
120
|
-
<path
|
|
121
|
-
d="M13.185 16.9089C13.185 15.3294 10.8164 15.3294 10.8164 16.9089C10.8164 18.4884 13.185 18.4884 13.185 16.9089Z"
|
|
122
|
-
fill="white"
|
|
123
|
-
/>
|
|
124
|
-
<path
|
|
125
|
-
d="M11.1582 13.2688C11.1582 13.7326 11.5342 14.1087 11.9981 14.1087V14.1087C12.462 14.1087 12.838 13.7326 12.838 13.2688V6.74489C12.838 6.28101 12.462 5.90497 11.9981 5.90497V5.90497C11.5342 5.90497 11.1582 6.28102 11.1582 6.74489V13.2688Z"
|
|
126
|
-
fill="white"
|
|
127
|
-
/>
|
|
128
|
-
</svg>
|
|
129
|
-
<//>`
|
|
130
|
-
: '';
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
export const InstanceStatusPill = (props: {
|
|
134
|
-
instance: Instance;
|
|
135
|
-
flowType: 'ON_DEMAND' | 'AUTOMATIC';
|
|
136
|
-
executionBehaviour: 'SAVE_ONLY' | 'SAVE_AND_EXECUTE';
|
|
137
|
-
}) => {
|
|
138
|
-
const {
|
|
139
|
-
instance,
|
|
140
|
-
flowType = 'AUTOMATIC',
|
|
141
|
-
executionBehaviour = 'SAVE_AND_EXECUTE',
|
|
142
|
-
} = props;
|
|
143
|
-
const {
|
|
144
|
-
last_run_status = null,
|
|
145
|
-
last_run_start_time = null,
|
|
146
|
-
status,
|
|
147
|
-
} = instance;
|
|
148
|
-
const getTagData = () => {
|
|
149
|
-
if (!last_run_status && !last_run_start_time && status === 'ACTIVE') {
|
|
150
|
-
return {
|
|
151
|
-
type: 'grey',
|
|
152
|
-
label:
|
|
153
|
-
flowType === 'ON_DEMAND' && executionBehaviour === 'SAVE_AND_EXECUTE'
|
|
154
|
-
? 'Queued'
|
|
155
|
-
: // : "Hasn't Run",
|
|
156
|
-
'',
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
switch (last_run_status) {
|
|
160
|
-
case 'failed':
|
|
161
|
-
return {
|
|
162
|
-
type: 'fail',
|
|
163
|
-
label: 'Aborted',
|
|
164
|
-
};
|
|
165
|
-
case 'running...':
|
|
166
|
-
return {
|
|
167
|
-
type: 'info',
|
|
168
|
-
label: 'Running...',
|
|
169
|
-
};
|
|
170
|
-
case 'running':
|
|
171
|
-
return {
|
|
172
|
-
type: 'info',
|
|
173
|
-
label: 'Running...',
|
|
174
|
-
};
|
|
175
|
-
case 'ok':
|
|
176
|
-
return {
|
|
177
|
-
type: 'success',
|
|
178
|
-
label: 'Completed',
|
|
179
|
-
};
|
|
180
|
-
default:
|
|
181
|
-
return null;
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
const tagData = getTagData();
|
|
186
|
-
if (tagData?.label === '') return html``;
|
|
187
|
-
return tagData
|
|
188
|
-
? html`<${Tag}
|
|
189
|
-
type="${tagData.type}"
|
|
190
|
-
label="${tagData.label}"
|
|
191
|
-
className="flow-instance"
|
|
192
|
-
/>`
|
|
193
|
-
: '';
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
export const FlowInstanceRow = (props: FlowInstanceRowProps) => {
|
|
197
|
-
const {
|
|
198
|
-
instance,
|
|
199
|
-
onEditInstance,
|
|
200
|
-
onDelete,
|
|
201
|
-
isSingleInstance = false,
|
|
202
|
-
} = props;
|
|
203
|
-
const context = useContext(AppContext);
|
|
204
|
-
const [instanceStatus, setInstanceStatus] = useState<Instance['status']>(
|
|
205
|
-
instance.status,
|
|
206
|
-
);
|
|
207
|
-
const [isDeleting, setIsDeleting] = useState(false);
|
|
208
|
-
|
|
209
|
-
useEffect(() => {
|
|
210
|
-
setInstanceStatus(instance.status);
|
|
211
|
-
}, [instance.status]);
|
|
212
|
-
|
|
213
|
-
const toggleIntegration = (instanceId: number, value: boolean) => {
|
|
214
|
-
setInstanceStatus(value ? 'ACTIVE' : 'INACTIVE'); // optimistic update
|
|
215
|
-
context?.apiHandler
|
|
216
|
-
.toggleIntegration(instanceId, value)
|
|
217
|
-
.catch((err: unknown) => {
|
|
218
|
-
console.error(err);
|
|
219
|
-
setInstanceStatus(instance.status);
|
|
220
|
-
})
|
|
221
|
-
.finally(() => {
|
|
222
|
-
const eventName = value
|
|
223
|
-
? 'did-enable-integration'
|
|
224
|
-
: 'did-disable-integration';
|
|
225
|
-
context.eventEmitter.emit(eventName, {
|
|
226
|
-
integrationId: instance.id,
|
|
227
|
-
name: instance.name,
|
|
228
|
-
status: value ? 'ACTIVE' : 'INACTIVE',
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
};
|
|
232
|
-
const handleOptionSelect = (
|
|
233
|
-
option: { id: string; label: string },
|
|
234
|
-
selectedInstance: Instance,
|
|
235
|
-
) => {
|
|
236
|
-
switch (option.id) {
|
|
237
|
-
case 'edit':
|
|
238
|
-
onEditInstance(selectedInstance);
|
|
239
|
-
break;
|
|
240
|
-
case 'delete':
|
|
241
|
-
setIsDeleting(true);
|
|
242
|
-
if (onDelete) onDelete(selectedInstance);
|
|
243
|
-
break;
|
|
244
|
-
default:
|
|
245
|
-
break;
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
return html`
|
|
250
|
-
<div class="${styles.flowInstanceColumn} ${styles.instanceRunTime}">
|
|
251
|
-
${instance.last_run_start_time
|
|
252
|
-
? convertDateToStandard(instance.last_run_start_time)
|
|
253
|
-
: 'No runs as yet'}
|
|
254
|
-
</div>
|
|
255
|
-
<div class="${styles.flowInstanceColumn}">
|
|
256
|
-
${html`<${InstanceStatusPill} instance=${instance} />`}
|
|
257
|
-
</div>
|
|
258
|
-
<div
|
|
259
|
-
class="${styles.flowInstanceColumn} ${styles.instanceStatus}"
|
|
260
|
-
style="${isSingleInstance ? 'margin-right: 0;' : ''}"
|
|
261
|
-
>
|
|
262
|
-
${instanceStatus === 'BLOCKED'
|
|
263
|
-
? html`<${InstanceBlockedInfo} instance=${instance} />`
|
|
264
|
-
: ''}
|
|
265
|
-
${html`<${Toggle}
|
|
266
|
-
id=${instance.id}
|
|
267
|
-
value=${isDeleting ? false : instanceStatus === 'ACTIVE'}
|
|
268
|
-
disabled=${isDeleting}
|
|
269
|
-
onChange=${(value: boolean) => {
|
|
270
|
-
if (!isDeleting) {
|
|
271
|
-
toggleIntegration(instance.id, value);
|
|
272
|
-
}
|
|
273
|
-
}}
|
|
274
|
-
/>`}
|
|
275
|
-
</div>
|
|
276
|
-
<div
|
|
277
|
-
class="${styles.flowInstanceColumn}"
|
|
278
|
-
style="display: flex; flex-direction: row; align-items: center; justify-content: flex-start;"
|
|
279
|
-
>
|
|
280
|
-
${isDeleting
|
|
281
|
-
? html`<${Loader} />`
|
|
282
|
-
: html` <${CollapsedMenu}
|
|
283
|
-
verticalIcon=${true}
|
|
284
|
-
icon=${MenuIcon}
|
|
285
|
-
className="instanceMenu"
|
|
286
|
-
options=${[
|
|
287
|
-
{
|
|
288
|
-
id: 'edit',
|
|
289
|
-
label: 'Edit',
|
|
290
|
-
},
|
|
291
|
-
...(onDelete
|
|
292
|
-
? [
|
|
293
|
-
{
|
|
294
|
-
id: 'delete',
|
|
295
|
-
label: 'Delete',
|
|
296
|
-
},
|
|
297
|
-
]
|
|
298
|
-
: []),
|
|
299
|
-
]}
|
|
300
|
-
onOptionSelect=${(option: { id: string; label: string }) =>
|
|
301
|
-
handleOptionSelect(option, instance)}
|
|
302
|
-
/>`}
|
|
303
|
-
</div>
|
|
304
|
-
`;
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
const FlowInstance = (props: FlowInstanceProps) => {
|
|
308
|
-
const { instances, onEditInstance, updateInstanceName, onDelete } = props;
|
|
309
|
-
const context = useContext(AppContext);
|
|
310
|
-
|
|
311
|
-
const onUpdateName = (instanceId: number, name: string) => {
|
|
312
|
-
const oldName =
|
|
313
|
-
instances.find((instance) => instance.id === instanceId)?.name || '';
|
|
314
|
-
updateInstanceName(instanceId, name);
|
|
315
|
-
context?.apiHandler
|
|
316
|
-
.renameIntegration(`${instanceId}`, name)
|
|
317
|
-
.then((integrationData) => {
|
|
318
|
-
if (!integrationData) {
|
|
319
|
-
updateInstanceName(instanceId, oldName);
|
|
320
|
-
throw new Error('Could not update integration name');
|
|
321
|
-
} else {
|
|
322
|
-
context.eventEmitter.emit('did-rename-integration', {
|
|
323
|
-
integrationId: instanceId,
|
|
324
|
-
name,
|
|
325
|
-
status: integrationData.status,
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
})
|
|
329
|
-
.catch((err) => {
|
|
330
|
-
console.error(err);
|
|
331
|
-
updateInstanceName(instanceId, oldName);
|
|
332
|
-
});
|
|
333
|
-
};
|
|
334
|
-
return html`
|
|
335
|
-
<div class="${styles.flowInstanceContainer}">
|
|
336
|
-
<div class="${styles.flowInstanceTitleRow} ">
|
|
337
|
-
<div class="${styles.flowInstanceTitleColumn}">Integration</div>
|
|
338
|
-
<div class="${styles.flowInstanceTitleColumn}">Last run start</div>
|
|
339
|
-
</div>
|
|
340
|
-
${instances.map(
|
|
341
|
-
(instance) => html`
|
|
342
|
-
<div
|
|
343
|
-
class="${styles.flowInstanceRow}"
|
|
344
|
-
key=${`instance-id-flow-row-${instance.id}`}
|
|
345
|
-
>
|
|
346
|
-
<${EditableText}
|
|
347
|
-
value=${instance.name}
|
|
348
|
-
handleChange=${(name: string) => onUpdateName(instance.id, name)}
|
|
349
|
-
wrapperClassName=${styles.editableTextWrapper}
|
|
350
|
-
customStyles=${{
|
|
351
|
-
wrapperClassName: styles.editableTextWrapper,
|
|
352
|
-
inputClassName: styles.inlineEditInput,
|
|
353
|
-
}}
|
|
354
|
-
/>
|
|
355
|
-
<${FlowInstanceRow}
|
|
356
|
-
instance=${instance}
|
|
357
|
-
onEditInstance=${onEditInstance}
|
|
358
|
-
onDelete=${onDelete}
|
|
359
|
-
/>
|
|
360
|
-
</div>
|
|
361
|
-
`,
|
|
362
|
-
)}
|
|
363
|
-
</div>
|
|
364
|
-
`;
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
export default FlowInstance;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/preact';
|
|
2
|
-
import { html } from 'htm/preact';
|
|
3
|
-
import { Provider } from 'unistore/preact';
|
|
4
|
-
import createStore from 'unistore';
|
|
5
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
6
|
-
import FlowCard from './flowCard';
|
|
7
|
-
|
|
8
|
-
const baseFlow = {
|
|
9
|
-
id: 1,
|
|
10
|
-
name: 'Test Flow',
|
|
11
|
-
description: null,
|
|
12
|
-
execution_type: 'ON_DEMAND',
|
|
13
|
-
allow_multiple_instances: false,
|
|
14
|
-
instances: [],
|
|
15
|
-
execution_behaviour: 'SAVE_ONLY',
|
|
16
|
-
button_text: '',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const renderWithStore = (flow: any) => {
|
|
20
|
-
const store = createStore({ userConfig: {} });
|
|
21
|
-
return render(
|
|
22
|
-
html`<${Provider} store=${store}>
|
|
23
|
-
<${FlowCard}
|
|
24
|
-
flow=${flow}
|
|
25
|
-
accountVerified=${true}
|
|
26
|
-
onFlowSelect=${vi.fn()}
|
|
27
|
-
updateInstanceName=${vi.fn()}
|
|
28
|
-
/>
|
|
29
|
-
<//>`,
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
describe('FlowCard', () => {
|
|
34
|
-
it('shows setup button when integration creation not in progress', () => {
|
|
35
|
-
const flow = { ...baseFlow, integration_creation_in_progress: false };
|
|
36
|
-
renderWithStore(flow);
|
|
37
|
-
expect(screen.getByRole('button')).toBeInTheDocument();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('shows setup button when creation is in progress but multiple instances allowed', () => {
|
|
41
|
-
const flow = {
|
|
42
|
-
...baseFlow,
|
|
43
|
-
allow_multiple_instances: true,
|
|
44
|
-
integration_creation_in_progress: true,
|
|
45
|
-
};
|
|
46
|
-
renderWithStore(flow);
|
|
47
|
-
expect(screen.getByRole('button')).toBeInTheDocument();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('shows progress message when integration creation is in progress and single instance', () => {
|
|
51
|
-
const flow = { ...baseFlow, integration_creation_in_progress: true };
|
|
52
|
-
renderWithStore(flow);
|
|
53
|
-
expect(screen.queryByRole('button')).toBeNull();
|
|
54
|
-
expect(
|
|
55
|
-
screen.getByText('Integration creation in progress')
|
|
56
|
-
).toBeInTheDocument();
|
|
57
|
-
});
|
|
58
|
-
});
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import { html } from 'htm/preact';
|
|
2
|
-
import { connect } from 'unistore/preact';
|
|
3
|
-
import { Button, ButtonTypes } from '@/components/Button';
|
|
4
|
-
import { Hint } from '@/components/Tooltip';
|
|
5
|
-
import { ThreeDotLoader } from '@/components/ThreeDotLoader';
|
|
6
|
-
import { convertDateToStandard } from '@/utils/datetime';
|
|
7
|
-
import { Flow, Instance } from '@/interfaces';
|
|
8
|
-
import { actionFunctions } from '@/store';
|
|
9
|
-
import { StoreType } from '@/types/store';
|
|
10
|
-
import { UserConfig } from '@/interfaces';
|
|
11
|
-
|
|
12
|
-
import styles from './styles.module.scss';
|
|
13
|
-
import FlowInstance, {
|
|
14
|
-
FlowInstanceRow,
|
|
15
|
-
InstanceStatusPill,
|
|
16
|
-
InstanceBlockedInfo,
|
|
17
|
-
} from './flow-instance';
|
|
18
|
-
|
|
19
|
-
interface Props {
|
|
20
|
-
flow: Flow;
|
|
21
|
-
flowIcon?: string;
|
|
22
|
-
accountVerified: boolean;
|
|
23
|
-
userConfig?: UserConfig;
|
|
24
|
-
onFlowSelect: (flow: Flow, instance?: Instance) => void;
|
|
25
|
-
onDeleteInstance?: (instanceId: number) => void;
|
|
26
|
-
updateInstanceName: (
|
|
27
|
-
flowId: number,
|
|
28
|
-
instanceId: number,
|
|
29
|
-
name: string,
|
|
30
|
-
) => void;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const FlowCard = ({
|
|
34
|
-
flow,
|
|
35
|
-
flowIcon,
|
|
36
|
-
accountVerified,
|
|
37
|
-
onFlowSelect,
|
|
38
|
-
updateInstanceName,
|
|
39
|
-
onDeleteInstance,
|
|
40
|
-
userConfig,
|
|
41
|
-
}: Props) => {
|
|
42
|
-
const showFlowLastRunTime = () =>
|
|
43
|
-
flow.execution_type === 'ON_DEMAND' &&
|
|
44
|
-
!flow.allow_multiple_instances &&
|
|
45
|
-
flow.instances.length > 0;
|
|
46
|
-
|
|
47
|
-
const showFooter = () =>
|
|
48
|
-
flow.execution_type === 'ON_DEMAND' ||
|
|
49
|
-
(flow.execution_type === 'AUTOMATIC' && flow.allow_multiple_instances) ||
|
|
50
|
-
(flow.execution_type === 'AUTOMATIC' &&
|
|
51
|
-
!flow.allow_multiple_instances &&
|
|
52
|
-
flow.instances.length === 0);
|
|
53
|
-
|
|
54
|
-
const disabledButtonTooltip = () =>
|
|
55
|
-
flow.execution_type === 'ON_DEMAND'
|
|
56
|
-
? 'Please connect your account to setup and run this flow'
|
|
57
|
-
: 'Please connect your account to setup and enable this flow';
|
|
58
|
-
|
|
59
|
-
const getButtonLabel = () => {
|
|
60
|
-
if (flow.button_text) {
|
|
61
|
-
return flow.button_text;
|
|
62
|
-
}
|
|
63
|
-
if (
|
|
64
|
-
flow.execution_type === 'ON_DEMAND' &&
|
|
65
|
-
flow.execution_behaviour === 'SAVE_AND_EXECUTE'
|
|
66
|
-
) {
|
|
67
|
-
return 'Setup and run';
|
|
68
|
-
}
|
|
69
|
-
if (
|
|
70
|
-
flow.execution_type === 'ON_DEMAND' &&
|
|
71
|
-
flow.execution_behaviour === 'SAVE_ONLY'
|
|
72
|
-
) {
|
|
73
|
-
return 'Setup';
|
|
74
|
-
}
|
|
75
|
-
if (flow.execution_type === 'AUTOMATIC' && flow.allow_multiple_instances) {
|
|
76
|
-
return flow.instances.length > 0 && !userConfig?.hideExistingIntegrations
|
|
77
|
-
? 'Setup another'
|
|
78
|
-
: 'Setup and enable';
|
|
79
|
-
}
|
|
80
|
-
return 'Setup and enable';
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const handleFlowSelect = () => {
|
|
84
|
-
const latestInstance =
|
|
85
|
-
flow?.instances.length > 0 ? flow?.instances[0] : undefined;
|
|
86
|
-
/* if (flow.execution_type === 'ON_DEMAND') {
|
|
87
|
-
onFlowSelect(flow, latestInstance);
|
|
88
|
-
} else if (flow.execution_type === 'AUTOMATIC') { */
|
|
89
|
-
if (flow.allow_multiple_instances) {
|
|
90
|
-
onFlowSelect(flow);
|
|
91
|
-
} else {
|
|
92
|
-
onFlowSelect(flow, latestInstance);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
return html`<div class="${styles.flowCard}">
|
|
97
|
-
<div class="${styles.flowInfo}">
|
|
98
|
-
${flowIcon
|
|
99
|
-
? html` <${Hint}
|
|
100
|
-
dismissOnClick=${false}
|
|
101
|
-
position="top"
|
|
102
|
-
deltaY=${0}
|
|
103
|
-
hideArrow=${true}
|
|
104
|
-
>
|
|
105
|
-
<div class="${styles.flowIcon}">
|
|
106
|
-
<img
|
|
107
|
-
data-hint="${flow.branding_app?.name}"
|
|
108
|
-
src=${flowIcon}
|
|
109
|
-
alt=${flow.name}
|
|
110
|
-
/>
|
|
111
|
-
</div>
|
|
112
|
-
<//>`
|
|
113
|
-
: ''}
|
|
114
|
-
<div>
|
|
115
|
-
<div class="${styles.flowName}">
|
|
116
|
-
${flow.name}
|
|
117
|
-
${flow.version_number &&
|
|
118
|
-
html`<span class=${styles.flowVersion}
|
|
119
|
-
>v${flow.version_number}</span
|
|
120
|
-
>`}
|
|
121
|
-
</div>
|
|
122
|
-
${flow.description
|
|
123
|
-
? html`<div class="${styles.flowDescription}">
|
|
124
|
-
${flow.description}
|
|
125
|
-
</div>`
|
|
126
|
-
: ''}
|
|
127
|
-
</div>
|
|
128
|
-
</div>
|
|
129
|
-
${flow.execution_type === 'AUTOMATIC' &&
|
|
130
|
-
flow.allow_multiple_instances &&
|
|
131
|
-
flow.instances?.length > 0 &&
|
|
132
|
-
!userConfig?.hideExistingIntegrations &&
|
|
133
|
-
html`<${FlowInstance}
|
|
134
|
-
instances=${flow.instances}
|
|
135
|
-
updateInstanceName=${(instanceId: number, name: string) =>
|
|
136
|
-
updateInstanceName(flow.id, instanceId, name)}
|
|
137
|
-
onEditInstance=${(instance: Instance) => onFlowSelect(flow, instance)}
|
|
138
|
-
onDelete=${onDeleteInstance}
|
|
139
|
-
/>`}
|
|
140
|
-
${flow.execution_type === 'AUTOMATIC' &&
|
|
141
|
-
!flow.allow_multiple_instances &&
|
|
142
|
-
flow.instances?.length > 0 &&
|
|
143
|
-
html`<div class="${styles.singleFlowInstanceRow}">
|
|
144
|
-
<div class="${styles.flowInstanceColumn}">Last run:</div>
|
|
145
|
-
<${FlowInstanceRow}
|
|
146
|
-
isSingleInstance=${true}
|
|
147
|
-
instance=${flow.instances[0]}
|
|
148
|
-
onEditInstance=${(instance: Instance) => onFlowSelect(flow, instance)}
|
|
149
|
-
onDelete=${onDeleteInstance}
|
|
150
|
-
/>
|
|
151
|
-
</div> `}
|
|
152
|
-
${showFooter() &&
|
|
153
|
-
html`<div class="${styles.flowCardFooter}">
|
|
154
|
-
${html`
|
|
155
|
-
<${Hint}
|
|
156
|
-
dismissOnClick=${false}
|
|
157
|
-
position="top"
|
|
158
|
-
deltaY=${0}
|
|
159
|
-
hideArrow=${true}
|
|
160
|
-
disabled=${accountVerified}
|
|
161
|
-
>
|
|
162
|
-
${!accountVerified &&
|
|
163
|
-
html`<span
|
|
164
|
-
class=${styles.readonlyHint}
|
|
165
|
-
data-hint=${disabledButtonTooltip()}
|
|
166
|
-
></span>`}
|
|
167
|
-
${flow?.integration_creation_in_progress &&
|
|
168
|
-
!flow?.allow_multiple_instances
|
|
169
|
-
? html`<div class=${styles.integrationProgress}>
|
|
170
|
-
Integration creation in progress
|
|
171
|
-
<${ThreeDotLoader} color="#999" />
|
|
172
|
-
</div>`
|
|
173
|
-
: html`<${Button}
|
|
174
|
-
label=${getButtonLabel()}
|
|
175
|
-
type=${ButtonTypes.PRIMARY}
|
|
176
|
-
onClick=${() => handleFlowSelect()}
|
|
177
|
-
disabled=${!accountVerified}
|
|
178
|
-
id=${`setup-integration-btn-${flow?.id}`}
|
|
179
|
-
/>`}
|
|
180
|
-
<//>
|
|
181
|
-
`}
|
|
182
|
-
${showFlowLastRunTime() &&
|
|
183
|
-
html`<div class="${styles.flowStatus}">
|
|
184
|
-
<div>
|
|
185
|
-
Last run:${' '}
|
|
186
|
-
${flow.instances[0]?.last_run_start_time
|
|
187
|
-
? convertDateToStandard(flow.instances[0]?.last_run_start_time)
|
|
188
|
-
: // : 'Never'}
|
|
189
|
-
'No runs as yet'}
|
|
190
|
-
</div>
|
|
191
|
-
<${InstanceStatusPill}
|
|
192
|
-
instance=${{
|
|
193
|
-
...flow.instances[0],
|
|
194
|
-
}}
|
|
195
|
-
flowType="ON_DEMAND"
|
|
196
|
-
executionBehaviour=${flow.execution_behaviour}
|
|
197
|
-
/>
|
|
198
|
-
<div class=${styles.blockedInfo}>
|
|
199
|
-
<${InstanceBlockedInfo} instance=${flow.instances[0]} />
|
|
200
|
-
</div>
|
|
201
|
-
</div>`}
|
|
202
|
-
</div>`}
|
|
203
|
-
</div>`;
|
|
204
|
-
};
|
|
205
|
-
export default connect<Props, unknown, StoreType, unknown>(
|
|
206
|
-
['userConfig'],
|
|
207
|
-
actionFunctions,
|
|
208
|
-
)(FlowCard);
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/preact';
|
|
2
|
-
import { html } from 'htm/preact';
|
|
3
|
-
import { Provider } from 'unistore/preact';
|
|
4
|
-
import createStore from 'unistore';
|
|
5
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
6
|
-
import FlowCardCompact from './flowCardCompact';
|
|
7
|
-
|
|
8
|
-
const baseFlow = {
|
|
9
|
-
id: 1,
|
|
10
|
-
name: 'Test Flow',
|
|
11
|
-
description: null,
|
|
12
|
-
execution_type: 'ON_DEMAND',
|
|
13
|
-
allow_multiple_instances: false,
|
|
14
|
-
instances: [],
|
|
15
|
-
execution_behaviour: 'SAVE_ONLY',
|
|
16
|
-
button_text: '',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const renderWithStore = (flow: any) => {
|
|
20
|
-
const store = createStore({ userConfig: {} });
|
|
21
|
-
return render(
|
|
22
|
-
html`<${Provider} store=${store}>
|
|
23
|
-
<${FlowCardCompact}
|
|
24
|
-
flow=${flow}
|
|
25
|
-
accountVerified=${true}
|
|
26
|
-
onFlowSelect=${vi.fn()}
|
|
27
|
-
updateInstanceName=${vi.fn()}
|
|
28
|
-
/>
|
|
29
|
-
<//>`,
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
describe('FlowCardCompact', () => {
|
|
34
|
-
it('shows setup button when integration creation not in progress', () => {
|
|
35
|
-
const flow = { ...baseFlow, integration_creation_in_progress: false };
|
|
36
|
-
renderWithStore(flow);
|
|
37
|
-
expect(screen.getByRole('button')).toBeInTheDocument();
|
|
38
|
-
expect(
|
|
39
|
-
screen.queryByText('Integration creation in progress'),
|
|
40
|
-
).toBeNull();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('shows progress message when integration creation is in progress', () => {
|
|
44
|
-
const flow = { ...baseFlow, integration_creation_in_progress: true };
|
|
45
|
-
renderWithStore(flow);
|
|
46
|
-
expect(screen.queryByRole('button')).toBeNull();
|
|
47
|
-
expect(screen.getByText('Integration creation in progress')).toBeInTheDocument();
|
|
48
|
-
});
|
|
49
|
-
});
|