Skip to content

Commit 1d892d8

Browse files
xflordHejdaJakub
authored andcommitted
feat: allow inputting multi-line string values to string attributes
1 parent b27f79c commit 1d892d8

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

apps/admin-gui/src/assets/i18n/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3019,6 +3019,9 @@
30193019
"CANCEL_BUTTON": "Cancel"
30203020
}
30213021
},
3022+
"ATTRIBUTE_VALUE_STRING": {
3023+
"HINT": "This attribute value includes newlines. Please make sure this is intended!"
3024+
},
30223025
"ATTRIBUTES_LIST": {
30233026
"FILTER": "Filter attributes by Id, name, value or description",
30243027
"ID": "Id",

libs/perun/components/src/lib/attributes-list/attribute-value/attribute-value-string/attribute-value-string.component.html

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,28 @@
33
subscriptSizing="dynamic"
44
class="w-100">
55
<input
6+
*ngIf="readonly"
67
matInput
7-
(click)="readonly && value !== undefined && showValue(value, attribute.displayName)"
8-
[class.cursor-pointer]="readonly && value !== undefined"
9-
[readonly]="readonly"
8+
(click)="value !== undefined && showValue(value, attribute.displayName)"
9+
[class.cursor-pointer]="value !== undefined"
10+
[readonly]="true"
1011
class="overflow-ellipsis"
1112
[(ngModel)]="attribute.value"
1213
type="text"
1314
attr.data-cy="{{attribute.displayName | multiWordDataCy}}-value"
1415
(keydown)="_sendEventToParent()" />
16+
<textarea
17+
*ngIf="!readonly"
18+
matInput
19+
rows="3"
20+
wrap="off"
21+
class="overflow-ellipsis"
22+
[(ngModel)]="attribute.value"
23+
type="text"
24+
attr.data-cy="{{attribute.displayName | multiWordDataCy}}-value"
25+
(keydown)="_sendEventToParent()">
26+
</textarea>
27+
<mat-hint class="hint-color" *ngIf="!readonly && attribute.value?.includes('\n')"
28+
><b>{{'SHARED_LIB.PERUN.COMPONENTS.ATTRIBUTE_VALUE_STRING.HINT' | translate}}</b></mat-hint
29+
>
1530
</mat-form-field>

libs/perun/components/src/lib/attributes-list/attribute-value/attribute-value-string/attribute-value-string.component.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22
cursor: pointer;
33
}
44

5+
.hint-color {
6+
color: darkorange;
7+
}
8+
59
.overflow-ellipsis {
610
text-overflow: ellipsis;
711
}
12+
13+
// hide hint when field not in focus
14+
.mat-mdc-form-field:not(.mat-focused) mat-hint {
15+
display: none;
16+
}
17+
18+
:host ::ng-deep .mdc-text-field {
19+
padding-right: 0 !important;
20+
}

0 commit comments

Comments
 (0)