Browse Source

Merge branch 'rc'

master
Viacheslav Klimov 4 hours ago
parent
commit
21ea755acf
Failed to extract signature
  1. 4
      ui-ngx/src/app/modules/home/components/integration/configuration/custom-integration-form/custom-integration-form.component.html
  2. 1
      ui-ngx/src/app/modules/home/components/integration/configuration/http-integration-form/http-integration-form.component.html
  3. 2
      ui-ngx/src/app/modules/home/components/integration/configuration/kafka-integration-form/kafka-integration-form.component.html
  4. 5
      ui-ngx/src/app/modules/home/components/integration/configuration/kpn-integration-form/kpn-integration-form.component.html
  5. 1
      ui-ngx/src/app/modules/home/components/integration/configuration/loriot-integration-form/loriot-integration-form.component.html
  6. 1
      ui-ngx/src/app/modules/home/components/integration/configuration/particle-integration-form/particle-integration-form.component.html
  7. 4
      ui-ngx/src/app/modules/home/components/rule-node/external/rest-api-call-config.component.html
  8. 34
      ui-ngx/src/app/shared/components/kv-map.component.html
  9. 8
      ui-ngx/src/app/shared/components/kv-map.component.ts
  10. 22
      ui-ngx/src/app/shared/components/secret-storage/secret-key-input.component.html
  11. 6
      ui-ngx/src/app/shared/components/secret-storage/secret-key-input.component.scss
  12. 14
      ui-ngx/src/app/shared/components/secret-storage/secret-key-input.component.ts
  13. 3
      ui-ngx/src/assets/locale/locale.constant-en_US.json

4
ui-ngx/src/app/modules/home/components/integration/configuration/custom-integration-form/custom-integration-form.component.html

@ -21,6 +21,10 @@
validateContent
validateOnChange>
</tb-json-content>
<div class="tb-form-hint tb-primary-fill mb-4">
<mat-icon>info_outline</mat-icon>
<span [innerHTML]="'secret-storage.placeholder-hint' | translate | safe: 'html'"></span>
</div>
<ng-container [ngTemplateOutlet]="executeRemotelyTemplate">
</ng-container>

1
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">
</tb-key-val-map>
</ng-template>

2
ui-ngx/src/app/modules/home/components/integration/configuration/kafka-integration-form/kafka-integration-form.component.html

@ -73,7 +73,7 @@
<ng-template matExpansionPanelContent>
<fieldset class="fields-group">
<legend class="group-title" translate>integration.other-properties</legend>
<tb-key-val-map formControlName="otherProperties" isStrokedButton="true" showRequiredErrors appearance="outline"></tb-key-val-map>
<tb-key-val-map formControlName="otherProperties" isStrokedButton="true" showRequiredErrors appearance="outline" secretHint></tb-key-val-map>
</fieldset>
<ng-container [ngTemplateOutlet]="genericAdditionalInfoTemplate">
</ng-container>

