Include stage templates
This commit is contained in:
parent
4c781eb667
commit
33c36c1112
|
@ -4,6 +4,7 @@
|
|||
import {
|
||||
Label,
|
||||
Input,
|
||||
Select,
|
||||
Divider,
|
||||
Layout,
|
||||
Icon,
|
||||
|
@ -42,6 +43,19 @@
|
|||
}
|
||||
}
|
||||
|
||||
function setEditorTemplate(fromKey, toKey, index) {
|
||||
if (
|
||||
schema.steps.filter(step => step.key === fromKey)[0]?.template ===
|
||||
query.fields.steps[index].value.value
|
||||
) {
|
||||
query.fields.steps[index].value.value = schema.steps.filter(
|
||||
step => step.key === toKey
|
||||
)[0]?.template
|
||||
flowEditors[index].update(query.fields.steps[index].value.value)
|
||||
}
|
||||
query.fields.steps[index].key = toKey
|
||||
}
|
||||
|
||||
$: shouldDisplayJsonBox =
|
||||
schema.type === QueryTypes.JSON && query.fields.extra?.actionType !== "flow"
|
||||
</script>
|
||||
|
@ -114,10 +128,11 @@
|
|||
<Layout noPadding gap="S">
|
||||
<div class="fields">
|
||||
<div class="block-field">
|
||||
<Input
|
||||
<Select
|
||||
value={step.key}
|
||||
options={schema.steps.map(s => s.key)}
|
||||
on:change={({ detail }) => {
|
||||
query.fields.steps[index].key = detail
|
||||
setEditorTemplate(step.key, detail, index)
|
||||
}}
|
||||
/>
|
||||
<Editor
|
||||
|
|
|
@ -58,6 +58,25 @@ const SCHEMA: Integration = {
|
|||
},
|
||||
aggregate: {
|
||||
type: QueryType.JSON,
|
||||
steps: [
|
||||
{
|
||||
key: "$addFields",
|
||||
template: "{\n\t\n}",
|
||||
},
|
||||
{
|
||||
key: "$bucket",
|
||||
template: `{
|
||||
"groupBy": "",
|
||||
"boundaries": [],
|
||||
"default": "",
|
||||
"output": {}
|
||||
}`,
|
||||
},
|
||||
{
|
||||
key: "$match",
|
||||
template: "{\n\t\n}",
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
extra: {
|
||||
|
|
|
@ -70,6 +70,11 @@ export enum FilterType {
|
|||
ONE_OF = "oneOf",
|
||||
}
|
||||
|
||||
export interface StepDefinition {
|
||||
key: string
|
||||
template: string
|
||||
}
|
||||
|
||||
export interface QueryDefinition {
|
||||
type: QueryType
|
||||
displayName?: string
|
||||
|
@ -77,6 +82,7 @@ export interface QueryDefinition {
|
|||
customisable?: boolean
|
||||
fields?: object
|
||||
urlDisplay?: boolean
|
||||
steps?: Array<StepDefinition>
|
||||
}
|
||||
|
||||
export interface ExtraQueryConfig {
|
||||
|
|
Loading…
Reference in New Issue