@integry/sdk 4.5.2 → 4.5.4
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/.vscode/launch.json +2 -2
- package/THIRD_PARTY_LICENSES +0 -37
- package/dist/esm/index.csm.d.ts +12 -2
- package/dist/esm/index.csm.js +7262 -1
- package/dist/umd/index.umd.d.ts +9 -1
- package/dist/umd/index.umd.js +7262 -1
- package/jest.config.cjs +10 -0
- package/package.json +10 -4
- package/src/components/AddTagButton/index.ts +23 -0
- package/src/components/BasicSelect/index.ts +114 -0
- package/src/components/BasicSelect/styles.module.scss +44 -0
- package/src/components/Button/index.ts +94 -0
- package/src/components/Button/styles.module.scss +152 -0
- package/src/components/CheckboxGroup/Checkbox.ts +104 -0
- package/src/components/CheckboxGroup/index.ts +190 -0
- package/src/components/CheckboxGroup/styles.module.scss +63 -0
- package/src/components/CollapsedMenu/index.ts +101 -0
- package/src/components/CollapsedMenu/styles.module.scss +46 -0
- package/src/components/ConfigureFieldWrapper/index.ts +85 -0
- package/src/components/ConfigureFieldWrapper/styles.module.scss +57 -0
- package/src/components/EditableText/index.ts +121 -0
- package/src/components/EditableText/styles.module.scss +38 -0
- package/src/components/EditableTextArea/index.ts +143 -0
- package/src/components/EditableTextArea/styles.module.scss +91 -0
- package/src/components/ErrorMessage/index.ts +16 -0
- package/src/components/ErrorMessage/styles.module.scss +19 -0
- package/src/components/ErrorPage/index.ts +42 -0
- package/src/components/ErrorPage/styles.module.scss +26 -0
- package/src/components/Footer/index.ts +41 -0
- package/src/components/Footer/styles.module.scss +40 -0
- package/src/components/HTMLContent/index.tsx +275 -0
- package/src/components/HTMLContent/styles.module.scss +3 -0
- package/src/components/InfoBox/index.ts +48 -0
- package/src/components/InfoBox/styles.module.scss +21 -0
- package/src/components/Input/BaseInput/index.ts +170 -0
- package/src/components/Input/BaseInput/styles.module.scss +94 -0
- package/src/components/Input/DateInput/index.ts +103 -0
- package/src/components/Input/DateInput/styles.module.scss +50 -0
- package/src/components/Input/Input/index.ts +206 -0
- package/src/components/Input/Input/styles.module.scss +14 -0
- package/src/components/Input/PasswordInput/index.ts +164 -0
- package/src/components/Input/PasswordInput/styles.module.scss +37 -0
- package/src/components/Input/index.ts +7 -0
- package/src/components/Label/index.ts +61 -0
- package/src/components/Label/styles.module.scss +41 -0
- package/src/components/LargeLoader/index.ts +25 -0
- package/src/components/LargeLoader/styles.module.scss +16 -0
- package/src/components/Listbox/ListBoxItem.ts +57 -0
- package/src/components/Listbox/index.ts +479 -0
- package/src/components/Listbox/styles.module.scss +197 -0
- package/src/components/Loader/index.ts +25 -0
- package/src/components/Loader/styles.module.scss +16 -0
- package/src/components/MediaGallery/MediaGalleryModal.ts +82 -0
- package/src/components/MediaGallery/MediaSlider.ts +76 -0
- package/src/components/MediaGallery/index.ts +92 -0
- package/src/components/MediaGallery/styles.module.scss +156 -0
- package/src/components/MediaUpload/index.ts +233 -0
- package/src/components/MediaUpload/styles.module.scss +118 -0
- package/src/components/Modal/index.ts +87 -0
- package/src/components/Modal/styles.module.scss +441 -0
- package/src/components/MultipurposeField/Dropdown/ListBoxItem.tsx +58 -0
- package/src/components/MultipurposeField/Dropdown/index.tsx +981 -0
- package/src/components/MultipurposeField/Dropdown/styles.module.scss +208 -0
- package/src/components/MultipurposeField/TagMenu/index.ts +384 -0
- package/src/components/MultipurposeField/TagMenu/styles.module.scss +136 -0
- package/src/components/MultipurposeField/TagOptions/index.tsx +83 -0
- package/src/components/MultipurposeField/TagOptions/styles.module.scss +95 -0
- package/src/components/MultipurposeField/index.tsx +687 -0
- package/src/components/MultipurposeField/styles.module.scss +56 -0
- package/src/components/NewModal/index.ts +69 -0
- package/src/components/NewModal/styles.module.scss +70 -0
- package/src/components/OverflowTooltip/index.tsx +59 -0
- package/src/components/PopUp/ConfirmationPopUp/index.ts +58 -0
- package/src/components/PopUp/ConfirmationPopUp/styles.module.scss +49 -0
- package/src/components/PopUp/SuccessPopUp/index.ts +62 -0
- package/src/components/PopUp/SuccessPopUp/styles.module.scss +38 -0
- package/src/components/RadioGroup/Radio.ts +129 -0
- package/src/components/RadioGroup/index.ts +169 -0
- package/src/components/RadioGroup/styles.module.scss +81 -0
- package/src/components/Search/index.ts +69 -0
- package/src/components/Search/styles.module.scss +149 -0
- package/src/components/TabBar/Tab.ts +33 -0
- package/src/components/TabBar/index.ts +64 -0
- package/src/components/TabBar/styles.module.scss +43 -0
- package/src/components/Tag/index.ts +29 -0
- package/src/components/Tag/styles.module.scss +57 -0
- package/src/components/TextArea/index.ts +172 -0
- package/src/components/TextArea/styles.module.scss +70 -0
- package/src/components/TextContent/index.tsx +128 -0
- package/src/components/TextContent/styles.module.scss +6 -0
- package/src/components/ThreeDotLoader/index.ts +39 -0
- package/src/components/ThreeDotLoader/styles.module.scss +41 -0
- package/src/components/TimeInput/index.ts +129 -0
- package/src/components/TimeInput/styles.module.scss +16 -0
- package/src/components/Toggle/index.ts +34 -0
- package/src/components/Toggle/styles.module.scss +56 -0
- package/src/components/Toggle-v2/index.ts +40 -0
- package/src/components/Toggle-v2/styles.module.scss +86 -0
- package/src/components/Tooltip/index.ts +271 -0
- package/src/components/Tooltip/styles.module.scss +105 -0
- package/src/components/form/ObjectField/index.ts +364 -0
- package/src/components/form/ObjectField/styles.module.scss +103 -0
- package/src/components/form/index.ts +3 -0
- package/src/contexts/AppContext.ts +12 -0
- package/src/declaration.d.ts +7 -0
- package/src/extensions/HMAC.ts +25 -0
- package/src/extensions/IntegryAPIError.ts +19 -0
- package/src/features/common/AccountDropdown/index.ts +291 -0
- package/src/features/common/AccountDropdown/styles.module.scss +19 -0
- package/src/features/common/ActionForm/index.ts +1818 -0
- package/src/features/common/ActionForm/styles.module.scss +23 -0
- package/src/features/common/AppCard/index.ts +207 -0
- package/src/features/common/AppCard/styles.module.scss +117 -0
- package/src/features/common/AppCardCompact/index.ts +189 -0
- package/src/features/common/AppCardCompact/styles.module.scss +141 -0
- package/src/features/common/AuthSelector/index.ts +537 -0
- package/src/features/common/AuthSelector/styles.module.scss +161 -0
- package/src/features/common/AuthSelectorCompact/index.ts +706 -0
- package/src/features/common/AuthSelectorCompact/styles.module.scss +219 -0
- package/src/features/common/AuthSelectorDropdown/index.ts +704 -0
- package/src/features/common/AuthSelectorDropdown/styles.module.scss +361 -0
- package/src/features/common/DynamicField/index.ts +229 -0
- package/src/features/common/DynamicField/styles.module.scss +67 -0
- package/src/features/common/DynamicTypedField/index.ts +217 -0
- package/src/features/common/DynamicTypedField/styles.module.scss +67 -0
- package/src/features/common/FunctionForm/index.ts +862 -0
- package/src/features/common/FunctionForm/styles.module.scss +163 -0
- package/src/features/common/MappingUI/index.ts +649 -0
- package/src/features/common/MappingUI/styles.module.scss +121 -0
- package/src/features/common/MarketplaceAppCard/index.ts +279 -0
- package/src/features/common/MarketplaceAppCard/styles.module.scss +231 -0
- package/src/features/common/MarketplaceAppCardCompact/index.ts +283 -0
- package/src/features/common/MarketplaceAppCardCompact/styles.module.scss +255 -0
- package/src/features/common/NewMappingUI/index.ts +515 -0
- package/src/features/common/NewMappingUI/styles.module.scss +113 -0
- package/src/features/common/RequestAppWidget/RequestAppModal/index.ts +67 -0
- package/src/features/common/RequestAppWidget/RequestAppModal/styles.module.scss +23 -0
- package/src/features/common/RequestAppWidget/index.ts +48 -0
- package/src/features/common/RequestAppWidget/request-app-form.ts +89 -0
- package/src/features/common/RequestAppWidget/styles.module.scss +43 -0
- package/src/features/common/SectionField/index.ts +272 -0
- package/src/features/common/SectionField/styles.module.scss +67 -0
- package/src/features/common/Step/index.ts +827 -0
- package/src/features/common/Step/styles.module.scss +12 -0
- package/src/features/common/StepNavigation/CollapsedSteps.ts +125 -0
- package/src/features/common/StepNavigation/NavItem.ts +111 -0
- package/src/features/common/StepNavigation/index.ts +257 -0
- package/src/features/common/StepNavigation/styles.module.scss +117 -0
- package/src/features/common/Steps/index.ts +1139 -0
- package/src/features/common/Steps/styles.module.scss +314 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/compactStyles.module.scss +383 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/flow-instance.tsx +367 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCard.tsx +194 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCardCompact.tsx +389 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowInstanceCompact.tsx +577 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/index.tsx +83 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/styles.module.scss +212 -0
- package/src/features/containers/AppFlowContainer/AppFlowWrap/app-page-loader.tsx +45 -0
- package/src/features/containers/AppFlowContainer/AppFlowWrap/index.tsx +1081 -0
- package/src/features/containers/AppFlowContainer/AppFlowWrap/styles.module.scss +452 -0
- package/src/features/containers/AppFlowContainer/Authentication/index.ts +610 -0
- package/src/features/containers/AppFlowContainer/Authentication/styles.module.scss +468 -0
- package/src/features/containers/AppFlowContainer/index.ts +114 -0
- package/src/features/containers/AppPageContainer/AppPage/index.tsx +262 -0
- package/src/features/containers/AppPageContainer/AppPage/styles.module.scss +120 -0
- package/src/features/containers/AppPageContainer/IntegrationCard/index.ts +165 -0
- package/src/features/containers/AppPageContainer/IntegrationCard/styles.module.scss +81 -0
- package/src/features/containers/AppPageContainer/index.tsx +93 -0
- package/src/features/containers/AppPageContainer/styles.module.scss +0 -0
- package/src/features/containers/AppsForFlows/index.ts +161 -0
- package/src/features/containers/AppsForFlows/styles.module.scss +280 -0
- package/src/features/containers/AppsForFlowsCompact/index.ts +161 -0
- package/src/features/containers/AppsForFlowsCompact/styles.module.scss +279 -0
- package/src/features/containers/AuthSetupContainer/AppSelection.ts +73 -0
- package/src/features/containers/AuthSetupContainer/AuthTypeSelection.ts +67 -0
- package/src/features/containers/AuthSetupContainer/Footer.ts +32 -0
- package/src/features/containers/AuthSetupContainer/Header.ts +39 -0
- package/src/features/containers/AuthSetupContainer/PostAdditionPopup.ts +27 -0
- package/src/features/containers/AuthSetupContainer/index.ts +349 -0
- package/src/features/containers/AuthSetupContainer/styles.module.scss +229 -0
- package/src/features/containers/FlowSetupContainer/index.ts +390 -0
- package/src/features/containers/FlowSetupContainer/styles.module.scss +18 -0
- package/src/features/containers/MarkeplaceApps/index.ts +574 -0
- package/src/features/containers/MarkeplaceApps/styles.module.scss +559 -0
- package/src/features/containers/MarketplaceAppsCompact/index.ts +576 -0
- package/src/features/containers/MarketplaceAppsCompact/styles.module.scss +546 -0
- package/src/features/containers/MarketplaceAppsContainer/index.ts +83 -0
- package/src/features/containers/MarketplaceContainer/AppCard/index.ts +91 -0
- package/src/features/containers/MarketplaceContainer/AppCard/styles.module.scss +66 -0
- package/src/features/containers/MarketplaceContainer/AppListing/index.ts +34 -0
- package/src/features/containers/MarketplaceContainer/AppListing/styles.module.scss +10 -0
- package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/index.ts +132 -0
- package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/styles.module.scss +117 -0
- package/src/features/containers/MarketplaceContainer/index.ts +242 -0
- package/src/features/containers/MarketplaceContainer/styles.module.scss +84 -0
- package/src/features/containers/SDKContainer/index.ts +817 -0
- package/src/features/containers/SDKContainer/styles.module.scss +266 -0
- package/src/features/containers/SDKDebugContainer/index.ts +137 -0
- package/src/features/containers/SDKDebugContainer/styles.module.scss +37 -0
- package/src/features/containers/SDKFailedContainer/index.ts +117 -0
- package/src/features/containers/SDKFailedContainer/styles.module.scss +57 -0
- package/src/features/integrations/IntegrationRow/Icons.ts +77 -0
- package/src/features/integrations/IntegrationRow/index.ts +129 -0
- package/src/features/integrations/IntegrationRow/styles.module.scss +62 -0
- package/src/features/integrations/IntegrationsHeader/index.ts +34 -0
- package/src/features/integrations/IntegrationsHeader/styles.module.scss +47 -0
- package/src/features/integrations/IntegrationsList/index.ts +252 -0
- package/src/features/integrations/IntegrationsList/styles.module.scss +67 -0
- package/src/features/templates/Template/index.ts +295 -0
- package/src/features/templates/Template/styles.module.scss +226 -0
- package/src/features/templates/TemplatesView/index.ts +368 -0
- package/src/features/templates/TemplatesView/styles.module.scss +71 -0
- package/src/features/templates/TemplatesViewCompact/index.ts +364 -0
- package/src/features/templates/TemplatesViewCompact/styles.module.scss +141 -0
- package/src/hooks/useAutosizeTextArea.ts +22 -0
- package/src/hooks/useCustomRef.ts +13 -0
- package/src/hooks/useDebounce.ts +17 -0
- package/src/hooks/useElementResize.ts +40 -0
- package/src/hooks/useEventListener.ts +44 -0
- package/src/hooks/useHover.ts +40 -0
- package/src/hooks/useOnClickOutside.ts +32 -0
- package/src/index.ts +2051 -0
- package/src/index.umd.ts +13 -0
- package/src/interfaces/index.ts +924 -0
- package/src/modules/api/index.ts +1315 -0
- package/src/modules/api/responseHandler.ts +38 -0
- package/src/modules/event-emitter/index.ts +72 -0
- package/src/modules/event-emitter/runners/abstract.ts +21 -0
- package/src/modules/event-emitter/runners/default.ts +11 -0
- package/src/modules/event-emitter/runners/ntimes.ts +28 -0
- package/src/modules/event-emitter/types.ts +34 -0
- package/src/store/actionFunctions.ts +1573 -0
- package/src/store/index.ts +17 -0
- package/src/store/initialState.ts +58 -0
- package/src/stories/Button.stories.tsx +83 -0
- package/src/stories/Checkbox/Checkbox.stories.tsx +41 -0
- package/src/stories/Checkbox/CheckboxGroup.stories.tsx +46 -0
- package/src/stories/EditableText.stories.tsx +35 -0
- package/src/stories/Input/BaseInput.stories.tsx +48 -0
- package/src/stories/Input/DateInput.stories.tsx +28 -0
- package/src/stories/Input/Input.stories.tsx +24 -0
- package/src/stories/Input/PasswordInput.stories.tsx +26 -0
- package/src/stories/Introduction.stories.mdx +211 -0
- package/src/stories/Label.stories.tsx +27 -0
- package/src/stories/Listbox.stories.tsx +122 -0
- package/src/stories/Radio/Radio.stories.tsx +39 -0
- package/src/stories/Radio/RadioGroup.stories.tsx +46 -0
- package/src/stories/StepNavigation/NavItem.stories.tsx +31 -0
- package/src/stories/StepNavigation/StepNavigation.stories.tsx +50 -0
- package/src/stories/TabBar.stories.tsx +31 -0
- package/src/stories/TextArea.stories.tsx +23 -0
- package/src/stories/TimeInput.stories.tsx +37 -0
- package/src/stories/Toggle.stories.tsx +33 -0
- package/src/stories/assets/code-brackets.svg +1 -0
- package/src/stories/assets/colors.svg +1 -0
- package/src/stories/assets/comments.svg +1 -0
- package/src/stories/assets/direction.svg +1 -0
- package/src/stories/assets/flow.svg +1 -0
- package/src/stories/assets/plugin.svg +1 -0
- package/src/stories/assets/repo.svg +1 -0
- package/src/stories/assets/stackalt.svg +1 -0
- package/src/types/index.ts +293 -0
- package/src/types/store.ts +366 -0
- package/src/types/utils.ts +19 -0
- package/src/utils/ActivityOutputUtils.ts +163 -0
- package/src/utils/common.ts +20 -0
- package/src/utils/copyToClipboard.ts +24 -0
- package/src/utils/datetime.ts +101 -0
- package/src/utils/getUrlParam.ts +11 -0
- package/src/utils/isAuthMessage.ts +16 -0
- package/src/utils/isBrowser.ts +1 -0
- package/src/utils/jsonEncodeDecode.ts +15 -0
- package/src/utils/objectUtils.ts +116 -0
- package/src/utils/popup.ts +30 -0
- package/src/utils/searchJson.ts +51 -0
- package/src/utils/stepUtils.ts +45 -0
- package/src/utils/truncate.ts +6 -0
- package/test/setup.ts +1 -0
- package/vitest.config.ts +10 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
/* eslint-disable import/no-cycle */
|
|
2
|
+
/* eslint-disable no-nested-ternary */
|
|
3
|
+
import { html } from 'htm/preact';
|
|
4
|
+
import { connect } from 'unistore/preact';
|
|
5
|
+
import {
|
|
6
|
+
useEffect,
|
|
7
|
+
useState,
|
|
8
|
+
} from 'preact/hooks';
|
|
9
|
+
import { InstanceStatusPill, MenuIcon } from '@/features/containers/AppFlowContainer/AppFlowListing/flow-instance';
|
|
10
|
+
import { Toggle } from '@/components/Toggle-v2';
|
|
11
|
+
import { CollapsedMenu } from '@/components/CollapsedMenu';
|
|
12
|
+
import { EditableText } from '@/components/EditableText';
|
|
13
|
+
|
|
14
|
+
import { StoreType } from '@/types/store';
|
|
15
|
+
import { actionFunctions } from '@/store';
|
|
16
|
+
import { TemplateListingRenderModes } from '@/types';
|
|
17
|
+
import { convertDateToStandard } from '@/utils/datetime';
|
|
18
|
+
import { Instance, Integration, Template as TemplateType } from '@/interfaces';
|
|
19
|
+
|
|
20
|
+
import style from './styles.module.scss';
|
|
21
|
+
|
|
22
|
+
export type FlowCardProps = {
|
|
23
|
+
id: number | string;
|
|
24
|
+
imgUrl: string;
|
|
25
|
+
name: string;
|
|
26
|
+
description: string;
|
|
27
|
+
tags: string;
|
|
28
|
+
layout: TemplateListingRenderModes;
|
|
29
|
+
handleClick: () => void;
|
|
30
|
+
apiHandler?: any;
|
|
31
|
+
app?: {
|
|
32
|
+
id: number;
|
|
33
|
+
}
|
|
34
|
+
onEdit?: (instance: Instance) => void;
|
|
35
|
+
onDelete?: (instance: Instance) => void;
|
|
36
|
+
onEditName?: ({
|
|
37
|
+
instance,
|
|
38
|
+
newName
|
|
39
|
+
}: {
|
|
40
|
+
instance: Instance;
|
|
41
|
+
newName: string;
|
|
42
|
+
}) => void;
|
|
43
|
+
dFlag?: string;
|
|
44
|
+
templateObj?: TemplateType | any;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
type State = {
|
|
48
|
+
loading: boolean;
|
|
49
|
+
filteredTemplates: TemplateType[];
|
|
50
|
+
error: string | null;
|
|
51
|
+
query: string;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const Template = (props: FlowCardProps) => {
|
|
55
|
+
|
|
56
|
+
const { apiHandler, app, id, onEdit, onDelete, dFlag } = props;
|
|
57
|
+
const [maxInstanceNameSize, setMaxInstanceNameSize] = useState(150);
|
|
58
|
+
// const [spliceName, setSpliceName] = useState(0);
|
|
59
|
+
const [template, setTemplateMeta] = useState({
|
|
60
|
+
id,
|
|
61
|
+
name: props.name,
|
|
62
|
+
description: props.description,
|
|
63
|
+
execution_type: 'AUTOMATIC',
|
|
64
|
+
instances: [],
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const getTextWidth = (text: string, font: string): number => {
|
|
68
|
+
const canvas = document.createElement('canvas');
|
|
69
|
+
const canvasContext = canvas.getContext('2d');
|
|
70
|
+
if (!canvasContext) {
|
|
71
|
+
return 150;
|
|
72
|
+
}
|
|
73
|
+
canvasContext.font = font;
|
|
74
|
+
const metrics = canvasContext.measureText(text);
|
|
75
|
+
return Math.round(metrics.width) + 8;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const handleInstanceGridWidth = (templateMeta: any) => {
|
|
79
|
+
// get maximum name size from integrations and convet to px
|
|
80
|
+
let maxNameSize = maxInstanceNameSize;
|
|
81
|
+
|
|
82
|
+
templateMeta.instances.forEach((instance: any) => {
|
|
83
|
+
const nameLengthInPX = getTextWidth(instance.name, '12px Inter');
|
|
84
|
+
if (nameLengthInPX > maxNameSize) {
|
|
85
|
+
maxNameSize = nameLengthInPX;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
if (maxNameSize > maxInstanceNameSize) {
|
|
90
|
+
// if (maxNameSize < 290) {
|
|
91
|
+
// setMaxInstanceNameSize(maxNameSize + 10)
|
|
92
|
+
// } else {
|
|
93
|
+
// setSpliceName(maxNameSize - 310);
|
|
94
|
+
// setMaxInstanceNameSize(300);
|
|
95
|
+
// }
|
|
96
|
+
setMaxInstanceNameSize(maxNameSize + 10)
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const getAppFlows = () => {
|
|
101
|
+
if (app) {
|
|
102
|
+
apiHandler.getAppFlows(app.id).then((data: any) => {
|
|
103
|
+
const { results = []} = data;
|
|
104
|
+
results.forEach((flow: any) => {
|
|
105
|
+
if (flow.id === id) {
|
|
106
|
+
const { instances = [] } = flow;
|
|
107
|
+
let tempInstances = [];
|
|
108
|
+
if (instances.length > 0) {
|
|
109
|
+
tempInstances = instances.map((instance: any) => ({
|
|
110
|
+
...instance,
|
|
111
|
+
id: instance.id,
|
|
112
|
+
name: `${instance.name}`,
|
|
113
|
+
status: instance.status,
|
|
114
|
+
last_run_start_time: instance.last_run_start_time,
|
|
115
|
+
}))
|
|
116
|
+
}
|
|
117
|
+
setTemplateMeta({
|
|
118
|
+
id,
|
|
119
|
+
...flow,
|
|
120
|
+
instances: tempInstances,
|
|
121
|
+
})
|
|
122
|
+
handleInstanceGridWidth(
|
|
123
|
+
{
|
|
124
|
+
id,
|
|
125
|
+
...flow,
|
|
126
|
+
instances: tempInstances,
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
const pollGetAppFlows= (frequency: number, pollInstances = 1, currentPolInstace = 0) => {
|
|
137
|
+
if (currentPolInstace < pollInstances) {
|
|
138
|
+
getAppFlows();
|
|
139
|
+
setTimeout(() => {
|
|
140
|
+
pollGetAppFlows(frequency, pollInstances, currentPolInstace + 1);
|
|
141
|
+
}, frequency);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const toggleIntegration = (instanceId: number, value: boolean) => {
|
|
146
|
+
apiHandler
|
|
147
|
+
.toggleIntegration(instanceId, value)
|
|
148
|
+
.catch((err: unknown) => {
|
|
149
|
+
console.error(err);
|
|
150
|
+
})
|
|
151
|
+
.finally(() => {
|
|
152
|
+
getAppFlows();
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const handleOptionSelect = (option: { id: string; label: string }, instance: Instance) => {
|
|
157
|
+
switch (option.id) {
|
|
158
|
+
case 'edit':
|
|
159
|
+
if(onEdit) onEdit(instance);
|
|
160
|
+
break;
|
|
161
|
+
case 'delete':
|
|
162
|
+
if(onDelete) onDelete(instance);
|
|
163
|
+
break;
|
|
164
|
+
default:
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const onUpdateName = (integration: Integration, name: string) => {
|
|
170
|
+
apiHandler
|
|
171
|
+
.renameIntegration(`${integration.id}`, name)
|
|
172
|
+
.then((integrationData: any) => {
|
|
173
|
+
if (!integrationData) {
|
|
174
|
+
throw new Error('Could not update integration name');
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
.catch((err: any) => console.error(err));
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const handleOnEditName = (newName: string, instance: Integration) => {
|
|
181
|
+
const tempInstances: any = template.instances.map((el: Instance) => {
|
|
182
|
+
if (el.id === instance.id) {
|
|
183
|
+
return {
|
|
184
|
+
...el,
|
|
185
|
+
name: newName,
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return el;
|
|
189
|
+
})
|
|
190
|
+
setTemplateMeta({
|
|
191
|
+
...template,
|
|
192
|
+
instances: tempInstances,
|
|
193
|
+
});
|
|
194
|
+
handleInstanceGridWidth(
|
|
195
|
+
{
|
|
196
|
+
...template,
|
|
197
|
+
instances: tempInstances,
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
onUpdateName(instance, newName);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
useEffect(() => {
|
|
204
|
+
// pollGetAppFlows(1000, 5, 0);
|
|
205
|
+
const { templateObj } = props;
|
|
206
|
+
setTemplateMeta(templateObj);
|
|
207
|
+
}, [dFlag, props.templateObj, props.templateObj.instances.length]);
|
|
208
|
+
const getLastRunStart = (dateTimeString: string): string => {
|
|
209
|
+
if (!dateTimeString) {
|
|
210
|
+
// return 'Never';
|
|
211
|
+
return 'No runs as yet';
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return convertDateToStandard(dateTimeString);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const integrations = template.instances || [];
|
|
218
|
+
return html`
|
|
219
|
+
<div class="${props.layout === TemplateListingRenderModes.LIST
|
|
220
|
+
? style.template_list_view
|
|
221
|
+
: style.template_grid_view} ${'integry-container__flow-card'}"
|
|
222
|
+
>
|
|
223
|
+
<div class=${style.titleContainer}>
|
|
224
|
+
<img src=${props.imgUrl} />
|
|
225
|
+
<div class=${style.title}>
|
|
226
|
+
<p class=${style.name}>${props.name}</p>
|
|
227
|
+
<p class=${style.description}>${props.description}</p>
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
230
|
+
${false && props.tags.length > 0 &&
|
|
231
|
+
html`
|
|
232
|
+
<div class=${style.tags}>
|
|
233
|
+
${props.tags
|
|
234
|
+
.split(',')
|
|
235
|
+
.map((el) => html` <div class=${style.tag}>${el}</div> `)}
|
|
236
|
+
</div>
|
|
237
|
+
`}
|
|
238
|
+
${integrations.length > 0 && html`<div class=${style.divider}></div>`}
|
|
239
|
+
${integrations.length > 0 ? html`
|
|
240
|
+
<div class=${style.integrations}>
|
|
241
|
+
<div class=${style.integrationsHeader} style="grid-template-columns: ${maxInstanceNameSize}px 1fr;">
|
|
242
|
+
<span style="flex: 1;" class=${style.th}>Instance</span>
|
|
243
|
+
<span style="width: 309px;" class=${style.th}>Last run start</span>
|
|
244
|
+
</div>
|
|
245
|
+
${integrations.map((instance: any) => html`
|
|
246
|
+
<div key=${`instance-${template.id}-${instance.id}`} class=${style.integration}>
|
|
247
|
+
<span>
|
|
248
|
+
<${EditableText} value=${instance.name} handleChange=${(newNameValue: string) => {
|
|
249
|
+
handleOnEditName(newNameValue, instance);
|
|
250
|
+
}} //>
|
|
251
|
+
</span>
|
|
252
|
+
<span>${getLastRunStart(instance.last_run_start_time)} ${html`<${InstanceStatusPill} instance=${instance} />`}</span>
|
|
253
|
+
<div>
|
|
254
|
+
${html`<${Toggle}
|
|
255
|
+
id=${instance.id}
|
|
256
|
+
value=${instance.status === 'ACTIVE'}
|
|
257
|
+
onChange=${(value: boolean) => toggleIntegration(instance.id, value)}
|
|
258
|
+
/>`}
|
|
259
|
+
</div>
|
|
260
|
+
<div>
|
|
261
|
+
<${CollapsedMenu}
|
|
262
|
+
icon=${MenuIcon}
|
|
263
|
+
options=${[
|
|
264
|
+
{
|
|
265
|
+
id: 'edit',
|
|
266
|
+
label: 'Edit',
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
id: 'delete',
|
|
270
|
+
label: 'Delete',
|
|
271
|
+
},
|
|
272
|
+
]}
|
|
273
|
+
onOptionSelect=${(option: { id: string; label: string }) =>
|
|
274
|
+
handleOptionSelect(option, instance)}
|
|
275
|
+
/>
|
|
276
|
+
</div>
|
|
277
|
+
</div>
|
|
278
|
+
`)}
|
|
279
|
+
</div>
|
|
280
|
+
` : html`<div class=${style.noIntegrations}></div>`}
|
|
281
|
+
<div class=${style.actions}>
|
|
282
|
+
<button class=${style.button} onclick=${props.handleClick}>${template.execution_type === 'AUTOMATIC' ? (integrations.length > 0 ? 'Setup another' : 'Setup and enable') : 'Setup and run'}</button>
|
|
283
|
+
</div>
|
|
284
|
+
</div>
|
|
285
|
+
`;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// export { Template };
|
|
289
|
+
|
|
290
|
+
const connectedTemplate = connect<FlowCardProps, State, StoreType, unknown>(
|
|
291
|
+
[],
|
|
292
|
+
actionFunctions,
|
|
293
|
+
)(Template);
|
|
294
|
+
|
|
295
|
+
export { connectedTemplate as Template };
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
.name {
|
|
2
|
+
margin-bottom: 0.5rem;
|
|
3
|
+
--tw-text-opacity: 1;
|
|
4
|
+
color: rgba(31, 41, 55, var(--tw-text-opacity));
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.description {
|
|
8
|
+
font-size: 0.875rem;
|
|
9
|
+
line-height: 1.25rem;
|
|
10
|
+
--tw-text-opacity: 1;
|
|
11
|
+
color: rgba(107, 114, 128, var(--tw-text-opacity));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.tags {
|
|
15
|
+
margin-top: 0.5rem;
|
|
16
|
+
margin-bottom: -0.5rem;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-wrap: wrap;
|
|
19
|
+
.tag {
|
|
20
|
+
margin-right: 0.5rem;
|
|
21
|
+
margin-bottom: 0.5rem;
|
|
22
|
+
border-radius: 0.75rem;
|
|
23
|
+
--tw-bg-opacity: 1;
|
|
24
|
+
background-color: rgba(229, 231, 235, var(--tw-bg-opacity));
|
|
25
|
+
padding: 0.25rem;
|
|
26
|
+
padding-left: 0.5rem;
|
|
27
|
+
padding-right: 0.5rem;
|
|
28
|
+
font-size: 0.75rem;
|
|
29
|
+
line-height: 1rem;
|
|
30
|
+
--tw-text-opacity: 1;
|
|
31
|
+
color: rgba(107, 114, 128, var(--tw-text-opacity));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.template_list_view {
|
|
36
|
+
display: flex;
|
|
37
|
+
// cursor: pointer;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
// justify-content: space-between;
|
|
40
|
+
justify-content: flex-start;
|
|
41
|
+
align-items: flex-start;
|
|
42
|
+
border-radius: 0.25rem;
|
|
43
|
+
border-width: 1px;
|
|
44
|
+
border-style: solid;
|
|
45
|
+
--tw-border-opacity: 1;
|
|
46
|
+
border-color: rgba(229, 231, 235, var(--tw-border-opacity));
|
|
47
|
+
padding-left: 1rem;
|
|
48
|
+
padding-right: 1rem;
|
|
49
|
+
padding-top: 1.25rem;
|
|
50
|
+
padding-bottom: 1.25rem;
|
|
51
|
+
transition: border-color 0.2s;
|
|
52
|
+
|
|
53
|
+
border-radius: 4px;
|
|
54
|
+
border: 1px solid var(--gray-5, #E0E0E0);
|
|
55
|
+
background: #FFF;
|
|
56
|
+
box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.08);
|
|
57
|
+
padding: 0;
|
|
58
|
+
|
|
59
|
+
img {
|
|
60
|
+
margin-bottom: 0.75rem;
|
|
61
|
+
height: 2.5rem;
|
|
62
|
+
width: 2.5rem;
|
|
63
|
+
}
|
|
64
|
+
&:hover {
|
|
65
|
+
// border-color: #a8a8a8;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.titleContainer {
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: row;
|
|
71
|
+
align-items: center;
|
|
72
|
+
justify-content: flex-start;
|
|
73
|
+
gap: 8px;
|
|
74
|
+
padding: 16px;
|
|
75
|
+
|
|
76
|
+
img {
|
|
77
|
+
width: 24px;
|
|
78
|
+
height: 24px;
|
|
79
|
+
border-radius: 50%;
|
|
80
|
+
object-fit: contain;
|
|
81
|
+
margin: 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.title {
|
|
85
|
+
p {
|
|
86
|
+
margin: 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.name {
|
|
90
|
+
color: var(--black-and-grey-title-and-desc, #333);
|
|
91
|
+
font-family: Inter;
|
|
92
|
+
font-size: 14px;
|
|
93
|
+
font-style: normal;
|
|
94
|
+
font-weight: 400;
|
|
95
|
+
line-height: 18px; /* 128.571% */
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.description {
|
|
99
|
+
color: var(--black-and-grey-draft-and-tooltip-desc, #999);
|
|
100
|
+
font-family: Inter;
|
|
101
|
+
font-size: 12px;
|
|
102
|
+
font-style: normal;
|
|
103
|
+
font-weight: 400;
|
|
104
|
+
line-height: normal;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.actions {
|
|
110
|
+
padding: 0 24px;
|
|
111
|
+
padding-bottom: 16px;
|
|
112
|
+
|
|
113
|
+
button {
|
|
114
|
+
border-radius: 5px;
|
|
115
|
+
border: 1px solid var(--theme-accent-blue-1, #4250F0);
|
|
116
|
+
background: var(--theme-accent-blue-1, #4250F0);
|
|
117
|
+
color: #FFF;
|
|
118
|
+
font-family: Inter;
|
|
119
|
+
font-size: 13px;
|
|
120
|
+
font-style: normal;
|
|
121
|
+
font-weight: 400;
|
|
122
|
+
line-height: normal;
|
|
123
|
+
padding: 4.5px 10px;
|
|
124
|
+
cursor: pointer;
|
|
125
|
+
|
|
126
|
+
&:hover {
|
|
127
|
+
background: var(--theme-accent-blue-2, #3A46D5);
|
|
128
|
+
border: 1px solid var(--theme-accent-blue-2, #3A46D5);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.template_grid_view {
|
|
135
|
+
display: flex;
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
flex-direction: column;
|
|
138
|
+
justify-content: space-between;
|
|
139
|
+
border-radius: 0.25rem;
|
|
140
|
+
border-width: 1px;
|
|
141
|
+
border-style: solid;
|
|
142
|
+
--tw-border-opacity: 1;
|
|
143
|
+
border-color: rgba(229, 231, 235, var(--tw-border-opacity));
|
|
144
|
+
padding-left: 1rem;
|
|
145
|
+
padding-right: 1rem;
|
|
146
|
+
padding-top: 1.25rem;
|
|
147
|
+
padding-bottom: 1.25rem;
|
|
148
|
+
transition: border-color 0.2s;
|
|
149
|
+
img {
|
|
150
|
+
margin-bottom: 0.75rem;
|
|
151
|
+
height: 2.5rem;
|
|
152
|
+
width: 2.5rem;
|
|
153
|
+
}
|
|
154
|
+
&:hover {
|
|
155
|
+
border-color: #a8a8a8;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.noIntegrations {
|
|
160
|
+
padding: 3px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.integrations {
|
|
164
|
+
padding: 16px 24px;
|
|
165
|
+
display: flex;
|
|
166
|
+
flex-direction: column;
|
|
167
|
+
align-items: flex-start;
|
|
168
|
+
justify-content: flex-start;
|
|
169
|
+
gap: 8px;
|
|
170
|
+
// width: calc(100% - 48px);
|
|
171
|
+
width: calc(100%);
|
|
172
|
+
box-sizing: border-box;
|
|
173
|
+
|
|
174
|
+
p, span {
|
|
175
|
+
color: var(--black-and-grey-title-and-desc, #333);
|
|
176
|
+
font-feature-settings: 'clig' off, 'liga' off;
|
|
177
|
+
font-family: Inter;
|
|
178
|
+
font-size: 12px;
|
|
179
|
+
font-style: normal;
|
|
180
|
+
font-weight: 400;
|
|
181
|
+
line-height: normal;
|
|
182
|
+
margin: 0;
|
|
183
|
+
|
|
184
|
+
display: flex;
|
|
185
|
+
flex-direction: row;
|
|
186
|
+
align-items: center;
|
|
187
|
+
justify-content: flex-start;
|
|
188
|
+
gap: 6px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.integrationsHeader {
|
|
192
|
+
display: grid;
|
|
193
|
+
grid-template-columns: 150px 1fr;
|
|
194
|
+
padding: 0 16px;
|
|
195
|
+
gap: 16px;
|
|
196
|
+
display: flex;
|
|
197
|
+
flex-direction: row;
|
|
198
|
+
align-items: center;
|
|
199
|
+
justify-content: flex-start;
|
|
200
|
+
width: 100%;
|
|
201
|
+
box-sizing: border-box;
|
|
202
|
+
|
|
203
|
+
* {
|
|
204
|
+
user-select: none;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.integration {
|
|
209
|
+
display: grid;
|
|
210
|
+
grid-template-columns: 1fr 207px 50px 20px;
|
|
211
|
+
gap: 16px;
|
|
212
|
+
border-radius: 4px;
|
|
213
|
+
border: 1px solid var(--gray-5, #E0E0E0);
|
|
214
|
+
background: #FFF;
|
|
215
|
+
padding: 12px 16px;
|
|
216
|
+
// width: calc(100% - 32px);
|
|
217
|
+
width: calc(100%);
|
|
218
|
+
box-sizing: border-box;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.divider {
|
|
223
|
+
background: #EDEDED;
|
|
224
|
+
width: 100%;
|
|
225
|
+
height: 1px;
|
|
226
|
+
}
|