diff --git a/frontend/src/views/settings/EnvVarSettings.vue b/frontend/src/views/settings/EnvVarSettings.vue index 9c72272c..f9070fbb 100644 --- a/frontend/src/views/settings/EnvVarSettings.vue +++ b/frontend/src/views/settings/EnvVarSettings.vue @@ -437,7 +437,7 @@ const loading = ref(true) const loadError = ref('') const groups = ref([]) -const skillCards = computed(() => skillSecretCards(groups.value)) +const skillCards = computed(() => skillSecretCards(groups.value, t('settings.skills.hostTarget'))) const sandboxCards = computed(() => sandboxGroupsWithVars(groups.value)) const multipleSandboxes = computed(() => groups.value.length > 1) const sandboxOptions = computed(() => diff --git a/frontend/src/views/settings/envVarState.test.ts b/frontend/src/views/settings/envVarState.test.ts index c95f59ac..2ca140f0 100644 --- a/frontend/src/views/settings/envVarState.test.ts +++ b/frontend/src/views/settings/envVarState.test.ts @@ -279,3 +279,11 @@ test('skillSecretCards lifts declared skills out of config groups and skips empt assert.equal(cards[0].skill.skill_id, 'weknora') assert.equal(cards[0].sandbox_config_name, 'Docker-Test') }) + +test('skillSecretCards labels the host sandbox like the sandbox cards do', () => { + const hostSkill = skill('weknora', 'weknora', [envVar({ name: 'WEKNORA_API_KEY' })]) + const groups = [config('host', '本机', [], [hostSkill])] + + assert.equal(skillSecretCards(groups, 'This computer')[0].sandbox_config_name, 'This computer') + assert.equal(skillSecretCards(groups)[0].sandbox_config_name, '本机') +}) diff --git a/frontend/src/views/settings/envVarState.ts b/frontend/src/views/settings/envVarState.ts index 37c75fc4..c147e2e7 100644 --- a/frontend/src/views/settings/envVarState.ts +++ b/frontend/src/views/settings/envVarState.ts @@ -193,14 +193,14 @@ export interface SkillSecretCard { skill: SkillEnvGroup } -export function skillSecretCards(groups: ConfigEnvGroup[]): SkillSecretCard[] { +export function skillSecretCards(groups: ConfigEnvGroup[], hostLabel = ''): SkillSecretCard[] { const cards: SkillSecretCard[] = [] for (const group of groups) { for (const skill of group.skills || []) { if (!skill.vars?.length) continue cards.push({ sandbox_config_id: group.sandbox_config_id, - sandbox_config_name: configLabel(group), + sandbox_config_name: configLabel(group, hostLabel), skill, }) }