windmill-components 1.35.1 → 1.35.43

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.
Files changed (201) hide show
  1. package/components/ArgInput.svelte +21 -21
  2. package/components/ArgInput.svelte.d.ts +3 -3
  3. package/components/DisplayResult.svelte +73 -67
  4. package/components/Editor.svelte +184 -246
  5. package/components/Editor.svelte.d.ts +4 -4
  6. package/components/EditorBar.svelte +58 -45
  7. package/components/EditorBar.svelte.d.ts +2 -1
  8. package/components/FlowBuilder.svelte +113 -121
  9. package/components/FlowJobResult.svelte +4 -5
  10. package/components/FlowModulesViewer.svelte +89 -7
  11. package/components/FlowModulesViewer.svelte.d.ts +1 -0
  12. package/components/FlowPreviewContent.svelte +56 -15
  13. package/components/FlowPreviewContent.svelte.d.ts +1 -1
  14. package/components/FlowStatusViewer.svelte +42 -24
  15. package/components/FlowStatusViewer.svelte.d.ts +0 -1
  16. package/components/FlowViewer.svelte +7 -3
  17. package/components/HighlightCode.svelte +21 -0
  18. package/components/HighlightCode.svelte.d.ts +17 -0
  19. package/components/IconedPath.svelte +9 -7
  20. package/components/IconedResourceType.svelte +1 -1
  21. package/components/InputTransformForm.svelte +88 -107
  22. package/components/InputTransformForm.svelte.d.ts +0 -1
  23. package/components/ItemPicker.svelte +2 -2
  24. package/components/LogViewer.svelte +23 -0
  25. package/components/LogViewer.svelte.d.ts +19 -0
  26. package/components/ModulePreview.svelte +108 -0
  27. package/components/ModulePreview.svelte.d.ts +24 -0
  28. package/components/RunForm.svelte +29 -18
  29. package/components/RunForm.svelte.d.ts +6 -2
  30. package/components/SchemaEditor.svelte +5 -3
  31. package/components/SchemaForm.svelte +0 -2
  32. package/components/SchemaForm.svelte.d.ts +0 -1
  33. package/components/ScriptBuilder.svelte +77 -66
  34. package/components/ScriptBuilder.svelte.d.ts +2 -4
  35. package/components/ScriptEditor.svelte +69 -142
  36. package/components/ScriptEditor.svelte.d.ts +0 -5
  37. package/components/ScriptPicker.svelte +3 -3
  38. package/components/ScriptPicker.svelte.d.ts +2 -1
  39. package/components/SharedBadge.svelte +5 -13
  40. package/components/SimpleEditor.svelte +147 -0
  41. package/components/SimpleEditor.svelte.d.ts +35 -0
  42. package/components/TestJobLoader.svelte +98 -0
  43. package/components/TestJobLoader.svelte.d.ts +26 -0
  44. package/components/Tooltip.svelte +2 -1
  45. package/components/common/actionRow/ActionRow.svelte +26 -0
  46. package/components/common/actionRow/ActionRow.svelte.d.ts +21 -0
  47. package/components/common/alert/Alert.svelte +53 -0
  48. package/components/common/alert/Alert.svelte.d.ts +20 -0
  49. package/components/common/alert/model.d.ts +1 -0
  50. package/components/common/alert/model.js +1 -0
  51. package/components/common/badge/Badge.svelte +82 -0
  52. package/components/common/badge/Badge.svelte.d.ts +28 -0
  53. package/components/common/badge/model.d.ts +8 -0
  54. package/components/common/badge/model.js +1 -0
  55. package/components/common/button/Button.svelte +107 -0
  56. package/components/common/button/Button.svelte.d.ts +37 -0
  57. package/components/common/button/model.d.ts +6 -0
  58. package/components/common/button/model.js +1 -0
  59. package/components/common/confirmationModal/ConfirmationModal.svelte +55 -0
  60. package/components/common/confirmationModal/ConfirmationModal.svelte.d.ts +23 -0
  61. package/components/common/drawer/Drawer.svelte +3 -0
  62. package/components/common/drawer/Drawer.svelte.d.ts +2 -0
  63. package/components/common/index.d.ts +14 -0
  64. package/components/common/index.js +14 -0
  65. package/components/common/tabs/TabContent.svelte +3 -2
  66. package/components/common/tabs/TabContent.svelte.d.ts +1 -0
  67. package/components/common/tabs/Tabs.svelte +8 -1
  68. package/components/common/tabs/Tabs.svelte.d.ts +2 -0
  69. package/components/common/toggleButton/ToggleButton.svelte +20 -0
  70. package/components/common/toggleButton/ToggleButton.svelte.d.ts +19 -0
  71. package/components/common/toggleButton/ToggleButtonGroup.svelte +33 -0
  72. package/components/common/toggleButton/ToggleButtonGroup.svelte.d.ts +24 -0
  73. package/components/flows/FlowEditor.svelte +30 -0
  74. package/components/{FlowEditor.svelte.d.ts → flows/FlowEditor.svelte.d.ts} +1 -8
  75. package/components/flows/common/FlowCard.svelte +9 -0
  76. package/components/flows/common/FlowCard.svelte.d.ts +21 -0
  77. package/components/flows/common/FlowCardHeader.svelte +39 -0
  78. package/components/flows/common/FlowCardHeader.svelte.d.ts +20 -0
  79. package/components/flows/content/CopyFirstStepSchema.svelte +13 -0
  80. package/components/flows/{CopyFirstStepSchema.svelte.d.ts → content/CopyFirstStepSchema.svelte.d.ts} +0 -0
  81. package/components/flows/{DynamicInputHelpBox.svelte → content/DynamicInputHelpBox.svelte} +0 -0
  82. package/components/flows/{DynamicInputHelpBox.svelte.d.ts → content/DynamicInputHelpBox.svelte.d.ts} +0 -0
  83. package/components/flows/content/FlowEditorPanel.svelte +26 -0
  84. package/components/flows/content/FlowEditorPanel.svelte.d.ts +14 -0
  85. package/components/flows/content/FlowFailureModule.svelte +17 -0
  86. package/components/flows/content/FlowFailureModule.svelte.d.ts +14 -0
  87. package/components/flows/content/FlowInput.svelte +22 -0
  88. package/components/flows/{FlowInput.svelte.d.ts → content/FlowInput.svelte.d.ts} +0 -0
  89. package/components/flows/{FlowInputs.svelte → content/FlowInputs.svelte} +24 -13
  90. package/components/flows/{FlowInputs.svelte.d.ts → content/FlowInputs.svelte.d.ts} +0 -0
  91. package/components/flows/content/FlowLoop.svelte +38 -0
  92. package/components/flows/content/FlowLoop.svelte.d.ts +14 -0
  93. package/components/flows/content/FlowModule.svelte +190 -0
  94. package/components/flows/content/FlowModule.svelte.d.ts +29 -0
  95. package/components/flows/content/FlowModuleAdvancedSettings.svelte +64 -0
  96. package/components/flows/content/FlowModuleAdvancedSettings.svelte.d.ts +17 -0
  97. package/components/flows/content/FlowModuleHeader.svelte +68 -0
  98. package/components/flows/{FlowModuleHeader.svelte.d.ts → content/FlowModuleHeader.svelte.d.ts} +2 -3
  99. package/components/flows/content/FlowModuleScript.svelte +21 -0
  100. package/components/flows/content/FlowModuleScript.svelte.d.ts +17 -0
  101. package/components/flows/content/FlowModuleWrapper.svelte +47 -0
  102. package/components/flows/content/FlowModuleWrapper.svelte.d.ts +14 -0
  103. package/components/flows/content/FlowRetries.svelte +80 -0
  104. package/components/flows/content/FlowRetries.svelte.d.ts +14 -0
  105. package/components/flows/content/FlowSchedules.svelte +18 -0
  106. package/components/flows/content/FlowSchedules.svelte.d.ts +14 -0
  107. package/components/flows/content/FlowSettings.svelte +51 -0
  108. package/components/flows/{FlowSettings.svelte.d.ts → content/FlowSettings.svelte.d.ts} +1 -6
  109. package/components/flows/content/RemoveStepConfirmationModal.svelte +32 -0
  110. package/components/flows/content/RemoveStepConfirmationModal.svelte.d.ts +19 -0
  111. package/components/flows/flowState.d.ts +8 -7
  112. package/components/flows/flowState.js +25 -46
  113. package/components/flows/flowStateUtils.d.ts +15 -13
  114. package/components/flows/flowStateUtils.js +80 -72
  115. package/components/flows/flowStore.js +7 -4
  116. package/components/flows/header/FlowEditorHeader.svelte +23 -0
  117. package/components/flows/header/FlowEditorHeader.svelte.d.ts +14 -0
  118. package/components/flows/header/FlowImportExportMenu.svelte +56 -0
  119. package/components/flows/header/FlowImportExportMenu.svelte.d.ts +14 -0
  120. package/components/flows/header/FlowPreviewButtons.svelte +49 -0
  121. package/components/flows/header/FlowPreviewButtons.svelte.d.ts +14 -0
  122. package/components/flows/header/FlowStatus.svelte +36 -0
  123. package/components/flows/header/FlowStatus.svelte.d.ts +14 -0
  124. package/components/flows/map/FlowErrorHandlerItem.svelte +54 -0
  125. package/components/flows/map/FlowErrorHandlerItem.svelte.d.ts +14 -0
  126. package/components/flows/map/FlowModuleSchemaItem.svelte +58 -0
  127. package/components/flows/map/FlowModuleSchemaItem.svelte.d.ts +27 -0
  128. package/components/flows/map/FlowModuleSchemaMap.svelte +161 -0
  129. package/components/flows/map/FlowModuleSchemaMap.svelte.d.ts +20 -0
  130. package/components/flows/pickers/PickHubScript.svelte +4 -3
  131. package/components/flows/pickers/PickHubScript.svelte.d.ts +2 -1
  132. package/components/flows/pickers/PickScript.svelte +4 -12
  133. package/components/flows/pickers/PickScript.svelte.d.ts +1 -1
  134. package/components/flows/propPicker/PropPickerWrapper.svelte +42 -0
  135. package/components/flows/propPicker/PropPickerWrapper.svelte.d.ts +31 -0
  136. package/components/flows/scheduleUtils.d.ts +0 -1
  137. package/components/flows/scheduleUtils.js +0 -1
  138. package/components/flows/types.d.ts +9 -0
  139. package/components/flows/types.js +1 -0
  140. package/components/flows/utils.d.ts +1 -1
  141. package/components/flows/utils.js +8 -11
  142. package/components/icons/HatIcon.svelte +19 -0
  143. package/components/icons/HatIcon.svelte.d.ts +16 -0
  144. package/components/landing/FlowGettingStarted.svelte +22 -68
  145. package/components/landing/FlowLandingBox.svelte +1 -1
  146. package/components/landing/RessourceGettingStarted.svelte +7 -37
  147. package/components/landing/ScriptBox.svelte +33 -60
  148. package/components/landing/ScriptGettingStarted.svelte +23 -69
  149. package/components/propertyPicker/ObjectViewer.svelte +16 -7
  150. package/components/propertyPicker/PropPicker.svelte +38 -12
  151. package/components/propertyPicker/WarningMessage.svelte +2 -15
  152. package/components/script_editor/LogPanel.svelte +108 -119
  153. package/components/script_editor/LogPanel.svelte.d.ts +2 -0
  154. package/components/sidebar/SidebarContent.svelte +2 -2
  155. package/editorUtils.d.ts +25 -0
  156. package/editorUtils.js +43 -0
  157. package/gen/models/CompletedJob.d.ts +2 -1
  158. package/gen/models/CompletedJob.js +1 -0
  159. package/gen/models/FlowModule.d.ts +1 -0
  160. package/gen/models/FlowStatus.d.ts +3 -0
  161. package/gen/models/FlowStatusModule.d.ts +1 -1
  162. package/gen/models/FlowValue.d.ts +11 -0
  163. package/gen/models/Preview.d.ts +2 -1
  164. package/gen/models/Preview.js +1 -0
  165. package/gen/models/QueuedJob.d.ts +2 -1
  166. package/gen/models/QueuedJob.js +1 -0
  167. package/gen/models/RawScript.d.ts +2 -1
  168. package/gen/models/RawScript.js +1 -0
  169. package/gen/models/Script.d.ts +9 -2
  170. package/gen/models/Script.js +8 -0
  171. package/gen/services/JobService.d.ts +40 -0
  172. package/gen/services/JobService.js +70 -0
  173. package/gen/services/ScriptService.d.ts +14 -3
  174. package/gen/services/ScriptService.js +13 -0
  175. package/infer.d.ts +1 -1
  176. package/infer.js +6 -1
  177. package/package.json +67 -35
  178. package/script_helpers.d.ts +5 -2
  179. package/script_helpers.js +41 -13
  180. package/stores.d.ts +1 -1
  181. package/utils.d.ts +6 -4
  182. package/utils.js +27 -4
  183. package/components/FlowEditor.svelte +0 -55
  184. package/components/FlowPreview.svelte +0 -107
  185. package/components/FlowPreview.svelte.d.ts +0 -23
  186. package/components/ModuleStep.svelte +0 -131
  187. package/components/ModuleStep.svelte.d.ts +0 -25
  188. package/components/flows/CopyFirstStepSchema.svelte +0 -13
  189. package/components/flows/FlowBox.svelte +0 -16
  190. package/components/flows/FlowBox.svelte.d.ts +0 -23
  191. package/components/flows/FlowBoxHeader.svelte +0 -16
  192. package/components/flows/FlowBoxHeader.svelte.d.ts +0 -21
  193. package/components/flows/FlowInput.svelte +0 -22
  194. package/components/flows/FlowModuleHeader.svelte +0 -109
  195. package/components/flows/FlowSettings.svelte +0 -165
  196. package/components/flows/FlowTimeline.svelte +0 -169
  197. package/components/flows/FlowTimeline.svelte.d.ts +0 -21
  198. package/components/flows/stepOpenedStore.d.ts +0 -1
  199. package/components/flows/stepOpenedStore.js +0 -6
  200. package/components/propertyPicker/OverlayPropertyPicker.svelte +0 -69
  201. package/components/propertyPicker/OverlayPropertyPicker.svelte.d.ts +0 -24
