feat(studio): rediseño con design tokens, pantalla de consumo y rename a Studio
El SPA pasa a llamarse uMind Studio y vive en /studio (el nombre "Orquestador" no le decía nada al cliente final, que ahora es quien lo usa). Diseño: - Los colores viven una sola vez como variables CSS + clases semánticas (.card, .input, .btn-*, .badge-*). Antes cada elemento repetía el par claro/oscuro a mano en cientos de lugares y cambiar un tono era buscar y reemplazar. - darkMode pasa de 'media' a 'class' con toggle propio persistido: el usuario elige, no el sistema operativo. Se aplica antes de montar la app para que no parpadee. - Componentes compartidos (UiModal, UiBadge, UiEmptyState) donde antes había markup duplicado inline. Nueva pantalla de consumo (/tenants/:id/uso): filtros por fecha con atajos, total del período, pendiente de facturar, barra contra el tope del plan, desglose por tipo y gráfico por día. El gráfico son divs con altura porcentual — no vale traer una librería de charts para esto. Rename: - /studio y /portal/studio; /orchestrator redirige 301 conservando la ruta interna, así los enlaces guardados siguen funcionando. Los assets del bundle quedan exentos (el `base` de Vite sigue en /orchestrator/): redirigirlos rompería el SPA. - El submódulo sembrado migra el mismo registro buscando por las tres URLs históricas (/app/umind → /orchestrator → /studio) en vez de dejar entradas duplicadas en el menú. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
023a8af494
commit
d8f9acd1f8
@@ -59,7 +59,7 @@ func UmindConectarHandler(c *fiber.Ctx) error {
|
||||
func UmindOAuthCallbackHandler(c *fiber.Ctx) error {
|
||||
proveedor := c.Params("proveedor")
|
||||
if errParam := c.Query("error"); errParam != "" {
|
||||
return c.Redirect(fmt.Sprintf("/orchestrator/?oauth_error=%s", errParam), fiber.StatusFound)
|
||||
return c.Redirect(fmt.Sprintf("/studio/?oauth_error=%s", errParam), fiber.StatusFound)
|
||||
}
|
||||
code := c.Query("code")
|
||||
state := c.Query("state")
|
||||
@@ -70,13 +70,13 @@ func UmindOAuthCallbackHandler(c *fiber.Ctx) error {
|
||||
conexion, err := services.CompletarConexionOAuth(proveedor, code, state)
|
||||
if err != nil {
|
||||
log.Printf("[UMIND_OAUTH] error completando conexión (%s): %v", proveedor, err)
|
||||
return c.Redirect("/orchestrator/?oauth_error=1", fiber.StatusFound)
|
||||
return c.Redirect("/studio/?oauth_error=1", fiber.StatusFound)
|
||||
}
|
||||
agente, err := models.GetUmindAgenteByID(conexion.AgenteID)
|
||||
if err != nil {
|
||||
return c.Redirect("/orchestrator/?oauth_error=1", fiber.StatusFound)
|
||||
return c.Redirect("/studio/?oauth_error=1", fiber.StatusFound)
|
||||
}
|
||||
return c.Redirect(fmt.Sprintf("/orchestrator/tenants/%d/agentes/%d?tab=conexiones", agente.TenantID, agente.ID), fiber.StatusFound)
|
||||
return c.Redirect(fmt.Sprintf("/studio/tenants/%d/agentes/%d?tab=conexiones", agente.TenantID, agente.ID), fiber.StatusFound)
|
||||
}
|
||||
|
||||
func DeleteUmindConexionHandler(c *fiber.Ctx) error {
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ func WebAuthRoutes(App fiber.Router) {
|
||||
)
|
||||
// Generar contraseñas aleatorias /do/generate-password
|
||||
App.Post("/do/generate-password",
|
||||
controllers.GeneratePasswordPost,
|
||||
controllers.GeneratePasswordPost,
|
||||
)
|
||||
|
||||
App.Get("/request-password-reset", middlewares.RedirectToHomePageOnLogin, controllers.RequestPasswordReset)
|
||||
|
||||
@@ -12,7 +12,6 @@ func LandingRoutes(web fiber.Router) {
|
||||
web.Get("/ping", Pong)
|
||||
web.Get("/all-routes", AllRoutes)
|
||||
web.Get("/do/verify-email", middlewares.ValidateConfirmToken, controllers.VerifyRegisteredEmail)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package routes
|
||||
|
||||
import "strings"
|
||||
|
||||
// destinoStudio traduce una URL vieja de /orchestrator a la nueva de /studio,
|
||||
// conservando la ruta del lado del cliente (vue-router) para que un enlace
|
||||
// guardado a un agente puntual siga cayendo en ese agente.
|
||||
func destinoStudio(path string) string {
|
||||
return "/studio" + strings.TrimPrefix(path, "/orchestrator")
|
||||
}
|
||||
|
||||
// esAssetDelBundle indica si la URL es un estático del build. El `base` de
|
||||
// Vite sigue siendo /orchestrator/, así que esos NO se redirigen: hacerlo
|
||||
// rompería el SPA. En la práctica el Static("/") general los atiende antes,
|
||||
// pero el chequeo explícito evita depender del orden de registro de rutas.
|
||||
func esAssetDelBundle(path string) bool {
|
||||
return strings.HasPrefix(path, "/orchestrator/assets/")
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package routes
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestDestinoStudio(t *testing.T) {
|
||||
casos := map[string]string{
|
||||
"/orchestrator": "/studio",
|
||||
"/orchestrator/": "/studio/",
|
||||
"/orchestrator/tenants/3": "/studio/tenants/3",
|
||||
"/orchestrator/tenants/3/agentes/11": "/studio/tenants/3/agentes/11",
|
||||
"/orchestrator/tenants/3/uso": "/studio/tenants/3/uso",
|
||||
}
|
||||
for entrada, esperado := range casos {
|
||||
if got := destinoStudio(entrada); got != esperado {
|
||||
t.Errorf("destinoStudio(%q) = %q, esperaba %q", entrada, got, esperado)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Redirigir los assets rompería el SPA: el `base` del bundle sigue siendo
|
||||
// /orchestrator/, así que el JS y el CSS tienen que seguir sirviéndose ahí.
|
||||
func TestAssetsDelBundleNoSeRedirigen(t *testing.T) {
|
||||
if !esAssetDelBundle("/orchestrator/assets/index-abc123.js") {
|
||||
t.Error("un asset del bundle debería quedar exento del redirect")
|
||||
}
|
||||
if esAssetDelBundle("/orchestrator/tenants/3") {
|
||||
t.Error("una ruta de navegación no es un asset y debe redirigirse")
|
||||
}
|
||||
}
|
||||
+19
-4
@@ -371,15 +371,30 @@ func UserRoutes(app fiber.Router) {
|
||||
protected.Put("/umind-planes/:id", middlewares.SoloAdmin, controllers.UpdateUmindPlanHandler)
|
||||
protected.Delete("/umind-planes/:id", middlewares.SoloAdmin, controllers.DeleteUmindPlanHandler)
|
||||
|
||||
// ─── uMind Orquestador (SPA Vue) ────────────────────────────────────────────
|
||||
// ─── uMind Studio (SPA Vue) ─────────────────────────────────────────────────
|
||||
// Estáticos reales (JS/CSS del build) ya los sirve el Static("/") general
|
||||
// registrado en config.LoadStatic — esto es solo el fallback para las rutas
|
||||
// del lado del cliente (vue-router en modo history), protegido con sesión.
|
||||
orchestratorFallback := func(c *fiber.Ctx) error {
|
||||
studioFallback := func(c *fiber.Ctx) error {
|
||||
return c.SendFile("./public/orchestrator/index.html")
|
||||
}
|
||||
app.Get("/orchestrator", middlewares.AuthWeb(), orchestratorFallback)
|
||||
app.Get("/orchestrator/*", middlewares.AuthWeb(), orchestratorFallback)
|
||||
app.Get("/studio", middlewares.AuthWeb(), studioFallback)
|
||||
app.Get("/studio/*", middlewares.AuthWeb(), studioFallback)
|
||||
|
||||
// /orchestrator era la URL vieja: redirige para no romper los enlaces que
|
||||
// alguien haya guardado. Los assets del build siguen viviendo bajo
|
||||
// /orchestrator/assets (es el base del bundle), así que solo se redirige
|
||||
// la navegación, no los estáticos.
|
||||
redirigirAStudio := func(c *fiber.Ctx) error {
|
||||
return c.Redirect(destinoStudio(c.Path()), fiber.StatusMovedPermanently)
|
||||
}
|
||||
app.Get("/orchestrator", middlewares.AuthWeb(), redirigirAStudio)
|
||||
app.Get("/orchestrator/*", middlewares.AuthWeb(), func(c *fiber.Ctx) error {
|
||||
if esAssetDelBundle(c.Path()) {
|
||||
return c.Next()
|
||||
}
|
||||
return redirigirAStudio(c)
|
||||
})
|
||||
|
||||
// ─── OSS API (Alibaba Cloud + S3/MinIO) ────────────────────────────────────
|
||||
protected.Get("/oss-api", middlewares.MenuMiddleware, controllers.OssApiIndex)
|
||||
|
||||
Reference in New Issue
Block a user