From 33d03a410d9f8bcae02d8a90b8c49e364f5c966d Mon Sep 17 00:00:00 2001 From: Thomas Hansen Date: Thu, 21 Dec 2023 18:45:42 +0200 Subject: [PATCH] b --- .../misc/workflows/actions/sql-execute.hl | 4 +-- .../misc/workflows/actions/sql-select.hl | 4 +-- .../create-key-value-dialog.component.html | 1 + .../create-key-value-dialog.component.ts | 18 ++++++++++--- .../formly-key-value.component.ts | 25 ++++++++++++++++--- 5 files changed, 40 insertions(+), 12 deletions(-) diff --git a/backend/files/misc/workflows/actions/sql-execute.hl b/backend/files/misc/workflows/actions/sql-execute.hl index 73063c56a2..ddfc2ad636 100644 --- a/backend/files/misc/workflows/actions/sql-execute.hl +++ b/backend/files/misc/workflows/actions/sql-execute.hl @@ -28,8 +28,8 @@ params type:key-value default - @name:some-role-name - @description:Some role description + name:some-role-name + description:Some role description mandatory:bool:false .icon:backup diff --git a/backend/files/misc/workflows/actions/sql-select.hl b/backend/files/misc/workflows/actions/sql-select.hl index d8a62a099d..3af0a383b1 100644 --- a/backend/files/misc/workflows/actions/sql-select.hl +++ b/backend/files/misc/workflows/actions/sql-select.hl @@ -23,12 +23,12 @@ mandatory:bool:true sql type:sql - default:select name from roles where name like @arg1 limit 2 + default:select name from roles where name like @filter limit 2 mandatory:bool:true params type:key-value default - @arg1:a% + filter:a% .icon:cloud_download // Sanity checking invocation. diff --git a/frontend/src/app/components/protected/create/hyper-ide/components/parametrise-action-dialog/components/formly-key-value/components/create-key-value-dialog/create-key-value-dialog.component.html b/frontend/src/app/components/protected/create/hyper-ide/components/parametrise-action-dialog/components/formly-key-value/components/create-key-value-dialog/create-key-value-dialog.component.html index 01e331d892..a31f2db393 100644 --- a/frontend/src/app/components/protected/create/hyper-ide/components/parametrise-action-dialog/components/formly-key-value/components/create-key-value-dialog/create-key-value-dialog.component.html +++ b/frontend/src/app/components/protected/create/hyper-ide/components/parametrise-action-dialog/components/formly-key-value/components/create-key-value-dialog/create-key-value-dialog.component.html @@ -15,6 +15,7 @@

New key/value pair

diff --git a/frontend/src/app/components/protected/create/hyper-ide/components/parametrise-action-dialog/components/formly-key-value/components/create-key-value-dialog/create-key-value-dialog.component.ts b/frontend/src/app/components/protected/create/hyper-ide/components/parametrise-action-dialog/components/formly-key-value/components/create-key-value-dialog/create-key-value-dialog.component.ts index 7bd328676c..2b86b35772 100644 --- a/frontend/src/app/components/protected/create/hyper-ide/components/parametrise-action-dialog/components/formly-key-value/components/create-key-value-dialog/create-key-value-dialog.component.ts +++ b/frontend/src/app/components/protected/create/hyper-ide/components/parametrise-action-dialog/components/formly-key-value/components/create-key-value-dialog/create-key-value-dialog.component.ts @@ -4,8 +4,8 @@ */ // Angular and system imports. -import { Component } from '@angular/core'; -import { MatDialogRef } from '@angular/material/dialog'; +import { Component, Inject, OnInit } from '@angular/core'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; // Application specific imports. import { GeneralService } from 'src/app/services/general.service'; @@ -18,14 +18,23 @@ import { GeneralService } from 'src/app/services/general.service'; templateUrl: './create-key-value-dialog.component.html', styleUrls: ['./create-key-value-dialog.component.scss'] }) -export class CreateKeyValueDialogComponent { +export class CreateKeyValueDialogComponent implements OnInit { key: string; value: string; constructor( private generalService: GeneralService, - private dialogRef: MatDialogRef) {} + @Inject(MAT_DIALOG_DATA) public data: any, + private dialogRef: MatDialogRef) { } + + ngOnInit() { + + if (this.data) { + this.key = this.data.key; + this.value = this.data.value; + } + } onSubmit() { @@ -38,6 +47,7 @@ export class CreateKeyValueDialogComponent { this.dialogRef.close({ key: this.key, value: this.value, + edit: !!this.data }); } } diff --git a/frontend/src/app/components/protected/create/hyper-ide/components/parametrise-action-dialog/components/formly-key-value/formly-key-value.component.ts b/frontend/src/app/components/protected/create/hyper-ide/components/parametrise-action-dialog/components/formly-key-value/formly-key-value.component.ts index 4067b7671b..8c291b950c 100644 --- a/frontend/src/app/components/protected/create/hyper-ide/components/parametrise-action-dialog/components/formly-key-value/formly-key-value.component.ts +++ b/frontend/src/app/components/protected/create/hyper-ide/components/parametrise-action-dialog/components/formly-key-value/formly-key-value.component.ts @@ -21,8 +21,9 @@ import { GeneralService } from 'src/app/services/general.service'; - {{item.name}}:{{item.value}} + {{item.key}}:{{item.value}} cancel @@ -51,7 +52,7 @@ export class FormlyKeyValueComponent extends FieldType implemen removeArgument(el: any) { - delete this.model[this.field.key][el.name]; + delete this.model[this.field.key][el.key]; this.createItems(); } @@ -74,7 +75,23 @@ export class FormlyKeyValueComponent extends FieldType implemen this.createItems(); } }); -} + } + + editArgument(item: any) { + + this.dialog.open(CreateKeyValueDialogComponent, { + width: '80vw', + maxWidth: '512px', + data: item, + }).afterClosed().subscribe((result: any) => { + + if (result) { + + this.model[this.field.key][result.key] = result.value; + this.createItems(); + } + }); + } /* * Private helpers. @@ -85,7 +102,7 @@ export class FormlyKeyValueComponent extends FieldType implemen this.items = []; for (var idx in this.model[this.field.key]) { this.items.push({ - name: idx, + key: idx, value: this.model[this.field.key][idx], }); }