@@ -2,22 +2,43 @@
2
2
  import { workspaceStore } from '../stores';
3
3
  import { faClose, faPlay } from '@fortawesome/free-solid-svg-icons';
4
4
  import { Button } from 'flowbite-svelte';
5
- import { createEventDispatcher, onDestroy } from 'svelte';
5
+ import { createEventDispatcher, getContext, onDestroy } from 'svelte';
6
6
  import Icon from 'svelte-awesome';
7
- import { flowStateStore, flowStateToFlow } from './flows/flowState';
7
+ import { flowStateStore } from './flows/flowState';
8
8
  import { mapJobResultsToFlowState } from './flows/flowStateUtils';
9
9
  import { flowStore } from './flows/flowStore';
10
10
  import { runFlowPreview } from './flows/utils';
11
- import FlowStatusViewer from './FlowStatusViewer.svelte';
12
11
  import SchemaForm from './SchemaForm.svelte';
13
- export let args = {};
12
+ import FlowStatusViewer from '../components/FlowStatusViewer.svelte';
13
+ export let previewMode;
14
14
  let jobId = undefined;
15
15
  let isValid = false;
16
16
  let intervalState = 'idle';
17
- $: newFlow = flowStateToFlow($flowStateStore, $flowStore);
18
- $: steps = newFlow?.value.modules.length ?? 0;
17
+ const { selectedId, previewArgs } = getContext('FlowEditorContext');
18
+ function extractFlow(previewMode) {
19
+ if (previewMode === 'whole') {
20
+ return $flowStore;
21
+ }
22
+ else {
23
+ const [parentIndex, childIndex] = $selectedId.split('-');
24
+ const modules = $flowStore.value.modules.slice(0, Number(parentIndex) + 1);
25
+ const flow = JSON.parse(JSON.stringify($flowStore));
26
+ flow.value.modules = modules;
27
+ if (childIndex != undefined) {
28
+ const lastModule = modules[modules.length - 1].value;
29
+ if (lastModule.type === 'forloopflow') {
30
+ lastModule.modules = lastModule.modules.slice(0, Number(childIndex) + 1);
31
+ }
32
+ else {
33
+ throw Error('Excepted forloopflow module');
34
+ }
35
+ }
36
+ return flow;
37
+ }
38
+ }
19
39
  const dispatch = createEventDispatcher();
