From e9a22127ca9ac33c926fd404012eeab4f2af0168 Mon Sep 17 00:00:00 2001 From: Mazurenko Nikita <104276704+MazurenkoNick@users.noreply.github.com> Date: Fri, 4 Dec 2026 12:41:27 +0100 Subject: [PATCH] Added the Secret storage picker to integration header filters and kept missing secret references as a warning instead of clearing them (#16849) * Add Secret storage picker and hints to integration headers filters and other secret-capable fields * Keep missing secret placeholders in secret inputs, drop metadata secret hint, unify REST API call hint * Show a missing secret as a warning chip with a shorter not-found hint * Use default text colours for the missing secret hint and chip label to meet the WCAG AA contrast --------- Co-authored-by: Vladyslav_Prykhodko --- .../custom-integration-form.component.html | 4 +++ .../http-integration-form.component.html | 1 + .../kafka-integration-form.component.html | 2 +- .../kpn-integration-form.component.html | 5 +-- .../loriot-integration-form.component.html | 1 + .../particle-integration-form.component.html | 1 + .../rest-api-call-config.component.html | 4 +++ .../shared/components/kv-map.component.html | 34 ++++++++++++++----- .../app/shared/components/kv-map.component.ts | 8 +++++ .../secret-key-input.component.html | 22 +++++++----- .../secret-key-input.component.scss | 6 ++++ .../secret-key-input.component.ts | 14 ++++++-- .../assets/locale/locale.constant-en_US.json | 3 ++ 13 files changed, 82 insertions(+), 23 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/integration/configuration/custom-integration-form/custom-integration-form.component.html b/ui-ngx/src/app/modules/home/components/integration/configuration/custom-integration-form/custom-integration-form.component.html index d7490b4c1c..d50d19d152 100644 --- a/ui-ngx/src/app/modules/home/components/integration/configuration/custom-integration-form/custom-integration-form.component.html +++ b/ui-ngx/src/app/modules/home/components/integration/configuration/custom-integration-form/custom-integration-form.component.html @@ -21,6 +21,10 @@ validateContent validateOnChange> +
+ info_outline + +
diff --git a/ui-ngx/src/app/modules/home/components/integration/configuration/http-integration-form/http-integration-form.component.html b/ui-ngx/src/app/modules/home/components/integration/configuration/http-integration-form/http-integration-form.component.html index 73c925c244..6fb90a6a99 100644 --- a/ui-ngx/src/app/modules/home/components/integration/configuration/http-integration-form/http-integration-form.component.html +++ b/ui-ngx/src/app/modules/home/components/integration/configuration/http-integration-form/http-integration-form.component.html @@ -52,6 +52,7 @@ isStrokedButton="true" showRequiredErrors appearance="outline" + secretValues formControlName="headersFilter"> diff --git a/ui-ngx/src/app/modules/home/components/integration/configuration/kafka-integration-form/kafka-integration-form.component.html b/ui-ngx/src/app/modules/home/components/integration/configuration/kafka-integration-form/kafka-integration-form.component.html index 2a45f8f15a..4b09f41dab 100644 --- a/ui-ngx/src/app/modules/home/components/integration/configuration/kafka-integration-form/kafka-integration-form.component.html +++ b/ui-ngx/src/app/modules/home/components/integration/configuration/kafka-integration-form/kafka-integration-form.component.html @@ -73,7 +73,7 @@
integration.other-properties - +
diff --git a/ui-ngx/src/app/modules/home/components/integration/configuration/kpn-integration-form/kpn-integration-form.component.html b/ui-ngx/src/app/modules/home/components/integration/configuration/kpn-integration-form/kpn-integration-form.component.html index 1d314e8ba9..50f4d721be 100644 --- a/ui-ngx/src/app/modules/home/components/integration/configuration/kpn-integration-form/kpn-integration-form.component.html +++ b/ui-ngx/src/app/modules/home/components/integration/configuration/kpn-integration-form/kpn-integration-form.component.html @@ -63,8 +63,9 @@ keyPlaceholderText="integration.header" isStrokedButton="true" showRequiredErrors - appearance="outline" - formControlName="additionalHeadersFilter"> + appearance="outline" + secretValues + formControlName="additionalHeadersFilter"> @if (kpnIntegrationConfigForm.get('additionalHeadersFilter').hasError('securityHeaderDuplicate')) { {{ 'integration.kpn-security-header-duplicate' | translate }} diff --git a/ui-ngx/src/app/modules/home/components/integration/configuration/loriot-integration-form/loriot-integration-form.component.html b/ui-ngx/src/app/modules/home/components/integration/configuration/loriot-integration-form/loriot-integration-form.component.html index 37dca8e8c9..1d30ca3ef9 100644 --- a/ui-ngx/src/app/modules/home/components/integration/configuration/loriot-integration-form/loriot-integration-form.component.html +++ b/ui-ngx/src/app/modules/home/components/integration/configuration/loriot-integration-form/loriot-integration-form.component.html @@ -124,6 +124,7 @@ isStrokedButton="true" showRequiredErrors appearance="outline" + secretValues formControlName="headersFilter">
diff --git a/ui-ngx/src/app/modules/home/components/integration/configuration/particle-integration-form/particle-integration-form.component.html b/ui-ngx/src/app/modules/home/components/integration/configuration/particle-integration-form/particle-integration-form.component.html index 5f0d54dda8..caf8189be6 100644 --- a/ui-ngx/src/app/modules/home/components/integration/configuration/particle-integration-form/particle-integration-form.component.html +++ b/ui-ngx/src/app/modules/home/components/integration/configuration/particle-integration-form/particle-integration-form.component.html @@ -69,6 +69,7 @@ isStrokedButton="true" showRequiredErrors appearance="outline" + secretValues formControlName="headersFilter"> diff --git a/ui-ngx/src/app/modules/home/components/rule-node/external/rest-api-call-config.component.html b/ui-ngx/src/app/modules/home/components/rule-node/external/rest-api-call-config.component.html index 16accc7980..892dc5039a 100644 --- a/ui-ngx/src/app/modules/home/components/rule-node/external/rest-api-call-config.component.html +++ b/ui-ngx/src/app/modules/home/components/rule-node/external/rest-api-call-config.component.html @@ -24,6 +24,10 @@
+
+ info_outline + +
@for (keyValControl of keyValsFormArray().controls; track $index) { -
+
@@ -16,14 +16,24 @@ key-val.key-required } - - - @if (showRequiredErrors && keyValControl.get('value').hasError('required')) { - key-val.value-required - } - - } - + @if (missingSecretName) { + {{ 'secret-storage.secret-not-found' | translate: {name: missingSecretName} }} + } @else { + + } @if (secretKeyFormGroup.get('secretKey').hasError('required') || secretKeyFormGroup.get('secretKey').hasError('pattern')) { diff --git a/ui-ngx/src/app/shared/components/secret-storage/secret-key-input.component.scss b/ui-ngx/src/app/shared/components/secret-storage/secret-key-input.component.scss index b623c70eae..b1b9e3af2c 100644 --- a/ui-ngx/src/app/shared/components/secret-storage/secret-key-input.component.scss +++ b/ui-ngx/src/app/shared/components/secret-storage/secret-key-input.component.scss @@ -14,6 +14,12 @@ margin: 0 0 0 8px; --mat-chip-container-height: 24px; --mat-chip-with-icon-icon-color: rgba(0, 0, 0, 0.38); + &.secret-chip-missing { + --mat-chip-elevated-container-color: #FFF3E0; + --mat-chip-with-icon-icon-color: #FF5722; + --mat-chip-outline-color: #FF5722; + --mat-chip-outline-width: 1px; + } } } } diff --git a/ui-ngx/src/app/shared/components/secret-storage/secret-key-input.component.ts b/ui-ngx/src/app/shared/components/secret-storage/secret-key-input.component.ts index 0a53f02a0e..2dab9b70b1 100644 --- a/ui-ngx/src/app/shared/components/secret-storage/secret-key-input.component.ts +++ b/ui-ngx/src/app/shared/components/secret-storage/secret-key-input.component.ts @@ -59,6 +59,9 @@ export class SecretKeyInputComponent extends PageComponent implements OnInit, Co @Input() hint: string; + @Input() + placeholder: string; + @Input({transform: booleanAttribute}) required: boolean = false; @@ -86,6 +89,9 @@ export class SecretKeyInputComponent extends PageComponent implements OnInit, Co secretStorageKey: string; + /** Name of a referenced secret that does not exist; the placeholder is kept as a plain value. */ + missingSecretName: string; + allowSecret = getCurrentAuthUser(this.store).authority !== Authority.CUSTOMER_USER; private modelValue: string; @@ -171,6 +177,7 @@ export class SecretKeyInputComponent extends PageComponent implements OnInit, Co writeValue(value: string): void { const parsedSecret = parseSecret(value); this.modelValue = value; + this.missingSecretName = null; if (parsedSecret) { this.secretStorageService.getSecretByName(parsedSecret, {ignoreErrors: true}).subscribe({ next: () => { @@ -180,11 +187,13 @@ export class SecretKeyInputComponent extends PageComponent implements OnInit, Co ); }, error: () => { + // Keep the placeholder as is (e.g. after import into another tenant or a deleted secret) + // instead of clearing the value and making the form dirty and invalid. this.secretStorageKey = null; + this.missingSecretName = parsedSecret; this.secretKeyFormGroup.patchValue( - {secretKey: null}, {emitEvent: true} + {secretKey: this.modelValue}, {emitEvent: false} ); - this.secretKeyFormGroup.get('secretKey').markAsTouched(); } }) } else { @@ -197,6 +206,7 @@ export class SecretKeyInputComponent extends PageComponent implements OnInit, Co private updateModel() { const secretKey: string = this.secretKeyFormGroup.get('secretKey').value; + this.missingSecretName = null; this.secretStorageKey = parseSecret(secretKey); if (this.modelValue !== secretKey) { this.modelValue = secretKey; diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index b2c13afccb..cb344a36ae 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -5777,6 +5777,9 @@ "secrets-are-in-use-text": "Not all secrets have been deleted because they are used by other entities.
You can view referenced entities by clicking the References button in the corresponding secret row.
To delete these secrets, first remove their usage from the entities where they are mentioned.", "selected-secrets": "{ count, plural, =1 {1 secret} other {# secrets} } selected", "use-secret-storage": "Use Secret storage", + "picker-hint": "Values can come from Secrets storage: click the key button to pick a secret, or enter the placeholder ${secret:name;type:TEXT}, where 'name' is the secret name.", + "secret-not-found": "Secret \"{{name}}\" not found. The value resolves to empty until the secret is created.", + "placeholder-hint": "To use a value from Secrets storage, enter the placeholder ${secret:name;type:TEXT}, where 'name' is the secret name.", "dialog-title": "Add secret", "use-storage": "Use storage", "create": {