Browse Source

Show a missing secret as a warning chip with a shorter not-found hint

pull/16849/head
Nikita Mazurenko 23 hours ago
parent
commit
c9cafb1679
  1. 16
      ui-ngx/src/app/shared/components/secret-storage/secret-key-input.component.html
  2. 7
      ui-ngx/src/app/shared/components/secret-storage/secret-key-input.component.scss
  3. 2
      ui-ngx/src/assets/locale/locale.constant-en_US.json

16
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" [placeholder]="placeholder ?? ''" 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}}"

7
ui-ngx/src/app/shared/components/secret-storage/secret-key-input.component.scss

@ -17,6 +17,13 @@
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-label-text-color: #E64A19;
--mat-chip-with-icon-icon-color: #FF5722;
--mat-chip-outline-color: #FF5722;
--mat-chip-outline-width: 1px;
}
}
}
}

2
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -1884,7 +1884,7 @@
"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}}' is not found in Secrets storage. The value resolves to empty until the secret is created.",
"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",

Loading…
Cancel
Save