@tekkare/romulus 0.1.265 → 0.1.266
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/ProjectList.vue +6 -1
- package/dist/runtime/utils/projects.d.ts +2 -0
- package/layer/app/components/panels/OipPanelProjects.vue +1 -2
- package/layer/app/components/project/Page.vue +7 -0
- package/layer/app/composables/useProjects.ts +15 -2
- package/layer/app/oip-defaults/projects.ts +10 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -66,7 +66,12 @@ const groups = computed(() => rmProjectGroups(props.projects, props.lang))
|
|
|
66
66
|
<div class="rm-project-list__grid">
|
|
67
67
|
<RmSectionCard v-for="project in group.projects" :key="project.id" position="none" action class="rm-project-list__card">
|
|
68
68
|
<!-- Deux branches en dur : `<component :is="'NuxtLink'">` ne resout rien. -->
|
|
69
|
-
<NuxtLink
|
|
69
|
+
<NuxtLink
|
|
70
|
+
v-if="project.to"
|
|
71
|
+
:to="project.to"
|
|
72
|
+
:target="project.external ? '_blank' : undefined"
|
|
73
|
+
class="rm-project-list__link"
|
|
74
|
+
>
|
|
70
75
|
<div class="rm-project-list__head">
|
|
71
76
|
<RmIcon name="FolderSimple" :size="18" />
|
|
72
77
|
<span class="rm-project-list__title">{{ project.title }}</span>
|
|
@@ -34,6 +34,8 @@ export interface RmProject {
|
|
|
34
34
|
pinned?: boolean;
|
|
35
35
|
/** Lien vers la page du projet. */
|
|
36
36
|
to?: string;
|
|
37
|
+
/** `to` mene a une autre app (projet Discovery...) : il s'ouvre dans un nouvel onglet. */
|
|
38
|
+
external?: boolean;
|
|
37
39
|
}
|
|
38
40
|
export interface RmProjectGroup {
|
|
39
41
|
key: 'pinned' | 'mine' | 'shared';
|
|
@@ -91,7 +91,6 @@ const emit = defineEmits<{
|
|
|
91
91
|
const FEATURE = { fr: "Projets", en: "Projects" };
|
|
92
92
|
|
|
93
93
|
const { locale } = useI18n();
|
|
94
|
-
const router = useRouter();
|
|
95
94
|
const localePath = useLocalePath();
|
|
96
95
|
const creating = ref(false);
|
|
97
96
|
|
|
@@ -132,7 +131,7 @@ function activate(id: string) {
|
|
|
132
131
|
}
|
|
133
132
|
|
|
134
133
|
function open(id: string) {
|
|
135
|
-
if (own)
|
|
134
|
+
if (own) own.open(id);
|
|
136
135
|
else emit("open", id);
|
|
137
136
|
}
|
|
138
137
|
|
|
@@ -194,6 +194,7 @@ import {
|
|
|
194
194
|
PROJECTS_UPSELL,
|
|
195
195
|
PROJECT_WORDING,
|
|
196
196
|
WATCHABLE_PROJECT_TYPES,
|
|
197
|
+
projectExternalHref,
|
|
197
198
|
useProjectScopeRows,
|
|
198
199
|
useProjectSuggestions,
|
|
199
200
|
useProjectsAccess,
|
|
@@ -774,6 +775,12 @@ async function load() {
|
|
|
774
775
|
failed.value = false;
|
|
775
776
|
try {
|
|
776
777
|
const [detail, list] = await Promise.all([useOipApi().projects.get(projectId), projects.fetchItems(projectId)]);
|
|
778
|
+
// Un projet d'une autre app (Discovery...) se lit chez elle : un ancien lien y renvoie.
|
|
779
|
+
const external = detail ? projectExternalHref(detail) : null;
|
|
780
|
+
if (external) {
|
|
781
|
+
await navigateTo(external, { external: true, replace: true });
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
777
784
|
project.value = {
|
|
778
785
|
title: detail?.title ?? "",
|
|
779
786
|
description: detail?.description ?? "",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
import type { RmProject, RmProjectArchivedEntry } from "@tekkare/romulus/utils/projects";
|
|
19
19
|
import { useOipApi } from "#oip-app/api";
|
|
20
20
|
import { oipSnackbar } from "#oip-app/ui";
|
|
21
|
-
import { PROJECTS_PATH, PROJECTS_STORAGE_KEY } from "#oip-projects";
|
|
21
|
+
import { PROJECTS_PATH, PROJECTS_STORAGE_KEY, projectExternalHref } from "#oip-projects";
|
|
22
22
|
import { useOipProjectKinds } from "./useOipProjectKinds";
|
|
23
23
|
|
|
24
24
|
export interface Project {
|
|
@@ -33,6 +33,8 @@ export interface Project {
|
|
|
33
33
|
membersCount?: number;
|
|
34
34
|
/** Ressources presentes, tous types confondus, y compris ceux que l'app n'affiche pas. */
|
|
35
35
|
resourcesCount?: number;
|
|
36
|
+
/** Le projet s'ouvre dans une autre app, a cette adresse (cf. projectExternalHref). */
|
|
37
|
+
href?: string;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
/** Un document, ou les documents que porte une meme carte. */
|
|
@@ -165,7 +167,15 @@ export const useProjects = () => {
|
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
function pathOf(projectId: string) {
|
|
168
|
-
return localePath(`${PROJECTS_PATH}/${projectId}`);
|
|
170
|
+
return projects.value.find((p) => p.id === projectId)?.href ?? localePath(`${PROJECTS_PATH}/${projectId}`);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** Ouvre un projet : sa page ici, ou son app dans un nouvel onglet. */
|
|
174
|
+
function open(projectId: string) {
|
|
175
|
+
const href = projects.value.find((p) => p.id === projectId)?.href;
|
|
176
|
+
return href
|
|
177
|
+
? navigateTo(href, { external: true, open: { target: "_blank" } })
|
|
178
|
+
: navigateTo(pathOf(projectId));
|
|
169
179
|
}
|
|
170
180
|
|
|
171
181
|
/** Le projet tel que les composants RmProject* l'affichent. */
|
|
@@ -181,6 +191,7 @@ export const useProjects = () => {
|
|
|
181
191
|
resourcesCount: project.resourcesCount,
|
|
182
192
|
pinned: pinnedIds.value.includes(project.id),
|
|
183
193
|
to: pathOf(project.id),
|
|
194
|
+
external: !!project.href,
|
|
184
195
|
};
|
|
185
196
|
}
|
|
186
197
|
|
|
@@ -220,6 +231,7 @@ export const useProjects = () => {
|
|
|
220
231
|
isShared: p.isShared,
|
|
221
232
|
membersCount: p.membersCount,
|
|
222
233
|
resourcesCount: p.resourcesCount,
|
|
234
|
+
href: projectExternalHref(p) ?? undefined,
|
|
223
235
|
}));
|
|
224
236
|
failure.value = null;
|
|
225
237
|
loaded.value = true;
|
|
@@ -620,6 +632,7 @@ export const useProjects = () => {
|
|
|
620
632
|
active,
|
|
621
633
|
activeId,
|
|
622
634
|
pathOf,
|
|
635
|
+
open,
|
|
623
636
|
isMine,
|
|
624
637
|
togglePin,
|
|
625
638
|
items,
|
|
@@ -40,6 +40,16 @@ export const PROJECTS_STORAGE_KEY = "oipProject";
|
|
|
40
40
|
*/
|
|
41
41
|
export const PROJECT_KINDS: RmProjectKind[] = [];
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* L'adresse d'un projet qui s'ouvre dans une autre app, lue sur le projet tel
|
|
45
|
+
* que l'API le rend (projet Discovery : ses PICOTS sont renseignes...). `null`
|
|
46
|
+
* : sa page dans cette app. Une adresse ouvre la carte dans un nouvel onglet
|
|
47
|
+
* et renvoie `/projects/<id>` vers elle.
|
|
48
|
+
*/
|
|
49
|
+
export function projectExternalHref(_project: Record<string, any>): string | null {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
43
53
|
/** Les projets sont-ils ouverts a l'utilisateur (licence...) ? Faux : le panneau `PROJECTS_UPSELL`. */
|
|
44
54
|
export function useProjectsAccess(): Ref<boolean> | ComputedRef<boolean> {
|
|
45
55
|
return computed(() => true);
|