Skip to content

Commit 72dc84a

Browse files
committed
fix(workflow-ui): scope operation styles and labels
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent ee9c779 commit 72dc84a

1 file changed

Lines changed: 29 additions & 22 deletions

File tree

src/workflow.ts

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ const workflowCardClassName = 'profile-fields-workflow-card'
130130
const workflowItemClassName = 'profile-fields-workflow-item'
131131
const workflowCardThemeStyleId = 'profile-fields-workflow-card-theme'
132132

133+
// TRANSLATORS The labels below are technical workflow operators shown in filter dropdowns.
134+
// Keep them short to avoid truncation in compact UI layouts.
133135
const operatorLabels: Record<string, string> = {
134136
'is-set': t('profile_fields', 'is set'),
135137
'!is-set': t('profile_fields', 'is not set'),
@@ -261,14 +263,16 @@ const getWorkflowTargetDescription = (token: string): string => {
261263
}
262264

263265
if (token.startsWith('group:')) {
266+
// TRANSLATORS {groupId} is the technical group identifier.
264267
return t('profile_fields', 'Group: {groupId}', { groupId: token.slice(6) })
265268
}
266269

267270
if (token.startsWith('user:')) {
271+
// TRANSLATORS {userId} is the technical user identifier.
268272
return t('profile_fields', 'User: {userId}', { userId: token.slice(5) })
269273
}
270274

271-
return t('profile_fields', 'Custom target')
275+
return t('profile_fields', 'Custom recipient token')
272276
}
273277

