Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ui/src/views/CompanyEditView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,17 @@ async function save() {
return
}

// Resolve the scope ID from its name. The backend expects an Integer
// ID (container scope), not the string name. scopeAll is preloaded at
// mount() from rest/service/id/container-scope/COMPANY.
const scopeEntry = scopeAll.value.find(s => s.name === form.value.scope)
if (!scopeEntry) {
errorStore.push({ message: `Unknown scope: ${form.value.scope}`, status: 0 })
return
}

saving.value = true
const payload = { name: form.value.name, scope: form.value.scope }
const payload = { name: form.value.name, scope: scopeEntry.id }

if (isEdit.value) {
await api.put('rest/service/id/company', payload)
Expand Down
17 changes: 16 additions & 1 deletion ui/src/views/GroupEditView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ const confirmDelete = ref(false)
const demoMode = ref(false)
const availableGroups = ref([])
const availableScopes = ref([])
// Full scope objects ({id, name, ...}) — used at save() to resolve the
// Integer ID expected by the backend from the name held in form.value.scope.
const scopeAll = ref([])
const scopesLoading = ref(false)

const isEdit = computed(() => route.params.id && route.params.id !== 'new')
Expand Down Expand Up @@ -113,11 +116,14 @@ async function loadGroupScopes() {
const data = await api.get('rest/service/id/container-scope/group')
const rows = Array.isArray(data) ? data : (Array.isArray(data?.data) ? data.data : null)
if (rows) {
scopeAll.value = rows
availableScopes.value = rows.map((s) => s.name).filter(Boolean)
} else {
scopeAll.value = []
availableScopes.value = ['Group', 'Department', 'Team', 'Project']
}
} catch {
scopeAll.value = []
availableScopes.value = ['Group', 'Department', 'Team', 'Project']
} finally {
scopesLoading.value = false
Expand Down Expand Up @@ -186,8 +192,17 @@ async function save() {
return
}

// Resolve the scope ID from its name. The backend expects an Integer
// ID (container scope), not the string name. scopeAll is preloaded at
// mount() from rest/service/id/container-scope/group.
const scopeEntry = scopeAll.value.find(s => s.name === form.value.scope)
if (!scopeEntry) {
errorStore.push({ message: `Unknown scope: ${form.value.scope}`, status: 0 })
return
}

saving.value = true
const payload = { name: form.value.name, scope: form.value.scope, parent: form.value.parent || null }
const payload = { name: form.value.name, scope: scopeEntry.id, parent: form.value.parent || null }

if (isEdit.value) {
await api.put('rest/service/id/group', payload)
Expand Down
Loading