Skip to content

Commit 0dfe9ed

Browse files
ELin2025claude
andcommitted
style(frontend): format property editor component with prettier
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 034855a commit 0dfe9ed

2 files changed

Lines changed: 69 additions & 47 deletions

File tree

frontend/src/app/workspace/component/property-editor/operator-property-edit-frame/operator-property-edit-frame.component.html

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@
100100
*ngIf="formlyFields && formlyFormGroup"
101101
[formGroup]="formlyFormGroup"
102102
class="property-editor-form">
103-
<div *ngIf="huggingFaceTaskPreview as preview" class="hf-task-preview">
103+
<div
104+
*ngIf="huggingFaceTaskPreview as preview"
105+
class="hf-task-preview">
104106
<p class="hf-task-preview-label">Task Preview:</p>
105107
<div class="hf-task-preview-card">
106108
<ng-container [ngSwitch]="preview.kind">
@@ -112,8 +114,7 @@
112114
playsinline
113115
controls
114116
class="hf-task-preview-media"
115-
[src]="preview.assetSrc">
116-
</video>
117+
[src]="preview.assetSrc"></video>
117118
<img
118119
*ngSwitchCase="'image'"
119120
class="hf-task-preview-media"
@@ -124,30 +125,59 @@
124125
controls
125126
preload="metadata"
126127
class="hf-task-preview-audio"
127-
[src]="preview.assetSrc">
128-
</audio>
129-
<div *ngSwitchCase="'text'" class="hf-task-preview-text-surface">
128+
[src]="preview.assetSrc"></audio>
129+
<div
130+
*ngSwitchCase="'text'"
131+
class="hf-task-preview-text-surface">
130132
<div class="hf-task-preview-text-title">{{ preview.title }}</div>
131133
<div class="hf-task-preview-text-body">{{ preview.body }}</div>
132-
<div *ngIf="preview.outputBody" class="hf-task-preview-text-output">{{ preview.outputBody }}</div>
134+
<div
135+
*ngIf="preview.outputBody"
136+
class="hf-task-preview-text-output">
137+
{{ preview.outputBody }}
138+
</div>
133139
</div>
134140
</ng-container>
135141

136142
<div class="hf-task-preview-meta">
137143
<div class="hf-task-preview-title">{{ preview.title }}</div>
138-
<div *ngIf="preview.inputLabel || preview.outputLabel" class="hf-task-preview-flow">
139-
<span *ngIf="preview.inputLabel" class="hf-task-preview-chip">{{ preview.inputLabel }}</span>
140-
<span *ngIf="preview.outputLabel" class="hf-task-preview-arrow"></span>
141-
<span *ngIf="preview.outputLabel" class="hf-task-preview-chip">{{ preview.outputLabel }}</span>
144+
<div
145+
*ngIf="preview.inputLabel || preview.outputLabel"
146+
class="hf-task-preview-flow">
147+
<span
148+
*ngIf="preview.inputLabel"
149+
class="hf-task-preview-chip"
150+
>{{ preview.inputLabel }}</span
151+
>
152+
<span
153+
*ngIf="preview.outputLabel"
154+
class="hf-task-preview-arrow"
155+
></span
156+
>
157+
<span
158+
*ngIf="preview.outputLabel"
159+
class="hf-task-preview-chip"
160+
>{{ preview.outputLabel }}</span
161+
>
142162
</div>
143-
<div *ngIf="preview.body && preview.kind !== 'text'" class="hf-task-preview-description">
163+
<div
164+
*ngIf="preview.body && preview.kind !== 'text'"
165+
class="hf-task-preview-description">
144166
{{ preview.body }}
145167
</div>
146-
<div *ngIf="preview.outputBody && preview.kind !== 'text'" class="hf-task-preview-output">
168+
<div
169+
*ngIf="preview.outputBody && preview.kind !== 'text'"
170+
class="hf-task-preview-output">
147171
{{ preview.outputBody }}
148172
</div>
149-
<div *ngIf="preview.pills?.length" class="hf-task-preview-pills">
150-
<span *ngFor="let pill of preview.pills" class="hf-task-preview-pill">{{ pill }}</span>
173+
<div
174+
*ngIf="preview.pills?.length"
175+
class="hf-task-preview-pills">
176+
<span
177+
*ngFor="let pill of preview.pills"
178+
class="hf-task-preview-pill"
179+
>{{ pill }}</span
180+
>
151181
</div>
152182
</div>
153183
</div>

