-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2954 from nextcloud/feature/orgChart
Add organization charts
- Loading branch information
Showing
19 changed files
with
1,347 additions
and
19 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<template> | ||
<AppContent> | ||
<OrgChart :data="transformData" /> | ||
</AppContent> | ||
</template> | ||
|
||
<script> | ||
import AppContent from '@nextcloud/vue/dist/Components/NcAppContent' | ||
import OrgChart from '../OrgChart.vue' | ||
import { getChart, transformNode } from '../../utils/chartUtils' | ||
export default { | ||
name: 'ChartContent', | ||
components: { | ||
AppContent, | ||
OrgChart, | ||
}, | ||
props: { | ||
contactsList: { | ||
type: Object, | ||
required: true, | ||
}, | ||
}, | ||
data() { | ||
return { | ||
data: [], | ||
searchQuery: '', | ||
} | ||
}, | ||
computed: { | ||
transformData() { | ||
const contactsByUid = {} | ||
const contacts = Object.keys(this.contactsList).map(key => { | ||
const [uid, addressbook] = key.split('~') | ||
if (!contactsByUid[addressbook]) { | ||
contactsByUid[addressbook] = {} | ||
} | ||
return (contactsByUid[addressbook][uid] = this.contactsList[key]) | ||
}) | ||
const headManagers = [] | ||
const tempContacts = contacts.filter(contact => contact.managersName).reduce((prev, contact) => { | ||
prev.push(transformNode(contact)) | ||
const manager = contactsByUid[contact.addressbook.id][contact.managersName] | ||
if (manager && !manager.managersName && !headManagers.includes(manager.uid)) { | ||
prev.push(transformNode(manager)) | ||
headManagers.push(manager.uid) | ||
} | ||
return prev | ||
}, []) | ||
return headManagers.map(uid => getChart(tempContacts, uid)) | ||
}, | ||
}, | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
<template> | ||
<div class="org-chart-node"> | ||
<div class="inner-box"> | ||
<router-link :to="{ | ||
name: 'contact', | ||
params: { | ||
selectedGroup: selectedChart, | ||
selectedContact: data.key, | ||
}, | ||
}"> | ||
<Avatar | ||
:disable-tooltip="true" | ||
:display-name="data.fullName" | ||
:is-no-user="true" | ||
:size="60" | ||
:url="data.photoUrl" | ||
class="org-chart-node__avatar" /> | ||
</router-link> | ||
<div class="panel" /> | ||
<div class="main-container"> | ||
<h3 class="fullName"> | ||
{{ data.fullName }} | ||
</h3> | ||
<h4 class="title"> | ||
{{ data.title }} | ||
</h4> | ||
</div> | ||
<div class="description"> | ||
<p v-if="data._directSubordinates"> | ||
{{ t('contacts', 'Manages') }}: {{ data._directSubordinates }} | ||
</p> | ||
<p v-if="data._totalSubordinates"> | ||
{{ t('contacts', 'Oversees') }}: {{ data._totalSubordinates }} | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import Avatar from '@nextcloud/vue/dist/Components/NcAvatar' | ||
export default { | ||
name: 'ChartTemplate', | ||
components: { | ||
Avatar, | ||
}, | ||
props: { | ||
data: { | ||
type: Object, | ||
default: () => {}, | ||
}, | ||
onAvatarClick: { | ||
type: Function, | ||
default: () => {}, | ||
}, | ||
}, | ||
computed: { | ||
selectedChart() { | ||
return this.$route.params.selectedChart | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.org-chart-node { | ||
background-color: var(--color-main-background); | ||
padding-top: 1px; | ||
height: 175px; | ||
border-radius: var(--border-radius-large); | ||
overflow: visible; | ||
&__avatar { | ||
margin-top: -30px; | ||
margin-left: 95px; | ||
border: 1px solid var(--color-border); | ||
} | ||
.inner-box { | ||
display: flex; | ||
flex-direction: column; | ||
height: 175px; | ||
padding-top: 0; | ||
border: 1px solid var(--color-border); | ||
border-radius: var(--border-radius-large); | ||
background-color: var(--color-main-background); | ||
.main-container { | ||
padding: 20px; | ||
text-align: center; | ||
flex: 1; | ||
.fullName { | ||
color: var(--color-primary-element); | ||
font-weight: bold; | ||
} | ||
.title { | ||
margin-top: 4px; | ||
} | ||
} | ||
.description { | ||
display: flex; | ||
justify-content: space-between; | ||
padding: 15px; | ||
} | ||
} | ||
.inner-box-highlight { | ||
border: 2px solid var(--color-primary) !important; | ||
} | ||
.panel { | ||
margin: -34px -1px 0 -1px; | ||
background-color: var(--color-primary); | ||
height: 15px; | ||
border-top-left-radius: var(--border-radius-large); | ||
border-top-right-radius: var(--border-radius-large); | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.