Ajoute la notion de groupe — collection nommée de repos (membership légère persistée, many-to-many) — pour piloter plusieurs repos en simultané : - DB : migration #5 (tables groups + group_repos, FK ON DELETE CASCADE). - GroupManager (synchrone, EventEmitter) + routes REST /api/v1/groups ; ne persiste que la membership, worktrees/sessions filtrés par repoId côté client. - Protocole : GroupSummary, DTOs, topic WS « groups », events group_update/removed (additifs, PROTOCOL_VERSION inchangé). - Web : store groups, GroupsListView, GroupView (réutilise RepoSection), grille multi-terminaux (TerminalGrid/TerminalCell), action « feature cross-repo » (orchestration client, tolérante aux échecs partiels), routes + i18n EN/FR. - Tests : group-manager.test.ts + extension protocol.test.ts ; acceptance-p5.mjs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
24 lines
1.2 KiB
TypeScript
24 lines
1.2 KiB
TypeScript
import { createRouter, createWebHistory } from 'vue-router';
|
|
import { useAuthStore } from '../stores/auth';
|
|
|
|
export const router = createRouter({
|
|
history: createWebHistory(),
|
|
routes: [
|
|
{ path: '/login', name: 'login', component: () => import('../views/LoginView.vue') },
|
|
{ path: '/', name: 'dashboard', component: () => import('../views/DashboardView.vue') },
|
|
{ path: '/sessions', name: 'sessions', component: () => import('../views/SessionsListView.vue') },
|
|
{ path: '/sessions/:id', name: 'session', component: () => import('../views/SessionView.vue') },
|
|
{ path: '/groups', name: 'groups', component: () => import('../views/GroupsListView.vue') },
|
|
{ path: '/groups/:id', name: 'group', component: () => import('../views/GroupView.vue') },
|
|
{ path: '/:pathMatch(.*)*', redirect: '/' },
|
|
],
|
|
});
|
|
|
|
// Garde globale : tout sauf /login exige une session valide (GET /api/v1/auth/me, 401 → /login)
|
|
router.beforeEach(async (to) => {
|
|
const auth = useAuthStore();
|
|
if (auth.authenticated === null) await auth.check();
|
|
if (to.name === 'login') return auth.authenticated ? { name: 'dashboard' } : true;
|
|
return auth.authenticated ? true : { name: 'login', query: { redirect: to.fullPath } };
|
|
});
|