@tekkare/romulus 0.1.261 → 0.1.262
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/layer/app/components/panels/OipPanelProjects.vue +70 -21
- package/layer/app/components/project/AddButton.vue +127 -0
- package/layer/app/components/project/Banner.vue +68 -0
- package/layer/app/components/project/Dashboard.vue +85 -0
- package/layer/app/components/project/DiscardConfirm.vue +74 -0
- package/layer/app/components/project/Documents.vue +611 -0
- package/layer/app/components/project/Export.vue +205 -0
- package/layer/app/components/project/Inbox.vue +1241 -0
- package/layer/app/components/project/ListPage.vue +102 -0
- package/layer/app/components/project/NewButton.vue +147 -0
- package/layer/app/components/project/Notes.vue +1158 -0
- package/layer/app/components/project/Page.vue +820 -0
- package/layer/app/components/project/Share.vue +135 -0
- package/layer/app/components/project/Watch.vue +273 -0
- package/layer/app/composables/useOipProjectKinds.ts +71 -0
- package/layer/app/composables/useOipResourceHooks.ts +8 -3
- package/layer/app/composables/useProjectDashboard.ts +22 -0
- package/layer/app/composables/useProjects.ts +646 -0
- package/layer/app/oip-defaults/projects.ts +175 -0
- package/layer/app/pages/projects/[id].vue +8 -0
- package/layer/app/pages/projects/index.vue +8 -0
- package/layer/app/types/projects.ts +168 -0
- package/layer/app/utils/projectNoteWelcome.ts +137 -0
- package/layer/nuxt.config.ts +16 -0
- package/layer/server/api/oip/sharing/artifacts.get.ts +44 -0
- package/package.json +2 -1
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contrat `#oip-app/projects` : ce que les projets Virtual Lab du layer
|
|
3
|
+
* demandent a l'app. Facultatif : une app sans `app/oip/projects.ts` recoit
|
|
4
|
+
* ces valeurs neutres (cf. l'alias `#oip-projects` du nuxt.config du layer),
|
|
5
|
+
* et ses projets marchent tels quels : liste, page, bandeau, bouton Projet,
|
|
6
|
+
* documents, notes, Inbox, partage, export, tableau de bord du contenu.
|
|
7
|
+
*
|
|
8
|
+
* Une app n'exporte que ce qu'elle change ; le reste se reprend d'ici :
|
|
9
|
+
*
|
|
10
|
+
* export * from "@tekkare/romulus/layer-defaults/projects";
|
|
11
|
+
* export const PROJECTS_STORAGE_KEY = "ocaProject";
|
|
12
|
+
*
|
|
13
|
+
* Les familles de ressources ne s'y declarent pas : elles viennent toutes de
|
|
14
|
+
* OIP_RESOURCE_SPECS (regle Romulus, une seule liste pour le portail).
|
|
15
|
+
*/
|
|
16
|
+
import { computed, ref, type Component, type ComputedRef, type Ref } from "vue";
|
|
17
|
+
import type { RmProjectKind, RmProjectResource, RmProjectScopeRow } from "@tekkare/romulus/utils/projects";
|
|
18
|
+
import type { RmExportSheet } from "@tekkare/romulus/utils/export";
|
|
19
|
+
import type { RmDashboardModel, RmWidgetContext, RmWidgetKind } from "@tekkare/romulus/utils/dashboard";
|
|
20
|
+
import { rmNewWidgetId } from "@tekkare/romulus/utils/dashboard";
|
|
21
|
+
import type { ProjectSuggestion } from "../types/projects";
|
|
22
|
+
|
|
23
|
+
type Lang = "fr" | "en";
|
|
24
|
+
type Text = { fr: string; en: string };
|
|
25
|
+
|
|
26
|
+
/** La page « Mes projets », sans prefixe de langue ; celle d'un projet est `${PROJECTS_PATH}/<id>`. */
|
|
27
|
+
export const PROJECTS_PATH = "/projects";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Prefixe des cles du navigateur : `${cle}Id` (projet actif), `${cle}Pins`
|
|
31
|
+
* (epingles). Une app qui avait les siennes les garde, sinon ses
|
|
32
|
+
* utilisateurs perdent leur projet actif a la mise a jour.
|
|
33
|
+
*/
|
|
34
|
+
export const PROJECTS_STORAGE_KEY = "oipProject";
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Familles de OIP_RESOURCE_SPECS relues avec d'autres champs que ceux du
|
|
38
|
+
* layer (ceux qu'attendent l'export, le cadrage ou les suggestions de l'app).
|
|
39
|
+
* Meme `type` qu'une spec du layer : elle la remplace pour cette app.
|
|
40
|
+
*/
|
|
41
|
+
export const PROJECT_KINDS: RmProjectKind[] = [];
|
|
42
|
+
|
|
43
|
+
/** Les projets sont-ils ouverts a l'utilisateur (licence...) ? Faux : le panneau `PROJECTS_UPSELL`. */
|
|
44
|
+
export function useProjectsAccess(): Ref<boolean> | ComputedRef<boolean> {
|
|
45
|
+
return computed(() => true);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Ce qui remplace les projets sans acces, avec la prop `feature` ({ fr, en }). */
|
|
49
|
+
export const PROJECTS_UPSELL: Component | null = null;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* La creation assistee (v-model d'ouverture), proposee a cote de la
|
|
53
|
+
* creation libre. Absente : « Nouveau projet » ouvre directement le
|
|
54
|
+
* formulaire du nom.
|
|
55
|
+
*/
|
|
56
|
+
export const PROJECT_ASSISTANT: Component | null = null;
|
|
57
|
+
|
|
58
|
+
/** Les mots de l'app pour ce qu'un projet range. */
|
|
59
|
+
export const PROJECT_WORDING: {
|
|
60
|
+
/** Liste vide de « Mes projets ». */
|
|
61
|
+
empty: Text;
|
|
62
|
+
/** Etape « Consulter les ressources » de la vue d'ensemble. */
|
|
63
|
+
resources: Text;
|
|
64
|
+
/** Etape « Deposer des documents ». */
|
|
65
|
+
documents: Text;
|
|
66
|
+
/** Invite du tableau de bord vide. */
|
|
67
|
+
dashboard: Text;
|
|
68
|
+
/** Ce que suit l'alerte d'un projet (« un statut, une phase... »). */
|
|
69
|
+
watch: Text;
|
|
70
|
+
} = {
|
|
71
|
+
empty: {
|
|
72
|
+
fr: "Un projet rassemble ce que vous mettez de côté au fil des pages.",
|
|
73
|
+
en: "A project gathers what you set aside across the pages.",
|
|
74
|
+
},
|
|
75
|
+
resources: {
|
|
76
|
+
fr: "Les fiches rangées depuis les listes et les pages.",
|
|
77
|
+
en: "The records filed from the lists and pages.",
|
|
78
|
+
},
|
|
79
|
+
documents: {
|
|
80
|
+
fr: "Vos propres fichiers, rangés avec les fiches du projet.",
|
|
81
|
+
en: "Your own files, kept alongside the project records.",
|
|
82
|
+
},
|
|
83
|
+
dashboard: {
|
|
84
|
+
fr: "Ajoutez des graphiques sur ce que le projet range.",
|
|
85
|
+
en: "Add charts on what the project holds.",
|
|
86
|
+
},
|
|
87
|
+
watch: {
|
|
88
|
+
fr: "un champ suivi change",
|
|
89
|
+
en: "a watched field changes",
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/** Les rangees du cadrage de la vue d'ensemble. Aucune par defaut. */
|
|
94
|
+
export function useProjectScopeRows(
|
|
95
|
+
_project: Ref<{ scope?: unknown } | null>,
|
|
96
|
+
_rows: Ref<RmProjectResource[]>,
|
|
97
|
+
_lang: Ref<Lang>,
|
|
98
|
+
): ComputedRef<RmProjectScopeRow[]> {
|
|
99
|
+
return computed(() => []);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Les fiches liees que l'app cherche elle-meme pour l'Inbox d'un projet
|
|
104
|
+
* (ids `local:<type>:<_id>`). Aucune par defaut : l'Inbox montre ce que
|
|
105
|
+
* l'API propose.
|
|
106
|
+
*/
|
|
107
|
+
export function useProjectSuggestions(_projectId: string, _rows: Ref<RmProjectResource[]>, _lang: Ref<Lang>) {
|
|
108
|
+
return {
|
|
109
|
+
suggestions: ref<ProjectSuggestion[]>([]),
|
|
110
|
+
loading: ref(false),
|
|
111
|
+
busy: ref(""),
|
|
112
|
+
load: async () => {},
|
|
113
|
+
accept: async (_item: ProjectSuggestion) => false,
|
|
114
|
+
dismiss: (_item: ProjectSuggestion) => {},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Les familles qu'une alerte de projet sait suivre. Aucune : pas de bouton Suivre. */
|
|
119
|
+
export const WATCHABLE_PROJECT_TYPES: string[] = [];
|
|
120
|
+
|
|
121
|
+
/** Ce que l'alerte de projet envoie a l'API : les champs suivis par famille et leurs libelles. */
|
|
122
|
+
export function projectAlertSpecs(_lang: Lang): {
|
|
123
|
+
resourceSpecs: Record<string, { watchedFields: string[]; labelFields: string[] }>;
|
|
124
|
+
fieldLabels: Record<string, string>;
|
|
125
|
+
} {
|
|
126
|
+
return { resourceSpecs: {}, fieldLabels: {} };
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Feuilles du classeur d'un projet en plus de la fiche, des ressources et des commentaires. */
|
|
130
|
+
export function projectExportSheets(_rows: RmProjectResource[], _lang: Lang): RmExportSheet[] {
|
|
131
|
+
return [];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** Ce que le projet donne aux widgets de son tableau de bord. */
|
|
135
|
+
export interface OipProjectWidgetContext extends RmWidgetContext {
|
|
136
|
+
/** Elements du projet par famille. */
|
|
137
|
+
groups: { label: string; count: number }[];
|
|
138
|
+
/** Les documents des elements ranges, deja relus par la page. */
|
|
139
|
+
docs: { type: string; source: Record<string, any> }[];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** Le widget que toute app sait remplir : le contenu du projet, par famille. */
|
|
143
|
+
export const PROJECT_RESOURCES_WIDGET: RmWidgetKind<OipProjectWidgetContext> = {
|
|
144
|
+
kind: "project.resources",
|
|
145
|
+
group: { fr: "Projet", en: "Project" },
|
|
146
|
+
title: { fr: "Contenu du projet", en: "Project content" },
|
|
147
|
+
description: { fr: "Les éléments rangés dans le projet, par famille.", en: "What the project holds, per family." },
|
|
148
|
+
viz: ["donut", "bar", "table", "kpi"],
|
|
149
|
+
sources: [],
|
|
150
|
+
usesBrands: false,
|
|
151
|
+
params: [],
|
|
152
|
+
size: { w: 4, h: 5 },
|
|
153
|
+
async fetch(_params, { groups }) {
|
|
154
|
+
return { type: "parts", parts: groups.filter((g) => g.count > 0).map((g) => ({ name: g.label, value: g.count })) };
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/** Catalogue des widgets du tableau de bord. */
|
|
159
|
+
export const PROJECT_DASHBOARD_WIDGETS: RmWidgetKind<OipProjectWidgetContext>[] = [PROJECT_RESOURCES_WIDGET];
|
|
160
|
+
|
|
161
|
+
/** Le tableau de depart d'un projet qui n'en a pas encore enregistre. */
|
|
162
|
+
export function defaultProjectDashboard(): RmDashboardModel {
|
|
163
|
+
return {
|
|
164
|
+
version: 1,
|
|
165
|
+
widgets: [
|
|
166
|
+
{
|
|
167
|
+
id: rmNewWidgetId(),
|
|
168
|
+
kind: PROJECT_RESOURCES_WIDGET.kind,
|
|
169
|
+
viz: "donut",
|
|
170
|
+
params: {},
|
|
171
|
+
layout: { x: 0, y: 0, ...PROJECT_RESOURCES_WIDGET.size },
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
};
|
|
175
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
La page d'un projet, servie par le layer OIP a toute app qui l'etend (cf.
|
|
3
|
+
ProjectPage). Une app qui range ses projets ailleurs (PROJECTS_PATH) monte
|
|
4
|
+
ProjectPage dans sa propre page.
|
|
5
|
+
-->
|
|
6
|
+
<template>
|
|
7
|
+
<ProjectPage :key="String($route.params.id)" :project-id="String($route.params.id)" />
|
|
8
|
+
</template>
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Les types de la Virtual Lab API que manipulent les projets du layer
|
|
3
|
+
* (repris du client useElysiaApi des apps OIP). Le client lui-meme reste a
|
|
4
|
+
* l'app (`useOipApi`, #oip-app/api).
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** Un utilisateur qui a acces a un projet, proprietaire compris. */
|
|
8
|
+
export type ProjectUser = {
|
|
9
|
+
userId: string | null;
|
|
10
|
+
email: string;
|
|
11
|
+
displayName: string | null;
|
|
12
|
+
firstName: string | null;
|
|
13
|
+
lastName: string | null;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// Projets Virtual Lab : proprietaire et commentaires d'une fiche rangee.
|
|
17
|
+
export interface ProjectOwner {
|
|
18
|
+
userId: string;
|
|
19
|
+
email: string;
|
|
20
|
+
displayName: string | null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type ProjectCommentType = "Discussion" | "ResourceComment";
|
|
24
|
+
|
|
25
|
+
export interface ProjectComment {
|
|
26
|
+
id: string;
|
|
27
|
+
userId: string;
|
|
28
|
+
userEmail: string;
|
|
29
|
+
userFirstName: string;
|
|
30
|
+
userLastName: string;
|
|
31
|
+
text: string;
|
|
32
|
+
citedResourceId: string | null;
|
|
33
|
+
commentedResourceId: string | null;
|
|
34
|
+
commentType: ProjectCommentType;
|
|
35
|
+
projectId: string;
|
|
36
|
+
createdAt: string;
|
|
37
|
+
updatedAt: string;
|
|
38
|
+
deletedAt: string | null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Le tableau de bord d'un projet, commun a ses membres et aux apps (RmDashboard).
|
|
42
|
+
export type { RmDashboardModel as ProjectDashboard } from "@tekkare/romulus/utils/dashboard";
|
|
43
|
+
|
|
44
|
+
/** Un livrable de share-platform, tel que le rend son API d'espace de travail. */
|
|
45
|
+
export interface SharedArtifact {
|
|
46
|
+
id: string;
|
|
47
|
+
filename: string;
|
|
48
|
+
contentType: string;
|
|
49
|
+
size: number;
|
|
50
|
+
createdAt: string;
|
|
51
|
+
title: string | null;
|
|
52
|
+
projectId?: string | null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Un document propose a un projet. `resourceType` vaut `Molecule` pour une
|
|
57
|
+
* carte de rebond des apps du medicament, dont les fiches sont les `children`.
|
|
58
|
+
* Les propositions qu'une app cherche elle-meme s'ecrivent cote client, sous
|
|
59
|
+
* des ids `local:` (cf. useProjectSuggestions de #oip-app/projects).
|
|
60
|
+
*/
|
|
61
|
+
export interface ProjectSuggestion {
|
|
62
|
+
id: string;
|
|
63
|
+
resourceType: string;
|
|
64
|
+
resourceId: string;
|
|
65
|
+
title: string | null;
|
|
66
|
+
subtitle: string | null;
|
|
67
|
+
reason: { kind: string; value: string; label: string } | null;
|
|
68
|
+
metadata: { role?: "trigger" | "linked"; molecule?: { code: string; name: string } } | null;
|
|
69
|
+
createdAt: string;
|
|
70
|
+
/** Dans un message de l'Inbox : ou en est la proposition. */
|
|
71
|
+
status?: "pending" | "added" | "dismissed" | "seen";
|
|
72
|
+
/** Carte de rebond : ses fiches. */
|
|
73
|
+
children?: ProjectSuggestion[];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Un changement releve par l'alerte du projet, copie dans le message. */
|
|
77
|
+
export interface ProjectInboxChange {
|
|
78
|
+
id: string;
|
|
79
|
+
kind: "appeared" | "changed" | "disappeared";
|
|
80
|
+
/** `<index>:<_id>` du document. */
|
|
81
|
+
docId: string;
|
|
82
|
+
title: string;
|
|
83
|
+
subtitle: string | null;
|
|
84
|
+
changes: Array<{ field: string; label?: string; before: string; after: string }> | null;
|
|
85
|
+
detectedAt: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Un message de l'Inbox d'un projet. L'app en ecrit la phrase. */
|
|
89
|
+
export interface ProjectInboxItem {
|
|
90
|
+
id: string;
|
|
91
|
+
kind: "welcome" | "resources" | "documents" | "changes" | "suggestions" | "mention";
|
|
92
|
+
actorName: string | null;
|
|
93
|
+
payload: {
|
|
94
|
+
items?: Array<{ resourceType: string; resourceId: string; addedAt: string; title?: string | null }>;
|
|
95
|
+
events?: ProjectInboxChange[];
|
|
96
|
+
ids?: string[];
|
|
97
|
+
/** Message `mention` : la page ou l'on a ete cite, et son titre a ce moment. */
|
|
98
|
+
noteId?: string;
|
|
99
|
+
title?: string;
|
|
100
|
+
} | null;
|
|
101
|
+
occurredAt: string;
|
|
102
|
+
readAt: string | null;
|
|
103
|
+
pinnedAt: string | null;
|
|
104
|
+
/** Message `suggestions` : les propositions du lot, dans leur etat du moment. */
|
|
105
|
+
suggestions?: ProjectSuggestion[];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Une page des notes d'un projet. `private` : son auteur seul la lit ;
|
|
110
|
+
* `project` : tous les membres la lisent et la modifient, seul l'auteur la
|
|
111
|
+
* supprime ou change sa visibilite.
|
|
112
|
+
*/
|
|
113
|
+
export interface ProjectNoteSummary {
|
|
114
|
+
id: string;
|
|
115
|
+
projectId: string;
|
|
116
|
+
parentId: string | null;
|
|
117
|
+
authorId: string;
|
|
118
|
+
authorName: string | null;
|
|
119
|
+
updatedById: string;
|
|
120
|
+
updatedByName: string | null;
|
|
121
|
+
visibility: "private" | "project";
|
|
122
|
+
title: string;
|
|
123
|
+
icon: string | null;
|
|
124
|
+
tags: string[];
|
|
125
|
+
position: number;
|
|
126
|
+
/** A renvoyer a chaque sauvegarde : une version perimee est refusee (409). */
|
|
127
|
+
version: number;
|
|
128
|
+
createdAt: string;
|
|
129
|
+
updatedAt: string;
|
|
130
|
+
canDelete: boolean;
|
|
131
|
+
canChangeVisibility: boolean;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface ProjectNote extends ProjectNoteSummary {
|
|
135
|
+
/** Le document de l'editeur (JSON Tiptap). */
|
|
136
|
+
content: Record<string, unknown> | null;
|
|
137
|
+
/** Les pages lisibles qui pointent vers celle-ci. */
|
|
138
|
+
backlinks?: Array<{ id: string; title: string; icon: string | null }>;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Une page des notes qui cite une fiche : `excerpts`, les blocs qui la citent. */
|
|
142
|
+
export interface ProjectNoteMention {
|
|
143
|
+
noteId: string;
|
|
144
|
+
title: string;
|
|
145
|
+
icon: string | null;
|
|
146
|
+
visibility: "private" | "project";
|
|
147
|
+
excerpts: string[];
|
|
148
|
+
updatedByName: string | null;
|
|
149
|
+
updatedAt: string;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export type ProjectNoteChange = Partial<
|
|
153
|
+
Pick<ProjectNote, "title" | "icon" | "visibility" | "parentId" | "position" | "content" | "tags">
|
|
154
|
+
>;
|
|
155
|
+
|
|
156
|
+
/** Un fichier depose dans un projet, tel que l'API le rend. */
|
|
157
|
+
export interface UploadedDocument {
|
|
158
|
+
id: string;
|
|
159
|
+
title: string;
|
|
160
|
+
fileName: string;
|
|
161
|
+
mimeType: string;
|
|
162
|
+
sizeBytes: number;
|
|
163
|
+
pageCount: number | null;
|
|
164
|
+
/** « ready » quand le texte a ete extrait, « no_text » pour un scan sans texte. */
|
|
165
|
+
status: "ready" | "no_text";
|
|
166
|
+
sectionCount: number;
|
|
167
|
+
createdAt: string;
|
|
168
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* La page d'accueil des notes d'un projet : creee a la premiere ouverture de
|
|
3
|
+
* l'onglet quand le projet n'a encore aucune page, elle montre par l'exemple
|
|
4
|
+
* ce que l'editeur sait faire. Privee, elle ne gene personne d'autre.
|
|
5
|
+
*
|
|
6
|
+
* Le document est le JSON de RmRichTextEditor (Tiptap) ; une fiche du projet
|
|
7
|
+
* y est citee quand il y en a une, pour que `@` se voie en vrai.
|
|
8
|
+
*
|
|
9
|
+
* Servie par le layer OIP a toutes les apps (reprise de France Augmented
|
|
10
|
+
* Science et d'OIP Case Atlas).
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
type Citable = { type: string; id: string; label: string };
|
|
14
|
+
|
|
15
|
+
const text = (value: string, marks?: Array<Record<string, unknown>>) => ({
|
|
16
|
+
type: "text",
|
|
17
|
+
text: value,
|
|
18
|
+
...(marks && { marks }),
|
|
19
|
+
});
|
|
20
|
+
const bold = (value: string) => text(value, [{ type: "bold" }]);
|
|
21
|
+
const code = (value: string) => text(value, [{ type: "code" }]);
|
|
22
|
+
const paragraph = (...content: unknown[]) => ({ type: "paragraph", ...(content.length && { content }) });
|
|
23
|
+
const heading = (level: 1 | 2 | 3, value: string) => ({ type: "heading", attrs: { level }, content: [text(value)] });
|
|
24
|
+
const task = (checked: boolean, ...content: unknown[]) => ({
|
|
25
|
+
type: "taskItem",
|
|
26
|
+
attrs: { checked },
|
|
27
|
+
content: [paragraph(...content)],
|
|
28
|
+
});
|
|
29
|
+
const cell = (kind: "tableHeader" | "tableCell", value: string) => ({
|
|
30
|
+
type: kind,
|
|
31
|
+
content: [paragraph(...(value ? [text(value)] : []))],
|
|
32
|
+
});
|
|
33
|
+
const row = (kind: "tableHeader" | "tableCell", values: string[]) => ({
|
|
34
|
+
type: "tableRow",
|
|
35
|
+
content: values.map((value) => cell(kind, value)),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export function projectNoteWelcome(en: boolean, resource?: Citable | null) {
|
|
39
|
+
const cite = resource
|
|
40
|
+
? [
|
|
41
|
+
text(en ? "For instance " : "Par exemple "),
|
|
42
|
+
{
|
|
43
|
+
type: "mention",
|
|
44
|
+
attrs: { kind: "resource", id: resource.id, resourceType: resource.type, label: resource.label },
|
|
45
|
+
},
|
|
46
|
+
text(en ? ", filed in this project. Click it to open its record." : ", rangée dans ce projet. Cliquez dessus pour ouvrir sa fiche."),
|
|
47
|
+
]
|
|
48
|
+
: [text(en ? "Records filed in the project show up there as soon as there are some." : "Les fiches rangées dans le projet y apparaissent dès qu'il y en a.")];
|
|
49
|
+
|
|
50
|
+
const content = [
|
|
51
|
+
paragraph(
|
|
52
|
+
text(
|
|
53
|
+
en
|
|
54
|
+
? "Notes keep what the project teaches you, next to the data: a summary, a meeting, a hypothesis to check. This note shows what you can do. Edit it, or delete it once read."
|
|
55
|
+
: "Les notes gardent ce que le projet vous apprend, à côté des données : une synthèse, une réunion, une hypothèse à vérifier. Cette note montre ce que l'on peut y faire. Modifiez-la, ou supprimez-la une fois lue.",
|
|
56
|
+
),
|
|
57
|
+
),
|
|
58
|
+
paragraph(
|
|
59
|
+
text(en ? "A note is either " : "Une note est soit "),
|
|
60
|
+
bold(en ? "private" : "privée"),
|
|
61
|
+
text(en ? " (only you can read it), or " : " (vous seul la lisez), soit "),
|
|
62
|
+
bold(en ? "shared with the project" : "partagée au projet"),
|
|
63
|
+
text(
|
|
64
|
+
en
|
|
65
|
+
? " (every member reads and edits it). A new note starts private; switch it with Access, next to the title."
|
|
66
|
+
: " (chaque membre la lit et la modifie). Une nouvelle note commence privée ; on bascule avec Accès, à côté du titre.",
|
|
67
|
+
),
|
|
68
|
+
),
|
|
69
|
+
heading(2, en ? "Cite with @" : "Citer avec @"),
|
|
70
|
+
paragraph(
|
|
71
|
+
text(en ? "Type " : "Tapez "),
|
|
72
|
+
code("@"),
|
|
73
|
+
text(
|
|
74
|
+
en
|
|
75
|
+
? " to cite a member of the project (they get a message in their Inbox), a record of the project, or another note."
|
|
76
|
+
: " pour citer un membre du projet (la personne reçoit un message dans son Inbox), une fiche du projet ou une autre note.",
|
|
77
|
+
),
|
|
78
|
+
),
|
|
79
|
+
paragraph(...cite),
|
|
80
|
+
heading(2, en ? "Insert with /" : "Insérer avec /"),
|
|
81
|
+
paragraph(
|
|
82
|
+
text(en ? "Type " : "Tapez "),
|
|
83
|
+
code("/"),
|
|
84
|
+
text(
|
|
85
|
+
en
|
|
86
|
+
? " at the start of a line for a title, a list, a table, a quote or a code block. "
|
|
87
|
+
: " en début de ligne pour un titre, une liste, un tableau, une citation ou un bloc de code. ",
|
|
88
|
+
),
|
|
89
|
+
bold("Alt + ↑ / ↓"),
|
|
90
|
+
text(en ? " moves the current block." : " déplace le bloc courant."),
|
|
91
|
+
),
|
|
92
|
+
{
|
|
93
|
+
type: "taskList",
|
|
94
|
+
content: [
|
|
95
|
+
task(true, text(en ? "Open the Notes tab" : "Ouvrir l'onglet Notes")),
|
|
96
|
+
task(false, text(en ? "Write a first summary of the project" : "Écrire une première synthèse du projet")),
|
|
97
|
+
task(false, text(en ? "Add a tag with the + under the title" : "Ajouter un tag avec le + sous le titre")),
|
|
98
|
+
task(false, text(en ? "Share a note with the project (Access, next to the title)" : "Partager une note au projet (Accès, à côté du titre)")),
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
type: "table",
|
|
103
|
+
content: [
|
|
104
|
+
row("tableHeader", en ? ["Record", "Status", "Next step"] : ["Fiche", "Statut", "Prochaine étape"]),
|
|
105
|
+
row("tableCell", en ? ["Record A", "Confirmed", "Compare with the same source"] : ["Fiche A", "Confirmée", "Comparer avec la même source"]),
|
|
106
|
+
row("tableCell", en ? ["Record B", "To be checked", ""] : ["Fiche B", "À vérifier", ""]),
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
type: "blockquote",
|
|
111
|
+
content: [
|
|
112
|
+
paragraph(
|
|
113
|
+
text(
|
|
114
|
+
en
|
|
115
|
+
? "A quote stands out like this: handy for a sentence lifted from a publication or a minutes."
|
|
116
|
+
: "Une citation se détache ainsi : pratique pour une phrase reprise d'une publication ou d'un compte rendu.",
|
|
117
|
+
),
|
|
118
|
+
),
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
heading(2, en ? "Organise" : "Organiser"),
|
|
122
|
+
paragraph(
|
|
123
|
+
text(
|
|
124
|
+
en
|
|
125
|
+
? "A note can hold subnotes (the + next to a note in the list). Tags group notes across the tree, and the search looks inside the text."
|
|
126
|
+
: "Une note peut porter des sous-notes (le + à côté d'une note dans la liste). Les tags regroupent des notes d'un bout à l'autre de l'arbre, et la recherche lit aussi leur texte.",
|
|
127
|
+
),
|
|
128
|
+
),
|
|
129
|
+
];
|
|
130
|
+
|
|
131
|
+
return {
|
|
132
|
+
title: en ? "Welcome to my notes" : "Bienvenue dans mes notes",
|
|
133
|
+
icon: "👋",
|
|
134
|
+
tags: [en ? "Example" : "Exemple"],
|
|
135
|
+
content: { type: "doc", content },
|
|
136
|
+
};
|
|
137
|
+
}
|
package/layer/nuxt.config.ts
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
// pas dans `modules` : l'app les enregistre deja avec ses options (romulus
|
|
9
9
|
// sans baseStyles, ses locales), et un second enregistrement par le layer
|
|
10
10
|
// les reinstallerait avec les options par defaut.
|
|
11
|
+
import { existsSync } from "node:fs";
|
|
12
|
+
import { join } from "node:path";
|
|
11
13
|
import { fileURLToPath } from "node:url";
|
|
12
14
|
|
|
13
15
|
export default defineNuxtConfig({
|
|
@@ -18,6 +20,18 @@ export default defineNuxtConfig({
|
|
|
18
20
|
alias: {
|
|
19
21
|
"#oip-app": fileURLToPath(new URL("./app/oip-defaults", import.meta.url)),
|
|
20
22
|
},
|
|
23
|
+
// Les projets demandent a l'app un module facultatif, `projects` dans son
|
|
24
|
+
// dossier `#oip-app` : les apps branchees avant lui n'en ont pas, et un
|
|
25
|
+
// import `#oip-app/projects` casserait leur build. `#oip-projects` vise
|
|
26
|
+
// donc le fichier de l'app quand il existe, sinon les valeurs neutres.
|
|
27
|
+
modules: [
|
|
28
|
+
(_options: unknown, nuxt: any) => {
|
|
29
|
+
const base = String(nuxt.options.alias["#oip-app"] ?? "");
|
|
30
|
+
const own = ["ts", "js"].map((ext) => join(base, `projects.${ext}`)).find((file) => existsSync(file));
|
|
31
|
+
nuxt.options.alias["#oip-projects"] =
|
|
32
|
+
own ?? fileURLToPath(new URL("./app/oip-defaults/projects.ts", import.meta.url));
|
|
33
|
+
},
|
|
34
|
+
],
|
|
21
35
|
future: {
|
|
22
36
|
compatibilityVersion: 4,
|
|
23
37
|
},
|
|
@@ -42,6 +56,8 @@ export default defineNuxtConfig({
|
|
|
42
56
|
oipAppUrl: "",
|
|
43
57
|
/** API Virtual Lab pour le droit superadmin, sinon VIRTUAL_LAB_API_URL. */
|
|
44
58
|
oipVirtualLabApiUrl: "",
|
|
59
|
+
/** share-platform, ou se lisent les livrables rattaches a un projet (onglet Documents). */
|
|
60
|
+
oipSharingApiBase: "https://share.tekkare.com",
|
|
45
61
|
/** Directus qui porte la collection ElasticIndices, et un jeton qui la lit. */
|
|
46
62
|
oipEsIndicesUrl: "",
|
|
47
63
|
oipEsIndicesToken: "",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineEventHandler } from "h3";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* GET /api/oip/sharing/artifacts, servi par le layer OIP (onglet Documents
|
|
5
|
+
* d'un projet) : les livrables share-platform rattaches a un projet.
|
|
6
|
+
*
|
|
7
|
+
* share-platform n'a pas de CORS (meme route que l'onglet Reporting de
|
|
8
|
+
* Discovery) : le navigateur passe par ici et on transmet le jeton FusionAuth.
|
|
9
|
+
* share-platform refait les controles (membre de l'espace de travail, membre
|
|
10
|
+
* du projet) contre virtual-lab-api ; on ne filtre rien de plus.
|
|
11
|
+
*/
|
|
12
|
+
export default defineEventHandler(async (event) => {
|
|
13
|
+
const { workspaceId, projectId } = getQuery(event);
|
|
14
|
+
if (typeof workspaceId !== "string" || !workspaceId || typeof projectId !== "string" || !projectId) {
|
|
15
|
+
throw createError({ statusCode: 400, message: "workspaceId and projectId required" });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const accessToken = await requireOipSession(event);
|
|
19
|
+
const base = String(useRuntimeConfig().oipSharingApiBase).replace(/\/$/, "");
|
|
20
|
+
try {
|
|
21
|
+
const response = await $fetch<{ items: any[] }>(
|
|
22
|
+
`${base}/api/workspaces/${encodeURIComponent(workspaceId)}/artifacts`,
|
|
23
|
+
{
|
|
24
|
+
query: { projectId },
|
|
25
|
+
headers: { Authorization: `Bearer ${accessToken}` },
|
|
26
|
+
},
|
|
27
|
+
);
|
|
28
|
+
return {
|
|
29
|
+
items: (response?.items ?? []).map((item) => ({
|
|
30
|
+
id: item.id,
|
|
31
|
+
filename: item.filename,
|
|
32
|
+
contentType: item.contentType,
|
|
33
|
+
size: item.size,
|
|
34
|
+
createdAt: item.createdAt,
|
|
35
|
+
title: item.title ?? null,
|
|
36
|
+
projectId: item.projectId ?? null,
|
|
37
|
+
})),
|
|
38
|
+
};
|
|
39
|
+
} catch (error: any) {
|
|
40
|
+
const status = error?.response?.status || 502;
|
|
41
|
+
console.error(`[sharing proxy] ${base}/api/workspaces/${workspaceId}/artifacts -> ${status}`, error?.data ?? error?.message);
|
|
42
|
+
throw createError({ statusCode: status, message: "Unable to reach the sharing service" });
|
|
43
|
+
}
|
|
44
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tekkare/romulus",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.262",
|
|
4
4
|
"description": "Romulus Design System - Nuxt module by Tekkare",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"./layer": "./layer/nuxt.config.ts",
|
|
21
21
|
"./layer-utils/*": "./layer/app/utils/*.ts",
|
|
22
22
|
"./layer-composables/*": "./layer/app/composables/*.ts",
|
|
23
|
+
"./layer-defaults/*": "./layer/app/oip-defaults/*.ts",
|
|
23
24
|
"./layer-patients/*": "./layer/app/oip-patients/*.ts"
|
|
24
25
|
},
|
|
25
26
|
"main": "./dist/module.cjs",
|