@tekkare/romulus 0.1.352 → 0.1.353
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
CHANGED
|
@@ -35,13 +35,25 @@
|
|
|
35
35
|
@create="onCreate"
|
|
36
36
|
>
|
|
37
37
|
<template v-if="button" #new="{ openForm }">
|
|
38
|
-
|
|
38
|
+
<!-- Branche sur le layer : les memes gestes que « Mes projets » (creation
|
|
39
|
+
libre dans la meme fenetre, nom et description, ou creation guidee). -->
|
|
40
|
+
<component :is="button" size="sm" @free="own ? (dialogOpen = true) : openForm()" />
|
|
39
41
|
</template>
|
|
40
42
|
</RmProjectPanel>
|
|
43
|
+
|
|
44
|
+
<RmProjectCreateDialog
|
|
45
|
+
v-if="own"
|
|
46
|
+
v-model="dialogOpen"
|
|
47
|
+
:loading="dialogSaving"
|
|
48
|
+
:error="dialogError"
|
|
49
|
+
:lang="locale === 'en' ? 'en' : 'fr'"
|
|
50
|
+
@create="createFromDialog"
|
|
51
|
+
/>
|
|
41
52
|
</template>
|
|
42
53
|
|
|
43
54
|
<script setup lang="ts">
|
|
44
|
-
import {
|
|
55
|
+
import type { Component } from "vue";
|
|
56
|
+
import ProjectNewButton from "../project/NewButton.vue";
|
|
45
57
|
import type { RmProject } from "@tekkare/romulus/utils/projects";
|
|
46
58
|
import { PROJECTS_PATH, PROJECTS_UPSELL, useProjectsAccess } from "#oip-projects";
|
|
47
59
|
|
|
@@ -98,7 +110,10 @@ const creating = ref(false);
|
|
|
98
110
|
const wired = props.projects === undefined;
|
|
99
111
|
const own = wired ? useProjects() : null;
|
|
100
112
|
const allowed = useProjectsAccess();
|
|
101
|
-
|
|
113
|
+
// Importe, pas resolu par son nom : un composant du layer n'est pas enregistre
|
|
114
|
+
// globalement, `resolveComponent` rendait une chaine et le panneau retombait
|
|
115
|
+
// sur son seul formulaire du nom.
|
|
116
|
+
const newProjectButton = ProjectNewButton;
|
|
102
117
|
|
|
103
118
|
const list = computed(() => (own ? own.rmProjects.value : props.projects ?? []));
|
|
104
119
|
const active = computed(() => (own ? own.activeId.value : props.activeId));
|
|
@@ -124,6 +139,31 @@ async function onCreate(title: string) {
|
|
|
124
139
|
}
|
|
125
140
|
}
|
|
126
141
|
|
|
142
|
+
/**
|
|
143
|
+
* La creation libre du panneau, la meme que celle de « Mes projets » : nom et
|
|
144
|
+
* description, puis le projet devient l'actif et s'ouvre.
|
|
145
|
+
*/
|
|
146
|
+
const dialogOpen = ref(false);
|
|
147
|
+
const dialogSaving = ref(false);
|
|
148
|
+
const dialogError = ref("");
|
|
149
|
+
async function createFromDialog(value: { title: string; description: string }) {
|
|
150
|
+
if (!own) return;
|
|
151
|
+
dialogSaving.value = true;
|
|
152
|
+
dialogError.value = "";
|
|
153
|
+
try {
|
|
154
|
+
const project = await own.create(value.title, value.description);
|
|
155
|
+
dialogOpen.value = false;
|
|
156
|
+
own.setActive(project.id);
|
|
157
|
+
emit("close");
|
|
158
|
+
own.open(project.id);
|
|
159
|
+
} catch (error: any) {
|
|
160
|
+
dialogError.value =
|
|
161
|
+
error?.data?.error || error?.data?.message || (locale.value === "en" ? "The project was not created" : "Le projet n'a pas été créé");
|
|
162
|
+
} finally {
|
|
163
|
+
dialogSaving.value = false;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
127
167
|
function activate(id: string) {
|
|
128
168
|
if (own) own.setActive(id);
|
|
129
169
|
else emit("activate", id);
|