summaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
authorChristoph Wurst <ChristophWurst@users.noreply.github.com>2022-09-27 19:36:07 +0200
committerGitHub <noreply@github.com>2022-09-27 19:36:07 +0200
commite058254f588c3ade89c111ab2246e9f93ebc9ce8 (patch)
tree4f002cc392b929cae8a9545bc3d03c6908a58612 /src/components
parent307840462a8d99c48c4c40a79481fb734cddeb30 (diff)
parent240ee34f0515580c13537ea1e8c480dbc41bf7eb (diff)
Merge pull request #2962 from nextcloud/fix/org-chart-save-uid-and-display-name
Save UID and display name for managers of the org chart
Diffstat (limited to 'src/components')
-rw-r--r--src/components/AppContent/ChartContent.vue9
-rw-r--r--src/components/ContactDetails/ContactDetailsProperty.vue20
2 files changed, 24 insertions, 5 deletions
diff --git a/src/components/AppContent/ChartContent.vue b/src/components/AppContent/ChartContent.vue
index b77f61a9..e9c3b82f 100644
--- a/src/components/AppContent/ChartContent.vue
+++ b/src/components/AppContent/ChartContent.vue
@@ -44,14 +44,17 @@ export default {
prev.push(transformNode(contact))
const manager = contactsByUid[contact.addressbook.id][contact.managersName]
- if (manager && !manager.managersName && !headManagers.includes(manager.uid)) {
+ if (manager && !manager.managersName && !headManagers.some(m => m.nodeId === manager.uid)) {
prev.push(transformNode(manager))
- headManagers.push(manager.uid)
+ headManagers.push(transformNode(manager))
}
return prev
}, [])
- return headManagers.map(uid => getChart(tempContacts, uid))
+ const charts = headManagers.map(managerNode => getChart(tempContacts, managerNode))
+ // Debugging logs to figure out why a graph might not show. Leave this in place until the logic is bulletproof
+ console.debug('Org charts', charts.map((nodes, index) => nodes.map(n => `list ${index} ${n.nodeId} (${n.fullName}) -> ${n.parentNodeId}`)))
+ return charts
},
},
}
diff --git a/src/components/ContactDetails/ContactDetailsProperty.vue b/src/components/ContactDetails/ContactDetailsProperty.vue
index 2882853e..feb8c06c 100644
--- a/src/components/ContactDetails/ContactDetailsProperty.vue
+++ b/src/components/ContactDetails/ContactDetailsProperty.vue
@@ -230,7 +230,7 @@ export default {
return {
...prev,
[contact.uid]: {
- id: contact.uid,
+ id: contact.key,
name: contact.displayName,
},
}
@@ -333,6 +333,16 @@ export default {
? this.property.getValues()[0]
: this.property.getValues()
}
+ if (this.propName === 'x-managersname') {
+ if (this.property.getParameter('uid')) {
+ return this.property.getParameter('uid') + '~' + this.contact.addressbook.id
+ }
+ // Try to find the matching contact by display name
+ // TODO: this only *shows* the display name but doesn't assign the missing UID
+ const displayName = this.property.getFirstValue()
+ const other = this.otherContacts(this.contact).find(contact => contact.displayName === displayName)
+ return other?.key
+ }
return this.property.getFirstValue()
},
set(data) {
@@ -342,7 +352,13 @@ export default {
? this.property.setValues([data])
: this.property.setValues(data)
} else {
- this.property.setValue(data)
+ if (this.propName === 'x-managersname') {
+ const manager = this.$store.getters.getContact(data)
+ this.property.setValue(manager.displayName)
+ this.property.setParameter('uid', manager.uid)
+ } else {
+ this.property.setValue(data)
+ }
}
this.updateContact()
},