minor UI fixes

This commit is contained in:
Ruben Fiszel
2022-10-02 21:32:39 +02:00
parent 6bf1abf16e
commit 84979527eb
4 changed files with 32 additions and 27 deletions
+12 -10
View File
@@ -432,18 +432,20 @@ async fn transform_input(
InputTransform::Javascript { expr } => {
let previous_result = last_result.clone();
let flow_input = flow_args.clone().unwrap_or_else(|| json!({}));
let context = vec![
("params".to_string(), serde_json::json!(mapped)),
("previous_result".to_string(), previous_result),
("flow_input".to_string(), flow_input),
(
"resume".to_string(),
resumes.last().map(|v| json!(v)).unwrap_or_default(),
),
("resumes".to_string(), resumes.clone().into()),
];
let v = eval_timeout(
expr.to_string(),
vec![
("params".to_string(), serde_json::json!(mapped)),
("previous_result".to_string(), previous_result),
("flow_input".to_string(), flow_input),
(
"resume".to_string(),
resumes.last().map(|v| json!(v)).unwrap_or_default(),
),
("resumes".to_string(), resumes.clone().into()),
],
context,
Some(EvalCreds { workspace: workspace.to_string(), token: token.to_string() }),
steps.clone(),
)
@@ -133,6 +133,7 @@
const selectedIdStore = writable<string>('settings')
const scheduleStore = writable<Schedule>({ args: {}, cron: '', enabled: false })
const previewArgsStore = writable<Record<string, any>>({})
const reservedVariablesStore = writable<Record<string, string>>({})
function select(selectedId: string) {
selectedIdStore.set(selectedId)
@@ -142,10 +143,11 @@
selectedId: selectedIdStore,
schedule: scheduleStore,
select,
previewArgs: previewArgsStore
previewArgs: previewArgsStore,
reservedVariables: reservedVariablesStore
})
$: {
async function loadSchedule() {
loadFlowSchedule(initialPath, $workspaceStore)
.then((schedule: Schedule) => {
scheduleStore.set(schedule)
@@ -159,9 +161,9 @@
})
}
onMount(() => {
loadHubScripts()
})
$: initialPath && $workspaceStore && loadSchedule()
loadHubScripts()
</script>
<div class="flex flex-col flex-1 h-full">
+2 -1
View File
@@ -5,5 +5,6 @@ export type FlowEditorContext = {
selectedId: Writable<string>
select: (id: string) => void
schedule: Writable<Schedule>
previewArgs: Writable<Record<string, any>>
previewArgs: Writable<Record<string, any>>,
reservedVariables: Writable<Record<string, string>>
}
@@ -18,9 +18,15 @@
search === EMPTY_STRING ? pickableProperties : keepByKey(pickableProperties, search)
</script>
<div class="px-4 pt-4">
<div class="px-2 pt-2">
<input
type="text"
bind:value={search}
class="bg-gray-50 mt-1 border border-gray-300 text-gray-900 text-sm rounded-lg block px-2 mb-2 w-full"
placeholder="Search prop..."
/>
<div class="flex justify-between items-center space-x-1">
<span class="font-bold text-sm">Context</span>
<span class="font-bold text-sm">Step Context</span>
<div class="flex space-x-2 items-center">
{#if $propPickerConfig}
<span
@@ -43,13 +49,7 @@
{/if}
</div>
</div>
<input
type="text"
bind:value={search}
class="bg-gray-50 mt-1 border border-gray-300 text-gray-900 text-sm rounded-lg block p-2 mb-2"
placeholder="Search prop..."
/>
</div>
<div class="overflow-y-auto mb-8">
<ObjectViewer json={propsFiltered} on:select />
<div class="overflow-y-auto mb-2">
<ObjectViewer json={propsFiltered} on:select />
</div>
</div>