20
40
  export async function runPreview(args) {
41
+ const newFlow = extractFlow(previewMode);
21
42
  jobId = await runFlowPreview(args, newFlow);
22
43
  intervalState = 'running';
23
44
  }
@@ -28,19 +49,32 @@ onDestroy(() => {
28
49
 
29
50
  <div class="flex divide-y flex-col space-y-2 h-screen bg-white p-6 w-full">
30
51
  <div class="flex justify-between">
31
- <div class="flex flex-row justify-center items-center">
32
- <div class="flex justify-center p-2 w-8 h-8 bg-blue-200 rounded-lg mr-2">
52
+ <div class="flex flex-row justify-center items-center ">
53
+ <div class="flex justify-center p-2 w-8 h-8 bg-blue-200 rounded-lg mr-2 ">
33
54
  <Icon data={faPlay} scale={1} class="text-blue-500" />
34
55
  </div>
35
56
 
36
- <h3 class="text-lg leading-6 font-bold text-gray-900">Flow preview</h3>
57
+ <h3 class="text-lg leading-6 font-bold text-gray-900">
58
+ Test preview - {previewMode === 'upTo'
59
+ ? `up to step ${$selectedId.split('-').join(',')}`
60
+ : ' whole flow'}
61
+ </h3>
37
62
  </div>
38
- <Button color="alternative" on:click={() => dispatch('close')}>
63
+ <Button
64
+ color="alternative"
65
+ on:click={() => {
66
+ jobId = undefined
67
+ intervalState = 'idle'
68
+ dispatch('close')
69
+ }}
70
+ >
39
71
  <Icon data={faClose} />
40
72
  </Button>
41
73
  </div>
42
- <div class="max-h-80 overflow-y-auto">
43
- <SchemaForm schema={$flowStore.schema} bind:isValid bind:args />
74
+ <div class="pb-4 h-full max-h-1/2 overflow-auto">
75
+ <div class="mt-4">
76
+ <SchemaForm schema={$flowStore.schema} bind:isValid bind:args={$previewArgs} />
77
+ </div>
44
78
  </div>
45
79
  {#if intervalState === 'running'}
46
80
  <Button
@@ -63,7 +97,12 @@ onDestroy(() => {
63
97
  Cancel
64
98
  </Button>
65
99
  {:else}
66
- <Button disabled={!isValid} class="blue-button" on:click={() => runPreview(args)} size="md">
100
+ <Button
101
+ disabled={!isValid}
102
+ class="blue-button"
103
+ on:click={() => runPreview($previewArgs)}
104
+ size="md"
105
+ >
67
106
  {`Run${intervalState === 'done' ? ' again' : ''}`}
68
107
  </Button>
69
108
  {/if}
@@ -74,9 +113,11 @@ onDestroy(() => {
74
113
  {jobId}
75
114
  on:jobsLoaded={(e) => {
76
115
  intervalState = 'done'
77
- mapJobResultsToFlowState(e.detail, 'upto', steps - 1)
116
+ const [parentIndex] = $selectedId.split('-')
117
+ const upToIndex =
118
+ previewMode === 'upTo' ? Number(parentIndex) + 1 : $flowStateStore.modules.length
119
+ mapJobResultsToFlowState(e.detail, upToIndex)
78
120
  }}
79
- root={true}
80
121
  />
81
122
  {/if}
82
123
  </div>
@@ -1,7 +1,7 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
- args?: Record<string, any> | undefined;
4
+ previewMode: 'upTo' | 'whole';
5
5
  runPreview?: ((args: Record<string, any>) => Promise<void>) | undefined;
6
6
  };
7
7
  events: {
@@ -1,4 +1,4 @@
1
- <script>import { JobService } from '../gen';
1
+ <script>import { FlowStatusModule, JobService } from '../gen';
2
2
  import { workspaceStore } from '../stores';
3
3
  import FlowJobResult from './FlowJobResult.svelte';
4
4
  import FlowPreviewStatus from './preview/FlowPreviewStatus.svelte';
@@ -9,7 +9,6 @@ import { createEventDispatcher } from 'svelte';
9
9
  import { onDestroy } from 'svelte';
10
10
  const dispatch = createEventDispatcher();
11
11
  export let jobId;
12
- export let root = false;
13
12
  export let forloopJobIds = undefined;
14
13
  export let jobResult = {
15
14
  job: undefined,
@@ -18,6 +17,7 @@ export let jobResult = {
18
17
  };
19
18
  let forloop_selected = '';
20
19
  let timeout;
20
+ $: innerModules = jobResult.job?.flow_status?.modules ?? [];
21
21
  async function loadJobInProgress() {
22
22
  const job = await JobService.getJob({
23
23
  workspace: $workspaceStore ?? '',
@@ -28,14 +28,11 @@ async function loadJobInProgress() {
28
28
  if (job?.type !== 'CompletedJob') {
29
29
  timeout = setTimeout(() => loadJobInProgress(), 500);
30
30
  }
31
- else if (root) {
32
- dispatch('jobsLoaded', jobResult);
33
- }
34
31
  }
35
- $: hasModules =
36
- jobResult.job &&
37
- Array.isArray(jobResult.job?.raw_flow?.modules) &&
38
- jobResult.job?.raw_flow?.modules.length > 1;
32
+ $: jobResult &&
33
+ jobResult.job?.type === 'CompletedJob' &&
34
+ jobResult.job.flow_status?.modules.length == jobResult.innerJobs?.length &&
35
+ dispatch('jobsLoaded', jobResult);
39
36
  function updateJobId() {
40
37
  if (jobId !== jobResult.job?.id) {
41
38
  loadJobInProgress();
@@ -49,7 +46,9 @@ onDestroy(() => {
49
46
 
50
47
  {#if jobResult.job}
51
48
  <div class="flow-root w-full space-y-4">
52
- <h3 class="text-md leading-6 font-bold text-gray-900 border-b pb-2">Preview results</h3>
49
+ {#if innerModules.length > 0}
50
+ <h3 class="text-md leading-6 font-bold text-gray-900 border-b pb-2">Flow result</h3>
51
+ {/if}
53
52
  <FlowPreviewStatus job={jobResult.job} />
54
53
  {#if `result` in jobResult.job}
55
54
  <FlowJobResult job={jobResult.job} />
@@ -87,32 +86,51 @@ onDestroy(() => {
87
86
  <svelte:self jobId={loopJobId} bind:jobResult={jobResult.loopJobs[j]} />
88
87
  </div>
89
88
  {/each}
90
- {:else if hasModules && Array.isArray(jobResult.innerJobs)}
89
+ {:else if innerModules.length > 0}
91
90
  <ul class="w-full">
92
91
  <h3 class="text-md leading-6 font-bold text-gray-900 border-b mb-4 py-2">
93
- Detailed results
92
+ Step-by-step results
94
93
  </h3>
95
94
 
96
- {#each jobResult.job?.flow_status?.modules ?? [] as module, i}
97
- <p class="text-gray-500 mb-6 w-full ">
98
- Step
99
- <span class="font-medium text-gray-900"> {i + 1} </span> out of
100
- <span class="font-medium text-gray-900">{jobResult.job?.raw_flow?.modules.length}</span>
95
+ {#each innerModules as mod, i}
96
+ <p class="text-gray-500 mb-2 w-full ">
97
+ {#if jobResult.job?.raw_flow?.modules && i < jobResult.job?.raw_flow?.modules.length}
98
+ Step
99
+ <span class="font-medium text-gray-900">
100
+ {i + 1}
101
+ </span>
102
+ out of
103
+ <span class="font-medium text-gray-900"
104
+ >{jobResult.job?.raw_flow?.modules.length}</span
105
+ >
106
+ {#if jobResult.job.raw_flow?.modules[i]?.summary}
107
+ : <span class="font-medium text-gray-900"
108
+ >{jobResult.job.raw_flow?.modules[i]?.summary ?? ''}</span
109
+ >
110
+ {/if}
111
+ {:else}
112
+ <span class="font-medium text-gray-900"> Failure module </span>
113
+ {/if}
101
114
  </p>
102
115
 
103
- {#if ['InProgress', 'Success', 'Error'].includes(module.type)}
104
- <li class="w-full border p-6 space-y-2">
116
+ <li class="w-full border p-6 space-y-2">
117
+ {#if [FlowStatusModule.type.IN_PROGRESS, FlowStatusModule.type.SUCCESS, FlowStatusModule.type.FAILURE].includes(mod.type)}
105
118
  <svelte:self
106
- jobId={module.job}
119
+ jobId={mod.job}
107
120
  bind:jobResult={jobResult.innerJobs[i]}
108
- forloopJobIds={module.forloop_jobs}
121
+ forloopJobIds={mod.forloop_jobs}
122
+ on:jobsLoaded={(e) => {
123
+ jobResult = jobResult
124
+ }}
109
125
  />
110
- </li>
111
- {/if}
126
+ {:else}
127
+ <span>{mod.type}</span>
128
+ {/if}
129
+ </li>
112
130
  {/each}
113
131
  </ul>
114
132
  {/if}
115
133
  </div>
116
134
  {:else}
117
- No script selected
135
+ Job loading...
118
136
  {/if}
@@ -3,7 +3,6 @@ import type { JobResult } from './flows/flowStateUtils';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  jobId: string;
6
- root?: boolean | undefined;
7
6
  forloopJobIds?: string[] | undefined;
8
7
  jobResult?: JobResult | undefined;
9
8
  };
@@ -9,7 +9,7 @@ import SvelteMarkdown from 'svelte-markdown';
9
9
  import FlowModulesViewer from './FlowModulesViewer.svelte';
10
10
  export let flow;
11
11
  export let initialOpen = undefined;
12
- let flowFiltered = {
12
+ $: flowFiltered = {
13
13
  summary: flow.summary,
14
14
  description: flow.description,
15
15
  value: flow.value,
@@ -61,7 +61,10 @@ function toAny(x) {
61
61
  {:else}
62
62
  <div class="text-gray-700 text-xs italic mb-4">No inputs</div>
63
63
  {/if}
64
- <FlowModulesViewer modules={flow?.value?.modules} />
64
+ <FlowModulesViewer
65
+ modules={flow?.value?.modules}
66
+ failureModule={flow?.value?.failure_module}
67
+ />
65
68
  </div>
66
69
  </TabContent>
67
70
  <TabContent value="json">
@@ -71,7 +74,8 @@ function toAny(x) {
71
74
  await navigator.clipboard.writeText(JSON.stringify(flowFiltered, null, 4))
72
75
  }}
73
76
  class="absolute default-secondary-button-v2 bg-white/30 right-0 my-2 ml-4"
74
- >copy content</button
77
+ >
78
+ copy content</button
75
79
  >
76
80
  <Highlight language={json} code={JSON.stringify(flowFiltered, null, 4)} />
77
81
  </div>
@@ -0,0 +1,21 @@
1
+ <script>import Highlight from 'svelte-highlight';
2
+ import python from 'svelte-highlight/languages/python';
3
+ import typescript from 'svelte-highlight/languages/typescript';
4
+ import go from 'svelte-highlight/languages/go';
5
+ export let code = '';
6
+ export let language;
7
+ function getLang() {
8
+ switch (language) {
9
+ case 'python3':
10
+ return python;
11
+ case 'deno':
12
+ return typescript;
13
+ case 'go':
14
+ return go;
15
+ default:
16
+ return python;
17
+ }
18
+ }
19
+ </script>
20
+
21
+ <Highlight language={getLang()} {code} />
@@ -0,0 +1,17 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ code?: string | undefined;
5
+ language: 'python3' | 'deno' | 'go' | undefined;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {};
11
+ };
12
+ export declare type HighlightCodeProps = typeof __propDef.props;
13
+ export declare type HighlightCodeEvents = typeof __propDef.events;
14
+ export declare type HighlightCodeSlots = typeof __propDef.slots;
15
+ export default class HighlightCode extends SvelteComponentTyped<HighlightCodeProps, HighlightCodeEvents, HighlightCodeSlots> {
16
+ }
17
+ export {};
@@ -1,12 +1,14 @@
1
- <script>import IconedResourceType from './IconedResourceType.svelte';
1
+ <script>import Badge from './common/badge/Badge.svelte';
2
+ import IconedResourceType from './IconedResourceType.svelte';
2
3
  export let path;
3
4
  </script>
4
5
 
5
- {#if path.startsWith('hub/')}
6
- <span class="inline-flex flex-row gap-x-2 items-center">
6
+ <div class="flex space-x-2 items-center">
7
+ {#if path.startsWith('hub/')}
7
8
  <IconedResourceType name={path.split('/')[2]} silent={true} />
8
9
  <span>{path}</span>
9
- </span>
10
- {:else}
11
- {path}
12
- {/if}
10
+ {:else}
11
+ <Badge color="blue">Workspace</Badge>
12
+ <span>{path}</span>
13
+ {/if}
14
+ </div>
@@ -42,7 +42,7 @@ export let width = '24px';
42
42
  {:else if name === 'slack'}
43
43
  <Slack {height} {width} />
44
44
  {:else if name === 'github'}
45
- <Icon data={GithubIcon} scale={1.4} />
45
+ <GithubIcon />
46
46
  {:else if name === 'gmail'}
47
47
  <GmailIcon {height} {width} />
48
48
  {:else if name === 'gsheets'}
@@ -1,26 +1,24 @@
1
- <script>import { faChain } from '@fortawesome/free-solid-svg-icons';
2
- import { Button, Tooltip } from 'flowbite-svelte';
3
- import Icon from 'svelte-awesome';
1
+ <script>import { getContext } from 'svelte';
4
2
  import ArgInput from './ArgInput.svelte';
5
- import Editor from './Editor.svelte';
6
3
  import FieldHeader from './FieldHeader.svelte';
7
- import DynamicInputHelpBox from './flows/DynamicInputHelpBox.svelte';
4
+ import DynamicInputHelpBox from './flows/content/DynamicInputHelpBox.svelte';
8
5
  import { codeToStaticTemplate, getDefaultExpr, isCodeInjection } from './flows/utils';
9
- import OverlayPropertyPicker from './propertyPicker/OverlayPropertyPicker.svelte';
6
+ import SimpleEditor from './SimpleEditor.svelte';
10
7
  import Toggle from './Toggle.svelte';
8
+ import { Button, Tooltip } from 'flowbite-svelte';
9
+ import Icon from 'svelte-awesome';
10
+ import { faChain } from '@fortawesome/free-solid-svg-icons';
11
11
  export let schema;
12
12
  export let arg;
13
13
  export let argName;
14
14
  export let extraLib = 'missing extraLib';
15
15
  export let inputCheck;
16
16
  export let importPath = undefined;
17
- export let pickableProperties = undefined;
18
- let overlays = {};
19
17
  let monacos = {};
20
18
  let inputCats = {};
21
19
  let propertyType = getPropertyType(arg);
22
20
  function getPropertyType(arg) {
23
- let type = arg.type;
21
+ let type = arg?.type ?? 'static';
24
22
  if (type == 'javascript') {
25
23
  if (codeToStaticTemplate(arg.expr)) {
26
24
  type = 'static';
@@ -49,16 +47,6 @@ function setPropertyType(rawValue) {
49
47
  function isStaticTemplate(inputCat) {
50
48
  return inputCat === 'string' || inputCat === 'sql';
51
49
  }
52
- function focusProp(argName, monacoEditor = false) {
53
- Object.keys(overlays).forEach((k) => {
54
- if (k == argName && (isStaticTemplate(inputCats[argName]) || monacoEditor)) {
55
- overlays[k].focus();
56
- }
57
- else {
58
- overlays[k].unfocus();
59
- }
60
- });
61
- }
62
50
  function connectProperty(argName, rawValue) {
63
51
  if (isStaticTemplate(inputCats[argName])) {
64
52
  arg.value = `\$\{${rawValue}}`;
@@ -74,6 +62,7 @@ function connectProperty(argName, rawValue) {
74
62
  }
75
63
  }
76
64
  $: checked = propertyType == 'javascript';
65
+ const { focusProp } = getContext('PropPickerWrapper');
77
66
  </script>
78
67
 
79
68
  {#if arg != undefined}
@@ -94,45 +83,54 @@ $: checked = propertyType == 'javascript';
94
83
  </span>
95
84
  {/if}
96
85
  </div>
97
- <Toggle
98
- bind:checked
99
- options={{
100
- right: 'Raw Javascript Editor'
101
- }}
102
- on:change={(e) => {
103
- const type = e.detail ? 'javascript' : 'static'
104
- const staticTemplate = isStaticTemplate(inputCats[argName])
105
- if (type === 'javascript') {
106
- arg.expr = getDefaultExpr(
107
- importPath,
108
- argName,
109
- staticTemplate ? `\`${arg.value ?? ''}\`` : arg.value
110
- )
86
+ <div class="flex flex-row space-x-2 items-center">
87
+ <Toggle
88
+ bind:checked
89
+ options={{
90
+ right: 'Raw Javascript Editor'
91
+ }}
92
+ on:change={(e) => {
93
+ const type = e.detail ? 'javascript' : 'static'
94
+ const staticTemplate = isStaticTemplate(inputCats[argName])
95
+ if (type === 'javascript') {
96
+ arg.expr = getDefaultExpr(
97
+ importPath,
98
+ argName,
99
+ staticTemplate ? `\`${arg.value ?? ''}\`` : arg.value
100
+ )
111
101
 
112
- arg.value = undefined
113
- propertyType = 'javascript'
114
- } else {
115
- arg.value = staticTemplate ? codeToStaticTemplate(arg.expr) : undefined
102
+ arg.value = undefined
103
+ propertyType = 'javascript'
104
+ } else {
105
+ arg.value = staticTemplate ? codeToStaticTemplate(arg.expr) : undefined
116
106
 
117
- arg.expr = undefined
118
- propertyType = 'static'
119
- }
107
+ arg.expr = undefined
108
+ propertyType = 'static'
109
+ }
120
110
 
121
- arg.type = type
122
- }}
123
- />
111
+ arg.type = type
112
+ }}
113
+ />
114
+ <div
115
+ on:click={() => {
116
+ focusProp(argName, 'connect', (path) => {
117
+ connectProperty(argName, path)
118
+ })
119
+ }}
120
+ >
121
+ <Button size="sm" class="blue-button">
122
+ <Icon data={faChain} />
123
+ </Button>
124
+ </div>
125
+ </div>
124
126
  </div>
125
127
  <div class="max-w-xs" />
126
128
 
127
129
  {#if propertyType === undefined || !checked}
128
- <OverlayPropertyPicker
129
- {pickableProperties}
130
- bind:this={overlays[argName]}
131
- on:select={({ detail }) => {
132
- if (detail.pickerVariation === 'connect') {
133
- connectProperty(argName, detail.propPath)
134
- } else {
135
- const toAppend = `\$\{${detail.propPath}}`
130
+ <ArgInput
131
+ on:focus={() => {
132
+ focusProp(argName, 'append', (path) => {
133
+ const toAppend = `\$\{${path}}`
136
134
  arg.value = `${arg.value ?? ''}${toAppend}`
137
135
  if (monacos[argName]) {
138
136
  monacos[argName].setCode(arg.value)
@@ -140,67 +138,50 @@ $: checked = propertyType == 'javascript';
140
138
  if (isStaticTemplate(inputCats[argName])) {
141
139
  setPropertyType(arg.value)
142
140
  }
141
+ })
142
+ }}
143
+ label={argName}
144
+ bind:editor={monacos[argName]}
145
+ bind:description={schema.properties[argName].description}
146
+ bind:value={arg.value}
147
+ type={schema.properties[argName].type}
148
+ required={schema.required.includes(argName)}
149
+ bind:pattern={schema.properties[argName].pattern}
150
+ bind:valid={inputCheck[argName]}
151
+ defaultValue={schema.properties[argName].default}
152
+ bind:enum_={schema.properties[argName].enum}
153
+ bind:format={schema.properties[argName].format}
154
+ contentEncoding={schema.properties[argName].contentEncoding}
155
+ bind:itemsType={schema.properties[argName].items}
156
+ properties={schema.properties[argName].properties}
157
+ displayHeader={false}
158
+ bind:inputCat={inputCats[argName]}
159
+ on:input={(e) => {
160
+ if (isStaticTemplate(inputCats[argName])) {
161
+ setPropertyType(e.detail.rawValue)
143
162
  }
144
163
  }}
145
- >
146
- <ArgInput
147
- on:focus={() => focusProp(argName)}
148
- label={argName}
149
- bind:editor={monacos[argName]}
150
- bind:description={schema.properties[argName].description}
151
- bind:value={arg.value}
152
- type={schema.properties[argName].type}
153
- required={schema.required.includes(argName)}
154
- bind:pattern={schema.properties[argName].pattern}
155
- bind:valid={inputCheck[argName]}
156
- defaultValue={schema.properties[argName].default}
157
- bind:enum_={schema.properties[argName].enum}
158
- bind:format={schema.properties[argName].format}
159
- contentEncoding={schema.properties[argName].contentEncoding}
160
- bind:itemsType={schema.properties[argName].items}
161
- properties={schema.properties[argName].properties}
162
- displayHeader={false}
163
- bind:inputCat={inputCats[argName]}
164
- on:input={(e) => {
165
- if (isStaticTemplate(inputCats[argName])) {
166
- setPropertyType(e.detail.rawValue)
167
- }
168
- }}
169
- >
170
- <div slot="actions">
171
- <div on:click={() => overlays[argName]?.focus('connect')}>
172
- <Tooltip placement="bottom" content="Input connect">
173
- <Button size="sm" class="blue-button h-8">
174
- <Icon data={faChain} />
175
- </Button>
176
- </Tooltip>
177
- </div>
178
- </div>
179
- </ArgInput>
180
- </OverlayPropertyPicker>
164
+ />
181
165
  {:else if checked}
182
166
  {#if arg.expr != undefined}
183
- <OverlayPropertyPicker
184
- bind:this={overlays[argName]}
185
- {pickableProperties}
186
- on:select={(event) => {
187
- monacos[argName].insertAtCursor(event.detail.propPath)
188
- }}
189
- >
190
- <div class="border rounded p-2 mt-2 border-gray-300">
191
- <Editor
192
- bind:this={monacos[argName]}
193
- on:focus={() => focusProp(argName, true)}
194
- bind:code={arg.expr}
195
- lang="javascript"
196
- class="few-lines-editor"
197
- {extraLib}
198
- extraLibPath="file:///node_modules/@types/windmill@{importPath}/index.d.ts"
199
- shouldBindKey={false}
200
- />
201
- </div>
202
- </OverlayPropertyPicker>
167
+ <div class="border rounded p-2 mt-2 border-gray-300">
168
+ <SimpleEditor
169
+ bind:this={monacos[argName]}
170
+ on:focus={() => {
171
+ focusProp(argName, 'insert', (path) => {
172
+ monacos[argName].insertAtCursor(path)
173
+ })
174
+ }}
175
+ bind:code={arg.expr}
176
+ lang="javascript"
177
+ class="few-lines-editor"
178
+ {extraLib}
179
+ extraLibPath="file:///node_modules/@types/windmill@{importPath}/index.d.ts"
180
+ shouldBindKey={false}
181
+ />
182
+ </div>
203
183
  <DynamicInputHelpBox {importPath} />
184
+ <div class="mb-2" />
204
185
  {/if}
205
186
  {:else}
206
187
  <p>Not recognized arg type {arg.type}</p>
@@ -11,7 +11,6 @@ declare const __propDef: {
11
11
  [id: string]: boolean;
12
12
  };
13
13
  importPath?: string | undefined;
14
- pickableProperties?: Object | undefined;
15
14
  };
16
15
  events: {
17
16
  [evt: string]: CustomEvent<any>;
@@ -27,7 +27,7 @@ let modal;
27
27
  </script>
28
28
 
29
29
  <Modal bind:this={modal} z="z-30">
30
- <div slot="title">search a {itemName}</div>
30
+ <div slot="title">Search a {itemName}</div>
31
31
  <div slot="content">
32
32
  <div class="w-12/12 pb-4">
33
33
  <input placeholder="Search {itemName}" bind:value={itemsFilter} class="search-item" />
@@ -48,7 +48,7 @@ let modal;
48
48
  <IconedResourceType silent={true} name={obj['app']} />
49
49
  <span class="mr-2" />
50
50
  {/if}
51
- <span class="mr-2">{obj[extraField]}</span><span class="font-normal whitespace-nowrap"
51
+ <span class="mr-2">{obj[extraField]}</span><span class="font-normal break-all"
52
52
  >{obj['path'] ?? ''}</span
53
53
  >
54
54
  </p>
@@ -0,0 +1,23 @@
1
+ <script>export let content;
2
+ export let isLoading;
3
+ let scroll = true;
4
+ let div = null;
5
+ $: if (content != undefined) {
6
+ isLoading = false;
7
+ }
8
+ $: content && scrollToBottom();
9
+ export function scrollToBottom() {
10
+ scroll && setTimeout(() => div?.scroll({ top: div?.scrollHeight, behavior: 'smooth' }), 100);
11
+ }
12
+ </script>
13
+
14
+ <div class="relative w-full h-full">
15
+ <div bind:this={div} class="w-full h-full overflow-auto bg-gray-50 relative">
16
+ <pre
17
+ class="whitespace-pre-wrap break-all bg-gray-50 text-xs w-full p-2">{#if content}{content}{:else if isLoading}Waiting for job to start...{:else}No logs are available yet{/if}</pre>
18
+ </div>
19
+ <div class="absolute top-0 right-0 mr-2 text-gray-500 text-sm bg-gray-50/20">
20
+ Auto scroll
21
+ <input type="checkbox" bind:checked={scroll} />
22
+ </div>
23
+ </div>