5
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">
</tb-key-val-map>
@if (kpnIntegrationConfigForm.get('additionalHeadersFilter').hasError('securityHeaderDuplicate')) {
<mat-error>{{ 'integration.kpn-security-header-duplicate' | translate }}</mat-error>

1
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">
</tb-key-val-map>
</ng-template>

1
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">
</tb-key-val-map>
</ng-template>

4
ui-ngx/src/app/modules/home/components/rule-node/external/rest-api-call-config.component.html

@ -24,6 +24,10 @@
<div [tb-hint-tooltip-icon]="'rule-node-config.query-params-hint' | translate" tooltipPosition="above"></div>
</mat-expansion-panel-header>
<ng-template matExpansionPanelContent>
<div class="tb-form-hint tb-primary-fill mb-4">
<mat-icon>info_outline</mat-icon>
<span [innerHTML]="'secret-storage.placeholder-hint' | translate | safe: 'html'"></span>
</div>
<tb-kv-list-config
formControlName="queryParams"
keyText="rule-node-config.query-params-name"

34
ui-ngx/src/app/shared/components/kv-map.component.html

@ -8,7 +8,7 @@
<section class="tb-kv-map flex flex-col" [formGroup]="kvListFormGroup">
<label translate class="tb-title">{{ titleText }}</label>
@for (keyValControl of keyValsFormArray().controls; track $index) {
<div class="flex flex-row items-center justify-start gap-2"[class.mb-1]="!$last" formArrayName="keyVals">
<div class="flex flex-row justify-start gap-2" [class.items-center]="!secretValues" [class.items-start]="secretValues" [class.mb-1]="!$last" formArrayName="keyVals">
<mat-form-field class="mat-block flex-1" subscriptSizing="{{ subscriptSizing }}" [appearance]="appearance">
<input [formControl]="keyValControl.get('key')" matInput required
placeholder="{{ (keyPlaceholderText ? keyPlaceholderText : 'key-val.key') | translate }}{{ showRequiredErrors ? '*' : '' }}"/>
@ -16,14 +16,24 @@
<mat-error tbTruncateWithTooltip translate>key-val.key-required</mat-error>
}
</mat-form-field>
<mat-form-field class="mat-block flex-1" subscriptSizing="{{ subscriptSizing }}" [appearance]="appearance">
<input [formControl]="keyValControl.get('value')" matInput [required]="isValueRequired"
placeholder="{{ (valuePlaceholderText ? valuePlaceholderText : 'key-val.value') | translate }}{{ showRequiredErrors && isValueRequired ? '*' : '' }}"/>
@if (showRequiredErrors && keyValControl.get('value').hasError('required')) {
<mat-error tbTruncateWithTooltip translate>key-val.value-required</mat-error>
}
</mat-form-field>
<button mat-icon-button color="primary"
@if (secretValues) {
<tb-secret-key-input class="flex-1"
[formControl]="keyValControl.get('value')"
[required]="isValueRequired"
[appearance]="appearance"
[requiredText]="showRequiredErrors ? ('key-val.value-required' | translate) : ''"
placeholder="{{ (valuePlaceholderText ? valuePlaceholderText : 'key-val.value') | translate }}{{ showRequiredErrors && isValueRequired ? '*' : '' }}">
</tb-secret-key-input>
} @else {
<mat-form-field class="mat-block flex-1" subscriptSizing="{{ subscriptSizing }}" [appearance]="appearance">
<input [formControl]="keyValControl.get('value')" matInput [required]="isValueRequired"
placeholder="{{ (valuePlaceholderText ? valuePlaceholderText : 'key-val.value') | translate }}{{ showRequiredErrors && isValueRequired ? '*' : '' }}"/>
@if (showRequiredErrors && keyValControl.get('value').hasError('required')) {
<mat-error tbTruncateWithTooltip translate>key-val.value-required</mat-error>
}
</mat-form-field>
}
<button mat-icon-button color="primary" [class.mt-1]="secretValues"
[class.!hidden]="disabled"
type="button"
(click)="removeKeyVal($index)"
@ -39,6 +49,12 @@
'!hidden': keyValsFormArray().length
}"
class="no-data-found flex items-center justify-center" translate>{{noDataText ? noDataText : 'key-val.no-data'}}</span>
@if (secretValues || secretHint) {
<div class="tb-form-hint tb-primary-fill mt-2">
<mat-icon>info_outline</mat-icon>
<span [innerHTML]="(secretValues ? 'secret-storage.picker-hint' : 'secret-storage.placeholder-hint') | translate | safe: 'html'"></span>
</div>
}
<div style="margin-top: 8px;">
@if (!isStrokedButton) {
<button mat-button mat-raised-button color="primary"

8
ui-ngx/src/app/shared/components/kv-map.component.ts

@ -61,6 +61,14 @@ export class KeyValMapComponent extends PageComponent implements ControlValueAcc
@Input() isStrokedButton = false;
/** Renders values with tb-secret-key-input (Use secret picker) and shows the secret placeholder hint.
* Use for maps whose values the backend resolves ${secret:...} placeholders in. */
@Input() @coerceBoolean() secretValues = false;
/** Shows only the secret placeholder hint, keeping plain value inputs.
* Use for maps that may hold secrets among non-secret values (e.g. Kafka properties). */
@Input() @coerceBoolean() secretHint = false;
@Input()
subscriptSizing: SubscriptSizing = 'fixed';

22
ui-ngx/src/app/shared/components/secret-storage/secret-key-input.component.html

@ -8,20 +8,20 @@
@if (label) {
<mat-label>{{ label }}</mat-label>
}
@if (secretStorageKey) {
@if (secretStorageKey || missingSecretName) {
<mat-chip-set class="secret-chip-container" [disabled]="disabled">
<mat-chip class="secret-chip tb-chip-row-ellipsis">
<mat-icon class="icon-key" matChipAvatar svgIcon="mdi:key-variant"></mat-icon>
{{secretStorageKey}}
<mat-chip class="secret-chip tb-chip-row-ellipsis" [class.secret-chip-missing]="missingSecretName">
<mat-icon class="icon-key" matChipAvatar [svgIcon]="missingSecretName ? 'mdi:key-alert' : 'mdi:key-variant'"></mat-icon>
{{ secretStorageKey || missingSecretName }}
</mat-chip>
</mat-chip-set>
}
<input matInput [required]="required" [type]="inputType" autocomplete="new-password" name="custom-field" formControlName="secretKey" [class.!hidden]="secretStorageKey">
<tb-toggle-password matSuffix [class.!hidden]="secretStorageKey || inputType !== 'password'"></tb-toggle-password>
<input matInput [required]="required" [type]="inputType" autocomplete="new-password" name="custom-field" [placeholder]="placeholder ?? ''" formControlName="secretKey" [class.!hidden]="secretStorageKey || missingSecretName">
<tb-toggle-password matSuffix [class.!hidden]="secretStorageKey || missingSecretName || inputType !== 'password'"></tb-toggle-password>
<button mat-icon-button matSuffix
type="button"
class="tb-small"
[class.!hidden]="!secretStorageKey || disabled"
[class.!hidden]="!(secretStorageKey || missingSecretName) || disabled"
[disabled]="disabled"
(click)="remove($event)"
matTooltip="{{'action.remove' | translate}}"
@ -32,7 +32,7 @@
<button mat-icon-button matSuffix
type="button"
class="tb-small"
[class.secret-warning-btn]="!secretStorageKey && !disabled && !readonly && secretKeyFormGroup.get('secretKey').value"
[class.secret-warning-btn]="!secretStorageKey && !missingSecretName && !disabled && !readonly && secretKeyFormGroup.get('secretKey').value"
[disabled]="disabled || readonly"
(click)="openSecretKeyDialog($event)"
matTooltip="{{'secret-storage.use-secret' | translate}}"
@ -40,7 +40,11 @@
<mat-icon svgIcon="mdi:key-variant"></mat-icon>
</button>
}
<mat-hint innerHTML="{{ hint }}"></mat-hint>
@if (missingSecretName) {
<mat-hint>{{ 'secret-storage.secret-not-found' | translate: {name: missingSecretName} }}</mat-hint>
} @else {
<mat-hint innerHTML="{{ hint }}"></mat-hint>
}
@if (secretKeyFormGroup.get('secretKey').hasError('required') ||
secretKeyFormGroup.get('secretKey').hasError('pattern')) {
<mat-error>

6
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;
}
}
}
}

14
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;

3
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.</br>You can view referenced entities by clicking the <b>References</b> button in the corresponding secret row.</br>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 <code>$&#123;secret:name;type:TEXT&#125;</code>, 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 <code>$&#123;secret:name;type:TEXT&#125;</code>, where 'name' is the secret name.",
"dialog-title": "Add secret",
"use-storage": "Use storage",
"create": {

Loading…
Cancel
Save