This is an automated email from the ASF dual-hosted git repository.
wu-sheng pushed a commit to branch feat/ai-history-and-enhancement
in repository https://gitbox.apache.org/repos/asf/skywalking-horizon-ui.git
The following commit(s) were added to
refs/heads/feat/ai-history-and-enhancement by this push:
new 7a171d7 fix(ai): keep the profiling proposal header lint-clean and
exhaustive
7a171d7 is described below
commit 7a171d7a7ea73b9d0a6b41ca42e9574433dad06d
Author: Wu Sheng <[email protected]>
AuthorDate: Tue Jul 28 18:56:44 2026 +0800
fix(ai): keep the profiling proposal header lint-clean and exhaustive
The per-type header switch had no default, so
vue/return-in-computed-property
failed the lint gate (the rule cannot see TypeScript's exhaustiveness). A
Record keyed by the profilingType union always returns, still makes a new
profiling type a compile error, and keeps the literal en.json keys in
source.
---
apps/ui/src/ai/ChatProposalBlock.vue | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/apps/ui/src/ai/ChatProposalBlock.vue
b/apps/ui/src/ai/ChatProposalBlock.vue
index c59b036..2f8572b 100644
--- a/apps/ui/src/ai/ChatProposalBlock.vue
+++ b/apps/ui/src/ai/ChatProposalBlock.vue
@@ -109,21 +109,17 @@ function dismiss(): void {
// One whole sentence per type — interpolating a type name into a generic
header
// leaves the card half-English. Product nouns (JVM, async-profiler, pprof,
eBPF)
-// stay verbatim in every locale.
-const headerText = computed<string>(() => {
- switch (props.block.spec.profilingType) {
- case 'trace':
- return t('Suggested action: start trace profiling');
- case 'async':
- return t('Suggested action: start JVM async-profiler profiling');
- case 'pprof':
- return t('Suggested action: start Go pprof profiling');
- case 'ebpf':
- return t('Suggested action: start eBPF profiling');
- case 'network':
- return t('Suggested action: start network profiling');
- }
-});
+// stay verbatim in every locale. The Record is keyed by the union, so a new
+// profiling type is a compile error rather than a silently mislabelled card;
+// the values are the literal en.json keys.
+const HEADER_KEY: Record<ProposalSpec['profilingType'], string> = {
+ trace: 'Suggested action: start trace profiling',
+ async: 'Suggested action: start JVM async-profiler profiling',
+ pprof: 'Suggested action: start Go pprof profiling',
+ ebpf: 'Suggested action: start eBPF profiling',
+ network: 'Suggested action: start network profiling',
+};
+const headerText = computed<string>(() =>
t(HEADER_KEY[props.block.spec.profilingType]));
const showDuration = computed<boolean>(() => hasDuration(props.block.spec));
// One target line adapted to the type: endpoint for trace, resolved instances
// for async/pprof/network, the CPU target for eBPF.