Skip to content

Commit

Permalink
b
Browse files Browse the repository at this point in the history
  • Loading branch information
polterguy committed Dec 22, 2023
1 parent d81b56e commit 3462f5b
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 12 deletions.
1 change: 1 addition & 0 deletions backend/files/misc/workflows/actions/send-email.hl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
default:@"Hello John,

How's it going?"
.icon:email

// Sanity checking invocation.
validators.mandatory:x:@.arguments/*/name
Expand Down
2 changes: 1 addition & 1 deletion backend/files/system/workflows/get-hyperlambda.post.hl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ if
..:x:@.action/0

// Making sure we correctly convert arguments according to type declaration.
for-each:x:@.arguments/*/args/*
for-each:x:@.arguments/*/args/**
if
strings.starts-with:x:@.dp/#
.:":x:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h3 mat-dialog-title>New key/value pair</h3>
<input
matInput
placeholder="Key ..."
[disabled]="data"
[disabled]="data?.item"
name="key"
[(ngModel)]="key"
autocomplete="off">
Expand All @@ -30,11 +30,16 @@ <h3 mat-dialog-title>New key/value pair</h3>
<span class="text-muted">|</span>
</span>
<input
type="text"
matInput
placeholder="Value ..."
name="value"
[(ngModel)]="value"
autocomplete="off">
[formControl]="autocompleter"
[matAutocomplete]="auto">
<mat-autocomplete #auto="matAutocomplete">
<mat-option
*ngFor="let option of filteredOptions | async"
[value]="option.value">{{option.label}}</mat-option>
</mat-autocomplete>
</mat-form-field>

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

// Angular and system imports.
import { Component, Inject, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Observable, map, startWith } from 'rxjs';

// Application specific imports.
import { GeneralService } from 'src/app/services/general.service';
Expand All @@ -20,8 +22,9 @@ import { GeneralService } from 'src/app/services/general.service';
})
export class CreateKeyValueDialogComponent implements OnInit {

autocompleter = new FormControl('');
filteredOptions: Observable<string[]>;
key: string;
value: string;

constructor(
private generalService: GeneralService,
Expand All @@ -30,24 +33,39 @@ export class CreateKeyValueDialogComponent implements OnInit {

ngOnInit() {

if (this.data) {
this.key = this.data.key;
this.value = this.data.value;
if (this.data?.item) {
this.key = this.data.item.key;
this.autocompleter.setValue(this.data.item.value);
}
this.filteredOptions = this.autocompleter.valueChanges.pipe(
startWith(''),
map(value => this._filter(value || '')),
);
}

onSubmit() {

if (!this.key || !this.value || this.key === '' || this.value === '') {

if (!this.key || this.key === '' || this.autocompleter.value === '') {

this.generalService.showFeedback('Please provide both key and value', 'errorMessage');
return;
}

this.dialogRef.close({
key: this.key,
value: this.value,
value: this.autocompleter.value,
edit: !!this.data,
});
}

/*
* Private helper methods
*/

private _filter(value: string): string[] {
const filterValue = value.toLowerCase();

return this.data.options.filter(option => option.label.toLowerCase().includes(filterValue));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ export class FormlyKeyValueComponent extends FieldType<FieldTypeConfig> implemen
this.dialog.open(CreateKeyValueDialogComponent, {
width: '80vw',
maxWidth: '512px',
data: item || null,
data: {
item: item || null,
options: this.props.options,
}
}).afterClosed().subscribe((result: any) => {

if (result) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ export class ParametriseActionDialog implements OnInit {
case 'key-value':
add = true;
field.type = 'key-value';
field.props.options = [];
for (const idxCandidate of this.data.candidates) {
field.props.options.push({
value: ':x:' + idxCandidate.expression,
label: ':x:' + idxCandidate.expression,
});
}
break;

case 'array':
Expand Down

0 comments on commit 3462f5b

Please sign in to comment.