274278
const getWorkflowTargetId = (token: string): string => {
@@ -486,16 +490,16 @@ class WorkflowProfileFieldElement extends HTMLElement {
486490

487491
const style = document.createElement('style')
488492
style.textContent = `
489-
:host {
493+
${workflowElementId} {
490494
display: flex;
491495
flex: 1 1 22rem;
492496
gap: .5rem;
493497
align-items: center;
494498
min-width: 0;
495499
}
496500
497-
select,
498-
input {
501+
${workflowElementId} select,
502+
${workflowElementId} input {
499503
border: 1px solid var(--color-border-maxcontrast);
500504
border-radius: var(--border-radius-element, 6px);
501505
background: var(--color-main-background);
@@ -505,22 +509,22 @@ class WorkflowProfileFieldElement extends HTMLElement {
505509
min-height: 2.25rem;
506510
}
507511
508-
select {
512+
${workflowElementId} select {
509513
flex: 1 1 14rem;
510514
min-width: 10rem;
511515
}
512516
513-
input {
517+
${workflowElementId} input {
514518
flex: 1 1 10rem;
515519
min-width: 8rem;
516520
}
517521
518-
input[hidden] {
522+
${workflowElementId} input[hidden] {
519523
display: none;
520524
}
521525
522-
input.invalid,
523-
select.invalid {
526+
${workflowElementId} input.invalid,
527+
${workflowElementId} select.invalid {
524528
border-color: var(--color-error);
525529
}
526530
`
@@ -551,7 +555,7 @@ class WorkflowProfileFieldElement extends HTMLElement {
551555
valueInput.hidden = !operatorNeedsValue
552556
valueInput.placeholder = selectedDefinition?.type === 'number'
553557
? t('profile_fields', 'Enter the numeric value to compare')
554-
: t('profile_fields', 'Enter the value to compare')
558+
: t('profile_fields', 'Enter the comparison value')
555559
valueInput.className = !isValid && operatorNeedsValue ? 'invalid' : ''
556560

557561
fieldSelect.addEventListener('change', () => {
@@ -643,15 +647,15 @@ class WorkflowWebhookOperationElement extends HTMLElement {
643647

644648
const style = document.createElement('style')
645649
style.textContent = `
646-
:host {
650+
${webhookOperationElementId} {
647651
display: grid;
648652
flex: 1 1 22rem;
649653
gap: .5rem;
650654
min-width: 0;
651655
}
652656
653-
input,
654-
textarea {
657+
${webhookOperationElementId} input,
658+
${webhookOperationElementId} textarea {
655659
width: 100%;
656660
border: 1px solid var(--color-border-maxcontrast);
657661
border-radius: var(--border-radius-element, 6px);
@@ -662,13 +666,13 @@ class WorkflowWebhookOperationElement extends HTMLElement {
662666
min-height: 2.25rem;
663667
}
664668
665-
textarea {
669+
${webhookOperationElementId} textarea {
666670
min-height: 5rem;
667671
resize: vertical;
668672
}
669673
670-
input.invalid,
671-
textarea.invalid {
674+
${webhookOperationElementId} input.invalid,
675+
${webhookOperationElementId} textarea.invalid {
672676
border-color: var(--color-error);
673677
}
674678
`
@@ -705,6 +709,7 @@ class WorkflowWebhookOperationElement extends HTMLElement {
705709
const headersInput = document.createElement('textarea')
706710
headersInput.value = config.headers
707711
headersInput.disabled = this.disabledInternal
712+
// TRANSLATORS "X-Key: value" is an example HTTP header in "name: value" format.
708713
headersInput.placeholder = t('profile_fields', 'Optional headers, one per line. Example: X-Key: value')
709714

710715
const syncValue = () => {
@@ -767,15 +772,15 @@ class WorkflowEmailOperationElement extends HTMLElement {
767772

768773
const style = document.createElement('style')
769774
style.textContent = `
770-
:host {
775+
${emailOperationElementId} {
771776
display: grid;
772777
flex: 1 1 22rem;
773778
gap: .5rem;
774779
min-width: 0;
775780
}
776781
777-
input,
778-
textarea {
782+
${emailOperationElementId} input,
783+
${emailOperationElementId} textarea {
779784
width: 100%;
780785
border: 1px solid var(--color-border-maxcontrast);
781786
border-radius: var(--border-radius-element, 6px);
@@ -785,12 +790,12 @@ class WorkflowEmailOperationElement extends HTMLElement {
785790
padding: .45rem .6rem;
786791
}
787792
788-
textarea {
793+
${emailOperationElementId} textarea {
789794
min-height: 7rem;
790795
resize: vertical;
791796
}
792797
793-
.invalid {
798+
${emailOperationElementId} .invalid {
794799
border-color: var(--color-error);
795800
}
796801
`
@@ -805,6 +810,7 @@ class WorkflowEmailOperationElement extends HTMLElement {
805810
const bodyInput = document.createElement('textarea')
806811
bodyInput.value = config.bodyTemplate
807812
bodyInput.disabled = this.disabledInternal
813+
// TRANSLATORS Keep "{{fieldLabel}}" unchanged. It is a runtime placeholder replaced with the field label.
808814
bodyInput.placeholder = t('profile_fields', 'Optional email body template. You can use placeholders like {{fieldLabel}}')
809815
bodyInput.className = isValid || config.bodyTemplate.trim() !== '' ? '' : 'invalid'
810816

@@ -935,7 +941,7 @@ class WorkflowTargetsOperationElement extends HTMLElement {
935941

936942
const style = document.createElement('style')
937943
style.textContent = `
938-
:host {
944+
${targetsOperationElementId} {
939945
display: grid;
940946
flex: 1 1 22rem;
941947
gap: .5rem;
@@ -953,6 +959,7 @@ class WorkflowTargetsOperationElement extends HTMLElement {
953959
disabled: this.viewStateInternal.disabled,
954960
options: this.viewStateInternal.options,
955961
inputLabel: t('profile_fields', 'Search for admins, groups, or users'),
962+
// TRANSLATORS "administrators" refers to users in the built-in admin group.
956963
helperText: t('profile_fields', 'Select who should be notified. If empty, administrators are notified by default.'),
957964
loading: this.viewStateInternal.loading,
958965
onSearch: (value: string) => this.handleSearch(value),

0 commit comments

Comments
 (0)