+
-
diff --git a/src/app/frontend/index.scss b/src/app/frontend/index.scss
index 807ed956c981..c81cac127baa 100644
--- a/src/app/frontend/index.scss
+++ b/src/app/frontend/index.scss
@@ -198,6 +198,7 @@ router-outlet::after {
font-size: $body-font-size-base;
padding: $baseline-grid * 2;
white-space: pre-wrap;
+ width: 100%;
}
.kd-code-block-font {
@@ -352,3 +353,17 @@ router-outlet::after {
.nvtooltip {
font-family: Roboto, sans-serif;
}
+
+.kd-secret-detail-text {
+ .mat-form-field-wrapper {
+ padding-bottom: $baseline-grid;
+ }
+
+ .mat-form-field-infix {
+ padding-top: 2px;
+ }
+
+ textarea {
+ padding: (2 * $baseline-grid) (2 * $baseline-grid) 0 !important;
+ }
+}
diff --git a/src/app/frontend/resource/config/secret/detail/component.ts b/src/app/frontend/resource/config/secret/detail/component.ts
index 82ac825ef49f..e5db900afc8a 100644
--- a/src/app/frontend/resource/config/secret/detail/component.ts
+++ b/src/app/frontend/resource/config/secret/detail/component.ts
@@ -21,6 +21,7 @@ import {ActionbarService, ResourceMeta} from '../../../../common/services/global
import {NotificationsService} from '../../../../common/services/global/notifications';
import {EndpointManager, Resource} from '../../../../common/services/resource/endpoint';
import {NamespacedResourceService} from '../../../../common/services/resource/resource';
+import {HiddenPropertyMode} from '../../../../common/components/hiddenproperty/component';
@Component({
selector: 'kd-secret-detail',
@@ -31,6 +32,7 @@ export class SecretDetailComponent implements OnInit, OnDestroy {
private readonly endpoint_ = EndpointManager.resource(Resource.secret, true);
secret: SecretDetail;
isInitialized = false;
+ HiddenPropertyMode = HiddenPropertyMode;
constructor(
private readonly secret_: NamespacedResourceService
,
diff --git a/src/app/frontend/resource/config/secret/detail/edit/component.ts b/src/app/frontend/resource/config/secret/detail/edit/component.ts
index 6e13264c2f02..8e32d6112510 100644
--- a/src/app/frontend/resource/config/secret/detail/edit/component.ts
+++ b/src/app/frontend/resource/config/secret/detail/edit/component.ts
@@ -26,32 +26,34 @@ import {MatDialogConfig, MatDialog} from '@angular/material/dialog';
})
export class SecretDetailEditComponent implements OnInit {
@Output() onClose = new EventEmitter();
+ @Input() key: string;
+
+ text = '';
+
+ private secret_: SecretDetail;
+ private editing_ = false;
+
@Input() set editing(value: boolean) {
this.editing_ = value;
- this.updateText();
+ this.updateText_();
}
+
get editing(): boolean {
return this.editing_;
}
+
@Input() set secret(value: SecretDetail) {
this.secret_ = value;
-
- if (!this.editing) {
- this.updateText();
- }
}
+
get secret(): SecretDetail {
return this.secret_;
}
- @Input() key: string;
- text = '';
- private secret_: SecretDetail;
- private editing_ = false;
constructor(private readonly dialog_: MatDialog, private readonly http_: HttpClient) {}
ngOnInit(): void {
- this.updateText();
+ this.updateText_();
}
update(): void {
@@ -61,8 +63,8 @@ export class SecretDetailEditComponent implements OnInit {
.get(url)
.toPromise()
.then((resource: any) => {
- const dataValue = this.encode(this.text);
- resource.data[this.key] = this.encode(this.text);
+ const dataValue = this.encode_(this.text);
+ resource.data[this.key] = this.encode_(this.text);
const url = RawResource.getUrl(this.secret.typeMeta, this.secret.objectMeta);
this.http_
.put(url, resource, {headers: this.getHttpHeaders_(), responseType: 'text'})
@@ -78,26 +80,26 @@ export class SecretDetailEditComponent implements OnInit {
this.onClose.emit(true);
}
- updateText(): void {
- this.text = this.secret && this.key ? this.decode(this.secret.data[this.key]) : '';
- }
-
- getHttpHeaders_(): HttpHeaders {
- const headers = new HttpHeaders();
- headers.set('Content-Type', 'application/json');
- headers.set('Accept', 'application/json');
- return headers;
+ private updateText_(): void {
+ this.text = this.secret && this.key ? this.decode_(this.secret.data[this.key]) : '';
}
- decode(s: string): string {
+ private decode_(s: string): string {
return atob(s);
}
- encode(s: string): string {
+ private encode_(s: string): string {
return btoa(s);
}
- handleErrorResponse_(err: HttpErrorResponse): void {
+ private getHttpHeaders_(): HttpHeaders {
+ const headers = new HttpHeaders();
+ headers.set('Content-Type', 'application/json');
+ headers.set('Accept', 'application/json');
+ return headers;
+ }
+
+ private handleErrorResponse_(err: HttpErrorResponse): void {
if (err) {
const alertDialogConfig: MatDialogConfig = {
width: '630px',
diff --git a/src/app/frontend/resource/config/secret/detail/edit/style.scss b/src/app/frontend/resource/config/secret/detail/edit/style.scss
index 5106c57a0760..7474c7aa4425 100644
--- a/src/app/frontend/resource/config/secret/detail/edit/style.scss
+++ b/src/app/frontend/resource/config/secret/detail/edit/style.scss
@@ -15,8 +15,13 @@
@import '../../../../../variables';
@import '../../../../../mixins';
-.kd-secret-detail-edit-container {
- margin-top: $baseline-grid / 2;
+.kd-secret-detail-text {
+ width: 100%;
+
+ .mat-input-element {
+ font-family: $font-family-monospace;
+ font-size: $body-font-size-base;
+ }
}
.kd-secret-detail-actions {
diff --git a/src/app/frontend/resource/config/secret/detail/edit/template.html b/src/app/frontend/resource/config/secret/detail/edit/template.html
index c5e34a96fc08..6b074cc88593 100644
--- a/src/app/frontend/resource/config/secret/detail/edit/template.html
+++ b/src/app/frontend/resource/config/secret/detail/edit/template.html
@@ -16,10 +16,13 @@
-
+
+
+
-
{{key}}
-
+
{{decode(secret?.data[key])}}
+
+ [editing]="property.mode == HiddenPropertyMode.Edit"
+ (onClose)="property.mode = HiddenPropertyMode.Hidden">
{{decode(secret?.data[key]).length}} bytes