1
0
Fork 0
mirror of synced 2024-09-28 23:31:43 +12:00

Add delete button

This commit is contained in:
Mel O'Hagan 2022-08-25 17:40:09 +01:00
parent 018f4db2e4
commit c8330622e3
2 changed files with 17 additions and 8 deletions

View file

@ -67,7 +67,7 @@
{/if}
{:else if schema.type === QueryTypes.FLOW}
<br />
{#if !query.fields.steps}
{#if query.fields.steps?.length == 0}
<div class="controls">
<Button
secondary
@ -91,7 +91,14 @@
<div class="blockSection">
<div class="block-options">
Stage {index + 1}
<ActionButton on:click={() => {}} icon="DeleteOutline" />
<ActionButton
on:click={() => {
query.fields.steps = [
...query.fields.steps.splice(index, 1),
]
}}
icon="DeleteOutline"
/>
</div>
<Layout noPadding gap="S">
<div class="fields">

View file

@ -52,7 +52,7 @@ module MongoDBModule {
},
aggregate: {
type: QueryType.FLOW,
}
},
},
extra: {
collection: {
@ -327,11 +327,13 @@ module MongoDBModule {
const db = this.client.db(this.config.db)
const collection = db.collection(query.extra.collection)
let response = {}
for await (const doc of collection.aggregate(query.steps.map(({ key, value }) => {
let temp:any = {}
temp[key] = JSON.parse(value.value)
return temp
}))) {
for await (const doc of collection.aggregate(
query.steps.map(({ key, value }) => {
let temp: any = {}
temp[key] = JSON.parse(value.value)
return temp
})
)) {
response = doc
}
return response