@tekkare/romulus 0.1.367 → 0.1.368
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/runtime/components/ShareDialog.vue +82 -5
- package/layer/app/components/layout/tool/views.vue +3 -0
- package/layer/app/components/project/Page.vue +7 -1
- package/layer/app/components/project/Share.vue +69 -12
- package/layer/app/composables/useViewCardActions.ts +54 -12
- package/layer/app/types/projects.ts +10 -0
- package/layer/app/utils/oipScopes.ts +5 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -22,6 +22,13 @@
|
|
|
22
22
|
La liste des noms reste montee quand la portee change : on revient de
|
|
23
23
|
« tout l'espace » a « des personnes » sans avoir reperdu sa selection.
|
|
24
24
|
|
|
25
|
+
Quand l'appelant fournit des equipes (`teams`), « des personnes choisies »
|
|
26
|
+
propose aussi des equipes de l'espace. Partager a une equipe n'est pas
|
|
27
|
+
cocher ses membres : c'est la regle de « tout l'espace » a plus petite
|
|
28
|
+
echelle, qui vaut pour qui rejoint l'equipe ensuite et cesse pour qui la
|
|
29
|
+
quitte. Sans `teams`, le dialogue est inchange et ne rend pas
|
|
30
|
+
`sharedWithTeams`.
|
|
31
|
+
|
|
25
32
|
Le dialogue ne parle pas a l'API. Il rend une portee et une liste d'ids ;
|
|
26
33
|
l'appelant enregistre. Le package ne sait pas ou vivent les vues.
|
|
27
34
|
-->
|
|
@@ -45,11 +52,19 @@ export interface RmShareWorkspace {
|
|
|
45
52
|
tier?: string
|
|
46
53
|
}
|
|
47
54
|
|
|
55
|
+
/** Une equipe de l'espace, a qui partager d'un coup. */
|
|
56
|
+
export interface RmShareTeam {
|
|
57
|
+
teamId: string
|
|
58
|
+
name: string
|
|
59
|
+
/** Nombre de membres, rappele sous le nom. */
|
|
60
|
+
memberCount?: number
|
|
61
|
+
}
|
|
62
|
+
|
|
48
63
|
export type RmShareScope = 'private' | 'people' | 'workspace' | 'template'
|
|
49
64
|
|
|
50
65
|
/** Les libelles qu'un appelant peut redire, dans la langue du dialogue. */
|
|
51
66
|
export type RmShareTexts = Partial<Record<
|
|
52
|
-
'heading' | 'privateHint' | 'peopleHint' | 'workspaceHint' | 'save',
|
|
67
|
+
'heading' | 'privateHint' | 'peopleHint' | 'workspaceHint' | 'teamHint' | 'save',
|
|
53
68
|
string
|
|
54
69
|
>>
|
|
55
70
|
|
|
@@ -64,6 +79,10 @@ const props = withDefaults(
|
|
|
64
79
|
visibility?: 'private' | 'workspace'
|
|
65
80
|
/** Ids deja destinataires. */
|
|
66
81
|
sharedWith?: string[]
|
|
82
|
+
/** Equipes de l'espace proposees. Vide : pas de section equipes. */
|
|
83
|
+
teams?: RmShareTeam[]
|
|
84
|
+
/** Ids des equipes deja destinataires. */
|
|
85
|
+
sharedWithTeams?: string[]
|
|
67
86
|
/** Offrir la vue comme modele est possible. Reserve a l'administration. */
|
|
68
87
|
canTemplate?: boolean
|
|
69
88
|
/** La vue est deja publiee comme modele. */
|
|
@@ -95,6 +114,8 @@ const props = withDefaults(
|
|
|
95
114
|
members: () => [],
|
|
96
115
|
visibility: 'private',
|
|
97
116
|
sharedWith: () => [],
|
|
117
|
+
teams: () => [],
|
|
118
|
+
sharedWithTeams: () => [],
|
|
98
119
|
canTemplate: false,
|
|
99
120
|
isTemplate: false,
|
|
100
121
|
targetWorkspaces: () => [],
|
|
@@ -120,6 +141,8 @@ const emit = defineEmits<{
|
|
|
120
141
|
value: {
|
|
121
142
|
visibility: 'private' | 'workspace'
|
|
122
143
|
sharedWith: string[]
|
|
144
|
+
/** Absent quand l'appelant ne propose pas d'equipes. */
|
|
145
|
+
sharedWithTeams?: string[]
|
|
123
146
|
/** Absents quand l'appelant n'a pas le droit de publier. */
|
|
124
147
|
isTemplate?: boolean
|
|
125
148
|
targetWorkspaces?: string[]
|
|
@@ -136,7 +159,22 @@ const T = computed(() => ({
|
|
|
136
159
|
privateHint: en.value
|
|
137
160
|
? 'Nobody else sees this view.'
|
|
138
161
|
: 'Personne d\'autre ne voit cette vue.',
|
|
139
|
-
people:
|
|
162
|
+
people: props.teams.length
|
|
163
|
+
? en.value ? 'Chosen people or teams' : 'Des personnes ou équipes choisies'
|
|
164
|
+
: en.value ? 'Chosen people' : 'Des personnes choisies',
|
|
165
|
+
teamsHeading: en.value ? 'Teams' : 'Équipes',
|
|
166
|
+
peopleHeading: en.value ? 'People' : 'Personnes',
|
|
167
|
+
teamHint: en.value
|
|
168
|
+
? 'Whoever joins the team later sees it too.'
|
|
169
|
+
: 'Qui rejoint l\'équipe ensuite la voit aussi.',
|
|
170
|
+
memberCount: (n: number) =>
|
|
171
|
+
en.value
|
|
172
|
+
? `${n} ${n > 1 ? 'members' : 'member'}`
|
|
173
|
+
: `${n} membre${n > 1 ? 's' : ''}`,
|
|
174
|
+
teamCount: (n: number) =>
|
|
175
|
+
en.value
|
|
176
|
+
? `${n} ${n > 1 ? 'teams' : 'team'} selected`
|
|
177
|
+
: `${n} équipe${n > 1 ? 's' : ''} sélectionnée${n > 1 ? 's' : ''}`,
|
|
140
178
|
peopleHint: en.value
|
|
141
179
|
? 'They can apply the view and mark it, not change it.'
|
|
142
180
|
: 'Elles peuvent activer la vue et la marquer, pas la modifier.',
|
|
@@ -144,7 +182,9 @@ const T = computed(() => ({
|
|
|
144
182
|
workspaceHint: en.value
|
|
145
183
|
? 'Members who join later see it too.'
|
|
146
184
|
: 'Les membres qui arrivent ensuite la voient aussi.',
|
|
147
|
-
search:
|
|
185
|
+
search: props.teams.length
|
|
186
|
+
? en.value ? 'Search for a person or a team' : 'Chercher une personne ou une équipe'
|
|
187
|
+
: en.value ? 'Search for a person' : 'Chercher une personne',
|
|
148
188
|
empty: en.value ? 'No member to share with.' : 'Aucun membre a qui partager.',
|
|
149
189
|
noMatch: en.value ? 'No match.' : 'Aucun resultat.',
|
|
150
190
|
count: (n: number) =>
|
|
@@ -192,6 +232,7 @@ const T = computed(() => ({
|
|
|
192
232
|
|
|
193
233
|
const scope = ref<RmShareScope>('private')
|
|
194
234
|
const picked = ref<string[]>([])
|
|
235
|
+
const pickedTeams = ref<string[]>([])
|
|
195
236
|
const search = ref('')
|
|
196
237
|
const pickedWorkspaces = ref<string[]>([])
|
|
197
238
|
/** Personnes visees par le modele, gardees avec leur nom pour les etiquettes. */
|
|
@@ -208,13 +249,14 @@ watch(
|
|
|
208
249
|
(open) => {
|
|
209
250
|
if (!open) return
|
|
210
251
|
picked.value = [...props.sharedWith]
|
|
252
|
+
pickedTeams.value = [...props.sharedWithTeams]
|
|
211
253
|
pickedWorkspaces.value = [...props.targetWorkspaces]
|
|
212
254
|
pickedPeople.value = [...props.targetUsers]
|
|
213
255
|
scope.value = props.isTemplate
|
|
214
256
|
? 'template'
|
|
215
257
|
: props.visibility === 'workspace'
|
|
216
258
|
? 'workspace'
|
|
217
|
-
: props.sharedWith.length
|
|
259
|
+
: props.sharedWith.length || props.sharedWithTeams.length
|
|
218
260
|
? 'people'
|
|
219
261
|
: 'private'
|
|
220
262
|
search.value = ''
|
|
@@ -237,6 +279,19 @@ const matches = computed(() => {
|
|
|
237
279
|
)
|
|
238
280
|
})
|
|
239
281
|
|
|
282
|
+
const teamMatches = computed(() => {
|
|
283
|
+
const q = search.value.trim().toLowerCase()
|
|
284
|
+
if (!q) return props.teams
|
|
285
|
+
return props.teams.filter(team => team.name.toLowerCase().includes(q))
|
|
286
|
+
})
|
|
287
|
+
|
|
288
|
+
function toggleTeam(teamId: string) {
|
|
289
|
+
const next = new Set(pickedTeams.value)
|
|
290
|
+
if (next.has(teamId)) next.delete(teamId)
|
|
291
|
+
else next.add(teamId)
|
|
292
|
+
pickedTeams.value = [...next]
|
|
293
|
+
}
|
|
294
|
+
|
|
240
295
|
function toggle(userId: string) {
|
|
241
296
|
const next = new Set(picked.value)
|
|
242
297
|
if (next.has(userId)) next.delete(userId)
|
|
@@ -331,6 +386,11 @@ function save() {
|
|
|
331
386
|
emit('save', {
|
|
332
387
|
visibility: scope.value === 'workspace' ? 'workspace' : 'private',
|
|
333
388
|
sharedWith: scope.value === 'people' ? picked.value : [],
|
|
389
|
+
// Seulement si l'appelant propose des equipes : sinon le champ partirait
|
|
390
|
+
// vers une API qui ne le connait peut-etre pas.
|
|
391
|
+
...((props.teams.length || props.sharedWithTeams.length) && {
|
|
392
|
+
sharedWithTeams: scope.value === 'people' ? pickedTeams.value : [],
|
|
393
|
+
}),
|
|
334
394
|
// Rien sur le modele quand l'appelant n'a pas le droit d'en publier : la
|
|
335
395
|
// simple presence des champs serait refusee par l'API.
|
|
336
396
|
...(props.canTemplate && {
|
|
@@ -431,6 +491,23 @@ const scopes = computed<Array<{ key: RmShareScope; icon: string; label: string;
|
|
|
431
491
|
<input v-model="search" type="search" :placeholder="T.search" :aria-label="T.search">
|
|
432
492
|
</label>
|
|
433
493
|
|
|
494
|
+
<template v-if="teams.length">
|
|
495
|
+
<p class="rm-share__section">{{ T.teamsHeading }}</p>
|
|
496
|
+
<p v-if="!teamMatches.length" class="rm-share__empty">{{ T.noMatch }}</p>
|
|
497
|
+
<ul v-else class="rm-share__list">
|
|
498
|
+
<li v-for="team in teamMatches" :key="team.teamId">
|
|
499
|
+
<RmCheckbox
|
|
500
|
+
:model-value="pickedTeams.includes(team.teamId)"
|
|
501
|
+
:label="team.name"
|
|
502
|
+
:description="[team.memberCount !== undefined ? T.memberCount(team.memberCount) : '', T.teamHint].filter(Boolean).join(' · ')"
|
|
503
|
+
@update:model-value="toggleTeam(team.teamId)"
|
|
504
|
+
/>
|
|
505
|
+
</li>
|
|
506
|
+
</ul>
|
|
507
|
+
<p v-if="pickedTeams.length" class="rm-share__count">{{ T.teamCount(pickedTeams.length) }}</p>
|
|
508
|
+
<p class="rm-share__section">{{ T.peopleHeading }}</p>
|
|
509
|
+
</template>
|
|
510
|
+
|
|
434
511
|
<p v-if="!members.length" class="rm-share__empty">{{ T.empty }}</p>
|
|
435
512
|
<p v-else-if="!matches.length" class="rm-share__empty">{{ T.noMatch }}</p>
|
|
436
513
|
|
|
@@ -517,5 +594,5 @@ const scopes = computed<Array<{ key: RmShareScope; icon: string; label: string;
|
|
|
517
594
|
</template>
|
|
518
595
|
|
|
519
596
|
<style scoped>
|
|
520
|
-
.rm-share,.rm-share :where(*){box-sizing:border-box}.rm-share{display:flex;flex-direction:column;gap:var(--space-16)}.rm-share__note{background:var(--bg-surface-2);border:1px solid var(--border-soft);border-radius:var(--radius-md);color:var(--text-secondary);font-size:var(--font-12);padding:var(--space-8) var(--space-10)}.rm-share__head{display:flex;flex-direction:column;gap:var(--space-4)}.rm-share__title{color:var(--text-primary);font-size:var(--font-16);font-weight:var(--weight-bold)}.rm-share__subject{color:var(--text-secondary);font-size:var(--font-13)}.rm-share__scopes{display:flex;flex-direction:column;gap:var(--space-8);list-style:none;margin:0;padding:0}.rm-share__scope{align-items:flex-start;background:var(--bg-surface);border:1px solid var(--border-soft);border-radius:var(--radius-lg);color:var(--text-primary);cursor:pointer;display:flex;gap:var(--space-10);padding:var(--space-10) var(--space-12);text-align:left;width:100%}.rm-share__scope:hover{background:var(--bg-hover)}.rm-share__radio{border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);white-space:nowrap}.rm-share__scope:has(.rm-share__radio:focus-visible){outline:2px solid var(--color-secondary);outline-offset:2px}.rm-share__scope.is-on{background:var(--bg-hover);border-color:var(--color-secondary)}.rm-share__scope-text{display:flex;flex:1;flex-direction:column;gap:2px}.rm-share__scope-label{font-size:var(--font-13);font-weight:var(--weight-medium)}.rm-share__scope-hint{color:var(--text-secondary);font-size:var(--font-12)}.rm-share__scope-mark{color:var(--color-secondary)}.rm-share__people{display:flex;flex-direction:column;gap:var(--space-8)}.rm-share__search{align-items:center;background:var(--bg-surface);border:1px solid var(--border-soft);border-radius:var(--radius-pill);color:var(--text-muted);display:flex;gap:var(--space-8);padding:var(--space-6) var(--space-10)}.rm-share__search input{background:none;border:none;color:var(--text-primary);flex:1;font-size:var(--font-13);outline:none}.rm-share__list{flex-direction:column;gap:2px}.rm-share__list,.rm-share__tags{display:flex;list-style:none;margin:0;padding:0}.rm-share__tags{flex-wrap:wrap;gap:var(--space-6)}.rm-share__count,.rm-share__empty{color:var(--text-secondary);font-size:var(--font-12)}.rm-share__foot{display:flex;gap:var(--space-8);justify-content:flex-end}
|
|
597
|
+
.rm-share,.rm-share :where(*){box-sizing:border-box}.rm-share{display:flex;flex-direction:column;gap:var(--space-16)}.rm-share__note{background:var(--bg-surface-2);border:1px solid var(--border-soft);border-radius:var(--radius-md);color:var(--text-secondary);font-size:var(--font-12);padding:var(--space-8) var(--space-10)}.rm-share__head{display:flex;flex-direction:column;gap:var(--space-4)}.rm-share__title{color:var(--text-primary);font-size:var(--font-16);font-weight:var(--weight-bold)}.rm-share__subject{color:var(--text-secondary);font-size:var(--font-13)}.rm-share__scopes{display:flex;flex-direction:column;gap:var(--space-8);list-style:none;margin:0;padding:0}.rm-share__scope{align-items:flex-start;background:var(--bg-surface);border:1px solid var(--border-soft);border-radius:var(--radius-lg);color:var(--text-primary);cursor:pointer;display:flex;gap:var(--space-10);padding:var(--space-10) var(--space-12);text-align:left;width:100%}.rm-share__scope:hover{background:var(--bg-hover)}.rm-share__radio{border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);white-space:nowrap}.rm-share__scope:has(.rm-share__radio:focus-visible){outline:2px solid var(--color-secondary);outline-offset:2px}.rm-share__scope.is-on{background:var(--bg-hover);border-color:var(--color-secondary)}.rm-share__scope-text{display:flex;flex:1;flex-direction:column;gap:2px}.rm-share__scope-label{font-size:var(--font-13);font-weight:var(--weight-medium)}.rm-share__scope-hint{color:var(--text-secondary);font-size:var(--font-12)}.rm-share__scope-mark{color:var(--color-secondary)}.rm-share__people{display:flex;flex-direction:column;gap:var(--space-8)}.rm-share__search{align-items:center;background:var(--bg-surface);border:1px solid var(--border-soft);border-radius:var(--radius-pill);color:var(--text-muted);display:flex;gap:var(--space-8);padding:var(--space-6) var(--space-10)}.rm-share__search input{background:none;border:none;color:var(--text-primary);flex:1;font-size:var(--font-13);outline:none}.rm-share__list{flex-direction:column;gap:2px}.rm-share__list,.rm-share__tags{display:flex;list-style:none;margin:0;padding:0}.rm-share__tags{flex-wrap:wrap;gap:var(--space-6)}.rm-share__section{font-weight:var(--weight-medium);margin-top:var(--space-4)}.rm-share__count,.rm-share__empty,.rm-share__section{color:var(--text-secondary);font-size:var(--font-12)}.rm-share__foot{display:flex;gap:var(--space-8);justify-content:flex-end}
|
|
521
598
|
</style>
|
|
@@ -205,6 +205,7 @@ const {
|
|
|
205
205
|
sharing,
|
|
206
206
|
shareTarget,
|
|
207
207
|
shareMembers,
|
|
208
|
+
shareTeams,
|
|
208
209
|
isSuperAdmin,
|
|
209
210
|
workspaces,
|
|
210
211
|
templateNote,
|
|
@@ -736,6 +737,8 @@ async function confirmEdit() {
|
|
|
736
737
|
:members="shareMembers"
|
|
737
738
|
:visibility="shareTarget?.visibility ?? 'private'"
|
|
738
739
|
:shared-with="shareTarget?.sharedWith ?? []"
|
|
740
|
+
:teams="shareTeams"
|
|
741
|
+
:shared-with-teams="shareTarget?.sharedWithTeams ?? []"
|
|
739
742
|
:can-template="isSuperAdmin"
|
|
740
743
|
:is-template="shareTarget?.isTemplate ?? false"
|
|
741
744
|
:target-workspaces="shareTarget?.targetWorkspaces ?? []"
|
|
@@ -167,6 +167,7 @@
|
|
|
167
167
|
:is-shared="!!project.isShared"
|
|
168
168
|
:owner-id="project.owner?.userId ?? ''"
|
|
169
169
|
:users="projectUsers"
|
|
170
|
+
:project-teams="projectTeams"
|
|
170
171
|
@saved="onShared"
|
|
171
172
|
/>
|
|
172
173
|
|
|
@@ -215,6 +216,7 @@ import type {
|
|
|
215
216
|
ProjectInboxItem,
|
|
216
217
|
ProjectOwner,
|
|
217
218
|
ProjectSuggestion,
|
|
219
|
+
ProjectTeam,
|
|
218
220
|
ProjectUser,
|
|
219
221
|
} from "../../types/projects";
|
|
220
222
|
|
|
@@ -371,6 +373,7 @@ onMounted(() => {
|
|
|
371
373
|
|
|
372
374
|
const sharing = ref(false);
|
|
373
375
|
const projectUsers = ref<ProjectUser[]>([]);
|
|
376
|
+
const projectTeams = ref<ProjectTeam[]>([]);
|
|
374
377
|
const sharedCount = computed(
|
|
375
378
|
() => projectUsers.value.filter((user) => user.userId && user.userId !== project.value?.owner?.userId).length,
|
|
376
379
|
);
|
|
@@ -387,17 +390,20 @@ const overviewProject = computed(() =>
|
|
|
387
390
|
: null,
|
|
388
391
|
);
|
|
389
392
|
|
|
390
|
-
function onShared(value: { isShared: boolean; users: ProjectUser[] }) {
|
|
393
|
+
function onShared(value: { isShared: boolean; users: ProjectUser[]; teams: ProjectTeam[] }) {
|
|
391
394
|
if (project.value) project.value = { ...project.value, isShared: value.isShared };
|
|
392
395
|
projectUsers.value = value.users;
|
|
396
|
+
projectTeams.value = value.teams;
|
|
393
397
|
}
|
|
394
398
|
|
|
395
399
|
async function loadUsers() {
|
|
396
400
|
try {
|
|
397
401
|
const response = await useOipApi().projects.getUsers(projectId);
|
|
398
402
|
projectUsers.value = response?.users ?? [];
|
|
403
|
+
projectTeams.value = response?.teams ?? [];
|
|
399
404
|
} catch {
|
|
400
405
|
projectUsers.value = [];
|
|
406
|
+
projectTeams.value = [];
|
|
401
407
|
}
|
|
402
408
|
}
|
|
403
409
|
|
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
proprietaire : on repart donc de zero avant d'inscrire la liste choisie.
|
|
9
9
|
Seul le proprietaire peut changer le partage : la page ne montre le bouton
|
|
10
10
|
qu'a lui.
|
|
11
|
+
|
|
12
|
+
Les equipes (quand l'app sait les lister, `profile.getTeams`) se partagent
|
|
13
|
+
par `/projects/:id/teams` : leurs membres ont acces tant qu'ils sont dans
|
|
14
|
+
l'equipe, sans ligne a leur nom. Ils ne sont donc pas des destinataires
|
|
15
|
+
nommes, et le dialogue le dit (« via Oncologie »). Repasser en prive ne
|
|
16
|
+
retire pas les equipes cote API : on les retire une a une.
|
|
11
17
|
-->
|
|
12
18
|
<template>
|
|
13
19
|
<RmShareDialog
|
|
@@ -16,6 +22,8 @@
|
|
|
16
22
|
:members="members"
|
|
17
23
|
:visibility="isShared ? 'workspace' : 'private'"
|
|
18
24
|
:shared-with="isShared ? [] : sharedIds"
|
|
25
|
+
:teams="teams"
|
|
26
|
+
:shared-with-teams="isShared ? [] : sharedTeamIds"
|
|
19
27
|
:texts="texts"
|
|
20
28
|
:loading="busy"
|
|
21
29
|
:lang="en ? 'en' : 'fr'"
|
|
@@ -27,7 +35,7 @@
|
|
|
27
35
|
<script setup lang="ts">
|
|
28
36
|
import { useOipApi } from "#oip-app/api";
|
|
29
37
|
import { oipSnackbar } from "#oip-app/ui";
|
|
30
|
-
import type { ProjectUser } from "../../types/projects";
|
|
38
|
+
import type { ProjectTeam, ProjectUser } from "../../types/projects";
|
|
31
39
|
|
|
32
40
|
const props = defineProps<{
|
|
33
41
|
modelValue: boolean;
|
|
@@ -37,11 +45,13 @@ const props = defineProps<{
|
|
|
37
45
|
ownerId: string;
|
|
38
46
|
/** Qui a acces au projet aujourd'hui, proprietaire compris. */
|
|
39
47
|
users: ProjectUser[];
|
|
48
|
+
/** Equipes a qui le projet est partage. */
|
|
49
|
+
projectTeams?: ProjectTeam[];
|
|
40
50
|
}>();
|
|
41
51
|
|
|
42
52
|
const emit = defineEmits<{
|
|
43
53
|
"update:modelValue": [value: boolean];
|
|
44
|
-
saved: [value: { isShared: boolean; users: ProjectUser[] }];
|
|
54
|
+
saved: [value: { isShared: boolean; users: ProjectUser[]; teams: ProjectTeam[] }];
|
|
45
55
|
}>();
|
|
46
56
|
|
|
47
57
|
const { locale } = useI18n();
|
|
@@ -49,7 +59,8 @@ const en = computed(() => locale.value === "en");
|
|
|
49
59
|
const api = useOipApi();
|
|
50
60
|
const projects = useProjects();
|
|
51
61
|
|
|
52
|
-
const members = ref<{ userId: string; name: string; email?: string }[]>([]);
|
|
62
|
+
const members = ref<{ userId: string; name: string; email?: string; hint?: string }[]>([]);
|
|
63
|
+
const teams = ref<{ teamId: string; name: string; memberCount?: number }[]>([]);
|
|
53
64
|
const busy = ref(false);
|
|
54
65
|
|
|
55
66
|
const texts = computed(() =>
|
|
@@ -59,34 +70,62 @@ const texts = computed(() =>
|
|
|
59
70
|
privateHint: "Nobody else sees this project.",
|
|
60
71
|
peopleHint: "They can read, file and comment in the project.",
|
|
61
72
|
workspaceHint: "Every member of the workspace can open it.",
|
|
73
|
+
teamHint: "Whoever joins the team later can open it too.",
|
|
62
74
|
}
|
|
63
75
|
: {
|
|
64
76
|
heading: "Partager le projet",
|
|
65
77
|
privateHint: "Personne d'autre ne voit ce projet.",
|
|
66
78
|
peopleHint: "Elles peuvent le lire, y ranger des fiches et commenter.",
|
|
67
79
|
workspaceHint: "Chaque membre de l'espace de travail peut l'ouvrir.",
|
|
80
|
+
teamHint: "Qui rejoint l'équipe ensuite y a accès aussi.",
|
|
68
81
|
},
|
|
69
82
|
);
|
|
70
83
|
|
|
71
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Les destinataires nommes : le proprietaire n'en est pas un, ni qui n'a
|
|
86
|
+
* acces que par une equipe. Cocher ce dernier l'ajouterait en son nom.
|
|
87
|
+
*/
|
|
72
88
|
const sharedIds = computed(() =>
|
|
73
|
-
props.users
|
|
89
|
+
props.users
|
|
90
|
+
.filter((user) => user.direct !== false)
|
|
91
|
+
.map((user) => user.userId)
|
|
92
|
+
.filter((id): id is string => !!id && id !== props.ownerId),
|
|
74
93
|
);
|
|
94
|
+
const sharedTeamIds = computed(() => (props.projectTeams ?? []).map((team) => team.teamId));
|
|
95
|
+
|
|
96
|
+
/** « via Oncologie, MA » : par ou une personne a deja acces. */
|
|
97
|
+
function viaTeams(userId: string) {
|
|
98
|
+
const names = props.users.find((user) => user.userId === userId)?.teams?.map((team) => team.name) ?? [];
|
|
99
|
+
if (!names.length) return undefined;
|
|
100
|
+
return `via ${names.join(", ")}`;
|
|
101
|
+
}
|
|
75
102
|
|
|
76
|
-
// Les membres de l'espace ne se chargent qu'a l'ouverture du
|
|
103
|
+
// Les membres et les equipes de l'espace ne se chargent qu'a l'ouverture du
|
|
104
|
+
// dialogue. La mention « via » se recalcule a chaque ouverture : les equipes
|
|
105
|
+
// du projet ont pu changer depuis.
|
|
77
106
|
watch(
|
|
78
107
|
() => props.modelValue,
|
|
79
108
|
async (open) => {
|
|
80
|
-
if (!open
|
|
109
|
+
if (!open) return;
|
|
81
110
|
try {
|
|
82
|
-
const response = await
|
|
111
|
+
const [response, teamResponse] = await Promise.all([
|
|
112
|
+
api.profile.getWorkspaceMembers(),
|
|
113
|
+
// Une app dont le client ne connait pas les equipes garde le dialogue d'avant.
|
|
114
|
+
api.profile.getTeams?.().catch(() => null) ?? null,
|
|
115
|
+
]);
|
|
83
116
|
members.value = (response?.members ?? [])
|
|
84
|
-
.filter((member) => member.userId !== props.ownerId)
|
|
85
|
-
.map((member) => ({
|
|
117
|
+
.filter((member: any) => member.userId !== props.ownerId)
|
|
118
|
+
.map((member: any) => ({
|
|
86
119
|
userId: member.userId,
|
|
87
120
|
name: member.displayName || [member.firstName, member.lastName].filter(Boolean).join(" ") || member.email,
|
|
88
121
|
email: member.email,
|
|
122
|
+
hint: viaTeams(member.userId),
|
|
89
123
|
}));
|
|
124
|
+
teams.value = (teamResponse?.teams ?? []).map((team: any) => ({
|
|
125
|
+
teamId: team.teamId,
|
|
126
|
+
name: team.name,
|
|
127
|
+
memberCount: team.members?.length,
|
|
128
|
+
}));
|
|
90
129
|
} catch (error) {
|
|
91
130
|
console.error("[projects] Error loading workspace members:", error);
|
|
92
131
|
}
|
|
@@ -102,9 +141,23 @@ function notify(text: string) {
|
|
|
102
141
|
]);
|
|
103
142
|
}
|
|
104
143
|
|
|
105
|
-
async function save(share: { visibility: "private" | "workspace"; sharedWith: string[] }) {
|
|
144
|
+
async function save(share: { visibility: "private" | "workspace"; sharedWith: string[]; sharedWithTeams?: string[] }) {
|
|
106
145
|
busy.value = true;
|
|
107
146
|
try {
|
|
147
|
+
// Les equipes d'abord : « tout l'espace » et « moi seul » les retirent,
|
|
148
|
+
// « des personnes ou equipes » pose la liste choisie.
|
|
149
|
+
if (share.sharedWithTeams) {
|
|
150
|
+
const currentTeams = sharedTeamIds.value;
|
|
151
|
+
const wantedTeams = share.sharedWithTeams;
|
|
152
|
+
await Promise.all([
|
|
153
|
+
...wantedTeams
|
|
154
|
+
.filter((id) => !currentTeams.includes(id))
|
|
155
|
+
.map((id) => api.projects.addTeam(props.projectId, id)),
|
|
156
|
+
...currentTeams
|
|
157
|
+
.filter((id) => !wantedTeams.includes(id))
|
|
158
|
+
.map((id) => api.projects.removeTeam(props.projectId, id)),
|
|
159
|
+
]);
|
|
160
|
+
}
|
|
108
161
|
if (share.visibility === "workspace") {
|
|
109
162
|
if (!props.isShared) await projects.update(props.projectId, { isShared: true });
|
|
110
163
|
} else {
|
|
@@ -119,7 +172,11 @@ async function save(share: { visibility: "private" | "workspace"; sharedWith: st
|
|
|
119
172
|
]);
|
|
120
173
|
}
|
|
121
174
|
const response = await api.projects.getUsers(props.projectId);
|
|
122
|
-
emit("saved", {
|
|
175
|
+
emit("saved", {
|
|
176
|
+
isShared: share.visibility === "workspace",
|
|
177
|
+
users: response?.users ?? [],
|
|
178
|
+
teams: response?.teams ?? [],
|
|
179
|
+
});
|
|
123
180
|
emit("update:modelValue", false);
|
|
124
181
|
notify(en.value ? "Sharing updated" : "Partage mis à jour");
|
|
125
182
|
} catch (error: any) {
|
|
@@ -128,15 +128,12 @@ function deleteQuestion(scope: any): string | undefined {
|
|
|
128
128
|
: `${title} est un template Tekkare offert à des espaces clients. La supprimer le retire chez tous. Supprimer quand même ?`;
|
|
129
129
|
}
|
|
130
130
|
if (isShared(scope)) {
|
|
131
|
-
const n = scope.sharedWith?.length ?? 0;
|
|
132
131
|
const who =
|
|
133
132
|
scope.visibility === "workspace"
|
|
134
133
|
? en
|
|
135
134
|
? "the whole workspace"
|
|
136
135
|
: "tout l'espace"
|
|
137
|
-
:
|
|
138
|
-
? `${n} ${n > 1 ? "people" : "person"}`
|
|
139
|
-
: `${n} personne${n > 1 ? "s" : ""}`;
|
|
136
|
+
: audience(scope.sharedWith?.length ?? 0, scope.sharedWithTeams?.length ?? 0);
|
|
140
137
|
return en
|
|
141
138
|
? `${title} is shared with ${who}. Deleting it removes it for them too. Delete anyway?`
|
|
142
139
|
: `${title} est partagée avec ${who}. La supprimer la retire aussi chez eux. Supprimer quand même ?`;
|
|
@@ -156,9 +153,32 @@ function readerMenu(isDefault: boolean) {
|
|
|
156
153
|
return [alertEntry.value, ...exportEntry.value, defaultEntry(isDefault), duplicateEntry.value];
|
|
157
154
|
}
|
|
158
155
|
|
|
159
|
-
/** La vue est ouverte a d'autres : a tout l'espace,
|
|
156
|
+
/** La vue est ouverte a d'autres : a tout l'espace, a des gens nommes, ou a des equipes. */
|
|
160
157
|
function isShared(scope: any): boolean {
|
|
161
|
-
return
|
|
158
|
+
return (
|
|
159
|
+
scope.visibility === "workspace" ||
|
|
160
|
+
(scope.sharedWith?.length ?? 0) > 0 ||
|
|
161
|
+
(scope.sharedWithTeams?.length ?? 0) > 0
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** « 2 personnes et 1 équipe » : a qui une vue est partagee, nommement. */
|
|
166
|
+
function audience(people: number, teams: number): string {
|
|
167
|
+
const en = locale.value === "en";
|
|
168
|
+
return [
|
|
169
|
+
people
|
|
170
|
+
? en
|
|
171
|
+
? `${people} ${people > 1 ? "people" : "person"}`
|
|
172
|
+
: `${people} personne${people > 1 ? "s" : ""}`
|
|
173
|
+
: "",
|
|
174
|
+
teams
|
|
175
|
+
? en
|
|
176
|
+
? `${teams} ${teams > 1 ? "teams" : "team"}`
|
|
177
|
+
: `${teams} équipe${teams > 1 ? "s" : ""}`
|
|
178
|
+
: "",
|
|
179
|
+
]
|
|
180
|
+
.filter(Boolean)
|
|
181
|
+
.join(en ? " and " : " et ");
|
|
162
182
|
}
|
|
163
183
|
|
|
164
184
|
/**
|
|
@@ -196,6 +216,9 @@ const shareTarget = computed(() => (sharingId.value ? scopeOf(sharingId.value) :
|
|
|
196
216
|
|
|
197
217
|
const members = ref<{ userId: string; name: string; email?: string }[]>([]);
|
|
198
218
|
const membersLoaded = ref(false);
|
|
219
|
+
/** Equipes de l'espace. Vide quand le client de l'app ne sait pas les lister. */
|
|
220
|
+
const shareTeams = ref<{ teamId: string; name: string; memberCount?: number }[]>([]);
|
|
221
|
+
const teamsLoaded = ref(false);
|
|
199
222
|
|
|
200
223
|
/**
|
|
201
224
|
* Publication en template : reservee a qui administre la plateforme.
|
|
@@ -267,11 +290,30 @@ async function loadMembers() {
|
|
|
267
290
|
}
|
|
268
291
|
}
|
|
269
292
|
|
|
293
|
+
/** Equipes de l'espace, chargees comme les membres, a la premiere ouverture. */
|
|
294
|
+
async function loadTeams() {
|
|
295
|
+
if (teamsLoaded.value || !elysia.profile.getTeams) return;
|
|
296
|
+
teamsLoaded.value = true;
|
|
297
|
+
try {
|
|
298
|
+
const response = await elysia.profile.getTeams();
|
|
299
|
+
shareTeams.value = (response?.teams ?? []).map((team: any) => ({
|
|
300
|
+
teamId: team.teamId,
|
|
301
|
+
name: team.name,
|
|
302
|
+
memberCount: team.members?.length,
|
|
303
|
+
}));
|
|
304
|
+
} catch (error) {
|
|
305
|
+
// Pas d'equipes : le dialogue garde personnes et espace.
|
|
306
|
+
teamsLoaded.value = false;
|
|
307
|
+
console.error("[views] Error loading workspace teams:", error);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
270
311
|
async function openShare(id: string) {
|
|
271
312
|
sharingId.value = id;
|
|
272
313
|
outsiders.value = [];
|
|
273
314
|
await Promise.all([
|
|
274
315
|
loadMembers(),
|
|
316
|
+
loadTeams(),
|
|
275
317
|
ensureLoaded().then((admin) => (admin ? ensureWorkspaces() : [])),
|
|
276
318
|
]);
|
|
277
319
|
}
|
|
@@ -338,7 +380,7 @@ function notify(text: string) {
|
|
|
338
380
|
* c'est-a-dire comme si rien ne s'etait passe.
|
|
339
381
|
*/
|
|
340
382
|
function shareOutcome(
|
|
341
|
-
share: { visibility: string; sharedWith: string[]; isTemplate?: boolean },
|
|
383
|
+
share: { visibility: string; sharedWith: string[]; sharedWithTeams?: string[]; isTemplate?: boolean },
|
|
342
384
|
targets: number,
|
|
343
385
|
people = 0,
|
|
344
386
|
): string {
|
|
@@ -370,11 +412,9 @@ function shareOutcome(
|
|
|
370
412
|
if (share.visibility === "workspace") {
|
|
371
413
|
return en ? "View shared with the whole workspace." : "Vue partagée à tout l'espace.";
|
|
372
414
|
}
|
|
373
|
-
if (share.sharedWith.length) {
|
|
374
|
-
const
|
|
375
|
-
return en
|
|
376
|
-
? `View shared with ${n} ${n > 1 ? "people" : "person"}.`
|
|
377
|
-
: `Vue partagée à ${n} personne${n > 1 ? "s" : ""}.`;
|
|
415
|
+
if (share.sharedWith.length || share.sharedWithTeams?.length) {
|
|
416
|
+
const who = audience(share.sharedWith.length, share.sharedWithTeams?.length ?? 0);
|
|
417
|
+
return en ? `View shared with ${who}.` : `Vue partagée à ${who}.`;
|
|
378
418
|
}
|
|
379
419
|
return en ? "View is private again." : "Vue redevenue privée.";
|
|
380
420
|
}
|
|
@@ -382,6 +422,7 @@ function shareOutcome(
|
|
|
382
422
|
async function confirmShare(share: {
|
|
383
423
|
visibility: "private" | "workspace";
|
|
384
424
|
sharedWith: string[];
|
|
425
|
+
sharedWithTeams?: string[];
|
|
385
426
|
isTemplate?: boolean;
|
|
386
427
|
targetWorkspaces?: string[];
|
|
387
428
|
targetUsers?: string[];
|
|
@@ -528,6 +569,7 @@ return {
|
|
|
528
569
|
sharing,
|
|
529
570
|
shareTarget,
|
|
530
571
|
shareMembers,
|
|
572
|
+
shareTeams,
|
|
531
573
|
isSuperAdmin,
|
|
532
574
|
workspaces,
|
|
533
575
|
templateNote,
|
|
@@ -11,8 +11,18 @@ export type ProjectUser = {
|
|
|
11
11
|
displayName: string | null;
|
|
12
12
|
firstName: string | null;
|
|
13
13
|
lastName: string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Partage nomme (ou proprietaire). Faux pour qui n'a acces que par une
|
|
16
|
+
* equipe. Absent d'une API sans equipes : tout le monde est alors direct.
|
|
17
|
+
*/
|
|
18
|
+
direct?: boolean;
|
|
19
|
+
/** Equipes par lesquelles la personne a acces. */
|
|
20
|
+
teams?: { teamId: string; name: string }[];
|
|
14
21
|
};
|
|
15
22
|
|
|
23
|
+
/** Une equipe a qui le projet est partage. */
|
|
24
|
+
export type ProjectTeam = { teamId: string; name: string; sharedAt?: string };
|
|
25
|
+
|
|
16
26
|
// Projets Virtual Lab : proprietaire et commentaires d'une fiche rangee.
|
|
17
27
|
export interface ProjectOwner {
|
|
18
28
|
userId: string;
|
|
@@ -61,6 +61,9 @@ export function createOipScopes(scopeStore: ReturnType<typeof defineOipScopeStor
|
|
|
61
61
|
isOwner: pulse.isOwner ?? true,
|
|
62
62
|
ownerName: pulse.ownerName ?? null,
|
|
63
63
|
sharedWith: pulse.sharedWith ?? [],
|
|
64
|
+
// Equipes a qui la vue est partagee (owner seulement), en ids pour
|
|
65
|
+
// le dialogue : l'API les rend avec leur nom.
|
|
66
|
+
sharedWithTeams: (pulse.sharedWithTeams ?? []).map((team: any) => team.teamId),
|
|
64
67
|
// Publication en template Tekkare : le dialogue de partage en a
|
|
65
68
|
// besoin pour rouvrir sur ce qui est deja pose.
|
|
66
69
|
isTemplate: pulse.isTemplate ?? false,
|
|
@@ -273,6 +276,8 @@ export function createOipScopes(scopeStore: ReturnType<typeof defineOipScopeStor
|
|
|
273
276
|
share: {
|
|
274
277
|
visibility: "private" | "workspace";
|
|
275
278
|
sharedWith: string[];
|
|
279
|
+
/** Equipes destinataires, quand le dialogue les propose. */
|
|
280
|
+
sharedWithTeams?: string[];
|
|
276
281
|
/**
|
|
277
282
|
* Publication en template Tekkare, quand le dialogue la propose
|
|
278
283
|
* (superadmin seul). Absents sinon : l'API refuse les champs a qui n'a
|