Skip to content

Commit

Permalink
Merge branch 'postgres' of https://github.com/ezpaarse-project/ezmesure
Browse files Browse the repository at this point in the history
… into postgres
  • Loading branch information
nojhamster committed Oct 23, 2023
2 parents ed4702b + 8928371 commit 95c38be
Show file tree
Hide file tree
Showing 8 changed files with 290 additions and 176 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/api-erd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:
COMMIT_NAME: 'doc(api): updated database documentation[skip ci]'
COMMIT_BODY: '${{ github.event.compare }}'
COMMIT_FOOTER: 'Co-authored-by: @${{ github.event.sender.login }}'
ERD_WS: https://p-erd.oxypomme.fr/
ERD_WS: https://p-erd.oxypomme.fr
ERD_WS_KEY: ${{ secrets.PRISMA_ERD_API_KEY }}

jobs:
Expand Down
380 changes: 211 additions & 169 deletions api/prisma/doc/DIC.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion api/prisma/doc/ERD.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion front/components/MemberInstitutionPermissions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
:key="permissionLevel.value"
:value="permissionLevel.value"
:loading="saving"
:disabled="readonly"
small
outlined
>
Expand Down Expand Up @@ -76,6 +77,10 @@ export default {
type: String,
default: () => '',
},
readonly: {
type: Boolean,
default: () => false,
},
},
data() {
return {
Expand Down Expand Up @@ -149,7 +154,9 @@ export default {
},
async savePermissions() {
if (!this.username || !this.institutionId) { return; }
if (!this.username || !this.institutionId || this.readonly) {
return;
}
this.saving = true;
this.saveError = null;
Expand Down
7 changes: 6 additions & 1 deletion front/components/MemberRepoPermissions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
:key="permission.value"
:value="permission.value"
:loading="loadingPerms[repository.id]"
:disabled="readonly"
small
outlined
>
Expand Down Expand Up @@ -77,6 +78,10 @@ export default {
type: String,
default: () => '',
},
readonly: {
type: Boolean,
default: () => false,
},
},
data() {
return {
Expand Down Expand Up @@ -151,7 +156,7 @@ export default {
},
async savePermission(repositoryId) {
if (!this.username) {
if (!this.username || this.readonly) {
return;
}
Expand Down
56 changes: 54 additions & 2 deletions front/components/MemberSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@

<v-list v-if="hasUsers">
<v-list-item
v-for="user in users" :key="user.username"
v-for="user in users"
:key="user.username"
:disabled="!isAdmin && isConnectedUser(user)"
>
<v-list-item-avatar>
Expand All @@ -58,8 +59,50 @@
<v-list-item-title>
{{ user.fullName }}
</v-list-item-title>

<v-list-item-subtitle v-if="user.email">
{{ user.email }}
</v-list-item-subtitle>
</v-list-item-content>

<!-- Membership list -->
<v-menu
v-if="Array.isArray(user.memberships) && user.memberships.length"
:close-on-content-click="false"
open-on-hover
bottom
offset-y
>
<template #activator="{ on, attrs }">
<v-chip v-bind="attrs" v-on="on">
{{ user.memberships.length }}

<v-icon right>
mdi-domain
</v-icon>
</v-chip>
</template>

<v-list>
<v-list-item
v-for="({ institution }) in user.memberships"
:key="`${user.username}:member:${institution.id}`"
>
<v-list-item-avatar>
<v-img
v-if="institution.logoId"
:src="`/api/assets/logos/${institution.logoId}`"
/>
<v-icon v-else>
mdi-domain
</v-icon>
</v-list-item-avatar>

<v-list-item-title>{{ institution.name }}</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>

<slot name="action" :user="user" :close-menu="closeMenu" />
</v-list-item>
</v-list>
Expand Down Expand Up @@ -149,7 +192,16 @@ export default {
this.failedToSearch = false;
try {
const { data } = await this.$axios.get('/users', { params: { q: this.search } });
const { data } = await this.$axios.get(
'/users',
{
params: {
q: this.search,
source: this.isAdmin ? '*' : undefined,
include: this.isAdmin ? 'memberships.institution' : undefined,
},
},
);
this.users = Array.isArray(data) ? data : [];
} catch (e) {
this.failedToSearch = true;
Expand Down
7 changes: 6 additions & 1 deletion front/components/MemberSpacePermissions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
:key="permission.value"
:value="permission.value"
:loading="loadingPerms[space.id]"
:disabled="readonly"
small
outlined
>
Expand Down Expand Up @@ -77,6 +78,10 @@ export default {
type: String,
default: () => '',
},
readonly: {
type: Boolean,
default: () => false,
},
},
data() {
return {
Expand Down Expand Up @@ -151,7 +156,7 @@ export default {
},
async savePermission(spaceId) {
if (!this.username) {
if (!this.username || this.readonly) {
return;
}
Expand Down
3 changes: 3 additions & 0 deletions front/components/MemberUpdateDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<MemberInstitutionPermissions
:institution-id="institutionId"
:username="username"
:readonly="readonly"
class="px-0"
@change="hasChanged = true"
/>
Expand All @@ -44,6 +45,7 @@
<MemberRepoPermissions
:institution-id="institutionId"
:username="username"
:readonly="readonly"
class="px-0"
@change="hasChanged = true"
/>
Expand All @@ -59,6 +61,7 @@
<MemberSpacePermissions
:institution-id="institutionId"
:username="username"
:readonly="readonly"
class="px-0"
@change="hasChanged = true"
/>
Expand Down

0 comments on commit 95c38be

Please sign in to comment.