Skip to content

Commit d4c81fb

Browse files
feat: add group options for project configuration
1 parent 59c826e commit d4c81fb

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/stores/projectsStore.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ export const useProjectsStore = defineStore('projects', () => {
4444
}))
4545
})
4646

47+
// 所有组别
48+
const allGroups = computed(() => {
49+
const groupSet = new Set<string>()
50+
for (const project of projects.value) {
51+
if (project.group && project.group.trim() !== '') {
52+
groupSet.add(project.group)
53+
}
54+
}
55+
return Array.from(groupSet).sort((a, b) => a.localeCompare(b))
56+
})
57+
4758
// -------------------------
4859
// Actions
4960
// -------------------------
@@ -169,6 +180,7 @@ export const useProjectsStore = defineStore('projects', () => {
169180
allProjects,
170181
tempProjects,
171182
mainLangSummary,
183+
allGroups,
172184

173185
// actions
174186
addProject,

src/views/ProjectConfig/ProjectConfig.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const projectPathInputValidated = ref<boolean>(false)
3535
const projectNameInputValidated = ref<boolean>(false)
3636
const repositoryFolderName = ref<string>('')
3737
const excludedPaths = isUpdateProject ? [localProjectItem.value.path || ''] : []
38+
const groupOptions = ref<JeComboboxOptionProps[]>(projects.allGroups.map(group => ({ label: group, value: group })))
3839
3940
function fillProjectName() {
4041
localProjectItem.value.name = repositoryFolderName.value
@@ -358,7 +359,7 @@ function updateProject() {
358359
<div flex="~ row items-center" gap="10px">
359360
<JeCombobox
360361
v-model="localProjectItem.group"
361-
:options="mainLanguageOptions"
362+
:options="groupOptions"
362363
:spellcheck="false"
363364
w="200px"
364365
/>

0 commit comments

Comments
 (0)