frontend/src/app/workspace/component/property-editor/operator-property-edit-frame/operator-property-edit-frame.component.ts

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -350,15 +350,15 @@ export class OperatorPropertyEditFrameComponent implements OnInit, OnChanges, On
350350
body: "We need to accelerate onboarding for enterprise customers.",
351351
pills: ["business", "operations", "support"],
352352
},
353-
"translation": {
353+
translation: {
354354
kind: "text",
355355
inputLabel: "Source text",
356356
outputLabel: "Translated text",
357357
title: "Translation preview",
358358
body: "Good morning, thanks for joining the call.",
359359
outputBody: "Buenos dias, gracias por unirte a la llamada.",
360360
},
361-
"summarization": {
361+
summarization: {
362362
kind: "text",
363363
inputLabel: "Long text",
364364
outputLabel: "Summary",
@@ -400,32 +400,32 @@ export class OperatorPropertyEditFrameComponent implements OnInit, OnChanges, On
400400
},
401401
};
402402

403-
get huggingFaceTaskPreview():
404-
| {
405-
kind: "image" | "video" | "audio" | "text";
406-
inputLabel?: string;
407-
outputLabel?: string;
408-
title?: string;
409-
body?: string;
410-
outputBody?: string;
411-
pills?: string[];
412-
assetSrc?: string;
413-
}
414-
| null {
403+
get huggingFaceTaskPreview(): {
404+
kind: "image" | "video" | "audio" | "text";
405+
inputLabel?: string;
406+
outputLabel?: string;
407+
title?: string;
408+
body?: string;
409+
outputBody?: string;
410+
pills?: string[];
411+
assetSrc?: string;
412+
} | null {
415413
if (!this.isHuggingFaceOperator()) {
416414
return null;
417415
}
418416
const task = this.formData?.["task"];
419417
if (typeof task !== "string" || task.trim().length === 0) {
420418
return null;
421419
}
422-
return this.huggingFaceTaskPreviewSamples[task] ?? {
423-
kind: "text",
424-
inputLabel: "Task input",
425-
outputLabel: "Task output",
426-
title: this.formatTaskTitle(task),
427-
body: "This task transforms the provided input into a model response.",
428-
};
420+
return (
421+
this.huggingFaceTaskPreviewSamples[task] ?? {
422+
kind: "text",
423+
inputLabel: "Task input",
424+
outputLabel: "Task output",
425+
title: this.formatTaskTitle(task),
426+
body: "This task transforms the provided input into a model response.",
427+
}
428+
);
429429
}
430430

431431
constructor(
@@ -819,17 +819,11 @@ export class OperatorPropertyEditFrameComponent implements OnInit, OnChanges, On
819819
mappedField.type = "huggingface";
820820
}
821821

822-
if (
823-
mappedField.key === "modelId" &&
824-
this.currentOperatorSchema?.operatorType === "HuggingFace"
825-
) {
822+
if (mappedField.key === "modelId" && this.currentOperatorSchema?.operatorType === "HuggingFace") {
826823
mappedField.type = "huggingface";
827824
}
828825

829-
if (
830-
mappedField.key === "task" &&
831-
this.currentOperatorSchema?.operatorType === "HuggingFace"
832-
) {
826+
if (mappedField.key === "task" && this.currentOperatorSchema?.operatorType === "HuggingFace") {
833827
mappedField.hide = true;
834828
}
835829

@@ -864,9 +858,7 @@ export class OperatorPropertyEditFrameComponent implements OnInit, OnChanges, On
864858
"zero-shot-image-classification",
865859
];
866860
const getSelectedTask = (field: FormlyFieldConfig): string | undefined => {
867-
const fromForm =
868-
field.form?.get("task")?.value ??
869-
field.formControl?.parent?.get("task")?.value;
861+
const fromForm = field.form?.get("task")?.value ?? field.formControl?.parent?.get("task")?.value;
870862
if (typeof fromForm === "string" && fromForm.trim().length > 0) {
871863
return fromForm;
872864
}

0 commit comments

Comments
 (0)