Skip to content

Modern Docker Management, Designed for Everyone

refactor: recreate arcane table using tanstack table (#390)

Kyle Mendell29297def968e
diff --git a/.github/workflows/build-1.0-preview-image.yml b/.github/workflows/build-1.0-preview-image.yml
index 4978407d8..d8ccaea7f 100644
--- a/.github/workflows/build-1.0-preview-image.yml
+++ b/.github/workflows/build-1.0-preview-image.yml
@@ -32,8 +32,6 @@ jobs:
- name: Setup PNPM
uses: pnpm/action-setup@v4
- with:
- version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
diff --git a/.github/workflows/build-next.yml b/.github/workflows/build-next.yml
index d71614796..01b9fe6d5 100644
--- a/.github/workflows/build-next.yml
+++ b/.github/workflows/build-next.yml
@@ -23,8 +23,6 @@ jobs:
- name: Setup pnpm
uses: pnpm/action-setup@v4
- with:
- version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml
index 9fd69bff7..35f229b0e 100644
--- a/.github/workflows/e2e-tests.yml
+++ b/.github/workflows/e2e-tests.yml
@@ -73,8 +73,6 @@ jobs:
- name: Setup pnpm
uses: pnpm/action-setup@v4
- with:
- version: 10
- uses: actions/setup-node@v4
with:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index d4a80b259..53d8c9bc1 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -26,8 +26,6 @@ jobs:
- name: Setup PNPM
uses: pnpm/action-setup@v4
- with:
- version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
diff --git a/.github/workflows/svelte-check.yml b/.github/workflows/svelte-check.yml
index 811bb65ba..4b4f723ba 100644
--- a/.github/workflows/svelte-check.yml
+++ b/.github/workflows/svelte-check.yml
@@ -40,8 +40,6 @@ jobs:
- name: Setup pnpm
uses: pnpm/action-setup@v4
- with:
- version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
@@ -57,9 +55,3 @@ jobs:
uses: ofkm/gha-svelte-check@v1
with:
working-directory: './frontend'
-
- # - name: Add svelte-check problem matcher
- # run: echo "::add-matcher::.github/svelte-check-matcher.json"
-
- # - name: Run svelte-check via npm script
- # run: pnpm --filter arcane-frontend check
diff --git a/backend/internal/api/container_registry_handler.go b/backend/internal/api/container_registry_handler.go
index 659edebd7..305b69669 100644
--- a/backend/internal/api/container_registry_handler.go
+++ b/backend/internal/api/container_registry_handler.go
@@ -7,6 +7,7 @@ import (
"time"
"github.com/gin-gonic/gin"
+ "github.com/ofkm/arcane-backend/internal/dto"
"github.com/ofkm/arcane-backend/internal/models"
"github.com/ofkm/arcane-backend/internal/services"
"github.com/ofkm/arcane-backend/internal/utils"
@@ -22,21 +23,12 @@ func NewContainerRegistryHandler(registryService *services.ContainerRegistryServ
}
}
-// GetRegistries godoc
-// @Summary Get all container registries
-// @Description Get all container registries
-// @Tags container-registries
-// @Accept json
-// @Produce json
-// @Success 200 {object} models.APISuccessResponse
-// @Failure 500 {object} models.APIErrorResponse
-// @Router /container-registries [get]
func (h *ContainerRegistryHandler) GetRegistries(c *gin.Context) {
var req utils.SortedPaginationRequest
if err := c.ShouldBindQuery(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
- "error": "Invalid pagination or sort parameters: " + err.Error(),
+ "data": gin.H{"error": "Invalid pagination or sort parameters: " + err.Error()},
})
return
}
@@ -52,15 +44,11 @@ func (h *ContainerRegistryHandler) GetRegistries(c *gin.Context) {
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
- "error": "Failed to list registries: " + err.Error(),
+ "data": gin.H{"error": "Failed to list registries: " + err.Error()},
})
return
}
- for i := range registries {
- registries[i].Token = ""
- }
-
c.JSON(http.StatusOK, gin.H{
"success": true,
"data": registries,
@@ -68,60 +56,41 @@ func (h *ContainerRegistryHandler) GetRegistries(c *gin.Context) {
})
}
-// GetRegistry godoc
-// @Summary Get a container registry by ID
-// @Description Get a container registry by ID
-// @Tags container-registries
-// @Accept json
-// @Produce json
-// @Param id path string true "Registry ID"
-// @Success 200 {object} models.APISuccessResponse
-// @Failure 404 {object} models.APIErrorResponse
-// @Failure 500 {object} models.APIErrorResponse
-// @Router /container-registries/{id} [get]
func (h *ContainerRegistryHandler) GetRegistry(c *gin.Context) {
id := c.Param("id")
registry, err := h.registryService.GetRegistryByID(c.Request.Context(), id)
if err != nil {
apiErr := models.ToAPIError(err)
- c.JSON(apiErr.HTTPStatus(), models.APIErrorResponse{
- Success: false,
- Error: apiErr.Message,
- Code: apiErr.Code,
- Details: apiErr.Details,
+ c.JSON(apiErr.HTTPStatus(), gin.H{
+ "success": false,
+ "data": gin.H{"error": apiErr.Message},
})
return
}
- registry.Token = ""
+ out, mapErr := dto.MapOne[*models.ContainerRegistry, dto.ContainerRegistryDto](registry)
+ if mapErr != nil {
+ c.JSON(http.StatusInternalServerError, gin.H{
+ "success": false,
+ "data": gin.H{"error": "Failed to map registry"},
+ })
+ return
+ }
- c.JSON(http.StatusOK, models.APISuccessResponse{
- Success: true,
- Data: registry,
+ c.JSON(http.StatusOK, gin.H{
+ "success": true,
+ "data": out,
})
}
-// CreateRegistry godoc
-// @Summary Create a new container registry
-// @Description Create a new container registry
-// @Tags container-registries
-// @Accept json
-// @Produce json
-// @Param registry body models.CreateContainerRegistryRequest true "Registry data"
-// @Success 201 {object} models.APISuccessResponse
-// @Failure 400 {object} models.APIErrorResponse
-// @Failure 500 {object} models.APIErrorResponse
-// @Router /container-registries [post]
func (h *ContainerRegistryHandler) CreateRegistry(c *gin.Context) {
var req models.CreateContainerRegistryRequest
if err := c.ShouldBindJSON(&req); err != nil {
apiErr := models.NewValidationError("Invalid request data", err)
- c.JSON(apiErr.HTTPStatus(), models.APIErrorResponse{
- Success: false,
- Error: apiErr.Message,
- Code: apiErr.Code,
- Details: apiErr.Details,
+ c.JSON(apiErr.HTTPStatus(), gin.H{
+ "success": false,
+ "data": gin.H{"error": apiErr.Message},
})
return
}
@@ -129,48 +98,37 @@ func (h *ContainerRegistryHandler) CreateRegistry(c *gin.Context) {
registry, err := h.registryService.CreateRegistry(c.Request.Context(), req)
if err != nil {
apiErr := models.ToAPIError(err)
- c.JSON(apiErr.HTTPStatus(), models.APIErrorResponse{
- Success: false,
- Error: apiErr.Message,
- Code: apiErr.Code,
- Details: apiErr.Details,
+ c.JSON(apiErr.HTTPStatus(), gin.H{
+ "success": false,
+ "data": gin.H{"error": apiErr.Message},
})
return
}
- registry.Token = ""
+ out, mapErr := dto.MapOne[*models.ContainerRegistry, dto.ContainerRegistryDto](registry)
+ if mapErr != nil {
+ c.JSON(http.StatusInternalServerError, gin.H{
+ "success": false,
+ "data": gin.H{"error": "Failed to map registry"},
+ })
+ return
+ }
- c.JSON(http.StatusCreated, models.APISuccessResponse{
- Success: true,
- Data: registry,
- Message: "Container registry created successfully",
+ c.JSON(http.StatusCreated, gin.H{
+ "success": true,
+ "data": out,
})
}
-// UpdateRegistry godoc
-// @Summary Update a container registry
-// @Description Update a container registry
-// @Tags container-registries
-// @Accept json
-// @Produce json
-// @Param id path string true "Registry ID"
-// @Param registry body models.UpdateContainerRegistryRequest true "Registry data"
-// @Success 200 {object} models.APISuccessResponse
-// @Failure 400 {object} models.APIErrorResponse
-// @Failure 404 {object} models.APIErrorResponse
-// @Failure 500 {object} models.APIErrorResponse
-// @Router /container-registries/{id} [put]
func (h *ContainerRegistryHandler) UpdateRegistry(c *gin.Context) {
id := c.Param("id")
var req models.UpdateContainerRegistryRequest
if err := c.ShouldBindJSON(&req); err != nil {
apiErr := models.NewValidationError("Invalid request data", err)
- c.JSON(apiErr.HTTPStatus(), models.APIErrorResponse{
- Success: false,
- Error: apiErr.Message,
- Code: apiErr.Code,
- Details: apiErr.Details,
+ c.JSON(apiErr.HTTPStatus(), gin.H{
+ "success": false,
+ "data": gin.H{"error": apiErr.Message},
})
return
}
@@ -178,78 +136,55 @@ func (h *ContainerRegistryHandler) UpdateRegistry(c *gin.Context) {
registry, err := h.registryService.UpdateRegistry(c.Request.Context(), id, req)
if err != nil {
apiErr := models.ToAPIError(err)
- c.JSON(apiErr.HTTPStatus(), models.APIErrorResponse{
- Success: false,
- Error: apiErr.Message,
- Code: apiErr.Code,
- Details: apiErr.Details,
+ c.JSON(apiErr.HTTPStatus(), gin.H{
+ "success": false,
+ "data": gin.H{"error": apiErr.Message},
})
return
}
- registry.Token = ""
+ out, mapErr := dto.MapOne[*models.ContainerRegistry, dto.ContainerRegistryDto](registry)
+ if mapErr != nil {
+ c.JSON(http.StatusInternalServerError, gin.H{
+ "success": false,
+ "data": gin.H{"error": "Failed to map registry"},
+ })
+ return
+ }
- c.JSON(http.StatusOK, models.APISuccessResponse{
- Success: true,
- Data: registry,
- Message: "Container registry updated successfully",
+ c.JSON(http.StatusOK, gin.H{
+ "success": true,
+ "data": out,
})
}
-// DeleteRegistry godoc
-// @Summary Delete a container registry
-// @Description Delete a container registry
-// @Tags container-registries
-// @Accept json
-// @Produce json
-// @Param id path string true "Registry ID"
-// @Success 200 {object} models.APISuccessResponse
-// @Failure 404 {object} models.APIErrorResponse
-// @Failure 500 {object} models.APIErrorResponse
-// @Router /container-registries/{id} [delete]
func (h *ContainerRegistryHandler) DeleteRegistry(c *gin.Context) {
id := c.Param("id")
- err := h.registryService.DeleteRegistry(c.Request.Context(), id)
- if err != nil {
+ if err := h.registryService.DeleteRegistry(c.Request.Context(), id); err != nil {
apiErr := models.ToAPIError(err)
- c.JSON(apiErr.HTTPStatus(), models.APIErrorResponse{
- Success: false,
- Error: apiErr.Message,
- Code: apiErr.Code,
- Details: apiErr.Details,
+ c.JSON(apiErr.HTTPStatus(), gin.H{
+ "success": false,
+ "data": gin.H{"error": apiErr.Message},
})
return
}
- c.JSON(http.StatusOK, models.APISuccessResponse{
- Success: true,
- Message: "Container registry deleted successfully",
+ c.JSON(http.StatusOK, gin.H{
+ "success": true,
+ "data": gin.H{"message": "Container registry deleted successfully"},
})
}
-// TestRegistry godoc
-// @Summary Test connection to a container registry
-// @Description Test connection to a container registry
-// @Tags container-registries
-// @Accept json
-// @Produce json
-// @Param id path string true "Registry ID"
-// @Success 200 {object} models.APISuccessResponse
-// @Failure 404 {object} models.APIErrorResponse
-// @Failure 500 {object} models.APIErrorResponse
-// @Router /container-registries/{id}/test [post]
func (h *ContainerRegistryHandler) TestRegistry(c *gin.Context) {
id := c.Param("id")
registry, err := h.registryService.GetRegistryByID(c.Request.Context(), id)
if err != nil {
apiErr := models.ToAPIError(err)
- c.JSON(apiErr.HTTPStatus(), models.APIErrorResponse{
- Success: false,
- Error: apiErr.Message,
- Code: apiErr.Code,
- Details: apiErr.Details,
+ c.JSON(apiErr.HTTPStatus(), gin.H{
+ "success": false,
+ "data": gin.H{"error": apiErr.Message},
})
return
}
@@ -257,10 +192,9 @@ func (h *ContainerRegistryHandler) TestRegistry(c *gin.Context) {
decryptedToken, err := utils.Decrypt(registry.Token)
if err != nil {
apiErr := models.NewInternalServerError("Failed to decrypt token")
- c.JSON(apiErr.HTTPStatus(), models.APIErrorResponse{
- Success: false,
- Error: apiErr.Message,
- Code: apiErr.Code,
+ c.JSON(apiErr.HTTPStatus(), gin.H{
+ "success": false,
+ "data": gin.H{"error": apiErr.Message},
})
return
}
@@ -268,22 +202,19 @@ func (h *ContainerRegistryHandler) TestRegistry(c *gin.Context) {
testResult, err := h.performRegistryTest(c.Request.Context(), registry, decryptedToken)
if err != nil {
apiErr := models.NewInternalServerError(fmt.Sprintf("Registry test failed: %s", err.Error()))
- c.JSON(apiErr.HTTPStatus(), models.APIErrorResponse{
- Success: false,
- Error: apiErr.Message,
- Code: apiErr.Code,
+ c.JSON(apiErr.HTTPStatus(), gin.H{
+ "success": false,
+ "data": gin.H{"error": apiErr.Message},
})
return
}
- c.JSON(http.StatusOK, models.APISuccessResponse{
- Success: true,
- Data: testResult,
- Message: "Registry test completed successfully",
+ c.JSON(http.StatusOK, gin.H{
+ "success": true,
+ "data": testResult,
})
}
-// performRegistryTest performs the actual registry connection test using registry utils
func (h *ContainerRegistryHandler) performRegistryTest(ctx context.Context, registry *models.ContainerRegistry, decryptedToken string) (map[string]interface{}, error) {
var creds *utils.RegistryCredentials
if registry.Username != "" && decryptedToken != "" {
diff --git a/backend/internal/api/environment_handler.go b/backend/internal/api/environment_handler.go
index 4ded57be2..3795c65d8 100644
--- a/backend/internal/api/environment_handler.go
+++ b/backend/internal/api/environment_handler.go
@@ -12,6 +12,7 @@ import (
"github.com/ofkm/arcane-backend/internal/dto"
"github.com/ofkm/arcane-backend/internal/models"
"github.com/ofkm/arcane-backend/internal/services"
+ "github.com/ofkm/arcane-backend/internal/utils"
)
const LOCAL_DOCKER_ENVIRONMENT_ID = "0"
@@ -73,7 +74,7 @@ func (h *EnvironmentHandler) handleLocalRequest(c *gin.Context, endpoint string)
c.JSON(http.StatusNotFound, gin.H{
"success": false,
- "error": "Endpoint not found",
+ "data": gin.H{"error": "Endpoint not found"},
})
}
@@ -254,7 +255,7 @@ func (h *EnvironmentHandler) handleRemoteRequest(c *gin.Context, environmentID s
if err != nil {
c.JSON(http.StatusNotFound, gin.H{
"success": false,
- "error": "Environment not found",
+ "data": gin.H{"error": "Environment not found"},
})
return
}
@@ -262,7 +263,7 @@ func (h *EnvironmentHandler) handleRemoteRequest(c *gin.Context, environmentID s
if !environment.Enabled {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
- "error": "Environment is disabled",
+ "data": gin.H{"error": "Environment is disabled"},
})
return
}
@@ -356,13 +357,11 @@ func (h *EnvironmentHandler) handleRemoteRequest(c *gin.Context, environmentID s
_, _ = c.Writer.Write(responseBody)
}
+// Create
func (h *EnvironmentHandler) CreateEnvironment(c *gin.Context) {
var req dto.CreateEnvironmentDto
if err := c.ShouldBindJSON(&req); err != nil {
- c.JSON(http.StatusBadRequest, gin.H{
- "success": false,
- "error": "Invalid request format: " + err.Error(),
- })
+ c.JSON(http.StatusBadRequest, gin.H{"success": false, "data": gin.H{"error": "Invalid request format: " + err.Error()}})
return
}
@@ -372,71 +371,84 @@ func (h *EnvironmentHandler) CreateEnvironment(c *gin.Context) {
Description: req.Description,
Enabled: true,
}
-
if req.Enabled != nil {
environment.Enabled = *req.Enabled
}
createdEnvironment, err := h.environmentService.CreateEnvironment(c.Request.Context(), environment)
if err != nil {
- c.JSON(http.StatusInternalServerError, gin.H{
- "success": false,
- "error": "Failed to create environment: " + err.Error(),
- })
+ c.JSON(http.StatusInternalServerError, gin.H{"success": false, "data": gin.H{"error": "Failed to create environment: " + err.Error()}})
+ return
+ }
+
+ out, mapErr := dto.MapOne[*models.Environment, dto.EnvironmentDto](createdEnvironment)
+ if mapErr != nil {
+ c.JSON(http.StatusInternalServerError, gin.H{"success": false, "data": gin.H{"error": "Failed to map environment"}})
return
}
c.JSON(http.StatusCreated, gin.H{
- "success": true,
- "environment": createdEnvironment,
- "message": "Environment created successfully",
+ "success": true,
+ "data": out,
})
}
+// List (paginated)
func (h *EnvironmentHandler) ListEnvironments(c *gin.Context) {
- environments, err := h.environmentService.ListEnvironments(c.Request.Context())
+ var req utils.SortedPaginationRequest
+ if err := c.ShouldBindQuery(&req); err != nil {
+ c.JSON(http.StatusBadRequest, gin.H{"success": false, "data": gin.H{"error": "Invalid pagination or sort parameters: " + err.Error()}})
+ return
+ }
+ if req.Pagination.Page == 0 {
+ req.Pagination.Page = 1
+ }
+ if req.Pagination.Limit == 0 {
+ req.Pagination.Limit = 20
+ }
+
+ envs, pagination, err := h.environmentService.ListEnvironmentsPaginated(c.Request.Context(), req)
if err != nil {
- c.JSON(http.StatusInternalServerError, gin.H{
- "success": false,
- "error": "Failed to fetch environments",
- })
+ c.JSON(http.StatusInternalServerError, gin.H{"success": false, "data": gin.H{"error": "Failed to fetch environments"}})
return
}
c.JSON(http.StatusOK, gin.H{
- "success": true,
- "environments": environments,
- "count": len(environments),
+ "success": true,
+ "data": envs,
+ "pagination": pagination,
})
}
+// Get by ID
func (h *EnvironmentHandler) GetEnvironment(c *gin.Context) {
environmentID := c.Param("id")
environment, err := h.environmentService.GetEnvironmentByID(c.Request.Context(), environmentID)
if err != nil {
- c.JSON(http.StatusNotFound, gin.H{
- "success": false,
- "error": "Environment not found",
- })
+ c.JSON(http.StatusNotFound, gin.H{"success": false, "data": gin.H{"error": "Environment not found"}})
+ return
+ }
+
+ out, mapErr := dto.MapOne[*models.Environment, dto.EnvironmentDto](environment)
+ if mapErr != nil {
+ c.JSON(http.StatusInternalServerError, gin.H{"success": false, "data": gin.H{"error": "Failed to map environment"}})
return
}
c.JSON(http.StatusOK, gin.H{
- "success": true,
- "environment": environment,
+ "success": true,
+ "data": out,
})
}
+// Update
func (h *EnvironmentHandler) UpdateEnvironment(c *gin.Context) {
environmentID := c.Param("id")
var req dto.UpdateEnvironmentDto
if err := c.ShouldBindJSON(&req); err != nil {
- c.JSON(http.StatusBadRequest, gin.H{
- "success": false,
- "error": "Invalid request format: " + err.Error(),
- })
+ c.JSON(http.StatusBadRequest, gin.H{"success": false, "data": gin.H{"error": "Invalid request format: " + err.Error()}})
return
}
@@ -455,66 +467,64 @@ func (h *EnvironmentHandler) UpdateEnvironment(c *gin.Context) {
}
if len(updates) == 0 {
- c.JSON(http.StatusBadRequest, gin.H{
- "success": false,
- "error": "No fields to update",
- })
+ c.JSON(http.StatusBadRequest, gin.H{"success": false, "data": gin.H{"error": "No fields to update"}})
return
}
updatedEnvironment, err := h.environmentService.UpdateEnvironment(c.Request.Context(), environmentID, updates)
if err != nil {
- c.JSON(http.StatusInternalServerError, gin.H{
- "success": false,
- "error": "Failed to update environment: " + err.Error(),
- })
+ c.JSON(http.StatusInternalServerError, gin.H{"success": false, "data": gin.H{"error": "Failed to update environment: " + err.Error()}})
+ return
+ }
+
+ out, mapErr := dto.MapOne[*models.Environment, dto.EnvironmentDto](updatedEnvironment)
+ if mapErr != nil {
+ c.JSON(http.StatusInternalServerError, gin.H{"success": false, "data": gin.H{"error": "Failed to map environment"}})
return
}
c.JSON(http.StatusOK, gin.H{
- "success": true,
- "environment": updatedEnvironment,
- "message": "Environment updated successfully",
+ "success": true,
+ "data": out,
})
}
+// Delete
func (h *EnvironmentHandler) DeleteEnvironment(c *gin.Context) {
environmentID := c.Param("id")
err := h.environmentService.DeleteEnvironment(c.Request.Context(), environmentID)
if err != nil {
- c.JSON(http.StatusInternalServerError, gin.H{
- "success": false,
- "error": "Failed to delete environment: " + err.Error(),
- })
+ c.JSON(http.StatusInternalServerError, gin.H{"success": false, "data": gin.H{"error": "Failed to delete environment: " + err.Error()}})
return
}
c.JSON(http.StatusOK, gin.H{
"success": true,
- "message": "Environment deleted successfully",
+ "data": gin.H{"message": "Environment deleted successfully"},
})
}
+// TestConnection
func (h *EnvironmentHandler) TestConnection(c *gin.Context) {
environmentID := c.Param("id")
status, err := h.environmentService.TestConnection(c.Request.Context(), environmentID)
-
- response := dto.TestConnectionDto{
- Status: status,
- }
-
+ resp := dto.TestConnectionDto{Status: status}
if err != nil {
- response.Message = func() *string { s := err.Error(); return &s }()
- }
-
- httpStatus := http.StatusOK
- if status == "error" {
- httpStatus = http.StatusServiceUnavailable
+ msg := err.Error()
+ resp.Message = &msg
+ c.JSON(http.StatusServiceUnavailable, gin.H{
+ "success": false,
+ "data": resp,
+ })
+ return
}
- c.JSON(httpStatus, response)
+ c.JSON(http.StatusOK, gin.H{
+ "success": true,
+ "data": resp,
+ })
}
func (h *EnvironmentHandler) UpdateHeartbeat(c *gin.Context) {
diff --git a/backend/internal/api/event_handler.go b/backend/internal/api/event_handler.go
index 401a24bf0..d5f4757e9 100644
--- a/backend/internal/api/event_handler.go
+++ b/backend/internal/api/event_handler.go
@@ -26,7 +26,7 @@ func (h *EventHandler) ListEvents(c *gin.Context) {
if err := c.ShouldBindQuery(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
- "error": "Invalid pagination or sort parameters: " + err.Error(),
+ "data": gin.H{"error": "Invalid pagination or sort parameters: " + err.Error()},
})
return
}
@@ -42,7 +42,7 @@ func (h *EventHandler) ListEvents(c *gin.Context) {
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
- "error": "Failed to list events: " + err.Error(),
+ "data": gin.H{"error": "Failed to list events: " + err.Error()},
})
return
}
@@ -59,7 +59,7 @@ func (h *EventHandler) GetEventsByEnvironment(c *gin.Context) {
if environmentID == "" {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
- "error": "Environment ID is required",
+ "data": gin.H{"error": "Environment ID is required"},
})
return
}
@@ -68,7 +68,7 @@ func (h *EventHandler) GetEventsByEnvironment(c *gin.Context) {
if err := c.ShouldBindQuery(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
- "error": "Invalid pagination or sort parameters: " + err.Error(),
+ "data": gin.H{"error": "Invalid pagination or sort parameters: " + err.Error()},
})
return
}
@@ -84,7 +84,7 @@ func (h *EventHandler) GetEventsByEnvironment(c *gin.Context) {
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
- "error": "Failed to list events: " + err.Error(),
+ "data": gin.H{"error": "Failed to list events: " + err.Error()},
})
return
}
@@ -101,7 +101,7 @@ func (h *EventHandler) CreateEvent(c *gin.Context) {
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
- "error": "Invalid request body: " + err.Error(),
+ "data": gin.H{"error": "Invalid request body: " + err.Error()},
})
return
}
@@ -110,7 +110,7 @@ func (h *EventHandler) CreateEvent(c *gin.Context) {
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
- "error": "Failed to create event: " + err.Error(),
+ "data": gin.H{"error": "Failed to create event: " + err.Error()},
})
return
}
@@ -126,7 +126,7 @@ func (h *EventHandler) DeleteEvent(c *gin.Context) {
if eventID == "" {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
- "error": "Event ID is required",
+ "data": gin.H{"error": "Event ID is required"},
})
return
}
@@ -134,14 +134,14 @@ func (h *EventHandler) DeleteEvent(c *gin.Context) {
if err := h.eventService.DeleteEvent(c.Request.Context(), eventID); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
- "error": "Failed to delete event: " + err.Error(),
+ "data": gin.H{"error": "Failed to delete event: " + err.Error()},
})
return
}
c.JSON(http.StatusOK, gin.H{
"success": true,
- "message": "Event deleted successfully",
+ "data": gin.H{"message": "Event deleted successfully"},
})
}
@@ -155,7 +155,7 @@ func (h *EventHandler) DeleteOldEvents(c *gin.Context) {
if err != nil || days <= 0 {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
- "error": "Invalid or missing 'days' parameter",
+ "data": gin.H{"error": "Invalid or missing 'days' parameter"},
})
return
}
@@ -164,13 +164,13 @@ func (h *EventHandler) DeleteOldEvents(c *gin.Context) {
if err := h.eventService.DeleteOldEvents(c.Request.Context(), duration); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
- "error": "Failed to delete old events: " + err.Error(),
+ "data": gin.H{"error": "Failed to delete old events: " + err.Error()},
})
return
}
c.JSON(http.StatusOK, gin.H{
"success": true,
- "message": "Old events deleted successfully",
+ "data": gin.H{"message": "Old events deleted successfully"},
})
}
diff --git a/backend/internal/bootstrap/bootstrap.go b/backend/internal/bootstrap/bootstrap.go
index 2cdbf3262..ebaee656f 100644
--- a/backend/internal/bootstrap/bootstrap.go
+++ b/backend/internal/bootstrap/bootstrap.go
@@ -88,7 +88,7 @@ func InitializeApp() (*App, error) {
}
slog.InfoContext(appCtx, "Performing initial Docker image synchronization with the database")
- if _, err := appServices.Image.ListImages(appCtx); err != nil {
+ if err := appServices.Image.SyncDockerImages(appCtx); err != nil {
slog.WarnContext(appCtx, "Initial Docker image synchronization failed, image data may be stale",
slog.String("error", err.Error()))
} else {
diff --git a/backend/internal/dto/container_registry_dto.go b/backend/internal/dto/container_registry_dto.go
new file mode 100644
index 000000000..7a0ed1610
--- /dev/null
+++ b/backend/internal/dto/container_registry_dto.go
@@ -0,0 +1,14 @@
+package dto
+
+import "time"
+
+type ContainerRegistryDto struct {
+ ID string `json:"id"`
+ URL string `json:"url"`
+ Username string `json:"username"`
+ Description *string `json:"description,omitempty"`
+ Insecure bool `json:"insecure"`
+ Enabled bool `json:"enabled"`
+ CreatedAt time.Time `json:"createdAt"`
+ UpdatedAt time.Time `json:"updatedAt"`
+}
diff --git a/backend/internal/dto/environment_dto.go b/backend/internal/dto/environment_dto.go
index 569616424..dcc813f6b 100644
--- a/backend/internal/dto/environment_dto.go
+++ b/backend/internal/dto/environment_dto.go
@@ -18,3 +18,15 @@ type TestConnectionDto struct {
Status string `json:"status"`
Message *string `json:"message,omitempty"`
}
+
+type EnvironmentDto struct {
+ ID string `json:"id"`
+ Hostname string `json:"hostname"`
+ ApiUrl string `json:"apiUrl"`
+ Description *string `json:"description,omitempty"`
+ Status string `json:"status"`
+ Enabled bool `json:"enabled"`
+ LastSeen *string `json:"lastSeen,omitempty"`
+ CreatedAt string `json:"createdAt"`
+ UpdatedAt *string `json:"updatedAt,omitempty"`
+}
diff --git a/backend/internal/models/environment.go b/backend/internal/models/environment.go
index 069c215df..e4f72ce92 100644
--- a/backend/internal/models/environment.go
+++ b/backend/internal/models/environment.go
@@ -6,14 +6,14 @@ import (
type Environment struct {
ID string `json:"id" gorm:"primaryKey"`
- Hostname string `json:"hostname" gorm:"not null"`
- ApiUrl string `json:"apiUrl" gorm:"column:api_url;not null"`
- Description *string `json:"description"`
- Status string `json:"status" gorm:"default:offline"`
- Enabled bool `json:"enabled" gorm:"default:true"`
- LastSeen *time.Time `json:"lastSeen" gorm:"column:last_seen"`
- CreatedAt time.Time `json:"createdAt" gorm:"column:created_at"`
- UpdatedAt *time.Time `json:"updatedAt" gorm:"column:updated_at"`
+ Hostname string `json:"hostname" gorm:"not null" sortable:"true"`
+ ApiUrl string `json:"apiUrl" gorm:"column:api_url;not null" sortable:"true"`
+ Description *string `json:"description" sortable:"true"`
+ Status string `json:"status" gorm:"default:offline" sortable:"true"`
+ Enabled bool `json:"enabled" gorm:"default:true" sortable:"true"`
+ LastSeen *time.Time `json:"lastSeen" gorm:"column:last_seen" sortable:"true"`
+ CreatedAt time.Time `json:"createdAt" gorm:"column:created_at" sortable:"true"`
+ UpdatedAt *time.Time `json:"updatedAt" gorm:"column:updated_at" sortable:"true"`
}
func (Environment) TableName() string {
diff --git a/backend/internal/services/container_registry_service.go b/backend/internal/services/container_registry_service.go
index 0df2b1c36..31ad4b318 100644
--- a/backend/internal/services/container_registry_service.go
+++ b/backend/internal/services/container_registry_service.go
@@ -7,6 +7,7 @@ import (
"time"
"github.com/ofkm/arcane-backend/internal/database"
+ "github.com/ofkm/arcane-backend/internal/dto"
"github.com/ofkm/arcane-backend/internal/models"
"github.com/ofkm/arcane-backend/internal/utils"
)
@@ -27,7 +28,7 @@ func (s *ContainerRegistryService) GetAllRegistries(ctx context.Context) ([]mode
return registries, nil
}
-func (s *ContainerRegistryService) GetRegistriesPaginated(ctx context.Context, req utils.SortedPaginationRequest) ([]models.ContainerRegistry, utils.PaginationResponse, error) {
+func (s *ContainerRegistryService) GetRegistriesPaginated(ctx context.Context, req utils.SortedPaginationRequest) ([]dto.ContainerRegistryDto, utils.PaginationResponse, error) {
var registries []models.ContainerRegistry
query := s.db.WithContext(ctx).Model(&models.ContainerRegistry{})
@@ -41,7 +42,12 @@ func (s *ContainerRegistryService) GetRegistriesPaginated(ctx context.Context, r
return nil, utils.PaginationResponse{}, fmt.Errorf("failed to paginate container registries: %w", err)
}
- return registries, pagination, nil
+ out, mapErr := dto.MapSlice[models.ContainerRegistry, dto.ContainerRegistryDto](registries)
+ if mapErr != nil {
+ return nil, utils.PaginationResponse{}, fmt.Errorf("failed to map registries: %w", mapErr)
+ }
+
+ return out, pagination, nil
}
func (s *ContainerRegistryService) GetRegistryByID(ctx context.Context, id string) (*models.ContainerRegistry, error) {
diff --git a/backend/internal/services/environment_service.go b/backend/internal/services/environment_service.go
index 308290ded..ba6609949 100644
--- a/backend/internal/services/environment_service.go
+++ b/backend/internal/services/environment_service.go
@@ -9,7 +9,9 @@ import (
"github.com/google/uuid"
"github.com/ofkm/arcane-backend/internal/database"
+ "github.com/ofkm/arcane-backend/internal/dto"
"github.com/ofkm/arcane-backend/internal/models"
+ "github.com/ofkm/arcane-backend/internal/utils"
"gorm.io/gorm"
)
@@ -54,6 +56,51 @@ func (s *EnvironmentService) ListEnvironments(ctx context.Context) ([]*models.En
return environments, nil
}
+func (s *EnvironmentService) ListEnvironmentsPaginated(ctx context.Context, req utils.SortedPaginationRequest) ([]dto.EnvironmentDto, utils.PaginationResponse, error) {
+ var envs []models.Environment
+ q := s.db.WithContext(ctx).Model(&models.Environment{})
+
+ if req.Search != "" {
+ like := "%" + req.Search + "%"
+ q = q.Where(
+ s.db.Or("hostname ILIKE ?", like).
+ Or("api_url ILIKE ?", like).
+ Or("description ILIKE ?", like),
+ )
+ }
+
+ if req.Filters != nil {
+ if v, ok := req.Filters["status"]; ok && v != nil && v != "" {
+ q = q.Where("status = ?", v)
+ }
+ if v, ok := req.Filters["enabled"]; ok && v != nil && v != "" {
+ switch vv := v.(type) {
+ case bool:
+ q = q.Where("enabled = ?", vv)
+ case string:
+ switch vv {
+ case "true", "1":
+ q = q.Where("enabled = ?", true)
+ case "false", "0":
+ q = q.Where("enabled = ?", false)
+ }
+ }
+ }
+ }
+
+ pagination, err := utils.PaginateAndSort(req, q, &envs)
+ if err != nil {
+ return nil, utils.PaginationResponse{}, fmt.Errorf("failed to paginate environments: %w", err)
+ }
+
+ out, mapErr := dto.MapSlice[models.Environment, dto.EnvironmentDto](envs)
+ if mapErr != nil {
+ return nil, utils.PaginationResponse{}, fmt.Errorf("failed to map environments: %w", mapErr)
+ }
+
+ return out, pagination, nil
+}
+
func (s *EnvironmentService) UpdateEnvironment(ctx context.Context, id string, updates map[string]interface{}) (*models.Environment, error) {
now := time.Now()
updates["updated_at"] = &now
diff --git a/backend/internal/services/event_service.go b/backend/internal/services/event_service.go
index 37ff03035..27f2612bc 100644
--- a/backend/internal/services/event_service.go
+++ b/backend/internal/services/event_service.go
@@ -102,14 +102,12 @@ func (s *EventService) ListEventsPaginated(ctx context.Context, req utils.Sorted
query := s.db.WithContext(ctx).Model(&models.Event{})
- // Apply search filter - fix the Where clause structure
if req.Search != "" {
searchQuery := "%" + req.Search + "%"
query = query.Where("title LIKE ? OR description LIKE ? OR resource_name LIKE ? OR username LIKE ?",
searchQuery, searchQuery, searchQuery, searchQuery)
}
- // Apply filters if any
if req.Filters != nil {
for key, value := range req.Filters {
if value != nil && value != "" {
@@ -134,9 +132,9 @@ func (s *EventService) ListEventsPaginated(ctx context.Context, req utils.Sorted
return nil, utils.PaginationResponse{}, fmt.Errorf("failed to paginate events: %w", err)
}
- eventDtos := make([]dto.EventDto, len(events))
- for i, event := range events {
- eventDtos[i] = *s.toEventDto(&event)
+ eventDtos, mapErr := dto.MapSlice[models.Event, dto.EventDto](events)
+ if mapErr != nil {
+ return nil, utils.PaginationResponse{}, fmt.Errorf("failed to map events: %w", mapErr)
}
return eventDtos, pagination, nil
@@ -147,14 +145,12 @@ func (s *EventService) GetEventsByEnvironmentPaginated(ctx context.Context, envi
query := s.db.WithContext(ctx).Model(&models.Event{}).Where("environment_id = ?", environmentID)
- // Apply search filter - fix the Where clause structure
if req.Search != "" {
searchQuery := "%" + req.Search + "%"
query = query.Where("title LIKE ? OR description LIKE ? OR resource_name LIKE ? OR username LIKE ?",
searchQuery, searchQuery, searchQuery, searchQuery)
}
- // Apply filters if any
if req.Filters != nil {
for key, value := range req.Filters {
if value != nil && value != "" {
@@ -177,9 +173,9 @@ func (s *EventService) GetEventsByEnvironmentPaginated(ctx context.Context, envi
return nil, utils.PaginationResponse{}, fmt.Errorf("failed to paginate events: %w", err)
}
- eventDtos := make([]dto.EventDto, len(events))
- for i, event := range events {
- eventDtos[i] = *s.toEventDto(&event)
+ eventDtos, mapErr := dto.MapSlice[models.Event, dto.EventDto](events)
+ if mapErr != nil {
+ return nil, utils.PaginationResponse{}, fmt.Errorf("failed to map events: %w", mapErr)
}
return eventDtos, pagination, nil
diff --git a/backend/internal/services/image_service.go b/backend/internal/services/image_service.go
index 8fd575d70..a02c3e3cb 100644
--- a/backend/internal/services/image_service.go
+++ b/backend/internal/services/image_service.go
@@ -42,23 +42,22 @@ func NewImageService(db *database.DB, dockerService *DockerClientService, regist
}
}
-func (s *ImageService) ListImages(ctx context.Context) ([]image.Summary, error) {
+func (s *ImageService) SyncDockerImages(ctx context.Context) error {
dockerClient, err := s.dockerService.CreateConnection(ctx)
if err != nil {
- return nil, fmt.Errorf("failed to connect to Docker: %w", err)
+ return fmt.Errorf("failed to connect to Docker: %w", err)
}
defer dockerClient.Close()
images, err := dockerClient.ImageList(ctx, image.ListOptions{})
if err != nil {
- return nil, fmt.Errorf("failed to list Docker images: %w", err)
+ return fmt.Errorf("failed to list Docker images: %w", err)
}
- if syncErr := s.syncImagesToDatabase(ctx, images, dockerClient); syncErr != nil {
- fmt.Printf("Warning: error during image synchronization in ListImages: %v\n", syncErr)
+ if err := s.syncImagesToDatabase(ctx, images, dockerClient); err != nil {
+ return fmt.Errorf("error during image synchronization: %w", err)
}
-
- return images, nil
+ return nil
}
func (s *ImageService) GetImageByID(ctx context.Context, id string) (*image.InspectResponse, error) {
@@ -83,7 +82,6 @@ func (s *ImageService) RemoveImage(ctx context.Context, id string, force bool, u
}
defer dockerClient.Close()
- // Get image details for logging before deletion
imageDetails, inspectErr := dockerClient.ImageInspect(ctx, id)
var imageName string
if inspectErr == nil && len(imageDetails.RepoTags) > 0 {
@@ -104,7 +102,6 @@ func (s *ImageService) RemoveImage(ctx context.Context, id string, force bool, u
s.db.WithContext(ctx).Delete(&models.Image{}, "id = ?", id)
- // Log image deletion event
metadata := models.JSON{
"action": "delete",
"imageId": id,
@@ -126,11 +123,10 @@ func (s *ImageService) PullImage(ctx context.Context, imageName string, progress
fmt.Printf("Attempting to pull image: %s\n", imageName)
- // Get authentication for the registry
pullOptions, err := s.getPullOptionsWithAuth(ctx, imageName)
if err != nil {
fmt.Printf("Warning: Failed to get registry authentication for %s: %v\n", imageName, err)
- pullOptions = image.PullOptions{} // Fall back to no auth
+ pullOptions = image.PullOptions{}
}
reader, err := dockerClient.ImagePull(ctx, imageName, pullOptions)
@@ -188,7 +184,6 @@ func (s *ImageService) PullImage(ctx context.Context, imageName string, progress
return nil
}
-// getPullOptionsWithAuth gets pull options with appropriate registry authentication
func (s *ImageService) getPullOptionsWithAuth(ctx context.Context, imageRef string) (image.PullOptions, error) {
pullOptions := image.PullOptions{}
@@ -229,7 +224,6 @@ func (s *ImageService) getPullOptionsWithAuth(ctx context.Context, imageRef stri
return pullOptions, nil
}
-// extractRegistryHost extracts the registry hostname from an image reference
func (s *ImageService) extractRegistryHost(imageRef string) string {
parts := strings.Split(imageRef, "@")
if len(parts) > 1 {
@@ -280,7 +274,6 @@ func (s *ImageService) normalizeRegistryURL(url string) string {
return "https://index.docker.io/v1/"
}
- // For other registries, return raw hostname without protocol
result := strings.TrimPrefix(url, "https://")
result = strings.TrimPrefix(result, "http://")
result = strings.TrimSuffix(result, "/")
@@ -305,7 +298,6 @@ func (s *ImageService) PruneImages(ctx context.Context, dangling bool) (*image.P
return nil, fmt.Errorf("failed to prune images: %w", err)
}
- // Log image prune event using system user since this is typically a system operation
metadata := models.JSON{
"action": "prune",
"dangling": dangling,
@@ -387,7 +379,6 @@ func (s *ImageService) buildImageModel(di image.Summary, isInUse bool) models.Im
Created: time.Unix(di.Created, 0),
InUse: isInUse,
}
- // Persist the Docker image ID as our primary key so upserts and cleanup work correctly.
imageModel.ID = di.ID
if di.Labels != nil {
@@ -403,7 +394,6 @@ func (s *ImageService) buildImageModel(di image.Summary, isInUse bool) models.Im
}
func (s *ImageService) setRepoAndTag(imageModel *models.Image, repoTags []string) {
- // Prefer the first meaningful tag (skip empty and <none>)
var repoTag string
for _, t := range repoTags {
if t != "" && !strings.Contains(t, "<none>") {
@@ -459,16 +449,14 @@ func (s *ImageService) deleteAllImages(ctx context.Context) error {
}
func (s *ImageService) ListImagesWithUpdates(ctx context.Context) ([]*models.Image, error) {
- _, err := s.ListImages(ctx)
+ err := s.SyncDockerImages(ctx)
if err != nil {
return nil, fmt.Errorf("failed to list and sync Docker images: %w", err)
}
-
var images []*models.Image
if err := s.db.WithContext(ctx).Preload("UpdateRecord").Find(&images).Error; err != nil {
return nil, fmt.Errorf("failed to get images with update data from DB: %w", err)
}
-
return images, nil
}
@@ -490,42 +478,39 @@ func (s *ImageService) DeleteImageByDockerID(ctx context.Context, dockerImageID
}
func (s *ImageService) ListImagesWithUpdatesPaginated(ctx context.Context, req utils.SortedPaginationRequest) ([]dto.ImageSummaryDto, utils.PaginationResponse, error) {
- _, err := s.ListImages(ctx)
+ err := s.SyncDockerImages(ctx)
if err != nil {
return nil, utils.PaginationResponse{}, fmt.Errorf("failed to list and sync Docker images: %w", err)
}
-
var images []models.Image
query := s.db.WithContext(ctx).Model(&models.Image{}).Preload("UpdateRecord")
-
- if req.Sort.Column != "" {
- dir := utils.NormalizeSortDirection(req.Sort.Direction)
- col := utils.CamelCaseToSnakeCase(req.Sort.Column)
- query = query.Order(col + " " + dir)
+ if term := strings.TrimSpace(req.Search); term != "" {
+ like := "%" + strings.ToLower(term) + "%"
+ query = query.Where(`
+ LOWER(repo) LIKE ? OR
+ LOWER(tag) LIKE ? OR
+ LOWER(id) LIKE ? OR
+ LOWER(repo || ':' || tag) LIKE ?
+ `, like, like, like, like)
}
-
pagination, err := utils.PaginateAndSort(req, query, &images)
if err != nil {
return nil, utils.PaginationResponse{}, fmt.Errorf("failed to paginate images: %w", err)
}
-
result := make([]dto.ImageSummaryDto, 0, len(images))
for i := range images {
result = append(result, dto.NewImageSummaryDto(&images[i]))
}
-
return result, pagination, nil
}
func (s *ImageService) GetTotalImageSize(ctx context.Context) (int64, error) {
- images, err := s.ListImages(ctx)
- if err != nil {
- return 0, fmt.Errorf("failed to list images: %w", err)
+ if err := s.SyncDockerImages(ctx); err != nil {
+ return 0, fmt.Errorf("failed to sync images: %w", err)
}
-
var total int64
- for _, img := range images {
- total += img.Size
+ if err := s.db.WithContext(ctx).Model(&models.Image{}).Select("COALESCE(SUM(size), 0)").Scan(&total).Error; err != nil {
+ return 0, fmt.Errorf("failed to sum image sizes: %w", err)
}
return total, nil
}
diff --git a/frontend/jsrepo.json b/frontend/jsrepo.json
index 7676ff04a..683f7362f 100644
--- a/frontend/jsrepo.json
+++ b/frontend/jsrepo.json
@@ -3,7 +3,7 @@
"repos": ["@ieedan/shadcn-svelte-extras"],
"includeTests": false,
"includeDocs": false,
- "watermark": true,
+ "watermark": false,
"formatter": "prettier",
"configFiles": {},
"paths": {
diff --git a/frontend/package.json b/frontend/package.json
index c0b415f8f..948291fc7 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -3,6 +3,7 @@
"private": true,
"version": "1.0.0-preview.1",
"type": "module",
+ "packageManager": "[email protected]",
"scripts": {
"dev": "vite dev --port 3000",
"build": "vite build",
@@ -34,13 +35,15 @@
"@eslint/compat": "^1.3.2",
"@eslint/js": "^9.33.0",
"@internationalized/date": "^3.8.2",
- "@lucide/svelte": "^0.525.0",
+ "@lucide/svelte": "^0.542.0",
"@sveltejs/kit": "^2.31.0",
"@sveltejs/vite-plugin-svelte": "^6.1.2",
"@tailwindcss/vite": "^4.1.12",
+ "@types/bytes": "^3.1.5",
"@types/dockerode": "^3.3.42",
"@types/js-yaml": "^4.0.9",
"bits-ui": "^2.9.3",
+ "bytes": "^3.1.2",
"clsx": "^2.1.1",
"eslint": "^9.33.0",
"eslint-plugin-svelte": "^3.11.0",
diff --git a/frontend/src/app.css b/frontend/src/app.css
index 2fddf4883..5c319ed9d 100644
--- a/frontend/src/app.css
+++ b/frontend/src/app.css
@@ -34,7 +34,7 @@
}
:root {
- --radius: 0.5rem;
+ --radius: 0.65rem;
--background: oklch(1 0 0);
--foreground: oklch(0.141 0.005 285.823);
--card: oklch(1 0 0);
@@ -103,13 +103,11 @@
}
@theme inline {
- /* Radius (for rounded-*) */
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
- /* Colors */
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-muted: var(--muted);
@@ -153,55 +151,6 @@
}
}
-.dashboard-table-wrapper :global(.space-y-4) {
- margin-top: 0 !important;
- margin-bottom: 0 !important;
-}
-
-.dashboard-table-wrapper :global(.rounded-md.border) {
- border: none !important;
- border-radius: 0 !important;
- overflow: hidden;
-}
-
-.dashboard-table-wrapper :global(table) {
- margin: 0;
-}
-
-.dashboard-table-wrapper :global(th) {
- background-color: transparent !important;
- font-size: 0.75rem !important;
- font-weight: 500 !important;
- color: var(--muted-foreground) !important;
- padding-left: 1.5rem !important;
- padding-right: 1.5rem !important;
- height: 2.5rem !important;
- text-transform: uppercase !important;
- letter-spacing: 0.04em !important;
-}
-
-.dashboard-table-wrapper :global(td) {
- padding-left: 1.5rem !important;
- padding-right: 1.5rem !important;
- font-size: 0.875rem !important;
-}
-
-.dashboard-table-wrapper :global(tr:last-child td) {
- border-bottom: none !important;
-}
-
-.dashboard-table-wrapper > :global(div) > :global(div:first-child) {
- display: none !important;
-}
-
-.dashboard-table-wrapper > :global(div.space-y-4) > :global(div) {
- margin-top: 0 !important;
-}
-
-.dashboard-table-wrapper > :global(div.space-y-4) > :global(div:last-child) {
- display: none !important;
-}
-
.version-collapsed {
writing-mode: vertical-rl;
text-orientation: mixed;
@@ -209,118 +158,7 @@
opacity: 0.7;
}
-[class*='arcane-button-'] {
- position: relative;
- transition: all 0.2s ease;
- border-radius: 0.5rem !important;
- overflow: visible !important;
- z-index: 0;
- font-weight: 500;
- letter-spacing: 0.01em;
- box-shadow: none !important;
-}
-
-[class*='arcane-button-']:hover {
- transform: translateY(-1px);
-}
-
-.arcane-button-start,
-.arcane-button-deploy,
-.arcane-button-confirm,
-.arcane-button-save,
-.arcane-button-create {
- background-color: var(--primary) !important;
- color: white !important;
- border: none !important;
-}
-.arcane-button-start:hover,
-.arcane-button-deploy:hover,
-.arcane-button-confirm:hover,
-.arcane-button-save:hover,
-.arcane-button-create:hover {
- background-color: hsl(262.1 83.3% 52%) !important;
-}
-
-.arcane-button-create {
- background-color: hsl(262.1 83.3% 62%) !important;
-}
-.arcane-button-create:hover {
- background-color: hsl(262.1 83.3% 57%) !important;
-}
-
-.arcane-button-stop,
-.arcane-button-remove {
- background-color: transparent !important;
- color: var(--destructive) !important;
- border: 1px solid var(--destructive) !important;
-}
-.arcane-button-stop:hover,
-.arcane-button-remove:hover {
- background-color: hsla(0, 72.22%, 50.59%, 0.1) !important;
-}
-
-.dark .arcane-button-stop,
-.dark .arcane-button-remove {
- color: hsl(0 72.22% 65%) !important;
- border-color: hsl(0 72.22% 50%) !important;
-}
-.dark .arcane-button-stop:hover,
-.dark .arcane-button-remove:hover {
- background-color: hsla(0, 72.22%, 50%, 0.15) !important;
-}
-
-.arcane-button-restart,
-.arcane-button-pull,
-.arcane-button-redeploy,
-.arcane-button-edit {
- background-color: transparent !important;
- color: var(--primary) !important;
- border: 1px solid var(--primary) !important;
-}
-.arcane-button-restart:hover,
-.arcane-button-pull:hover,
-.arcane-button-redeploy:hover,
-.arcane-button-edit:hover {
- background-color: hsla(262.1, 83.3%, 50%, 0.1) !important;
-}
-
-.dark .arcane-button-restart,
-.dark .arcane-button-pull,
-.dark .arcane-button-redeploy,
-.dark .arcane-button-edit {
- color: hsl(263.4 70% 80%) !important;
- border-color: hsl(263.4 70% 60%) !important;
-}
-.dark .arcane-button-restart:hover,
-.dark .arcane-button-pull:hover,
-.dark .arcane-button-redeploy:hover,
-.dark .arcane-button-edit:hover {
- background-color: hsla(263.4, 70%, 60%, 0.15) !important;
-}
-
-.arcane-button-inspect,
-.arcane-button-logs,
-.arcane-button-cancel {
- background-color: transparent !important;
- color: var(--muted-foreground) !important;
- border: 1px solid var(--muted) !important;
-}
-.arcane-button-inspect:hover,
-.arcane-button-logs:hover,
-.arcane-button-cancel:hover {
- background-color: hsla(220, 14.3%, 50%, 0.1) !important;
-}
-.dark .arcane-button-inspect,
-.dark .arcane-button-logs,
-.dark .arcane-button-cancel {
- color: hsl(217.9 10.6% 74.9%) !important;
- border-color: hsl(215 27.9% 30%) !important;
-}
-.dark .arcane-button-inspect:hover,
-.dark .arcane-button-logs:hover,
-.dark .arcane-button-cancel:hover {
- background-color: hsla(215, 27.9%, 40%, 0.15) !important;
-}
+/* Removed legacy arcane-button CSS; component now uses Tailwind classes via tv() */
html,
body {
@@ -409,7 +247,6 @@ main {
@apply text-muted-foreground mt-1 text-sm;
}
-/* Form element consistency */
.settings-form-section {
@apply space-y-4;
}
diff --git a/frontend/src/lib/components/action-buttons.svelte b/frontend/src/lib/components/action-buttons.svelte
index 0e02af93b..dd86abe8f 100644
--- a/frontend/src/lib/components/action-buttons.svelte
+++ b/frontend/src/lib/components/action-buttons.svelte
@@ -2,14 +2,24 @@
import { openConfirmDialog } from './confirm-dialog';
import { goto, invalidateAll } from '$app/navigation';
import { toast } from 'svelte-sonner';
- import type { LoadingStates } from '$lib/types/loading-states.type';
import { environmentAPI } from '$lib/services/api';
import { tryCatch } from '$lib/utils/try-catch';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
- import ArcaneButton from './arcane-button.svelte';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
type TargetType = 'container' | 'stack';
+ type LoadingStates = {
+ start?: boolean;
+ stop?: boolean;
+ restart?: boolean;
+ pull?: boolean;
+ deploy?: boolean;
+ redeploy?: boolean;
+ remove?: boolean;
+ validating?: boolean;
+ };
+
let {
id,
type = 'container',
@@ -34,9 +44,7 @@
validating: false
});
- const isRunning = $derived(
- itemState === 'running' || (type === 'stack' && itemState === 'partially running')
- );
+ const isRunning = $derived(itemState === 'running' || (type === 'stack' && itemState === 'partially running'));
$effect(() => {
isLoading.start = loading.start ?? false;
@@ -101,9 +109,7 @@
message: `Failed to Redeploy ${type}`,
setLoadingState: (value) => (isLoading.redeploy = value),
onSuccess: async () => {
- toast.success(
- `${type.charAt(0).toUpperCase() + type.slice(1)} Redeployed Successfully`
- );
+ toast.success(`${type.charAt(0).toUpperCase() + type.slice(1)} Redeployed Successfully`);
await invalidateAll();
}
});
@@ -116,9 +122,7 @@
async function handleStart() {
isLoading.start = true;
handleApiResultWithCallbacks({
- result: await tryCatch(
- type === 'container' ? environmentAPI.startContainer(id) : environmentAPI.startProject(id)
- ),
+ result: await tryCatch(type === 'container' ? environmentAPI.startContainer(id) : environmentAPI.startProject(id)),
message: `Failed to Start ${type}`,
setLoadingState: (value) => (isLoading.start = value),
onSuccess: async () => {
@@ -144,9 +148,7 @@
async function handleStop() {
isLoading.stop = true;
handleApiResultWithCallbacks({
- result: await tryCatch(
- type === 'container' ? environmentAPI.stopContainer(id) : environmentAPI.stopProject(id)
- ),
+ result: await tryCatch(type === 'container' ? environmentAPI.stopContainer(id) : environmentAPI.stopProject(id)),
message: `Failed to Stop ${type}`,
setLoadingState: (value) => (isLoading.stop = value),
onSuccess: async () => {
@@ -159,11 +161,7 @@
async function handleRestart() {
isLoading.restart = true;
handleApiResultWithCallbacks({
- result: await tryCatch(
- type === 'container'
- ? environmentAPI.restartContainer(id)
- : environmentAPI.restartProject(id)
- ),
+ result: await tryCatch(type === 'container' ? environmentAPI.restartContainer(id) : environmentAPI.restartProject(id)),
message: `Failed to Restart ${type}`,
setLoadingState: (value) => (isLoading.restart = value),
onSuccess: async () => {
@@ -176,11 +174,7 @@
async function handlePull() {
isLoading.pulling = true;
handleApiResultWithCallbacks({
- result: await tryCatch(
- type === 'container'
- ? environmentAPI.pullContainerImage(id)
- : environmentAPI.pullProjectImages(id)
- ),
+ result: await tryCatch(type === 'container' ? environmentAPI.pullContainerImage(id) : environmentAPI.pullProjectImages(id)),
message: 'Failed to Pull Image(s)',
setLoadingState: (value) => (isLoading.pulling = value),
onSuccess: async () => {
@@ -195,36 +189,28 @@
{#if !isRunning}
<ArcaneButton
action={type === 'container' ? 'start' : 'deploy'}
- onClick={type === 'container' ? () => handleStart() : () => handleDeploy()}
+ onclick={type === 'container' ? () => handleStart() : () => handleDeploy()}
loading={isLoading.start}
/>
{:else}
<ArcaneButton
- label={type === 'stack' ? 'Down' : 'Stop'}
+ customLabel={type === 'stack' ? 'Down' : 'Stop'}
action="stop"
- onClick={() => handleStop()}
+ onclick={() => handleStop()}
loading={isLoading.stop}
/>
- <ArcaneButton action="restart" onClick={() => handleRestart()} loading={isLoading.restart} />
+ <ArcaneButton action="restart" onclick={() => handleRestart()} loading={isLoading.restart} />
{/if}
{#if type === 'container'}
- <ArcaneButton
- action="remove"
- onClick={() => confirmAction('remove')}
- loading={isLoading.remove}
- />
+ <ArcaneButton action="remove" onclick={() => confirmAction('remove')} loading={isLoading.remove} />
{:else}
+ <ArcaneButton action="redeploy" onclick={() => confirmAction('redeploy')} loading={isLoading.redeploy} />
+ <ArcaneButton action="pull" onclick={handlePull} loading={isLoading.pulling} />
<ArcaneButton
- action="redeploy"
- onClick={() => confirmAction('redeploy')}
- loading={isLoading.redeploy}
- />
- <ArcaneButton action="pull" onClick={handlePull} loading={isLoading.pulling} />
- <ArcaneButton
- label={type === 'stack' ? 'Destroy' : 'Remove'}
+ customLabel={type === 'stack' ? 'Destroy' : 'Remove'}
action="remove"
- onClick={() => confirmAction('remove')}
+ onclick={() => confirmAction('remove')}
loading={isLoading.remove}
/>
{/if}
diff --git a/frontend/src/lib/components/arcane-button.svelte b/frontend/src/lib/components/arcane-button.svelte
deleted file mode 100644
index a2351a52b..000000000
--- a/frontend/src/lib/components/arcane-button.svelte
+++ /dev/null
@@ -1,186 +0,0 @@
-<script lang="ts">
- import { Button, type Props as ButtonProps } from '$lib/components/ui/button/index.js';
- import { Play, StopCircle, RotateCcw, Download, Trash2, Loader2, RefreshCcwDot, ScanSearch, FileText, EditIcon as Edit, Check, X, Save, PlusCircle, type Icon as IconType, LayoutTemplate } from '@lucide/svelte';
-
- type Action = 'start' | 'deploy' | 'stop' | 'restart' | 'remove' | 'pull' | 'redeploy' | 'inspect' | 'logs' | 'edit' | 'confirm' | 'cancel' | 'save' | 'create' | 'template';
-
- interface Props {
- /** The type of action this button represents. Determines icon, default label, and variant. */
- action: Action;
- /** Function to call when the button is clicked. */
- onClick?: (event: MouseEvent) => void;
- /** If true, shows a loading spinner and disables the button. */
- loading?: boolean;
- /** If true, disables the button. */
- disabled?: boolean;
- /** Custom label for the button. Overrides the default label for the action. */
- label?: string;
- /** Custom loading label for the button. Overrides the default loading label for the action. */
- loadingLabel?: string;
- /** If true (default), shows the label text. If false, button will be icon-only. */
- showLabel?: boolean;
- /** Additional CSS classes to apply to the button. */
- class?: string;
- /** Button size. If 'icon', showLabel is effectively false for rendering purposes. */
- size?: ButtonProps['size'];
- /** Alias for label to maintain compatibility */
- customLabel?: string;
- }
-
- let {
- action,
- onClick,
- loading = false,
- disabled = false,
- label: propLabel = undefined,
- customLabel = undefined, // Alternate name for label
- loadingLabel: customLoadingLabel = undefined,
- showLabel = true,
- class: extraClass = '',
- size: customSize = 'default'
- }: Props = $props();
-
- // Use customLabel as fallback for compatibility
- const label = propLabel ?? customLabel;
-
- type ActionConfig = {
- defaultLabel: string;
- IconComponent: typeof IconType;
- variant: ButtonProps['variant'];
- loadingLabel?: string;
- customClass?: string;
- };
-
- const actionConfigs: Record<Action, ActionConfig> = {
- start: {
- defaultLabel: 'Start',
- IconComponent: Play,
- variant: 'default',
- loadingLabel: 'Starting...',
- customClass: 'arcane-button-start'
- },
- deploy: {
- defaultLabel: 'Deploy',
- IconComponent: Play,
- variant: 'default',
- loadingLabel: 'Deploying...',
- customClass: 'arcane-button-deploy'
- },
- stop: {
- defaultLabel: 'Stop',
- IconComponent: StopCircle,
- variant: 'destructive',
- loadingLabel: 'Stopping...',
- customClass: 'arcane-button-stop'
- },
- restart: {
- defaultLabel: 'Restart',
- IconComponent: RotateCcw,
- variant: 'secondary',
- loadingLabel: 'Restarting...',
- customClass: 'arcane-button-restart'
- },
- remove: {
- defaultLabel: 'Remove',
- IconComponent: Trash2,
- variant: 'destructive',
- loadingLabel: 'Removing...',
- customClass: 'arcane-button-remove'
- },
- pull: {
- defaultLabel: 'Pull',
- IconComponent: Download,
- variant: 'secondary',
- loadingLabel: 'Pulling...',
- customClass: 'arcane-button-pull'
- },
- redeploy: {
- defaultLabel: 'Redeploy',
- IconComponent: RefreshCcwDot,
- variant: 'secondary',
- loadingLabel: 'Redeploying...',
- customClass: 'arcane-button-redeploy'
- },
- inspect: {
- defaultLabel: 'Inspect',
- IconComponent: ScanSearch,
- variant: 'outline',
- loadingLabel: 'Inspecting...',
- customClass: 'arcane-button-inspect'
- },
- logs: {
- defaultLabel: 'Logs',
- IconComponent: FileText,
- variant: 'ghost',
- loadingLabel: 'Fetching...',
- customClass: 'arcane-button-logs'
- },
- edit: {
- defaultLabel: 'Edit',
- IconComponent: Edit,
- variant: 'secondary',
- loadingLabel: 'Saving...',
- customClass: 'arcane-button-edit'
- },
- confirm: {
- defaultLabel: 'Confirm',
- IconComponent: Check,
- variant: 'default',
- loadingLabel: 'Confirming...',
- customClass: 'arcane-button-confirm'
- },
- cancel: {
- defaultLabel: 'Cancel',
- IconComponent: X,
- variant: 'ghost',
- loadingLabel: 'Cancelling...',
- customClass: 'arcane-button-cancel'
- },
- save: {
- defaultLabel: 'Save',
- IconComponent: Save,
- variant: 'default',
- loadingLabel: 'Saving...',
- customClass: 'arcane-button-save'
- },
- create: {
- defaultLabel: 'Create',
- IconComponent: PlusCircle,
- variant: 'default',
- loadingLabel: 'Creating...',
- customClass: 'arcane-button-create'
- },
- template: {
- defaultLabel: 'Use Template',
- IconComponent: LayoutTemplate,
- variant: 'secondary',
- loadingLabel: 'Creating...',
- customClass: 'arcane-button-restart'
- }
- };
-
- let config = $derived(actionConfigs[action]);
- let displayLabel = $derived(label ?? config.defaultLabel);
- // Use custom loading label if provided, otherwise use the config's default loading label
- let displayLoadingLabel = $derived(customLoadingLabel ?? config.loadingLabel ?? 'Processing...');
-
- // Determine if the button should render as an icon-only button
- let isIconOnlyButton = $derived(customSize === 'icon' || !showLabel);
-
- // Icon margin class - apply only if label is shown and it's not explicitly an icon-sized button
- let iconMarginClass = $derived(!isIconOnlyButton ? 'mr-2' : '');
-</script>
-
-<Button variant={config.variant} size={customSize} class={`${extraClass} ${config.customClass || ''}`} disabled={disabled || loading} onclick={onClick} aria-label={isIconOnlyButton ? displayLabel : undefined}>
- {#if loading}
- <Loader2 class="animate-spin {iconMarginClass} size-4" />
- {#if !isIconOnlyButton}
- {displayLoadingLabel}
- {/if}
- {:else}
- <config.IconComponent class="{iconMarginClass} size-4" />
- {#if !isIconOnlyButton}
- {displayLabel}
- {/if}
- {/if}
-</Button>
diff --git a/frontend/src/lib/components/arcane-button/arcane-button.svelte b/frontend/src/lib/components/arcane-button/arcane-button.svelte
new file mode 100644
index 000000000..32fdb34f6
--- /dev/null
+++ b/frontend/src/lib/components/arcane-button/arcane-button.svelte
@@ -0,0 +1,117 @@
+<script lang="ts" module>
+ import type { WithChildren, WithoutChildren } from 'bits-ui';
+ import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
+ import type { ArcaneButtonSize, Action } from './variants';
+
+ export type ArcaneButtonPropsWithoutHTML = WithChildren<{
+ ref?: HTMLElement | null;
+ action: Action;
+ size?: ArcaneButtonSize;
+ loading?: boolean;
+ showLabel?: boolean;
+ customLabel?: string;
+ loadingLabel?: string;
+ onClickPromise?: (
+ e: MouseEvent & {
+ currentTarget: EventTarget & HTMLButtonElement;
+ }
+ ) => Promise<void>;
+ }>;
+
+ export type ArcaneAnchorElementProps = ArcaneButtonPropsWithoutHTML &
+ WithoutChildren<Omit<HTMLAnchorAttributes, 'href' | 'type'>> & {
+ href: HTMLAnchorAttributes['href'];
+ type?: never;
+ disabled?: HTMLButtonAttributes['disabled'];
+ };
+
+ export type ArcaneButtonElementProps = ArcaneButtonPropsWithoutHTML &
+ WithoutChildren<Omit<HTMLButtonAttributes, 'type' | 'href'>> & {
+ type?: HTMLButtonAttributes['type'];
+ href?: never;
+ disabled?: HTMLButtonAttributes['disabled'];
+ };
+
+ export type ArcaneButtonProps = ArcaneAnchorElementProps | ArcaneButtonElementProps;
+</script>
+
+<script lang="ts">
+ import { cn } from '$lib/utils';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import { arcaneButtonVariants, actionConfigs } from './variants';
+
+ let {
+ ref = $bindable(null),
+ action,
+ size = 'default',
+ href = undefined,
+ type = 'button',
+ loading = false,
+ disabled = false,
+ showLabel = true,
+ customLabel = undefined,
+ loadingLabel = undefined,
+ tabindex = 0,
+ onclick,
+ onClickPromise,
+ class: className,
+ children,
+ ...rest
+ }: ArcaneButtonProps = $props();
+
+ let config = $derived(actionConfigs[action]);
+ let displayLabel = $derived(customLabel ?? config.defaultLabel);
+ let displayLoadingLabel = $derived(loadingLabel ?? config.loadingLabel ?? 'Processing...');
+ let isIconOnlyButton = $derived(size === 'icon' || !showLabel);
+
+ let hasChildren = $derived(!!children);
+ let shouldUseInternalContent = $derived(!hasChildren);
+</script>
+
+<svelte:element
+ this={href ? 'a' : 'button'}
+ {...rest}
+ data-slot="arcane-button"
+ type={href ? undefined : type}
+ href={href && !disabled ? href : undefined}
+ disabled={href ? undefined : disabled || loading}
+ aria-disabled={href ? disabled : undefined}
+ role={href && disabled ? 'link' : undefined}
+ tabindex={href && disabled ? -1 : tabindex}
+ class={cn(arcaneButtonVariants({ tone: config.tone, size }), className)}
+ aria-label={hasChildren ? undefined : isIconOnlyButton ? displayLabel : undefined}
+ bind:this={ref}
+ onclick={async (
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ e: any
+ ) => {
+ onclick?.(e);
+ if (type === undefined) return;
+ if (onClickPromise) {
+ loading = true;
+ await onClickPromise(e);
+ loading = false;
+ }
+ }}
+>
+ {#if shouldUseInternalContent}
+ {#if type !== undefined && loading}
+ <div class="absolute inset-0 flex place-items-center justify-center bg-inherit">
+ <div class="flex animate-spin place-items-center justify-center">
+ <LoaderCircleIcon class="size-4" />
+ </div>
+ </div>
+ <span class="sr-only">Loading - {displayLoadingLabel}</span>
+ {#if !isIconOnlyButton}
+ <span class="opacity-0">{displayLabel}</span>
+ {/if}
+ {:else}
+ <config.IconComponent class="size-4" />
+ {#if !isIconOnlyButton}
+ {displayLabel}
+ {/if}
+ {/if}
+ {:else}
+ {@render children?.()}
+ {/if}
+</svelte:element>
diff --git a/frontend/src/lib/components/arcane-button/index.ts b/frontend/src/lib/components/arcane-button/index.ts
new file mode 100644
index 000000000..41d52b494
--- /dev/null
+++ b/frontend/src/lib/components/arcane-button/index.ts
@@ -0,0 +1,32 @@
+import Root, {
+ type ArcaneButtonProps,
+ type ArcaneAnchorElementProps,
+ type ArcaneButtonElementProps,
+ type ArcaneButtonPropsWithoutHTML
+} from './arcane-button.svelte';
+
+import {
+ arcaneButtonVariants,
+ actionConfigs,
+ type ArcaneButtonSize,
+ type ArcaneButtonTone,
+ type Action,
+ type ActionConfig
+} from './variants';
+
+export {
+ Root,
+ type ArcaneButtonProps as Props,
+ //
+ Root as ArcaneButton,
+ arcaneButtonVariants,
+ actionConfigs,
+ type ArcaneButtonProps,
+ type ArcaneAnchorElementProps,
+ type ArcaneButtonElementProps,
+ type ArcaneButtonPropsWithoutHTML,
+ type ArcaneButtonSize,
+ type ArcaneButtonTone,
+ type Action,
+ type ActionConfig
+};
diff --git a/frontend/src/lib/components/arcane-button/variants.ts b/frontend/src/lib/components/arcane-button/variants.ts
new file mode 100644
index 000000000..92ac45e1b
--- /dev/null
+++ b/frontend/src/lib/components/arcane-button/variants.ts
@@ -0,0 +1,105 @@
+import { tv, type VariantProps } from 'tailwind-variants';
+
+import CircleStopIcon from '@lucide/svelte/icons/circle-stop';
+import PlayIcon from '@lucide/svelte/icons/play';
+import RotateCcwIcon from '@lucide/svelte/icons/rotate-ccw';
+import DownloadIcon from '@lucide/svelte/icons/download';
+import Trash2Icon from '@lucide/svelte/icons/trash-2';
+import RefreshCcwDotIcon from '@lucide/svelte/icons/refresh-ccw-dot';
+import ScanSearchIcon from '@lucide/svelte/icons/scan-search';
+import FileTextIcon from '@lucide/svelte/icons/file-text';
+import EditIcon from '@lucide/svelte/icons/edit';
+import CheckIcon from '@lucide/svelte/icons/check';
+import XIcon from '@lucide/svelte/icons/x';
+import SaveIcon from '@lucide/svelte/icons/save';
+import PlusCircleIcon from '@lucide/svelte/icons/plus-circle';
+import LayoutTemplateIcon from '@lucide/svelte/icons/layout-template';
+
+export const arcaneButtonVariants = tv({
+ base:
+ 'inline-flex items-center justify-center gap-2 rounded-lg text-sm font-medium whitespace-nowrap select-none ' +
+ 'transition-[transform,box-shadow,background-color,border-color,color] duration-150 will-change-transform hover:-translate-y-0.5 active:translate-y-0 ' +
+ 'border disabled:pointer-events-none disabled:opacity-50 ' +
+ 'focus-visible:outline-none focus-visible:ring-0 ring-0 ring-offset-0 ' +
+ "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ variants: {
+ tone: {
+ 'outline-primary':
+ 'bg-transparent text-muted-foreground border-primary/70 hover:bg-primary/15 hover:border-primary/75 ' +
+ 'dark:text-muted-foreground dark:border-primary/60 dark:hover:bg-primary/20 shadow-none hover:shadow-none',
+ 'outline-destructive':
+ 'bg-transparent text-destructive/75 border-destructive/60 hover:bg-destructive/10 hover:border-destructive/65 ' +
+ 'dark:text-destructive/75 dark:border-destructive/55 dark:hover:bg-destructive/14 shadow-none hover:shadow-none',
+
+ ghost: 'border-transparent bg-transparent text-foreground hover:bg-accent/40 shadow-none hover:shadow-none',
+ link: 'border-transparent bg-transparent text-primary underline-offset-4 hover:underline shadow-none hover:shadow-none'
+ },
+ size: {
+ default: 'h-9 px-4 py-2 has-[>svg]:px-3',
+ sm: 'h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5',
+ lg: 'h-10 rounded-md px-5 has-[>svg]:px-4',
+ icon: 'size-9'
+ }
+ },
+ defaultVariants: {
+ tone: 'outline-primary',
+ size: 'default'
+ }
+});
+
+export type ArcaneButtonTone = VariantProps<typeof arcaneButtonVariants>['tone'];
+export type ArcaneButtonSize = VariantProps<typeof arcaneButtonVariants>['size'];
+
+export type Action =
+ | 'start'
+ | 'deploy'
+ | 'stop'
+ | 'restart'
+ | 'remove'
+ | 'pull'
+ | 'redeploy'
+ | 'inspect'
+ | 'logs'
+ | 'edit'
+ | 'confirm'
+ | 'cancel'
+ | 'save'
+ | 'create'
+ | 'template';
+
+export type IconCtor = typeof PlayIcon;
+
+export type ActionConfig = {
+ defaultLabel: string;
+ IconComponent: IconCtor;
+ tone: ArcaneButtonTone;
+ loadingLabel?: string;
+};
+
+export const actionConfigs: Record<Action, ActionConfig> = {
+ start: { defaultLabel: 'Start', IconComponent: PlayIcon, tone: 'outline-primary', loadingLabel: 'Starting...' },
+ deploy: { defaultLabel: 'Deploy', IconComponent: PlayIcon, tone: 'outline-primary', loadingLabel: 'Deploying...' },
+ stop: { defaultLabel: 'Stop', IconComponent: CircleStopIcon, tone: 'outline-destructive', loadingLabel: 'Stopping...' },
+ remove: { defaultLabel: 'Remove', IconComponent: Trash2Icon, tone: 'outline-destructive', loadingLabel: 'Removing...' },
+ restart: { defaultLabel: 'Restart', IconComponent: RotateCcwIcon, tone: 'outline-primary', loadingLabel: 'Restarting...' },
+ pull: { defaultLabel: 'Pull', IconComponent: DownloadIcon, tone: 'outline-primary', loadingLabel: 'Pulling...' },
+ redeploy: {
+ defaultLabel: 'Redeploy',
+ IconComponent: RefreshCcwDotIcon,
+ tone: 'outline-primary',
+ loadingLabel: 'Redeploying...'
+ },
+ inspect: { defaultLabel: 'Inspect', IconComponent: ScanSearchIcon, tone: 'outline-primary', loadingLabel: 'Inspecting...' },
+ edit: { defaultLabel: 'Edit', IconComponent: EditIcon, tone: 'outline-primary', loadingLabel: 'Saving...' },
+ confirm: { defaultLabel: 'Confirm', IconComponent: CheckIcon, tone: 'outline-primary', loadingLabel: 'Confirming...' },
+ save: { defaultLabel: 'Save', IconComponent: SaveIcon, tone: 'outline-primary', loadingLabel: 'Saving...' },
+ create: { defaultLabel: 'Create', IconComponent: PlusCircleIcon, tone: 'outline-primary', loadingLabel: 'Creating...' },
+ template: {
+ defaultLabel: 'Use Template',
+ IconComponent: LayoutTemplateIcon,
+ tone: 'outline-primary',
+ loadingLabel: 'Creating...'
+ },
+ logs: { defaultLabel: 'Logs', IconComponent: FileTextIcon, tone: 'ghost', loadingLabel: 'Fetching...' },
+ cancel: { defaultLabel: 'Cancel', IconComponent: XIcon, tone: 'ghost', loadingLabel: 'Cancelling...' }
+};
diff --git a/frontend/src/lib/components/arcane-table.svelte b/frontend/src/lib/components/arcane-table.svelte
deleted file mode 100644
index ab42dd5fd..000000000
--- a/frontend/src/lib/components/arcane-table.svelte
+++ /dev/null
@@ -1,220 +0,0 @@
-<script lang="ts" generics="TData extends {id: string}">
- import { Checkbox } from '$lib/components/ui/checkbox/index.js';
- import { Input } from '$lib/components/ui/input/index.js';
- import * as Pagination from '$lib/components/ui/pagination/index.js';
- import * as Select from '$lib/components/ui/select/index.js';
- import * as Table from '$lib/components/ui/table/index.js';
- import { Button } from '$lib/components/ui/button/index.js';
- import { ChevronDown } from '@lucide/svelte';
- import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
- import { debounced } from '$lib/utils';
- import { cn } from '$lib/utils';
- import type { Snippet } from 'svelte';
-
- let {
- items,
- requestOptions = $bindable(),
- selectedIds = $bindable(),
- withoutSearch = false,
- withoutPagination = false,
- selectionDisabled = false,
- onRefresh,
- columns,
- rows,
- filterPlaceholder = 'Search...',
- noResultsMessage = 'No results found',
- itemsPerPageLabel = 'Items per page',
- class: className = ''
- }: {
- items: Paginated<TData>;
- requestOptions: SearchPaginationSortRequest;
- selectedIds?: string[];
- withoutSearch?: boolean;
- withoutPagination?: boolean;
- selectionDisabled?: boolean;
- onRefresh: (requestOptions: SearchPaginationSortRequest) => Promise<Paginated<TData>>;
- columns: { label: string; hidden?: boolean; sortColumn?: string }[];
- rows: Snippet<[{ item: TData }]>;
- filterPlaceholder?: string;
- noResultsMessage?: string;
- itemsPerPageLabel?: string;
- class?: string;
- } = $props();
-
- let searchValue = $state('');
- let availablePageSizes: number[] = [10, 20, 50, 100];
-
- let allChecked = $derived.by(() => {
- if (!selectedIds || items.data.length === 0) return false;
- for (const item of items.data) {
- if (!selectedIds.includes(item.id)) {
- return false;
- }
- }
- return true;
- });
-
- const onSearch = debounced(async (search: string) => {
- requestOptions.search = search;
- await onRefresh(requestOptions);
- searchValue = search;
- }, 300);
-
- async function onAllCheck(checked: boolean) {
- if (checked) {
- selectedIds = items.data.map((item) => item.id);
- } else {
- selectedIds = [];
- }
- }
-
- async function onCheck(checked: boolean, id: string) {
- if (!selectedIds) return;
- if (checked) {
- selectedIds = [...selectedIds, id];
- } else {
- selectedIds = selectedIds.filter((selectedId) => selectedId !== id);
- }
- }
-
- async function onPageChange(page: number) {
- requestOptions.pagination = { limit: items.pagination.itemsPerPage, page };
- onRefresh(requestOptions);
- }
-
- async function onPageSizeChange(size: number) {
- requestOptions.pagination = { limit: size, page: 1 };
- onRefresh(requestOptions);
- }
-
- async function onSort(column?: string, direction: 'asc' | 'desc' = 'asc') {
- if (!column) return;
-
- requestOptions.sort = { column, direction };
- onRefresh(requestOptions);
- }
-</script>
-
-<div class={cn('space-y-4', className)}>
- {#if !withoutSearch}
- <Input
- value={searchValue}
- class={cn(
- 'relative z-50 mb-4 max-w-sm',
- items.data.length == 0 && searchValue == '' && 'hidden'
- )}
- placeholder={filterPlaceholder}
- type="text"
- oninput={(e) => onSearch(e.currentTarget.value)}
- />
- {/if}
-
- {#if items.data.length === 0 && searchValue === ''}
- <div class="my-5 flex flex-col items-center">
- <p class="text-muted-foreground mt-3 text-sm">{noResultsMessage}</p>
- </div>
- {:else}
- <Table.Root class="min-w-full table-auto overflow-x-auto">
- <Table.Header>
- <Table.Row>
- {#if selectedIds && !selectionDisabled}
- <Table.Head class="w-12">
- <Checkbox checked={allChecked} onCheckedChange={(c) => onAllCheck(c as boolean)} />
- </Table.Head>
- {/if}
- {#each columns as column}
- <Table.Head class={cn(column.hidden && 'sr-only', column.sortColumn && 'px-0')}>
- {#if column.sortColumn}
- <Button
- variant="ghost"
- class="flex items-center"
- onclick={() =>
- onSort(
- column.sortColumn,
- requestOptions.sort?.direction === 'desc' ? 'asc' : 'desc'
- )}
- >
- {column.label}
- {#if requestOptions.sort?.column === column.sortColumn}
- <ChevronDown
- class={cn(
- 'ml-2 size-4',
- requestOptions.sort?.direction === 'asc' ? 'rotate-180' : ''
- )}
- />
- {/if}
- </Button>
- {:else}
- {column.label}
- {/if}
- </Table.Head>
- {/each}
- </Table.Row>
- </Table.Header>
- <Table.Body>
- {#each items.data as item}
- <Table.Row class={selectedIds?.includes(item.id) ? 'bg-muted/20' : ''}>
- {#if selectedIds && !selectionDisabled}
- <Table.Cell class="w-12">
- <Checkbox
- checked={selectedIds.includes(item.id)}
- onCheckedChange={(c) => onCheck(c as boolean, item.id)}
- />
- </Table.Cell>
- {/if}
- {@render rows({ item })}
- </Table.Row>
- {/each}
- </Table.Body>
- </Table.Root>
-
- {#if !withoutPagination}
- <div class="mt-5 flex flex-col-reverse items-center justify-between gap-3 sm:flex-row">
- <div class="flex items-center space-x-2">
- <p class="text-sm font-medium">{itemsPerPageLabel}</p>
- <Select.Root
- type="single"
- value={items.pagination.itemsPerPage.toString()}
- onValueChange={(v) => onPageSizeChange(Number(v))}
- >
- <Select.Trigger class="h-9 w-[80px]">
- {items.pagination.itemsPerPage}
- </Select.Trigger>
- <Select.Content>
- {#each availablePageSizes as size}
- <Select.Item value={size.toString()}>{size}</Select.Item>
- {/each}
- </Select.Content>
- </Select.Root>
- </div>
- <Pagination.Root
- class="mx-0 w-auto"
- count={items.pagination.totalItems}
- perPage={items.pagination.itemsPerPage}
- {onPageChange}
- page={items.pagination.currentPage}
- >
- {#snippet children({ pages })}
- <Pagination.Content class="flex justify-end">
- <Pagination.Item>
- <Pagination.PrevButton />
- </Pagination.Item>
- {#each pages as page (page.key)}
- {#if page.type !== 'ellipsis' && page.value != 0}
- <Pagination.Item>
- <Pagination.Link {page} isActive={items.pagination.currentPage === page.value}>
- {page.value}
- </Pagination.Link>
- </Pagination.Item>
- {/if}
- {/each}
- <Pagination.Item>
- <Pagination.NextButton />
- </Pagination.Item>
- </Pagination.Content>
- {/snippet}
- </Pagination.Root>
- </div>
- {/if}
- {/if}
-</div>
diff --git a/frontend/src/lib/components/arcane-table/arcane-table-cell.svelte b/frontend/src/lib/components/arcane-table/arcane-table-cell.svelte
new file mode 100644
index 000000000..94c4b912c
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/arcane-table-cell.svelte
@@ -0,0 +1,9 @@
+<script lang="ts">
+ import type { HTMLAttributes } from 'svelte/elements';
+
+ let { children, ...restProps }: HTMLAttributes<HTMLDivElement> = $props();
+</script>
+
+<div {...restProps}>
+ {@render children?.()}
+</div>
diff --git a/frontend/src/lib/components/arcane-table/arcane-table-checkbox.svelte b/frontend/src/lib/components/arcane-table/arcane-table-checkbox.svelte
new file mode 100644
index 000000000..221494d69
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/arcane-table-checkbox.svelte
@@ -0,0 +1,8 @@
+<script lang="ts">
+ import { Checkbox } from '$lib/components/ui/checkbox/index.js';
+ import type { ComponentProps } from 'svelte';
+
+ let { checked = false, onCheckedChange = (v: boolean) => {}, ...restProps }: ComponentProps<typeof Checkbox> = $props();
+</script>
+
+<Checkbox {checked} {onCheckedChange} {...restProps} />
diff --git a/frontend/src/lib/components/arcane-table/arcane-table-filter.svelte b/frontend/src/lib/components/arcane-table/arcane-table-filter.svelte
new file mode 100644
index 000000000..b07504c24
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/arcane-table-filter.svelte
@@ -0,0 +1,120 @@
+<script lang="ts" generics="TData, TValue">
+ import ListFilterIcon from '@lucide/svelte/icons/list-filter';
+ import CheckIcon from '@lucide/svelte/icons/check';
+ import type { Column } from '@tanstack/table-core';
+ import { SvelteSet } from 'svelte/reactivity';
+ import * as Command from '$lib/components/ui/command/index.js';
+ import * as Popover from '$lib/components/ui/popover/index.js';
+ import { Button } from '$lib/components/ui/button/index.js';
+ import { cn } from '$lib/utils.js';
+ import { Separator } from '$lib/components/ui/separator/index.js';
+ import { Badge } from '$lib/components/ui/badge/index.js';
+ import type { Component } from 'svelte';
+
+ let {
+ column,
+ title,
+ options,
+ showCheckboxes = true
+ }: {
+ column: Column<TData, TValue>;
+ title: string;
+ options: {
+ label: string;
+ value: string | boolean;
+ icon?: Component;
+ }[];
+ showCheckboxes?: boolean;
+ } = $props();
+
+ const facets = $derived(column?.getFacetedUniqueValues());
+ const selectedValues = $derived(new SvelteSet(column?.getFilterValue() as any[]));
+</script>
+
+<Popover.Root>
+ <Popover.Trigger>
+ {#snippet child({ props })}
+ <Button
+ {...props}
+ variant="outline"
+ size="sm"
+ class="h-8 border-dashed"
+ data-testid={`facet-${title.toLowerCase()}-trigger`}
+ >
+ <ListFilterIcon />
+ {title}
+ {#if selectedValues.size > 0}
+ <Separator orientation="vertical" class="mx-2 h-4" />
+ <Badge variant="secondary" class="rounded-sm px-1 font-normal lg:hidden">
+ {selectedValues.size}
+ </Badge>
+ <div class="hidden space-x-1 lg:flex">
+ {#if selectedValues.size > 2}
+ <Badge variant="secondary" class="rounded-sm px-1 font-normal">
+ {selectedValues.size} selected
+ </Badge>
+ {:else}
+ {#each options.filter((opt) => selectedValues.has(opt.value)) as option (option)}
+ <Badge variant="secondary" class="rounded-sm px-1 font-normal">
+ {option.label}
+ </Badge>
+ {/each}
+ {/if}
+ </div>
+ {/if}
+ </Button>
+ {/snippet}
+ </Popover.Trigger>
+ <Popover.Content class="w-[200px] p-0" align="start" data-testid={`facet-${title.toLowerCase()}-content`}>
+ <Command.Root>
+ <Command.Input placeholder={title} />
+ <Command.List>
+ <Command.Empty>No results found.</Command.Empty>
+ <Command.Group>
+ {#each options as option (option)}
+ {@const isSelected = selectedValues.has(option.value)}
+ <Command.Item
+ data-testid={`facet-${title.toLowerCase()}-option-${String(option.value)}`}
+ onSelect={() => {
+ if (isSelected) selectedValues.delete(option.value);
+ else selectedValues.add(option.value);
+ const filterValues = Array.from(selectedValues);
+ column?.setFilterValue(filterValues.length ? filterValues : undefined);
+ }}
+ >
+ {#if showCheckboxes}
+ <div
+ class={cn(
+ 'border-primary mr-2 flex size-4 items-center justify-center rounded-sm border',
+ isSelected ? 'bg-primary text-primary-foreground' : 'opacity-50 [&_svg]:invisible'
+ )}
+ >
+ <CheckIcon class="size-4" />
+ </div>
+ {/if}
+ {#if option.icon}
+ {@const Icon = option.icon}
+ <Icon class="text-muted-foreground" />
+ {/if}
+
+ <span>{option.label}</span>
+ {#if facets?.get(option.value)}
+ <span class="ml-auto flex size-4 items-center justify-center font-mono text-xs">
+ {facets.get(option.value)}
+ </span>
+ {/if}
+ </Command.Item>
+ {/each}
+ </Command.Group>
+ {#if selectedValues.size > 0}
+ <Command.Separator />
+ <Command.Group>
+ <Command.Item onSelect={() => column?.setFilterValue(undefined)} class="justify-center text-center">
+ Clear filters
+ </Command.Item>
+ </Command.Group>
+ {/if}
+ </Command.List>
+ </Command.Root>
+ </Popover.Content>
+</Popover.Root>
diff --git a/frontend/src/lib/components/arcane-table/arcane-table-toolbar.svelte b/frontend/src/lib/components/arcane-table/arcane-table-toolbar.svelte
new file mode 100644
index 000000000..f347eac20
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/arcane-table-toolbar.svelte
@@ -0,0 +1,77 @@
+<script lang="ts" generics="TData">
+ import XIcon from '@lucide/svelte/icons/x';
+ import type { Table } from '@tanstack/table-core';
+ import { DataTableFacetedFilter, DataTableViewOptions } from './index.js';
+ import Button from '$lib/components/ui/button/button.svelte';
+ import { Input } from '$lib/components/ui/input/index.js';
+ import { imageUpdateFilters, usageFilters } from './data.js';
+ import { debounced } from '$lib/utils/utils.js';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+
+ let {
+ table,
+ selectedIds = [],
+ selectionDisabled = false,
+ onRemoveSelected
+ }: {
+ table: Table<TData>;
+ selectedIds?: string[];
+ selectionDisabled?: boolean;
+ onRemoveSelected?: (ids: string[]) => void;
+ } = $props();
+
+ const isFiltered = $derived(table.getState().columnFilters.length > 0 || !!table.getState().globalFilter);
+ const usageColumn = $derived(table.getColumn('inUse'));
+ const updatesColumn = $derived(table.getColumn('updates'));
+
+ const debouncedSetGlobal = debounced((v: string) => table.setGlobalFilter(v), 300);
+ const hasSelection = $derived(!selectionDisabled && (selectedIds?.length ?? 0) > 0);
+</script>
+
+<div class="flex items-center justify-between">
+ <div class="flex flex-1 items-center space-x-2">
+ <Input
+ placeholder="Search..."
+ value={(table.getState().globalFilter as string) ?? ''}
+ oninput={(e) => debouncedSetGlobal(e.currentTarget.value)}
+ onchange={(e) => table.setGlobalFilter(e.currentTarget.value)}
+ onkeydown={(e) => {
+ if (e.key === 'Enter') table.setGlobalFilter((e.currentTarget as HTMLInputElement).value);
+ }}
+ class="h-8 w-[150px] lg:w-[250px]"
+ />
+
+ {#if usageColumn}
+ <DataTableFacetedFilter column={usageColumn} title="Usage" options={usageFilters} />
+ {/if}
+ {#if updatesColumn}
+ <DataTableFacetedFilter column={updatesColumn} title="Updates" options={imageUpdateFilters} />
+ {/if}
+
+ {#if isFiltered}
+ <Button
+ variant="ghost"
+ onclick={() => {
+ table.resetColumnFilters();
+ table.resetGlobalFilter();
+ }}
+ class="h-8 px-2 lg:px-3"
+ >
+ Reset
+ <XIcon />
+ </Button>
+ {/if}
+ </div>
+
+ <div class="flex items-center gap-2">
+ {#if hasSelection && onRemoveSelected}
+ <ArcaneButton
+ action="remove"
+ size="sm"
+ customLabel={`Remove Selected (${selectedIds?.length ?? 0})`}
+ onclick={() => onRemoveSelected?.(selectedIds!)}
+ />
+ {/if}
+ <DataTableViewOptions {table} />
+ </div>
+</div>
diff --git a/frontend/src/lib/components/arcane-table/arcane-table-view-options.svelte b/frontend/src/lib/components/arcane-table/arcane-table-view-options.svelte
new file mode 100644
index 000000000..6b82a83e5
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/arcane-table-view-options.svelte
@@ -0,0 +1,35 @@
+<script lang="ts" generics="TData">
+ import Settings2Icon from '@lucide/svelte/icons/settings-2';
+ import type { Table } from '@tanstack/table-core';
+ import { buttonVariants } from '$lib/components/ui/button/index.js';
+ import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+
+ let { table }: { table: Table<TData> } = $props();
+</script>
+
+<DropdownMenu.Root>
+ <DropdownMenu.Trigger
+ class={buttonVariants({
+ variant: 'outline',
+ size: 'sm',
+ class: 'ml-auto hidden h-8 lg:flex'
+ })}
+ >
+ <Settings2Icon />
+ View
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Content>
+ <DropdownMenu.Group>
+ <DropdownMenu.Label>Toggle columns</DropdownMenu.Label>
+ <DropdownMenu.Separator />
+ {#each table.getAllColumns().filter((col) => typeof col.accessorFn !== 'undefined' && col.getCanHide()) as column (column)}
+ <DropdownMenu.CheckboxItem
+ bind:checked={() => column.getIsVisible(), (v) => column.toggleVisibility(!!v)}
+ class="capitalize"
+ >
+ {column.id}
+ </DropdownMenu.CheckboxItem>
+ {/each}
+ </DropdownMenu.Group>
+ </DropdownMenu.Content>
+</DropdownMenu.Root>
diff --git a/frontend/src/lib/components/arcane-table/arcane-table.svelte b/frontend/src/lib/components/arcane-table/arcane-table.svelte
new file mode 100644
index 000000000..a8bdaf487
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/arcane-table.svelte
@@ -0,0 +1,427 @@
+<script lang="ts" generics="TData extends {id: string}">
+ import {
+ type Column,
+ type ColumnDef,
+ type ColumnFiltersState,
+ type Row,
+ type RowSelectionState,
+ type SortingState,
+ type VisibilityState,
+ type Table as TableType,
+ getCoreRowModel,
+ getFacetedRowModel,
+ getFacetedUniqueValues,
+ getFilteredRowModel
+ } from '@tanstack/table-core';
+ import DataTableToolbar from './arcane-table-toolbar.svelte';
+ import { createSvelteTable } from '$lib/components/ui/data-table/data-table.svelte.js';
+ import FlexRender from '$lib/components/ui/data-table/flex-render.svelte';
+ import * as Table from '$lib/components/ui/table/index.js';
+ import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import { renderComponent, renderSnippet } from '$lib/components/ui/data-table/render-helpers.js';
+ import { Button } from '$lib/components/ui/button/index.js';
+ import ChevronRightIcon from '@lucide/svelte/icons/chevron-right';
+ import ChevronLeftIcon from '@lucide/svelte/icons/chevron-left';
+ import ChevronsLeftIcon from '@lucide/svelte/icons/chevrons-left';
+ import ChevronsRightIcon from '@lucide/svelte/icons/chevrons-right';
+ import ArrowUpIcon from '@lucide/svelte/icons/arrow-up';
+ import ArrowDownIcon from '@lucide/svelte/icons/arrow-down';
+ import ChevronsUpDownIcon from '@lucide/svelte/icons/chevrons-up-down';
+ import EyeOffIcon from '@lucide/svelte/icons/eye-off';
+ import * as Select from '$lib/components/ui/select/index.js';
+ import type { HTMLAttributes } from 'svelte/elements';
+ import { cn } from '$lib/utils.js';
+ import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
+ import type { Snippet } from 'svelte';
+ import type { ColumnSpec } from './arcane-table.types';
+ import TableCheckbox from './arcane-table-checkbox.svelte';
+
+ let {
+ items,
+ requestOptions = $bindable(),
+ withoutSearch = $bindable(),
+ withoutPagination = false,
+ selectionDisabled = false,
+ onRefresh,
+ columns,
+ rowActions,
+ selectedIds = $bindable<string[]>([]),
+ onRemoveSelected
+ }: {
+ items: Paginated<TData>;
+ requestOptions: SearchPaginationSortRequest;
+ withoutSearch?: boolean;
+ withoutPagination?: boolean;
+ selectionDisabled?: boolean;
+ onRefresh: (requestOptions: SearchPaginationSortRequest) => Promise<Paginated<TData>>;
+ columns: ColumnSpec<TData>[];
+ rowActions?: Snippet<[{ row: Row<TData>; item: TData }]>;
+ selectedIds?: string[];
+ onRemoveSelected?: (ids: string[]) => void;
+ } = $props();
+
+ let rowSelection = $state<RowSelectionState>({});
+ let columnVisibility = $state<VisibilityState>({});
+ let columnFilters = $state<ColumnFiltersState>([]);
+ let sorting = $state<SortingState>([]);
+ let globalFilter = $state<string>('');
+
+ const passAllGlobal: (row: unknown, columnId: string, filterValue: unknown) => boolean = () => true;
+
+ const currentPage = $derived(items.pagination.currentPage ?? requestOptions?.pagination?.page ?? 1);
+ const totalPages = $derived(items.pagination.totalPages ?? 1);
+ const totalItems = $derived(items.pagination.totalItems ?? 0);
+ const pageSize = $derived(requestOptions?.pagination?.limit ?? items?.pagination?.itemsPerPage ?? 20);
+ const canPrev = $derived(currentPage > 1);
+ const canNext = $derived(currentPage < totalPages);
+
+ function updatePagination(patch: Partial<{ page: number; limit: number }>) {
+ const prev = requestOptions?.pagination ?? {
+ page: items?.pagination?.currentPage ?? 1,
+ limit: items?.pagination?.itemsPerPage ?? 10
+ };
+ const next = { ...prev, ...patch };
+ requestOptions = { ...requestOptions, pagination: next };
+ onRefresh(requestOptions);
+ }
+
+ function setPage(page: number) {
+ if (page < 1) page = 1;
+ if (totalPages > 0 && page > totalPages) page = totalPages;
+ updatePagination({ page });
+ }
+
+ function setPageSize(limit: number) {
+ updatePagination({ limit, page: 1 });
+ }
+
+ function onToggleAll(checked: boolean, table: TableType<TData>) {
+ const pageIds = table.getRowModel().rows.map((r) => (r.original as TData).id);
+ if (checked) {
+ const set = new Set([...(selectedIds ?? []), ...pageIds]);
+ selectedIds = Array.from(set);
+ } else {
+ const pageSet = new Set(pageIds);
+ selectedIds = (selectedIds ?? []).filter((id) => !pageSet.has(id));
+ }
+ }
+
+ function onToggleRow(checked: boolean, id: string) {
+ if (checked) {
+ if (!selectedIds?.includes(id)) selectedIds = [...(selectedIds ?? []), id];
+ } else {
+ selectedIds = (selectedIds ?? []).filter((x) => x !== id);
+ }
+ }
+
+ function buildColumns(specs: ColumnSpec<TData>[]): ColumnDef<TData>[] {
+ const cols: ColumnDef<TData>[] = [];
+
+ if (!selectionDisabled) {
+ cols.push({
+ id: 'select',
+ header: ({ table }) => {
+ const pageIds = table.getRowModel().rows.map((r) => (r.original as TData).id);
+ const selectedSet = new Set(selectedIds ?? []);
+ const total = pageIds.length;
+ const selectedOnPage = pageIds.filter((id) => selectedSet.has(id)).length;
+ const checked = total > 0 && selectedOnPage === total;
+ const indeterminate = selectedOnPage > 0 && selectedOnPage < total;
+
+ return renderComponent(TableCheckbox, {
+ checked,
+ indeterminate,
+ onCheckedChange: (value) => onToggleAll(!!value, table),
+ 'aria-label': 'Select all'
+ });
+ },
+ cell: ({ row }) => {
+ const id = (row.original as TData).id;
+ return renderComponent(TableCheckbox, {
+ checked: (selectedIds ?? []).includes(id),
+ onCheckedChange: (value) => onToggleRow(!!value, id),
+ 'aria-label': 'Select row'
+ });
+ },
+ enableSorting: false,
+ enableHiding: false
+ });
+ }
+
+ specs.forEach((spec, i) => {
+ const accessorKey = spec.accessorKey;
+ const accessorFn = spec.accessorFn;
+ const id = spec.id ?? (accessorKey as string) ?? `col_${i}`;
+
+ cols.push({
+ id,
+ ...(accessorKey ? { accessorKey } : {}),
+ ...(accessorFn ? { accessorFn } : {}),
+ header: ({ column }) => {
+ if (spec.header) return renderSnippet(spec.header, { column, title: spec.title, class: spec.class });
+ if (spec.sortable) return renderSnippet(ColumnHeader, { column, title: spec.title, class: spec.class });
+ return renderSnippet(PlainHeader, { title: spec.title, class: spec.class });
+ },
+ cell: ({ row, getValue }) => {
+ const item = row.original as TData;
+ const value = accessorKey ? row.getValue(accessorKey) : getValue?.();
+ if (spec.cell) return renderSnippet(spec.cell, { row, item, value });
+ return renderSnippet(TextCell, { value });
+ },
+ enableSorting: !!spec.sortable,
+ enableHiding: true,
+ filterFn: spec.filterFn
+ });
+
+ if (spec.hidden) {
+ columnVisibility[String(accessorKey ?? id)] = false;
+ }
+ });
+
+ if (rowActions) {
+ cols.push({
+ id: 'actions',
+ cell: ({ row }) => renderSnippet(rowActions, { row, item: row.original as TData })
+ });
+ }
+
+ return cols;
+ }
+
+ const columnsDef: ColumnDef<TData>[] = buildColumns(columns);
+
+ const table = createSvelteTable({
+ get data() {
+ return items.data ?? [];
+ },
+ state: {
+ get sorting() {
+ return sorting;
+ },
+ get columnVisibility() {
+ return columnVisibility;
+ },
+ get rowSelection() {
+ return rowSelection;
+ },
+ get columnFilters() {
+ return columnFilters;
+ },
+ get globalFilter() {
+ return globalFilter;
+ }
+ },
+ columns: columnsDef,
+ globalFilterFn: passAllGlobal,
+ enableRowSelection: !selectionDisabled,
+ onRowSelectionChange: (updater) => {
+ rowSelection = typeof updater === 'function' ? updater(rowSelection) : updater;
+ },
+ onSortingChange: (updater) => {
+ const next = typeof updater === 'function' ? updater(sorting) : updater;
+ sorting = next;
+ const first = next[0];
+ if (first) {
+ requestOptions = {
+ ...requestOptions,
+ sort: { column: String(first.id), direction: first.desc ? 'desc' : 'asc' },
+ pagination: {
+ page: 1,
+ limit: requestOptions?.pagination?.limit ?? items?.pagination?.itemsPerPage ?? 10
+ }
+ };
+ } else {
+ requestOptions = {
+ ...requestOptions,
+ sort: undefined,
+ pagination: {
+ page: 1,
+ limit: requestOptions?.pagination?.limit ?? items?.pagination?.itemsPerPage ?? 10
+ }
+ };
+ }
+ onRefresh(requestOptions);
+ },
+ onColumnFiltersChange: (updater) => {
+ columnFilters = typeof updater === 'function' ? updater(columnFilters) : updater;
+ },
+ onColumnVisibilityChange: (updater) => {
+ columnVisibility = typeof updater === 'function' ? updater(columnVisibility) : updater;
+ },
+ onGlobalFilterChange: (value) => {
+ globalFilter = (value ?? '') as string;
+ const limit = requestOptions?.pagination?.limit ?? items?.pagination?.itemsPerPage ?? 10;
+ requestOptions = {
+ ...requestOptions,
+ search: globalFilter,
+ pagination: { page: 1, limit }
+ };
+ onRefresh(requestOptions);
+ },
+ getCoreRowModel: getCoreRowModel(),
+ getFilteredRowModel: getFilteredRowModel(),
+ getFacetedRowModel: getFacetedRowModel(),
+ getFacetedUniqueValues: getFacetedUniqueValues()
+ });
+
+ $effect(() => {
+ const s = requestOptions?.sort;
+ if (!s) {
+ if (sorting.length) sorting = [];
+ return;
+ }
+ const desc = s.direction === 'desc';
+ if (!sorting[0] || sorting[0].id !== s.column || sorting[0].desc !== desc) {
+ sorting = [{ id: s.column, desc }];
+ }
+ });
+</script>
+
+{#snippet TextCell({ value }: { value: unknown })}
+ <span class="max-w-[500px] truncate">{value ?? ''}</span>
+{/snippet}
+
+{#snippet PlainHeader({ title, class: className, ...restProps }: { title: string } & HTMLAttributes<HTMLDivElement>)}
+ <div class={className} {...restProps}>{title}</div>
+{/snippet}
+
+{#snippet Pagination({ table }: { table: TableType<TData> })}
+ <div class="flex items-center justify-between px-2">
+ <div class="text-muted-foreground flex-1 text-sm">
+ Showing {table.getFilteredRowModel().rows.length} of {totalItems} item(s).
+ </div>
+ <div class="flex items-center space-x-6 lg:space-x-8">
+ <div class="flex items-center space-x-2">
+ <p class="text-sm font-medium">Rows per page</p>
+ <Select.Root
+ allowDeselect={false}
+ type="single"
+ value={`${pageSize}`}
+ onValueChange={(value) => setPageSize(Number(value))}
+ >
+ <Select.Trigger class="h-8 w-[70px]">
+ {String(pageSize)}
+ </Select.Trigger>
+ <Select.Content side="top">
+ {#each [10, 20, 30, 40, 50] as size (size)}
+ <Select.Item value={`${size}`}>
+ {size}
+ </Select.Item>
+ {/each}
+ </Select.Content>
+ </Select.Root>
+ </div>
+ <div class="flex w-[100px] items-center justify-center text-sm font-medium">
+ Page {currentPage} of {totalPages}
+ </div>
+ <div class="flex items-center space-x-2">
+ <Button variant="outline" class="hidden size-8 p-0 lg:flex" onclick={() => setPage(1)} disabled={!canPrev}>
+ <span class="sr-only">Go to first page</span>
+ <ChevronsLeftIcon />
+ </Button>
+ <Button variant="outline" class="size-8 p-0" onclick={() => setPage(currentPage - 1)} disabled={!canPrev}>
+ <span class="sr-only">Go to previous page</span>
+ <ChevronLeftIcon />
+ </Button>
+ <Button variant="outline" class="size-8 p-0" onclick={() => setPage(currentPage + 1)} disabled={!canNext}>
+ <span class="sr-only">Go to next page</span>
+ <ChevronRightIcon />
+ </Button>
+ <Button variant="outline" class="hidden size-8 p-0 lg:flex" onclick={() => setPage(totalPages)} disabled={!canNext}>
+ <span class="sr-only">Go to last page</span>
+ <ChevronsRightIcon />
+ </Button>
+ </div>
+ </div>
+ </div>
+{/snippet}
+
+{#snippet ColumnHeader({
+ column,
+ title,
+ class: className,
+ ...restProps
+}: { column: Column<TData>; title: string } & HTMLAttributes<HTMLDivElement>)}
+ {#if !column?.getCanSort()}
+ <div class={className} {...restProps}>
+ {title}
+ </div>
+ {:else}
+ <div class={cn('flex items-center', className)} {...restProps}>
+ <DropdownMenu.Root>
+ <DropdownMenu.Trigger>
+ {#snippet child({ props })}
+ <Button {...props} variant="ghost" size="sm" class="data-[state=open]:bg-accent -ml-3 h-8">
+ <span>
+ {title}
+ </span>
+ {#if column.getIsSorted() === 'desc'}
+ <ArrowDownIcon />
+ {:else if column.getIsSorted() === 'asc'}
+ <ArrowUpIcon />
+ {:else}
+ <ChevronsUpDownIcon />
+ {/if}
+ </Button>
+ {/snippet}
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Content align="start">
+ <DropdownMenu.Item onclick={() => column.toggleSorting(false)}>
+ <ArrowUpIcon class="text-muted-foreground/70 mr-2 size-3.5" />
+ Asc
+ </DropdownMenu.Item>
+ <DropdownMenu.Item onclick={() => column.toggleSorting(true)}>
+ <ArrowDownIcon class="text-muted-foreground/70 mr-2 size-3.5" />
+ Desc
+ </DropdownMenu.Item>
+ <DropdownMenu.Separator />
+ <DropdownMenu.Item onclick={() => column.toggleVisibility(false)}>
+ <EyeOffIcon class="text-muted-foreground/70 mr-2 size-3.5" />
+ Hide
+ </DropdownMenu.Item>
+ </DropdownMenu.Content>
+ </DropdownMenu.Root>
+ </div>
+ {/if}
+{/snippet}
+
+<div class="space-y-4">
+ {#if !withoutSearch}
+ <DataTableToolbar {table} {selectedIds} {selectionDisabled} {onRemoveSelected} />
+ {/if}
+ <div class="rounded-md">
+ <Table.Root>
+ <Table.Header>
+ {#each table.getHeaderGroups() as headerGroup (headerGroup.id)}
+ <Table.Row>
+ {#each headerGroup.headers as header (header.id)}
+ <Table.Head colspan={header.colSpan}>
+ {#if !header.isPlaceholder}
+ <FlexRender content={header.column.columnDef.header} context={header.getContext()} />
+ {/if}
+ </Table.Head>
+ {/each}
+ </Table.Row>
+ {/each}
+ </Table.Header>
+ <Table.Body>
+ {#each table.getRowModel().rows as row (row.id)}
+ <Table.Row data-state={(selectedIds ?? []).includes((row.original as TData).id) && 'selected'}>
+ {#each row.getVisibleCells() as cell (cell.id)}
+ <Table.Cell>
+ <FlexRender content={cell.column.columnDef.cell} context={cell.getContext()} />
+ </Table.Cell>
+ {/each}
+ </Table.Row>
+ {:else}
+ <Table.Row>
+ <Table.Cell colspan={columnsDef.length} class="h-24 text-center">No results.</Table.Cell>
+ </Table.Row>
+ {/each}
+ </Table.Body>
+ </Table.Root>
+ </div>
+ {#if !withoutPagination}
+ {@render Pagination({ table })}
+ {/if}
+</div>
diff --git a/frontend/src/lib/components/arcane-table/arcane-table.types.ts b/frontend/src/lib/components/arcane-table/arcane-table.types.ts
new file mode 100644
index 000000000..c4aaaf843
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/arcane-table.types.ts
@@ -0,0 +1,15 @@
+import type { Row, Column, FilterFn } from '@tanstack/table-core';
+import type { Snippet } from 'svelte';
+
+export type ColumnSpec<T> = {
+ accessorKey?: keyof T & string;
+ accessorFn?: (row: T) => any;
+ id?: string;
+ title: string;
+ hidden?: boolean;
+ sortable?: boolean;
+ cell?: Snippet<[{ row: Row<T>; item: T; value: unknown }]>;
+ header?: Snippet<[{ column: Column<T>; title: string; class?: string }]>;
+ class?: string;
+ filterFn?: FilterFn<T>;
+};
diff --git a/frontend/src/lib/components/arcane-table/data.ts b/frontend/src/lib/components/arcane-table/data.ts
new file mode 100644
index 000000000..e1bec99cb
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/data.ts
@@ -0,0 +1,30 @@
+import BadgeCheckIcon from '@lucide/svelte/icons/badge-check';
+import BadgeXIcon from '@lucide/svelte/icons/badge-x';
+import CircleFadingArrowUp from '@lucide/svelte/icons/circle-fading-arrow-up';
+import CircleCheck from '@lucide/svelte/icons/circle-check';
+
+export const usageFilters = [
+ {
+ value: true,
+ label: 'In Use',
+ icon: BadgeCheckIcon
+ },
+ {
+ value: false,
+ label: 'Unused',
+ icon: CircleCheck
+ }
+];
+
+export const imageUpdateFilters = [
+ {
+ value: true,
+ label: 'Has Updates',
+ icon: CircleFadingArrowUp
+ },
+ {
+ value: false,
+ label: 'No Updates',
+ icon: BadgeXIcon
+ }
+];
diff --git a/frontend/src/lib/components/arcane-table/index.ts b/frontend/src/lib/components/arcane-table/index.ts
new file mode 100644
index 000000000..7f7a22d72
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/index.ts
@@ -0,0 +1,4 @@
+export { default as DataTableToolbar } from './arcane-table-toolbar.svelte';
+export { default as DataTableViewOptions } from './arcane-table-view-options.svelte';
+export { default as DataTableFacetedFilter } from './arcane-table-filter.svelte';
+export type { ColumnSpec } from './arcane-table.types';
diff --git a/frontend/src/lib/components/badges/unused-text-badge.svelte b/frontend/src/lib/components/badges/unused-text-badge.svelte
deleted file mode 100644
index 7c414ff67..000000000
--- a/frontend/src/lib/components/badges/unused-text-badge.svelte
+++ /dev/null
@@ -1,26 +0,0 @@
-<script lang="ts">
- import StatusBadge from './status-badge.svelte';
-
- interface Props {
- name: string;
- inUse: boolean | undefined;
- link?: string;
- }
-
- let { name, inUse, link }: Props = $props();
-</script>
-
-<div class="flex items-center gap-2">
- {#if link}
- <span class="truncate">
- <a class="font-medium hover:underline" href={link}>
- {name}
- </a>
- </span>
- {:else}
- <span class="truncate">{name}</span>
- {/if}
- {#if !inUse}
- <StatusBadge text="Unused" variant="amber" />
- {/if}
-</div>
diff --git a/frontend/src/lib/components/confirm-dialog/confirm-dialog.svelte b/frontend/src/lib/components/confirm-dialog/confirm-dialog.svelte
index 0cd10af6f..165ad06fa 100644
--- a/frontend/src/lib/components/confirm-dialog/confirm-dialog.svelte
+++ b/frontend/src/lib/components/confirm-dialog/confirm-dialog.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import * as Dialog from '$lib/components/ui/dialog';
- import { AlertTriangle } from '@lucide/svelte';
+ import TriangleAlert from '@lucide/svelte/icons/triangle-alert';
import { confirmDialogStore } from '.';
import Button from '../ui/button/button.svelte';
import { Label } from '$lib/components/ui/label';
@@ -30,16 +30,14 @@
<Dialog.Content class="w-full max-w-md sm:max-w-lg">
<Dialog.Header class="space-y-3">
<Dialog.Title class="flex items-start gap-3 text-lg font-semibold leading-tight">
- <AlertTriangle class="text-destructive mt-0.5 size-5 shrink-0" />
+ <TriangleAlert class="text-destructive mt-0.5 size-5 shrink-0" />
<span class="min-w-0 break-words">
{$confirmDialogStore.title}
</span>
</Dialog.Title>
</Dialog.Header>
- <div
- class="text-muted-foreground mt-4 min-w-0 text-sm leading-relaxed break-words whitespace-pre-wrap"
- >
+ <div class="text-muted-foreground mt-4 min-w-0 whitespace-pre-wrap break-words text-sm leading-relaxed">
{$confirmDialogStore.message}
</div>
@@ -67,7 +65,7 @@
<Label
id={`${checkbox.id}-label`}
for={checkbox.id}
- class="text-sm leading-relaxed font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70 min-w-0 break-words"
+ class="min-w-0 break-words text-sm font-medium leading-relaxed peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
>
{checkbox.label}
</Label>
@@ -77,14 +75,8 @@
{/if}
<Dialog.Footer class="mt-6">
- <div class="flex justify-end gap-3 w-full">
- <Button
- class="min-w-[80px]"
- variant="outline"
- onclick={() => ($confirmDialogStore.open = false)}
- >
- Cancel
- </Button>
+ <div class="flex w-full justify-end gap-3">
+ <Button class="min-w-[80px]" variant="outline" onclick={() => ($confirmDialogStore.open = false)}>Cancel</Button>
<Button
class="min-w-[80px]"
variant={$confirmDialogStore.confirm.destructive ? 'destructive' : 'default'}
diff --git a/frontend/src/lib/components/dialogs/oidc-config-dialog.svelte b/frontend/src/lib/components/dialogs/oidc-config-dialog.svelte
index 81a2d8e28..958288f0a 100644
--- a/frontend/src/lib/components/dialogs/oidc-config-dialog.svelte
+++ b/frontend/src/lib/components/dialogs/oidc-config-dialog.svelte
@@ -1,7 +1,10 @@
<script lang="ts">
import { Button } from '$lib/components/ui/button/index.js';
import { Input } from '$lib/components/ui/input/index.js';
- import { Key, AlertTriangle, Info, ChevronDown, Copy } from '@lucide/svelte';
+ import KeyIcon from '@lucide/svelte/icons/key';
+ import TriangleAlertIcon from '@lucide/svelte/icons/triangle-alert';
+ import InfoIcon from '@lucide/svelte/icons/info';
+ import CopyIcon from '@lucide/svelte/icons/copy';
import * as Dialog from '$lib/components/ui/dialog/index.js';
import { Label } from '$lib/components/ui/label/index.js';
import { toast } from 'svelte-sonner';
@@ -75,10 +78,10 @@
</script>
<Dialog.Root bind:open>
- <Dialog.Content class="sm:max-w-[700px] max-h-[90vh] flex flex-col">
- <Dialog.Header class="space-y-3 flex-shrink-0">
+ <Dialog.Content class="flex max-h-[90vh] flex-col sm:max-w-[700px]">
+ <Dialog.Header class="flex-shrink-0 space-y-3">
<Dialog.Title class="flex items-center gap-2">
- <Key class="size-5" />
+ <KeyIcon class="size-5" />
{#if isOidcViewMode}
OIDC Server Configuration Status
{:else if oidcStatus.envForced && !oidcStatus.envConfigured}
@@ -89,67 +92,59 @@
</Dialog.Title>
<Dialog.Description class="text-sm leading-relaxed">
{#if isOidcViewMode}
- OIDC authentication is configured and forced ON by server-side environment variables.
- These settings are read-only.
+ OIDC authentication is configured and forced ON by server-side environment variables. These settings are read-only.
{:else if oidcStatus.envForced && !oidcStatus.envConfigured}
- OIDC usage is forced ON by the server environment (<code
- class="bg-muted px-1 py-0.5 rounded text-xs">OIDC_ENABLED=true</code
- >), but critical server-side OIDC environment variables appear to be missing or
- incomplete.
+ OIDC usage is forced ON by the server environment (<code class="bg-muted rounded px-1 py-0.5 text-xs"
+ >OIDC_ENABLED=true</code
+ >), but critical server-side OIDC environment variables appear to be missing or incomplete.
{:else}
- Configure the OIDC settings for your application. These settings will be saved to the
- database and used for OIDC authentication.
+ Configure the OIDC settings for your application. These settings will be saved to the database and used for OIDC
+ authentication.
{/if}
</Dialog.Description>
</Dialog.Header>
- <div class="flex-1 overflow-y-auto min-h-0 py-4">
+ <div class="min-h-0 flex-1 overflow-y-auto py-4">
{#if isOidcViewMode}
<!-- Read-only view for server-configured OIDC -->
<div class="space-y-6">
<div class="space-y-4">
<h3 class="text-base font-semibold">Server Environment Configuration</h3>
- <p class="text-sm text-muted-foreground">
- The following OIDC settings are loaded from the server environment:
- </p>
+ <p class="text-muted-foreground text-sm">The following OIDC settings are loaded from the server environment:</p>
{#if currentSettings.authOidcEnabled}
<div class="space-y-3">
- <div class="flex justify-between items-center py-2 border-b border-border/50">
- <span class="font-medium text-sm">Client ID</span>
- <code class="bg-muted px-2 py-1 rounded text-xs">
+ <div class="border-border/50 flex items-center justify-between border-b py-2">
+ <span class="text-sm font-medium">Client ID</span>
+ <code class="bg-muted rounded px-2 py-1 text-xs">
{parsedOidcConfig().clientId || 'Not configured'}
</code>
</div>
- <div class="flex justify-between items-center py-2 border-b border-border/50">
- <span class="font-medium text-sm">Issuer URL</span>
- <code class="bg-muted px-2 py-1 rounded text-xs">
+ <div class="border-border/50 flex items-center justify-between border-b py-2">
+ <span class="text-sm font-medium">Issuer URL</span>
+ <code class="bg-muted rounded px-2 py-1 text-xs">
{parsedOidcConfig().issuerUrl || 'Not configured'}
</code>
</div>
- <div class="flex justify-between items-center py-2 border-b border-border/50">
- <span class="font-medium text-sm">Client Secret</span>
- <span class="text-muted-foreground italic text-xs">
- (Sensitive - Not Displayed)
- </span>
+ <div class="border-border/50 flex items-center justify-between border-b py-2">
+ <span class="text-sm font-medium">Client Secret</span>
+ <span class="text-muted-foreground text-xs italic"> (Sensitive - Not Displayed) </span>
</div>
- <div class="flex justify-between items-center py-2">
- <span class="font-medium text-sm">Scopes</span>
- <code class="bg-muted px-2 py-1 rounded text-xs">
+ <div class="flex items-center justify-between py-2">
+ <span class="text-sm font-medium">Scopes</span>
+ <code class="bg-muted rounded px-2 py-1 text-xs">
{parsedOidcConfig().scopes || 'openid email profile'}
</code>
</div>
</div>
{:else}
- <div class="text-center py-4">
- <AlertTriangle class="size-8 text-destructive mx-auto mb-2" />
- <p class="text-destructive text-sm font-medium">
- OIDC configuration details not found in effective settings.
- </p>
+ <div class="py-4 text-center">
+ <TriangleAlertIcon class="text-destructive mx-auto mb-2 size-8" />
+ <p class="text-destructive text-sm font-medium">OIDC configuration details not found in effective settings.</p>
</div>
{/if}
- <div class="p-3 bg-muted/50 rounded-md">
+ <div class="bg-muted/50 rounded-md p-3">
<p class="text-muted-foreground text-xs">
Changes to these settings must be made in your server's environment configuration.
</p>
@@ -162,7 +157,7 @@
<!-- Basic Configuration -->
<div class="space-y-4">
<h3 class="text-base font-semibold">Basic Configuration</h3>
- <p class="text-sm text-muted-foreground">Essential OIDC provider settings</p>
+ <p class="text-muted-foreground text-sm">Essential OIDC provider settings</p>
<div class="space-y-4">
<div class="space-y-2">
@@ -193,8 +188,7 @@
class="font-mono text-sm"
/>
<p class="text-muted-foreground text-xs">
- The issuer URL will be used to auto-discover OIDC endpoints. This is the
- recommended approach.
+ The issuer URL will be used to auto-discover OIDC endpoints. This is the recommended approach.
</p>
</div>
<div class="space-y-2">
@@ -211,15 +205,14 @@
<!-- Warning for server override -->
{#if oidcStatus.envForced && !oidcStatus.envConfigured}
- <div class="border border-destructive/50 bg-destructive/5 p-4 rounded-md">
- <div class="flex items-center gap-2 mb-2">
- <AlertTriangle class="size-4 text-destructive" />
- <h3 class="text-base font-semibold text-destructive">Server Override Warning</h3>
+ <div class="border-destructive/50 bg-destructive/5 rounded-md border p-4">
+ <div class="mb-2 flex items-center gap-2">
+ <TriangleAlertIcon class="text-destructive size-4" />
+ <h3 class="text-destructive text-base font-semibold">Server Override Warning</h3>
</div>
- <p class="text-sm text-destructive/80">
- While you can save these settings to the application database, it's strongly
- recommended to configure the OIDC settings directly in your server's environment for
- them to take full effect as intended by the server override.
+ <p class="text-destructive/80 text-sm">
+ While you can save these settings to the application database, it's strongly recommended to configure the OIDC
+ settings directly in your server's environment for them to take full effect as intended by the server override.
</p>
</div>
{/if}
@@ -227,37 +220,28 @@
{/if}
<!-- Redirect URI Information - Always shown -->
- <div class="border-t pt-6 mt-6">
- <div class="flex items-center gap-2 mb-3">
- <Info class="size-4 text-blue-600" />
+ <div class="mt-6 border-t pt-6">
+ <div class="mb-3 flex items-center gap-2">
+ <InfoIcon class="size-4 text-blue-600" />
<h3 class="text-base font-semibold">Redirect URI Configuration</h3>
</div>
- <p class="text-sm text-muted-foreground mb-3">
- Configure this redirect URI in your OIDC provider:
- </p>
+ <p class="text-muted-foreground mb-3 text-sm">Configure this redirect URI in your OIDC provider:</p>
<div class="flex items-center gap-2">
- <code class="flex-1 bg-muted p-2 rounded text-xs break-all font-mono">
+ <code class="bg-muted flex-1 break-all rounded p-2 font-mono text-xs">
{redirectUri}
</code>
- <Button
- size="sm"
- variant="outline"
- onclick={() => copyToClipboard(redirectUri)}
- class="flex-shrink-0"
- >
- <Copy class="size-3" />
+ <Button size="sm" variant="outline" onclick={() => copyToClipboard(redirectUri)} class="flex-shrink-0">
+ <CopyIcon class="size-3" />
</Button>
</div>
</div>
</div>
- <Dialog.Footer class="flex gap-3 pt-4 border-t flex-shrink-0">
- <Button variant="outline" onclick={() => (open = false)} class="flex-1 sm:flex-none">
- Close
- </Button>
+ <Dialog.Footer class="flex flex-shrink-0 gap-3 border-t pt-4">
+ <Button variant="outline" onclick={() => (open = false)} class="flex-1 sm:flex-none">Close</Button>
{#if !isOidcViewMode}
<Button onclick={onSave} class="flex-1 sm:flex-none">
- <Key class="size-4 mr-2" />
+ <KeyIcon class="mr-2 size-4" />
Configure OIDC
</Button>
{/if}
diff --git a/frontend/src/lib/components/dialogs/prune-confirmation-dialog.svelte b/frontend/src/lib/components/dialogs/prune-confirmation-dialog.svelte
index 242b80041..c33752838 100644
--- a/frontend/src/lib/components/dialogs/prune-confirmation-dialog.svelte
+++ b/frontend/src/lib/components/dialogs/prune-confirmation-dialog.svelte
@@ -3,7 +3,9 @@
import { Button } from '$lib/components/ui/button/index.js';
import * as Checkbox from '$lib/components/ui/checkbox/index.js';
import { Label } from '$lib/components/ui/label/index.js';
- import { AlertCircle, Trash2, Loader2 } from '@lucide/svelte';
+ import AlertCircleIcon from '@lucide/svelte/icons/alert-circle';
+ import Trash2Icon from '@lucide/svelte/icons/trash-2';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
import * as Alert from '$lib/components/ui/alert/index.js';
type PruneType = 'containers' | 'images' | 'networks' | 'volumes';
@@ -16,7 +18,13 @@
onCancel?: () => void;
}
- let { open = $bindable(), isPruning = false, imagePruneMode = 'dangling', onConfirm = () => {}, onCancel = () => {} }: Props = $props();
+ let {
+ open = $bindable(),
+ isPruning = false,
+ imagePruneMode = 'dangling',
+ onConfirm = () => {},
+ onCancel = () => {}
+ }: Props = $props();
let pruneContainers = $state(true);
let pruneImages = $state(true);
@@ -55,23 +63,36 @@
<Dialog.Content class="sm:max-w-[450px]" onkeydown={handleKeydown}>
<Dialog.Header>
<Dialog.Title>Confirm System Prune</Dialog.Title>
- <Dialog.Description>Select the resources you want to prune. This action permanently removes unused data and cannot be undone.</Dialog.Description>
+ <Dialog.Description
+ >Select the resources you want to prune. This action permanently removes unused data and cannot be undone.</Dialog.Description
+ >
</Dialog.Header>
<div class="grid gap-4 py-4">
<div class="flex items-center space-x-3">
<Checkbox.Root id="prune-containers" bind:checked={pruneContainers} disabled={isPruning} />
- <Label for="prune-containers" class="text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70">Stopped Containers</Label>
+ <Label
+ for="prune-containers"
+ class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
+ >Stopped Containers</Label
+ >
</div>
<div class="flex items-center space-x-3">
<Checkbox.Root id="prune-images" bind:checked={pruneImages} disabled={isPruning} />
- <Label for="prune-images" class="text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
+ <Label
+ for="prune-images"
+ class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
+ >
Unused Images ({imagePruneMode === 'dangling' ? 'Dangling Only' : 'All Unused'})
</Label>
</div>
<div class="flex items-center space-x-3">
<Checkbox.Root id="prune-networks" bind:checked={pruneNetworks} disabled={isPruning} />
- <Label for="prune-networks" class="text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70">Unused Networks</Label>
+ <Label
+ for="prune-networks"
+ class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
+ >Unused Networks</Label
+ >
</div>
<div class="flex items-start space-x-3">
<Checkbox.Root id="prune-volumes" bind:checked={pruneVolumes} disabled={isPruning} class="mt-1" />
@@ -79,13 +100,15 @@
<Label for="prune-volumes" class="text-sm font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
Unused Volumes <span class="text-destructive">(Potentially Destructive!)</span>
</Label>
- <p class="text-muted-foreground text-xs">Only enable this if you are certain no important data resides in unused volumes.</p>
+ <p class="text-muted-foreground text-xs">
+ Only enable this if you are certain no important data resides in unused volumes.
+ </p>
</div>
</div>
{#if pruneVolumes}
<Alert.Root variant="destructive" class="mt-2">
- <AlertCircle class="size-4" />
+ <AlertCircleIcon class="size-4" />
<Alert.Title>Warning: Pruning Volumes</Alert.Title>
<Alert.Description>Pruning volumes permanently deletes data. Ensure you have backups if necessary.</Alert.Description>
</Alert.Root>
@@ -94,11 +117,16 @@
<Dialog.Footer>
<Button class="arcane-button-cancel" variant="outline" onclick={handleCancel} disabled={isPruning}>Cancel</Button>
- <Button class="arcane-button-remove" variant="destructive" onclick={handleConfirm} disabled={selectedTypes.length === 0 || isPruning}>
+ <Button
+ class="arcane-button-remove"
+ variant="destructive"
+ onclick={handleConfirm}
+ disabled={selectedTypes.length === 0 || isPruning}
+ >
{#if isPruning}
- <Loader2 class="mr-2 size-4 animate-spin" /> Pruning...
+ <LoaderCircleIcon class="mr-2 size-4 animate-spin" /> Pruning...
{:else}
- <Trash2 class="mr-2 size-4" /> Prune Selected ({selectedTypes.length})
+ <Trash2Icon class="mr-2 size-4" /> Prune Selected ({selectedTypes.length})
{/if}
</Button>
</Dialog.Footer>
diff --git a/frontend/src/lib/components/dialogs/template-selection-dialog.svelte b/frontend/src/lib/components/dialogs/template-selection-dialog.svelte
index 35f5aea6e..301a09b51 100644
--- a/frontend/src/lib/components/dialogs/template-selection-dialog.svelte
+++ b/frontend/src/lib/components/dialogs/template-selection-dialog.svelte
@@ -3,7 +3,14 @@
import { Button } from '$lib/components/ui/button/index.js';
import { Card } from '$lib/components/ui/card/index.js';
import { Badge } from '$lib/components/ui/badge/index.js';
- import { FileText, Globe, FolderOpen, Settings, Download, Loader2, ChevronDown, ChevronRight } from '@lucide/svelte';
+ import FileTextIcon from '@lucide/svelte/icons/file-text';
+ import GlobeIcon from '@lucide/svelte/icons/globe';
+ import FolderOpenIcon from '@lucide/svelte/icons/folder-open';
+ import SettingsIcon from '@lucide/svelte/icons/settings';
+ import DownloadIcon from '@lucide/svelte/icons/download';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
+ import ChevronRightIcon from '@lucide/svelte/icons/chevron-right';
import { ScrollArea } from '$lib/components/ui/scroll-area/index.js';
import { templateAPI } from '$lib/services/api';
import type { Template } from '$lib/types/template.type';
@@ -26,10 +33,8 @@
let loadingStates = $state(new Map<string, boolean>());
const allTemplates = $derived(templates ?? []);
- // UI state
let sortBy = $state<'name-asc' | 'name-desc'>('name-asc');
let groupByRegistry = $state(true);
- let openGroups = $state<Set<string>>(new Set());
function normalizeTags(template: Template): string[] {
const raw = template.metadata?.tags;
@@ -155,7 +160,7 @@
<Dialog.Content class="max-h-screen overflow-y-auto sm:max-w-[900px]">
<Dialog.Header>
<Dialog.Title class="flex items-center gap-2">
- <FileText class="size-5" />
+ <FileTextIcon class="size-5" />
Choose a Template
</Dialog.Title>
<Dialog.Description>
@@ -192,7 +197,7 @@
<ScrollArea class="max-h-[65vh]">
{#if (allTemplates?.length ?? 0) === 0}
<div class="text-muted-foreground py-10 text-center">
- <FileText class="mx-auto mb-4 size-12 opacity-50" />
+ <FileTextIcon class="mx-auto mb-4 size-12 opacity-50" />
<p class="mb-2">No templates available</p>
<p class="text-sm">
Add a template registry in
@@ -207,8 +212,8 @@
<Card class="border-2">
<Collapsible.Trigger class="flex w-full items-center justify-between px-4 py-3 text-left">
<div class="flex items-center gap-2">
- <ChevronDown class="hidden size-4 data-[state=open]:block" />
- <ChevronRight class="block size-4 data-[state=open]:hidden" />
+ <ChevronDownIcon class="hidden size-4 data-[state=open]:block" />
+ <ChevronRightIcon class="block size-4 data-[state=open]:hidden" />
<span class="font-semibold">{group.name}</span>
<Badge variant="secondary" class="ml-2">{group.items.length}</Badge>
</div>
@@ -227,7 +232,7 @@
{/if}
{#if template.metadata?.envUrl || template.envContent}
<Badge variant="secondary" class="text-xs">
- <Settings class="mr-1 size-3" />
+ <SettingsIcon class="mr-1 size-3" />
ENV
</Badge>
{/if}
@@ -259,10 +264,10 @@
disabled={loadingStates.get(`download-${template.id}`)}
>
{#if loadingStates.get(`download-${template.id}`)}
- <Loader2 class="mr-1 size-3 animate-spin" />
+ <LoaderCircleIcon class="mr-1 size-3 animate-spin" />
Downloading...
{:else}
- <Download class="mr-1 size-3" />
+ <DownloadIcon class="mr-1 size-3" />
Download
{/if}
</Button>
@@ -273,7 +278,7 @@
disabled={loadingStates.get(template.id)}
>
{#if loadingStates.get(template.id)}
- <Loader2 class="mr-1 size-3 animate-spin" />
+ <LoaderCircleIcon class="mr-1 size-3 animate-spin" />
Loading...
{:else}
Use Now
@@ -305,7 +310,7 @@
{/if}
{#if template.metadata?.envUrl || template.envContent}
<Badge variant="secondary" class="text-xs">
- <Settings class="mr-1 size-3" />
+ <SettingsIcon class="mr-1 size-3" />
ENV
</Badge>
{/if}
@@ -315,9 +320,9 @@
<div class="mb-2">
<Badge variant="secondary" class="text-xs">
{#if template.isRemote}
- <Globe class="mr-1 size-3" />
+ <GlobeIcon class="mr-1 size-3" />
{:else}
- <FolderOpen class="mr-1 size-3" />
+ <FolderOpenIcon class="mr-1 size-3" />
{/if}
{getRegistryName(template)}
</Badge>
@@ -348,17 +353,17 @@
disabled={loadingStates.get(`download-${template.id}`)}
>
{#if loadingStates.get(`download-${template.id}`)}
- <Loader2 class="mr-1 size-3 animate-spin" />
+ <LoaderCircleIcon class="mr-1 size-3 animate-spin" />
Downloading...
{:else}
- <Download class="mr-1 size-3" />
+ <DownloadIcon class="mr-1 size-3" />
Download
{/if}
</Button>
{/if}
<Button size="sm" onclick={() => handleSelect(template)} disabled={loadingStates.get(template.id)}>
{#if loadingStates.get(template.id)}
- <Loader2 class="mr-1 size-3 animate-spin" />
+ <LoaderCircleIcon class="mr-1 size-3 animate-spin" />
Loading...
{:else}
Use Now
diff --git a/frontend/src/lib/components/dropdown-card.svelte b/frontend/src/lib/components/dropdown-card.svelte
index 45b007d06..b5d7e3805 100644
--- a/frontend/src/lib/components/dropdown-card.svelte
+++ b/frontend/src/lib/components/dropdown-card.svelte
@@ -1,6 +1,7 @@
<script lang="ts">
import { cn } from '$lib/utils';
- import { LucideChevronDown, type Icon as IconType } from '@lucide/svelte';
+ import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
+ import type { Icon as IconType } from '@lucide/svelte';
import { onMount, type Snippet } from 'svelte';
import { slide } from 'svelte/transition';
import { Button } from './ui/button';
@@ -49,12 +50,12 @@
</script>
<Card.Root>
- <Card.Header class="cursor-pointer p-5" onclick={toggleExpanded}>
+ <Card.Header class="cursor-pointer pt-2" onclick={toggleExpanded}>
<div class="flex items-center justify-between">
<div>
- <Card.Title class="mb-2 flex items-center gap-2 text-xl font-semibold">
+ <Card.Title class="my-2 flex items-center">
{#if icon}{@const Icon = icon}
- <Icon class="text-primary/80 size-5" />
+ <Icon class="text-primary/80 size-6" />
{/if}
{title}
</Card.Title>
@@ -63,9 +64,7 @@
{/if}
</div>
<Button class="ml-10 h-8 p-3" variant="ghost" aria-label="Expand Card">
- <LucideChevronDown
- class={cn('size-5 transition-transform duration-200', expanded && 'rotate-180 transform')}
- />
+ <ChevronDownIcon class={cn('size-5 transition-transform duration-200', expanded && 'rotate-180 transform')} />
</Button>
</div>
</Card.Header>
diff --git a/frontend/src/lib/components/dropdowns/filter-dropdown.svelte b/frontend/src/lib/components/dropdowns/filter-dropdown.svelte
deleted file mode 100644
index eaf141ca7..000000000
--- a/frontend/src/lib/components/dropdowns/filter-dropdown.svelte
+++ /dev/null
@@ -1,41 +0,0 @@
-<script lang="ts" generics="TFilters extends Record<string, any>">
- import { Button } from '$lib/components/ui/button/index.js';
- import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
- import { ChevronDown, Funnel } from '@lucide/svelte';
- import type { Snippet } from 'svelte';
- import { cn } from '$lib/utils';
-
- let {
- filters = $bindable(),
- children,
- label = 'Filter',
- icon = Funnel,
- variant = 'outline',
- align = 'end',
- class: className = ''
- }: {
- filters: TFilters;
- children: Snippet<[{ filters: TFilters }]>;
- label?: string;
- icon?: any;
- variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
- align?: 'start' | 'center' | 'end';
- class?: string;
- } = $props();
-</script>
-
-<DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- {@const Icon = icon}
- <Button {...props} {variant} class={cn('', className)}>
- <Icon class="size-4" />
- {label}
- <ChevronDown class="size-4" />
- </Button>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content class="border-primary" {align}>
- {@render children({ filters })}
- </DropdownMenu.Content>
-</DropdownMenu.Root>
diff --git a/frontend/src/lib/components/error.svelte b/frontend/src/lib/components/error.svelte
index 7e7696119..58dfbb5e2 100644
--- a/frontend/src/lib/components/error.svelte
+++ b/frontend/src/lib/components/error.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import { Button } from '$lib/components/ui/button';
- import { XCircle } from '@lucide/svelte';
+ import CircleXIcon from '@lucide/svelte/icons/circle-x';
let {
message,
@@ -21,10 +21,8 @@
<div class="grid h-full min-h-screen place-items-center px-6">
<div class="w-full max-w-md text-center">
- <div
- class="mx-auto mb-4 flex size-14 items-center justify-center rounded-full bg-destructive/10"
- >
- <XCircle class="text-destructive size-7" aria-hidden="true" />
+ <div class="bg-destructive/10 mx-auto mb-4 flex size-14 items-center justify-center rounded-full">
+ <CircleXIcon class="text-destructive size-7" aria-hidden="true" />
</div>
<h1 class="text-2xl font-semibold">{title}</h1>
diff --git a/frontend/src/lib/components/image-update-item.svelte b/frontend/src/lib/components/image-update-item.svelte
index 86c2e196e..65b597576 100644
--- a/frontend/src/lib/components/image-update-item.svelte
+++ b/frontend/src/lib/components/image-update-item.svelte
@@ -1,15 +1,13 @@
<script lang="ts">
import * as Tooltip from '$lib/components/ui/tooltip/index.js';
- import {
- CircleCheck,
- CircleFadingArrowUp,
- CircleArrowUp,
- Loader2,
- AlertTriangle,
- RefreshCw,
- ArrowRight,
- Package
- } from '@lucide/svelte';
+ import CircleCheckIcon from '@lucide/svelte/icons/circle-check';
+ import CircleFadingArrowUpIcon from '@lucide/svelte/icons/circle-fading-arrow-up';
+ import CircleArrowUpIcon from '@lucide/svelte/icons/circle-arrow-up';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import TriangleAlertIcon from '@lucide/svelte/icons/triangle-alert';
+ import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
+ import ArrowRightIcon from '@lucide/svelte/icons/arrow-right';
+ import PackageIcon from '@lucide/svelte/icons/package';
import { imageUpdateAPI } from '$lib/services/api';
import { toast } from 'svelte-sonner';
import type { ImageUpdateData } from '$lib/services/api/image-update-api-service';
@@ -23,14 +21,7 @@
onUpdated?: (data: ImageUpdateData) => void;
}
- let {
- updateInfo = undefined,
- isLoadingInBackground = false,
- imageId,
- repo,
- tag,
- onUpdated
- }: Props = $props();
+ let { updateInfo = undefined, isLoadingInBackground = false, imageId, repo, tag, onUpdated }: Props = $props();
let localUpdateInfo = $state<ImageUpdateData | undefined>(updateInfo);
let isChecking = $state(false);
@@ -84,8 +75,7 @@
color: string;
description: string;
} {
- if (!u.hasUpdate)
- return { level: 'None', color: 'text-green-500', description: 'Image is up to date' };
+ if (!u.hasUpdate) return { level: 'None', color: 'text-green-500', description: 'Image is up to date' };
if (u.updateType === 'digest')
return {
level: 'Security/Bug Fix',
@@ -108,11 +98,11 @@
<Tooltip.Trigger>
<span class="mr-2 inline-flex size-4 items-center justify-center align-middle">
{#if !localUpdateInfo.hasUpdate}
- <CircleCheck class="size-4 text-green-500" />
+ <CircleCheckIcon class="size-4 text-green-500" />
{:else if localUpdateInfo.updateType === 'digest'}
- <CircleArrowUp class="size-4 text-blue-500" />
+ <CircleArrowUpIcon class="size-4 text-blue-500" />
{:else}
- <CircleFadingArrowUp class="size-4 text-yellow-500" />
+ <CircleFadingArrowUpIcon class="size-4 text-yellow-500" />
{/if}
</span>
</Tooltip.Trigger>
@@ -124,30 +114,23 @@
<div class="overflow-hidden rounded-xl">
{#if !localUpdateInfo.hasUpdate}
<!-- Success State -->
- <div
- class="bg-gradient-to-br from-emerald-50 to-green-50/30 p-4 dark:from-emerald-950/20 dark:to-green-950/10"
- >
+ <div class="bg-gradient-to-br from-emerald-50 to-green-50/30 p-4 dark:from-emerald-950/20 dark:to-green-950/10">
<div class="flex items-center gap-3">
<div
class="flex h-10 w-10 items-center justify-center rounded-full bg-gradient-to-br from-emerald-500 to-green-500 shadow-lg shadow-emerald-500/25"
>
- <CircleCheck class="size-5 text-white" />
+ <CircleCheckIcon class="size-5 text-white" />
</div>
<div>
- <div class="text-sm font-semibold text-emerald-900 dark:text-emerald-100">
- Up to Date
- </div>
- <div class="text-xs text-emerald-700/80 dark:text-emerald-300/80">
- No updates available
- </div>
+ <div class="text-sm font-semibold text-emerald-900 dark:text-emerald-100">Up to Date</div>
+ <div class="text-xs text-emerald-700/80 dark:text-emerald-300/80">No updates available</div>
</div>
</div>
</div>
<div class="bg-white/90 p-4 dark:bg-gray-950/90">
<div class="text-center">
<div class="mb-2 text-xs text-gray-600 dark:text-gray-400">
- Running <span
- class="rounded bg-gray-100 px-1.5 py-0.5 font-mono text-xs font-medium dark:bg-gray-800"
+ Running <span class="rounded bg-gray-100 px-1.5 py-0.5 font-mono text-xs font-medium dark:bg-gray-800"
>{displayCurrentVersion()}</span
>
</div>
@@ -158,22 +141,16 @@
</div>
{:else if localUpdateInfo.updateType === 'digest'}
<!-- Digest Update State -->
- <div
- class="bg-gradient-to-br from-blue-50 to-cyan-50/30 p-4 dark:from-blue-950/20 dark:to-cyan-950/10"
- >
+ <div class="bg-gradient-to-br from-blue-50 to-cyan-50/30 p-4 dark:from-blue-950/20 dark:to-cyan-950/10">
<div class="flex items-center gap-3">
<div
class="flex h-10 w-10 items-center justify-center rounded-full bg-gradient-to-br from-blue-500 to-cyan-500 shadow-lg shadow-blue-500/25"
>
- <CircleArrowUp class="size-5 text-white" />
+ <CircleArrowUpIcon class="size-5 text-white" />
</div>
<div>
- <div class="text-sm font-semibold text-blue-900 dark:text-blue-100">
- Digest Update
- </div>
- <div class="text-xs text-blue-700/80 dark:text-blue-300/80">
- Security or bug fixes available
- </div>
+ <div class="text-sm font-semibold text-blue-900 dark:text-blue-100">Digest Update</div>
+ <div class="text-xs text-blue-700/80 dark:text-blue-300/80">Security or bug fixes available</div>
</div>
</div>
</div>
@@ -182,18 +159,17 @@
<div class="space-y-2 text-xs">
<div class="flex items-center justify-between">
<div class="flex items-center gap-1.5 text-gray-500 dark:text-gray-400">
- <Package class="size-3" />
+ <PackageIcon class="size-3" />
<span>Current</span>
</div>
- <span
- class="rounded bg-gray-100 px-1.5 py-0.5 font-mono font-medium dark:bg-gray-800"
+ <span class="rounded bg-gray-100 px-1.5 py-0.5 font-mono font-medium dark:bg-gray-800"
>{displayCurrentVersion()}</span
>
</div>
{#if displayLatestVersion()}
<div class="flex items-center justify-between">
<div class="flex items-center gap-1.5 text-gray-500 dark:text-gray-400">
- <ArrowRight class="size-3" />
+ <ArrowRightIcon class="size-3" />
<span>Latest Digest</span>
</div>
<span
@@ -205,9 +181,7 @@
{/if}
</div>
<div class="rounded-lg bg-blue-50 p-3 dark:bg-blue-950/30">
- <div
- class="text-xs text-center leading-relaxed text-blue-700 dark:text-blue-300 font-medium"
- >
+ <div class="text-center text-xs font-medium leading-relaxed text-blue-700 dark:text-blue-300">
{priority.description}
</div>
</div>
@@ -215,22 +189,16 @@
</div>
{:else}
<!-- Version Update State -->
- <div
- class="bg-gradient-to-br from-amber-50 to-yellow-50/30 p-4 dark:from-amber-950/20 dark:to-yellow-950/10"
- >
+ <div class="bg-gradient-to-br from-amber-50 to-yellow-50/30 p-4 dark:from-amber-950/20 dark:to-yellow-950/10">
<div class="flex items-center gap-3">
<div
class="flex h-10 w-10 items-center justify-center rounded-full bg-gradient-to-br from-amber-500 to-yellow-500 shadow-lg shadow-amber-500/25"
>
- <CircleFadingArrowUp class="size-5 text-white" />
+ <CircleFadingArrowUpIcon class="size-5 text-white" />
</div>
<div>
- <div class="text-sm font-semibold text-amber-900 dark:text-amber-100">
- Version Update
- </div>
- <div class="text-xs text-amber-700/80 dark:text-amber-300/80">
- New version available
- </div>
+ <div class="text-sm font-semibold text-amber-900 dark:text-amber-100">Version Update</div>
+ <div class="text-xs text-amber-700/80 dark:text-amber-300/80">New version available</div>
</div>
</div>
</div>
@@ -239,18 +207,17 @@
<div class="space-y-2 text-xs">
<div class="flex items-center justify-between">
<div class="flex items-center gap-1.5 text-gray-500 dark:text-gray-400">
- <Package class="size-3" />
+ <PackageIcon class="size-3" />
<span>Current</span>
</div>
- <span
- class="rounded bg-gray-100 px-1.5 py-0.5 font-mono font-medium dark:bg-gray-800"
+ <span class="rounded bg-gray-100 px-1.5 py-0.5 font-mono font-medium dark:bg-gray-800"
>{displayCurrentVersion()}</span
>
</div>
{#if displayLatestVersion()}
<div class="flex items-center justify-between">
<div class="flex items-center gap-1.5 text-gray-500 dark:text-gray-400">
- <ArrowRight class="size-3" />
+ <ArrowRightIcon class="size-3" />
<span>Latest</span>
</div>
<span
@@ -262,9 +229,7 @@
{/if}
</div>
<div class="rounded-lg bg-amber-50 p-3 dark:bg-amber-950/30">
- <div
- class="text-xs text-center leading-relaxed text-amber-700 dark:text-amber-300 font-medium"
- >
+ <div class="text-center text-xs font-medium leading-relaxed text-amber-700 dark:text-amber-300">
{priority.description}
</div>
</div>
@@ -273,19 +238,17 @@
{/if}
{#if canCheckUpdate}
- <div
- class="border-t border-gray-200/50 bg-gray-50/50 p-3 dark:border-gray-800/50 dark:bg-gray-900/50"
- >
+ <div class="border-t border-gray-200/50 bg-gray-50/50 p-3 dark:border-gray-800/50 dark:bg-gray-900/50">
<button
onclick={checkImageUpdate}
disabled={isChecking}
class="group flex w-full items-center justify-center gap-2 rounded-lg bg-white/80 px-3 py-2 text-xs font-medium text-gray-700 shadow-sm transition-all hover:bg-white hover:shadow-md disabled:cursor-not-allowed disabled:opacity-50 dark:bg-gray-800/80 dark:text-gray-300 dark:hover:bg-gray-800"
>
{#if isChecking}
- <Loader2 class="size-3 animate-spin" />
+ <LoaderCircleIcon class="size-3 animate-spin" />
Checking...
{:else}
- <RefreshCw class="size-3 transition-transform group-hover:rotate-45" />
+ <RefreshCwIcon class="size-3 transition-transform group-hover:rotate-45" />
Re-check Updates
{/if}
</button>
@@ -300,7 +263,7 @@
<Tooltip.Root>
<Tooltip.Trigger>
<span class="mr-2 inline-flex size-4 items-center justify-center align-middle">
- <Loader2 class="size-4 animate-spin text-blue-400" />
+ <LoaderCircleIcon class="size-4 animate-spin text-blue-400" />
</span>
</Tooltip.Trigger>
<Tooltip.Content
@@ -309,22 +272,16 @@
align="center"
>
<div class="overflow-hidden rounded-xl">
- <div
- class="bg-gradient-to-br from-blue-50 to-cyan-50/30 p-4 dark:from-blue-950/20 dark:to-cyan-950/10"
- >
+ <div class="bg-gradient-to-br from-blue-50 to-cyan-50/30 p-4 dark:from-blue-950/20 dark:to-cyan-950/10">
<div class="flex items-center gap-3">
<div
class="flex h-10 w-10 items-center justify-center rounded-full bg-gradient-to-br from-blue-500 to-cyan-500 shadow-lg shadow-blue-500/25"
>
- <Loader2 class="size-5 animate-spin text-white" />
+ <LoaderCircleIcon class="size-5 animate-spin text-white" />
</div>
<div>
- <div class="text-sm font-semibold text-blue-900 dark:text-blue-100">
- Checking Updates
- </div>
- <div class="text-xs text-blue-700/80 dark:text-blue-300/80">
- Querying registry for latest version...
- </div>
+ <div class="text-sm font-semibold text-blue-900 dark:text-blue-100">Checking Updates</div>
+ <div class="text-xs text-blue-700/80 dark:text-blue-300/80">Querying registry for latest version...</div>
</div>
</div>
</div>
@@ -344,17 +301,13 @@
class="group flex h-4 w-4 items-center justify-center rounded-full border-2 border-dashed border-gray-400 transition-colors hover:border-blue-400 hover:bg-blue-50 disabled:cursor-not-allowed dark:hover:bg-blue-950"
>
{#if isChecking}
- <Loader2 class="h-2 w-2 animate-spin text-blue-400" />
+ <LoaderCircleIcon class="h-2 w-2 animate-spin text-blue-400" />
{:else}
- <div
- class="h-1.5 w-1.5 rounded-full bg-gray-400 transition-colors group-hover:bg-blue-400"
- ></div>
+ <div class="h-1.5 w-1.5 rounded-full bg-gray-400 transition-colors group-hover:bg-blue-400"></div>
{/if}
</button>
{:else}
- <div
- class="flex h-4 w-4 items-center justify-center rounded-full border-2 border-dashed border-gray-400 opacity-30"
- >
+ <div class="flex h-4 w-4 items-center justify-center rounded-full border-2 border-dashed border-gray-400 opacity-30">
<div class="h-1.5 w-1.5 rounded-full bg-gray-400"></div>
</div>
{/if}
@@ -366,19 +319,15 @@
align="center"
>
<div class="overflow-hidden rounded-xl">
- <div
- class="bg-gradient-to-br from-gray-50 to-slate-50/30 p-4 dark:from-gray-900/20 dark:to-slate-900/10"
- >
+ <div class="bg-gradient-to-br from-gray-50 to-slate-50/30 p-4 dark:from-gray-900/20 dark:to-slate-900/10">
<div class="flex items-center gap-3">
<div
class="flex h-10 w-10 items-center justify-center rounded-full bg-gradient-to-br from-gray-400 to-slate-500 shadow-lg shadow-gray-400/25"
>
- <AlertTriangle class="size-5 text-white" />
+ <TriangleAlertIcon class="size-5 text-white" />
</div>
<div>
- <div class="text-sm font-semibold text-gray-900 dark:text-gray-100">
- Status Unknown
- </div>
+ <div class="text-sm font-semibold text-gray-900 dark:text-gray-100">Status Unknown</div>
<div class="text-xs text-gray-700/80 dark:text-gray-300/80">
{#if canCheckUpdate}
Click to check for updates from registry.
diff --git a/frontend/src/lib/components/LogViewer.svelte b/frontend/src/lib/components/log-viewer.svelte
similarity index 92%
rename from frontend/src/lib/components/LogViewer.svelte
rename to frontend/src/lib/components/log-viewer.svelte
index 662c54e4f..f267a39a6 100644
--- a/frontend/src/lib/components/LogViewer.svelte
+++ b/frontend/src/lib/components/log-viewer.svelte
@@ -186,13 +186,7 @@
return logs.length;
}
- function addLogEntry(logData: {
- level: string;
- message: string;
- timestamp?: string;
- service?: string;
- containerId?: string;
- }) {
+ function addLogEntry(logData: { level: string; message: string; timestamp?: string; service?: string; containerId?: string }) {
let cleanMessage = logData.message;
let timestamp = logData.timestamp || new Date().toISOString();
@@ -288,11 +282,9 @@
</div>
{:else}
{#each logs as log (log.timestamp + log.message + (log.service || ''))}
- <div
- class="flex border-l-2 border-transparent px-3 py-1 transition-colors hover:border-blue-500 hover:bg-gray-900/50"
- >
+ <div class="flex border-l-2 border-transparent px-3 py-1 transition-colors hover:border-blue-500 hover:bg-gray-900/50">
{#if showTimestamps}
- <span class="mr-3 shrink-0 text-xs text-gray-500 min-w-fit">
+ <span class="mr-3 min-w-fit shrink-0 text-xs text-gray-500">
{formatTimestamp(log.timestamp)}
</span>
{/if}
@@ -302,15 +294,12 @@
</span>
{#if type === 'stack' && log.service}
- <span
- class="mr-2 shrink-0 truncate text-xs text-blue-400 min-w-fit"
- title={log.service}
- >
+ <span class="mr-2 min-w-fit shrink-0 truncate text-xs text-blue-400" title={log.service}>
{log.service}
</span>
{/if}
- <span class="break-words whitespace-pre-wrap text-gray-300 flex-1">
+ <span class="flex-1 whitespace-pre-wrap break-words text-gray-300">
{log.message}
</span>
</div>
@@ -321,7 +310,6 @@
<style>
.log-viewer {
- font-family:
- 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
+ font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}
</style>
diff --git a/frontend/src/lib/components/meter-metric.svelte b/frontend/src/lib/components/meter-metric.svelte
index f4f418920..d6cfe2334 100644
--- a/frontend/src/lib/components/meter-metric.svelte
+++ b/frontend/src/lib/components/meter-metric.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
import Meter from '$lib/components/ui/meter/meter.svelte';
import type { Icon as IconType } from '@lucide/svelte';
- import { Loader2 } from '@lucide/svelte';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
interface Props {
title: string;
@@ -27,30 +27,26 @@
footerText
}: Props = $props();
- const percentage = $derived(
- currentValue !== undefined && !loading && maxValue > 0 ? (currentValue / maxValue) * 100 : 0
- );
+ const percentage = $derived(currentValue !== undefined && !loading && maxValue > 0 ? (currentValue / maxValue) * 100 : 0);
const Icon = icon;
</script>
<div
- class="group relative overflow-hidden rounded-xl border border-gray-200/50 bg-white/95 shadow-2xl shadow-black/10 backdrop-blur-sm transition-all duration-300 hover:border-gray-300/60 hover:shadow-3xl hover:shadow-black/15 dark:border-gray-800/50 dark:bg-gray-950/95 dark:shadow-black/30 dark:hover:border-gray-700/60"
+ class="hover:shadow-3xl group relative overflow-hidden rounded-xl border border-gray-200/50 bg-white/95 shadow-2xl shadow-black/10 backdrop-blur-sm transition-all duration-300 hover:border-gray-300/60 hover:shadow-black/15 dark:border-gray-800/50 dark:bg-gray-950/95 dark:shadow-black/30 dark:hover:border-gray-700/60"
>
<!-- Header Section with Gradient -->
- <div
- class="bg-gradient-to-br from-gray-50 to-slate-50/30 p-4 dark:from-gray-900/20 dark:to-slate-900/10"
- >
+ <div class="bg-gradient-to-br from-gray-50 to-slate-50/30 p-4 dark:from-gray-900/20 dark:to-slate-900/10">
<div class="flex items-center gap-3">
<div
- class="flex h-10 w-10 items-center justify-center rounded-full bg-gradient-to-br from-primary to-primary/80 shadow-lg shadow-primary/25"
+ class="from-primary to-primary/80 shadow-primary/25 flex h-10 w-10 items-center justify-center rounded-full bg-gradient-to-br shadow-lg"
>
{#if loading}
- <Loader2 class="size-5 animate-spin text-white" />
+ <LoaderCircleIcon class="size-5 animate-spin text-white" />
{:else}
<Icon class="size-5 text-white" />
{/if}
</div>
- <div class="flex-1 min-w-0">
+ <div class="min-w-0 flex-1">
<div class="text-sm font-semibold text-gray-900 dark:text-gray-100">{title}</div>
{#if description}
<div class="text-xs text-gray-700/80 dark:text-gray-300/80">{description}</div>
@@ -64,7 +60,7 @@
<div class="space-y-3">
<div class="text-center">
{#if loading}
- <div class="h-8 w-16 bg-muted animate-pulse rounded mx-auto"></div>
+ <div class="bg-muted mx-auto h-8 w-16 animate-pulse rounded"></div>
{:else}
<div class="text-2xl font-bold text-gray-900 dark:text-gray-100">
{currentValue !== undefined ? formatValue(currentValue) : '--'}
@@ -75,20 +71,18 @@
<div class="flex justify-center">
<div class="w-full max-w-[120px]">
{#if loading}
- <div class="h-2 w-full bg-muted animate-pulse rounded"></div>
+ <div class="bg-muted h-2 w-full animate-pulse rounded"></div>
{:else}
<Meter value={percentage} class="h-2 bg-gray-200 dark:bg-gray-800" />
{/if}
</div>
</div>
- <div class="rounded-lg bg-primary/10 p-3 dark:bg-primary/20">
+ <div class="bg-primary/10 dark:bg-primary/20 rounded-lg p-3">
{#if loading}
- <div class="h-3 w-20 bg-muted animate-pulse rounded mx-auto"></div>
+ <div class="bg-muted mx-auto h-3 w-20 animate-pulse rounded"></div>
{:else}
- <div
- class="text-xs text-center font-medium leading-relaxed text-primary dark:text-primary"
- >
+ <div class="text-primary dark:text-primary text-center text-xs font-medium leading-relaxed">
{footerText ?? `${percentage.toFixed(1)}% of resources being used`}
</div>
{/if}
diff --git a/frontend/src/lib/components/sheets/add-template-registry-sheet.svelte b/frontend/src/lib/components/sheets/add-template-registry-sheet.svelte
index 6afee2a70..b732fc98b 100644
--- a/frontend/src/lib/components/sheets/add-template-registry-sheet.svelte
+++ b/frontend/src/lib/components/sheets/add-template-registry-sheet.svelte
@@ -3,7 +3,9 @@
import { Button } from '$lib/components/ui/button/index.js';
import FormInput from '$lib/components/form/form-input.svelte';
import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
- import { Loader2, Globe, AlertCircle } from '@lucide/svelte';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import GlobeIcon from '@lucide/svelte/icons/globe';
+ import AlertCircleIcon from '@lucide/svelte/icons/alert-circle';
import { z } from 'zod/v4';
import { createForm, preventDefault } from '$lib/utils/form.utils';
import { templateAPI } from '$lib/services/api';
@@ -69,7 +71,7 @@
<Sheet.Header class="space-y-3 border-b pb-6">
<div class="flex items-center gap-3">
<div class="bg-primary/10 flex size-10 shrink-0 items-center justify-center rounded-lg">
- <Globe class="text-primary size-5" />
+ <GlobeIcon class="text-primary size-5" />
</div>
<div>
<Sheet.Title class="text-xl font-semibold">Add Template Registry</Sheet.Title>
@@ -97,7 +99,7 @@
{#if submitError}
<Alert.Root class="border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-950">
- <AlertCircle class="size-4" />
+ <AlertCircleIcon class="size-4" />
<Alert.Title>Validation Error</Alert.Title>
<Alert.Description class="text-sm">{submitError}</Alert.Description>
</Alert.Root>
@@ -115,7 +117,7 @@
</Button>
<Button type="submit" class="arcane-button-create flex-1" disabled={isLoading}>
{#if isLoading}
- <Loader2 class="mr-2 size-4 animate-spin" />
+ <LoaderCircleIcon class="mr-2 size-4 animate-spin" />
{/if}
Add Registry
</Button>
diff --git a/frontend/src/lib/components/sheets/container-registry-sheet.svelte b/frontend/src/lib/components/sheets/container-registry-sheet.svelte
index f2a2fd506..977af5cf9 100644
--- a/frontend/src/lib/components/sheets/container-registry-sheet.svelte
+++ b/frontend/src/lib/components/sheets/container-registry-sheet.svelte
@@ -3,9 +3,10 @@
import { Button } from '$lib/components/ui/button/index.js';
import FormInput from '$lib/components/form/form-input.svelte';
import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
- import { Loader2, PackagePlusIcon } from '@lucide/svelte';
- import type { ContainerRegistry } from '$lib/models/container-registry';
- import type { ContainerRegistryCreateDto, ContainerRegistryUpdateDto } from '$lib/dto/container-registry-dto';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import PackagePlusIcon from '@lucide/svelte/icons/package-plus';
+ import type { ContainerRegistry } from '$lib/types/container-registry.type';
+ import type { ContainerRegistryCreateDto, ContainerRegistryUpdateDto } from '$lib/types/container-registry.type';
import { z } from 'zod/v4';
import { createForm, preventDefault } from '$lib/utils/form.utils';
@@ -57,34 +58,67 @@
<Sheet.Root bind:open onOpenChange={handleOpenChange}>
<Sheet.Content class="p-6">
- <Sheet.Header class="space-y-3 pb-6 border-b">
+ <Sheet.Header class="space-y-3 border-b pb-6">
<div class="flex items-center gap-3">
- <div class="flex size-10 items-center justify-center rounded-lg bg-primary/10 shrink-0">
- <PackagePlusIcon class="size-5 text-primary" />
+ <div class="bg-primary/10 flex size-10 shrink-0 items-center justify-center rounded-lg">
+ <PackagePlusIcon class="text-primary size-5" />
</div>
<div>
<Sheet.Title class="text-xl font-semibold">
{isEditMode ? 'Edit' : 'Add'} Container Registry
</Sheet.Title>
- <Sheet.Description class="text-sm text-muted-foreground mt-1">
+ <Sheet.Description class="text-muted-foreground mt-1 text-sm">
{isEditMode ? 'Update the details for this container registry.' : 'Enter the details for the new container registry.'}
</Sheet.Description>
</div>
</div>
</Sheet.Header>
<form onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-4">
- <FormInput label="Registry URL *" type="text" placeholder="e.g., docker.io, ghcr.io, gcr.io, quay.io" description="Leave empty or use 'docker.io' for Docker Hub" bind:input={$inputs.url} />
+ <FormInput
+ label="Registry URL *"
+ type="text"
+ placeholder="e.g., docker.io, ghcr.io, gcr.io, quay.io"
+ description="Leave empty or use 'docker.io' for Docker Hub"
+ bind:input={$inputs.url}
+ />
<FormInput label="Username *" type="text" description="Your registry username" bind:input={$inputs.username} />
- <FormInput label="Token *" type="password" placeholder={isEditMode ? 'Leave empty to keep current token' : 'Your registry password or token'} description="Use a Personal Access Token or your password if the registry supports it. " bind:input={$inputs.token} />
- <FormInput label="Description" type="text" placeholder="Optional description for this registry" bind:input={$inputs.description} />
- <SwitchWithLabel id="isEnabledSwitch" label="Enabled" description="Enable this registry for authentication" bind:checked={$inputs.enabled.value} />
- <SwitchWithLabel id="insecureSwitch" label="Allow Insecure Connection" description="Allow HTTP connections" bind:checked={$inputs.insecure.value} />
+ <FormInput
+ label="Token *"
+ type="password"
+ placeholder={isEditMode ? 'Leave empty to keep current token' : 'Your registry password or token'}
+ description="Use a Personal Access Token or your password if the registry supports it. "
+ bind:input={$inputs.token}
+ />
+ <FormInput
+ label="Description"
+ type="text"
+ placeholder="Optional description for this registry"
+ bind:input={$inputs.description}
+ />
+ <SwitchWithLabel
+ id="isEnabledSwitch"
+ label="Enabled"
+ description="Enable this registry for authentication"
+ bind:checked={$inputs.enabled.value}
+ />
+ <SwitchWithLabel
+ id="insecureSwitch"
+ label="Allow Insecure Connection"
+ description="Allow HTTP connections"
+ bind:checked={$inputs.insecure.value}
+ />
<Sheet.Footer class="flex flex-row gap-2">
- <Button type="button" class="arcane-button-cancel flex-1" variant="outline" onclick={() => (open = false)} disabled={isLoading}>Cancel</Button>
+ <Button
+ type="button"
+ class="arcane-button-cancel flex-1"
+ variant="outline"
+ onclick={() => (open = false)}
+ disabled={isLoading}>Cancel</Button
+ >
<Button type="submit" class="arcane-button-create flex-1" disabled={isLoading}>
{#if isLoading}
- <Loader2 class="mr-2 size-4 animate-spin" />
+ <LoaderCircleIcon class="mr-2 size-4 animate-spin" />
{/if}
{isEditMode ? 'Save Changes' : 'Add Registry'}
</Button>
diff --git a/frontend/src/lib/components/sheets/create-container-sheet.svelte b/frontend/src/lib/components/sheets/create-container-sheet.svelte
index d98f148de..160612a39 100644
--- a/frontend/src/lib/components/sheets/create-container-sheet.svelte
+++ b/frontend/src/lib/components/sheets/create-container-sheet.svelte
@@ -7,7 +7,10 @@
import { Label } from '$lib/components/ui/label/index.js';
import { Input } from '$lib/components/ui/input/index.js';
import { Textarea } from '$lib/components/ui/textarea/index.js';
- import { Loader2, Container, X, Plus } from '@lucide/svelte';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import ContainerIcon from '@lucide/svelte/icons/container';
+ import XIcon from '@lucide/svelte/icons/x';
+ import PlusIcon from '@lucide/svelte/icons/plus';
import type { ContainerCreateOptions } from 'dockerode';
import { z } from 'zod/v4';
import { createForm, preventDefault } from '$lib/utils/form.utils';
@@ -22,7 +25,14 @@
availableVolumes?: string[];
};
- let { open = $bindable(false), onSubmit, isLoading, availableImages = [], availableNetworks = [], availableVolumes = [] }: CreateContainerFormProps = $props();
+ let {
+ open = $bindable(false),
+ onSubmit,
+ isLoading,
+ availableImages = [],
+ availableNetworks = [],
+ availableVolumes = []
+ }: CreateContainerFormProps = $props();
const restartPolicies = [
{ value: 'no', label: 'No' },
@@ -91,8 +101,12 @@
// Dynamic states for complex inputs
let envVars = $state<{ key: string; value: string }[]>([{ key: '', value: '' }]);
- let portMappings = $state<{ container: string; host: string; protocol: string }[]>([{ container: '', host: '', protocol: 'tcp' }]);
- let volumeMounts = $state<{ source: string; destination: string; readonly: boolean }[]>([{ source: '', destination: '', readonly: false }]);
+ let portMappings = $state<{ container: string; host: string; protocol: string }[]>([
+ { container: '', host: '', protocol: 'tcp' }
+ ]);
+ let volumeMounts = $state<{ source: string; destination: string; readonly: boolean }[]>([
+ { source: '', destination: '', readonly: false }
+ ]);
function parseKeyValuePairs(text: string): Record<string, string> {
if (!text?.trim()) return {};
@@ -190,7 +204,9 @@
const dynamicBinds: string[] = [];
volumeMounts.forEach((mount) => {
if (mount.source.trim() && mount.destination.trim()) {
- const bind = mount.readonly ? `${mount.source.trim()}:${mount.destination.trim()}:ro` : `${mount.source.trim()}:${mount.destination.trim()}`;
+ const bind = mount.readonly
+ ? `${mount.source.trim()}:${mount.destination.trim()}:ro`
+ : `${mount.source.trim()}:${mount.destination.trim()}`;
dynamicBinds.push(bind);
}
});
@@ -263,25 +279,27 @@
</script>
<Sheet.Root bind:open onOpenChange={handleOpenChange}>
- <Sheet.Content side="top" class="p-5 max-h-[90vh]">
- <div class="flex flex-col h-full">
+ <Sheet.Content side="top" class="max-h-[90vh] p-5">
+ <div class="flex h-full flex-col">
<!-- Header -->
- <div class="px-6 py-4 border-b bg-background shrink-0">
+ <div class="bg-background shrink-0 border-b px-6 py-4">
<div class="flex items-center gap-3">
- <div class="flex size-10 items-center justify-center rounded-lg bg-primary/10 shrink-0">
- <Container class="size-5 text-primary" />
+ <div class="bg-primary/10 flex size-10 shrink-0 items-center justify-center rounded-lg">
+ <ContainerIcon class="text-primary size-5" />
</div>
<div>
<Sheet.Title class="text-xl font-semibold">Create New Container</Sheet.Title>
- <Sheet.Description class="text-sm text-muted-foreground mt-1">Configure and create a new Docker container.</Sheet.Description>
+ <Sheet.Description class="text-muted-foreground mt-1 text-sm"
+ >Configure and create a new Docker container.</Sheet.Description
+ >
</div>
</div>
</div>
<!-- Content with Tabs -->
<div class="flex-1">
- <Tabs.Root value="basic" class="flex flex-col h-full">
- <Tabs.List class="grid w-full grid-cols-6 border-b bg-muted/30 shrink-0">
+ <Tabs.Root value="basic" class="flex h-full flex-col">
+ <Tabs.List class="bg-muted/30 grid w-full shrink-0 grid-cols-6 border-b">
<Tabs.Trigger value="basic" class="py-3">Basic</Tabs.Trigger>
<Tabs.Trigger value="environment" class="py-3">Environment</Tabs.Trigger>
<Tabs.Trigger value="ports" class="py-3">Ports</Tabs.Trigger>
@@ -291,55 +309,102 @@
</Tabs.List>
<div class="flex-1 overflow-y-auto">
- <form onsubmit={preventDefault(handleSubmit)} class="h-full flex flex-col">
+ <form onsubmit={preventDefault(handleSubmit)} class="flex h-full flex-col">
<div class="flex-1">
<!-- Basic Tab -->
- <Tabs.Content value="basic" class="p-6 space-y-8 mt-0">
- <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
+ <Tabs.Content value="basic" class="mt-0 space-y-8 p-6">
+ <div class="grid grid-cols-1 gap-6 lg:grid-cols-2">
<div class="space-y-3">
<Label for="container-name" class="text-sm font-medium">Container Name *</Label>
- <Input id="container-name" type="text" placeholder="e.g., my-app-container" disabled={isLoading} bind:value={$inputs.containerName.value} class={$inputs.containerName.error ? 'border-destructive' : ''} />
+ <Input
+ id="container-name"
+ type="text"
+ placeholder="e.g., my-app-container"
+ disabled={isLoading}
+ bind:value={$inputs.containerName.value}
+ class={$inputs.containerName.error ? 'border-destructive' : ''}
+ />
{#if $inputs.containerName.error}
- <p class="text-xs text-destructive mt-1">{$inputs.containerName.error}</p>
+ <p class="text-destructive mt-1 text-xs">{$inputs.containerName.error}</p>
{/if}
- <p class="text-xs text-muted-foreground">Unique name for the container</p>
+ <p class="text-muted-foreground text-xs">Unique name for the container</p>
</div>
<div class="space-y-3">
<Label for="image" class="text-sm font-medium">Image *</Label>
- <Input id="image" type="text" placeholder="e.g., nginx:latest" disabled={isLoading} bind:value={$inputs.image.value} class={$inputs.image.error ? 'border-destructive' : ''} />
+ <Input
+ id="image"
+ type="text"
+ placeholder="e.g., nginx:latest"
+ disabled={isLoading}
+ bind:value={$inputs.image.value}
+ class={$inputs.image.error ? 'border-destructive' : ''}
+ />
{#if $inputs.image.error}
- <p class="text-xs text-destructive mt-1">{$inputs.image.error}</p>
+ <p class="text-destructive mt-1 text-xs">{$inputs.image.error}</p>
{/if}
- <p class="text-xs text-muted-foreground">Docker image to use for the container</p>
+ <p class="text-muted-foreground text-xs">Docker image to use for the container</p>
</div>
</div>
<div class="space-y-3">
- <FormInput label="Command" type="text" placeholder="e.g., /bin/bash -c 'echo hello'" description="Command to run in the container" disabled={isLoading} bind:input={$inputs.command} />
+ <FormInput
+ label="Command"
+ type="text"
+ placeholder="e.g., /bin/bash -c 'echo hello'"
+ description="Command to run in the container"
+ disabled={isLoading}
+ bind:input={$inputs.command}
+ />
</div>
- <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
+ <div class="grid grid-cols-1 gap-6 lg:grid-cols-2">
<div class="space-y-3">
- <FormInput label="Working Directory" type="text" placeholder="/app" description="Working directory inside the container" disabled={isLoading} bind:input={$inputs.workingDir} />
+ <FormInput
+ label="Working Directory"
+ type="text"
+ placeholder="/app"
+ description="Working directory inside the container"
+ disabled={isLoading}
+ bind:input={$inputs.workingDir}
+ />
</div>
<div class="space-y-3">
- <FormInput label="User" type="text" placeholder="1000:1000" description="User to run the container as" disabled={isLoading} bind:input={$inputs.user} />
+ <FormInput
+ label="User"
+ type="text"
+ placeholder="1000:1000"
+ description="User to run the container as"
+ disabled={isLoading}
+ bind:input={$inputs.user}
+ />
</div>
<div class="space-y-3">
- <FormInput label="Hostname" type="text" placeholder="my-container" disabled={isLoading} bind:input={$inputs.hostname} />
+ <FormInput
+ label="Hostname"
+ type="text"
+ placeholder="my-container"
+ disabled={isLoading}
+ bind:input={$inputs.hostname}
+ />
</div>
<div class="space-y-3">
- <FormInput label="Domain Name" type="text" placeholder="example.com" disabled={isLoading} bind:input={$inputs.domainname} />
+ <FormInput
+ label="Domain Name"
+ type="text"
+ placeholder="example.com"
+ disabled={isLoading}
+ bind:input={$inputs.domainname}
+ />
</div>
</div>
- <div class="border rounded-lg p-6 space-y-4">
+ <div class="space-y-4 rounded-lg border p-6">
<h4 class="text-sm font-semibold">I/O Settings</h4>
- <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
+ <div class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
<div class="flex items-center space-x-2">
<Checkbox id="attach-stdout" bind:checked={$inputs.attachStdout.value} disabled={isLoading} />
<Label for="attach-stdout" class="text-sm font-normal">Attach Stdout</Label>
@@ -369,24 +434,38 @@
</Tabs.Content>
<!-- Environment Tab -->
- <Tabs.Content value="environment" class="p-6 space-y-8 mt-0">
- <div class="grid grid-cols-1 xl:grid-cols-2 gap-8">
+ <Tabs.Content value="environment" class="mt-0 space-y-8 p-6">
+ <div class="grid grid-cols-1 gap-8 xl:grid-cols-2">
<div class="space-y-6">
<div>
- <h3 class="text-lg font-semibold mb-4">Dynamic Environment Variables</h3>
+ <h3 class="mb-4 text-lg font-semibold">Dynamic Environment Variables</h3>
<div class="space-y-3">
{#each envVars as env, index (index)}
<div class="flex items-center gap-3">
<Input type="text" placeholder="KEY" bind:value={env.key} disabled={isLoading} class="flex-1" />
<span class="text-muted-foreground font-mono">=</span>
<Input type="text" placeholder="value" bind:value={env.value} disabled={isLoading} class="flex-1" />
- <Button type="button" variant="ghost" size="icon" onclick={() => removeEnvVar(index)} disabled={isLoading || envVars.length <= 1} class="text-destructive hover:text-destructive shrink-0">
- <X class="size-4" />
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon"
+ onclick={() => removeEnvVar(index)}
+ disabled={isLoading || envVars.length <= 1}
+ class="text-destructive hover:text-destructive shrink-0"
+ >
+ <XIcon class="size-4" />
</Button>
</div>
{/each}
- <Button type="button" variant="outline" size="sm" onclick={addEnvVar} disabled={isLoading} class="w-full">
- <Plus class="size-4 mr-2" />
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onclick={addEnvVar}
+ disabled={isLoading}
+ class="w-full"
+ >
+ <PlusIcon class="mr-2 size-4" />
Add Environment Variable
</Button>
</div>
@@ -395,13 +474,21 @@
<div class="space-y-6">
<div>
- <h3 class="text-lg font-semibold mb-4">Text Format Environment Variables</h3>
+ <h3 class="mb-4 text-lg font-semibold">Text Format Environment Variables</h3>
<div class="space-y-3">
- <Textarea placeholder="NODE_ENV=production&#10;PORT=3000&#10;DEBUG=true" disabled={isLoading} rows={12} bind:value={$inputs.environmentVars.value} class={$inputs.environmentVars.error ? 'border-destructive' : ''} />
+ <Textarea
+ placeholder="NODE_ENV=production&#10;PORT=3000&#10;DEBUG=true"
+ disabled={isLoading}
+ rows={12}
+ bind:value={$inputs.environmentVars.value}
+ class={$inputs.environmentVars.error ? 'border-destructive' : ''}
+ />
{#if $inputs.environmentVars.error}
- <p class="text-xs text-destructive">{$inputs.environmentVars.error}</p>
+ <p class="text-destructive text-xs">{$inputs.environmentVars.error}</p>
{/if}
- <p class="text-xs text-muted-foreground">Enter environment variables as KEY=value pairs, one per line</p>
+ <p class="text-muted-foreground text-xs">
+ Enter environment variables as KEY=value pairs, one per line
+ </p>
</div>
</div>
</div>
@@ -409,34 +496,64 @@
</Tabs.Content>
<!-- Ports Tab -->
- <Tabs.Content value="ports" class="p-6 space-y-8 mt-0">
- <div class="grid grid-cols-1 xl:grid-cols-2 gap-8">
+ <Tabs.Content value="ports" class="mt-0 space-y-8 p-6">
+ <div class="grid grid-cols-1 gap-8 xl:grid-cols-2">
<div class="space-y-6">
<div>
- <h3 class="text-lg font-semibold mb-4">Port Mappings</h3>
+ <h3 class="mb-4 text-lg font-semibold">Port Mappings</h3>
<div class="space-y-3">
{#each portMappings as mapping, index (index)}
<div class="flex items-center gap-3">
- <div class="flex items-center gap-2 flex-1">
- <div class="text-sm text-muted-foreground whitespace-nowrap min-w-12">Host:</div>
- <Input type="text" placeholder="8080" bind:value={mapping.host} disabled={isLoading} class="flex-1" />
+ <div class="flex flex-1 items-center gap-2">
+ <div class="text-muted-foreground min-w-12 whitespace-nowrap text-sm">Host:</div>
+ <Input
+ type="text"
+ placeholder="8080"
+ bind:value={mapping.host}
+ disabled={isLoading}
+ class="flex-1"
+ />
</div>
<span class="text-muted-foreground">→</span>
- <div class="flex items-center gap-2 flex-1">
- <div class="text-sm text-muted-foreground whitespace-nowrap min-w-20">Container:</div>
- <Input type="text" placeholder="80" bind:value={mapping.container} disabled={isLoading} class="flex-1" />
+ <div class="flex flex-1 items-center gap-2">
+ <div class="text-muted-foreground min-w-20 whitespace-nowrap text-sm">Container:</div>
+ <Input
+ type="text"
+ placeholder="80"
+ bind:value={mapping.container}
+ disabled={isLoading}
+ class="flex-1"
+ />
</div>
- <select bind:value={mapping.protocol} disabled={isLoading} class="px-3 py-2 border rounded-md text-sm min-w-16">
+ <select
+ bind:value={mapping.protocol}
+ disabled={isLoading}
+ class="min-w-16 rounded-md border px-3 py-2 text-sm"
+ >
<option value="tcp">TCP</option>
<option value="udp">UDP</option>
</select>
- <Button type="button" variant="ghost" size="icon" onclick={() => removePortMapping(index)} disabled={isLoading || portMappings.length <= 1} class="text-destructive hover:text-destructive shrink-0">
- <X class="size-4" />
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon"
+ onclick={() => removePortMapping(index)}
+ disabled={isLoading || portMappings.length <= 1}
+ class="text-destructive hover:text-destructive shrink-0"
+ >
+ <XIcon class="size-4" />
</Button>
</div>
{/each}
- <Button type="button" variant="outline" size="sm" onclick={addPortMapping} disabled={isLoading} class="w-full">
- <Plus class="size-4 mr-2" />
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onclick={addPortMapping}
+ disabled={isLoading}
+ class="w-full"
+ >
+ <PlusIcon class="mr-2 size-4" />
Add Port Mapping
</Button>
</div>
@@ -445,9 +562,16 @@
<div class="space-y-6">
<div>
- <h3 class="text-lg font-semibold mb-4">Port Configuration</h3>
+ <h3 class="mb-4 text-lg font-semibold">Port Configuration</h3>
<div class="space-y-4">
- <FormInput label="Exposed Ports" type="text" placeholder="80,443,8080/tcp" description="Comma-separated list of ports to expose" disabled={isLoading} bind:input={$inputs.exposedPorts} />
+ <FormInput
+ label="Exposed Ports"
+ type="text"
+ placeholder="80,443,8080/tcp"
+ description="Comma-separated list of ports to expose"
+ disabled={isLoading}
+ bind:input={$inputs.exposedPorts}
+ />
<div class="flex items-center space-x-2 pt-2">
<Checkbox id="publish-all" bind:checked={$inputs.publishAllPorts.value} disabled={isLoading} />
@@ -460,20 +584,39 @@
</Tabs.Content>
<!-- Volumes Tab -->
- <Tabs.Content value="volumes" class="p-6 space-y-8 mt-0">
- <div class="grid grid-cols-1 xl:grid-cols-2 gap-8">
+ <Tabs.Content value="volumes" class="mt-0 space-y-8 p-6">
+ <div class="grid grid-cols-1 gap-8 xl:grid-cols-2">
<div class="space-y-6">
<div>
- <h3 class="text-lg font-semibold mb-4">Volume Mounts</h3>
+ <h3 class="mb-4 text-lg font-semibold">Volume Mounts</h3>
<div class="space-y-3">
{#each volumeMounts as mount, index (index)}
<div class="space-y-2">
<div class="flex items-center gap-3">
- <Input type="text" placeholder="Source path or volume name" bind:value={mount.source} disabled={isLoading} class="flex-1" />
+ <Input
+ type="text"
+ placeholder="Source path or volume name"
+ bind:value={mount.source}
+ disabled={isLoading}
+ class="flex-1"
+ />
<span class="text-muted-foreground">:</span>
- <Input type="text" placeholder="Container path" bind:value={mount.destination} disabled={isLoading} class="flex-1" />
- <Button type="button" variant="ghost" size="icon" onclick={() => removeVolumeMount(index)} disabled={isLoading || volumeMounts.length <= 1} class="text-destructive hover:text-destructive shrink-0">
- <X class="size-4" />
+ <Input
+ type="text"
+ placeholder="Container path"
+ bind:value={mount.destination}
+ disabled={isLoading}
+ class="flex-1"
+ />
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon"
+ onclick={() => removeVolumeMount(index)}
+ disabled={isLoading || volumeMounts.length <= 1}
+ class="text-destructive hover:text-destructive shrink-0"
+ >
+ <XIcon class="size-4" />
</Button>
</div>
<div class="flex items-center space-x-2 pl-3">
@@ -482,8 +625,15 @@
</div>
</div>
{/each}
- <Button type="button" variant="outline" size="sm" onclick={addVolumeMount} disabled={isLoading} class="w-full">
- <Plus class="size-4 mr-2" />
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onclick={addVolumeMount}
+ disabled={isLoading}
+ class="w-full"
+ >
+ <PlusIcon class="mr-2 size-4" />
Add Volume Mount
</Button>
</div>
@@ -492,13 +642,21 @@
<div class="space-y-6">
<div>
- <h3 class="text-lg font-semibold mb-4">Text Format Volume Binds</h3>
+ <h3 class="mb-4 text-lg font-semibold">Text Format Volume Binds</h3>
<div class="space-y-3">
- <Textarea placeholder="/host/path:/container/path&#10;/host/path2:/container/path2:ro&#10;myvolume:/app/data" disabled={isLoading} rows={12} bind:value={$inputs.volumes.value} class={$inputs.volumes.error ? 'border-destructive' : ''} />
+ <Textarea
+ placeholder="/host/path:/container/path&#10;/host/path2:/container/path2:ro&#10;myvolume:/app/data"
+ disabled={isLoading}
+ rows={12}
+ bind:value={$inputs.volumes.value}
+ class={$inputs.volumes.error ? 'border-destructive' : ''}
+ />
{#if $inputs.volumes.error}
- <p class="text-xs text-destructive">{$inputs.volumes.error}</p>
+ <p class="text-destructive text-xs">{$inputs.volumes.error}</p>
{/if}
- <p class="text-xs text-muted-foreground">Enter volume binds as source:destination[:options], one per line</p>
+ <p class="text-muted-foreground text-xs">
+ Enter volume binds as source:destination[:options], one per line
+ </p>
</div>
</div>
</div>
@@ -506,18 +664,22 @@
</Tabs.Content>
<!-- Network & Security Tab -->
- <Tabs.Content value="network" class="p-6 space-y-8 mt-0">
- <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
+ <Tabs.Content value="network" class="mt-0 space-y-8 p-6">
+ <div class="grid grid-cols-1 gap-8 lg:grid-cols-2">
<div class="space-y-6">
- <div class="border rounded-lg p-6">
- <h3 class="text-lg font-semibold mb-4">Network Settings</h3>
+ <div class="rounded-lg border p-6">
+ <h3 class="mb-4 text-lg font-semibold">Network Settings</h3>
<div class="space-y-4">
<div class="flex items-center space-x-3">
<Checkbox id="network-disabled" bind:checked={$inputs.networkDisabled.value} disabled={isLoading} />
<Label for="network-disabled" class="text-sm font-normal">Disable Network</Label>
</div>
<div class="flex items-center space-x-3">
- <Checkbox id="publish-all-ports-net" bind:checked={$inputs.publishAllPorts.value} disabled={isLoading} />
+ <Checkbox
+ id="publish-all-ports-net"
+ bind:checked={$inputs.publishAllPorts.value}
+ disabled={isLoading}
+ />
<Label for="publish-all-ports-net" class="text-sm font-normal">Publish All Ports</Label>
</div>
</div>
@@ -525,8 +687,8 @@
</div>
<div class="space-y-6">
- <div class="border rounded-lg p-6">
- <h3 class="text-lg font-semibold mb-4">Security Settings</h3>
+ <div class="rounded-lg border p-6">
+ <h3 class="mb-4 text-lg font-semibold">Security Settings</h3>
<div class="space-y-4">
<div class="flex items-center space-x-3">
<Checkbox id="privileged" bind:checked={$inputs.privileged.value} disabled={isLoading} />
@@ -547,19 +709,33 @@
</Tabs.Content>
<!-- Advanced Tab -->
- <Tabs.Content value="advanced" class="p-6 space-y-8 mt-0">
- <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
+ <Tabs.Content value="advanced" class="mt-0 space-y-8 p-6">
+ <div class="grid grid-cols-1 gap-8 lg:grid-cols-2">
<div class="space-y-6">
- <div class="border rounded-lg p-6">
- <h3 class="text-lg font-semibold mb-4">Restart Policy</h3>
+ <div class="rounded-lg border p-6">
+ <h3 class="mb-4 text-lg font-semibold">Restart Policy</h3>
<div class="space-y-4">
- <SelectWithLabel id="restart-policy" bind:value={$inputs.restartPolicy.value} label="Restart Policy" description="Container restart behavior" options={restartPolicies} placeholder="Select restart policy" />
+ <SelectWithLabel
+ id="restart-policy"
+ bind:value={$inputs.restartPolicy.value}
+ label="Restart Policy"
+ description="Container restart behavior"
+ options={restartPolicies}
+ placeholder="Select restart policy"
+ />
{#if $inputs.restartPolicy.value === 'on-failure'}
<div class="space-y-3">
<Label for="max-retries" class="text-sm font-medium">Maximum Retry Count</Label>
- <Input id="max-retries" type="number" min="0" placeholder="5" disabled={isLoading} bind:value={$inputs.restartMaxRetries.value} />
- <p class="text-xs text-muted-foreground">Maximum number of restart attempts</p>
+ <Input
+ id="max-retries"
+ type="number"
+ min="0"
+ placeholder="5"
+ disabled={isLoading}
+ bind:value={$inputs.restartMaxRetries.value}
+ />
+ <p class="text-muted-foreground text-xs">Maximum number of restart attempts</p>
</div>
{/if}
</div>
@@ -567,14 +743,20 @@
</div>
<div class="space-y-6">
- <div class="border rounded-lg p-6">
- <h3 class="text-lg font-semibold mb-4">Labels</h3>
+ <div class="rounded-lg border p-6">
+ <h3 class="mb-4 text-lg font-semibold">Labels</h3>
<div class="space-y-3">
- <Textarea placeholder="com.example.description=My application&#10;com.example.version=1.0.0&#10;[email protected]" disabled={isLoading} rows={8} bind:value={$inputs.labels.value} class={$inputs.labels.error ? 'border-destructive' : ''} />
+ <Textarea
+ placeholder="com.example.description=My application&#10;com.example.version=1.0.0&#10;[email protected]"
+ disabled={isLoading}
+ rows={8}
+ bind:value={$inputs.labels.value}
+ class={$inputs.labels.error ? 'border-destructive' : ''}
+ />
{#if $inputs.labels.error}
- <p class="text-xs text-destructive">{$inputs.labels.error}</p>
+ <p class="text-destructive text-xs">{$inputs.labels.error}</p>
{/if}
- <p class="text-xs text-muted-foreground">Enter metadata labels as key=value pairs, one per line</p>
+ <p class="text-muted-foreground text-xs">Enter metadata labels as key=value pairs, one per line</p>
</div>
</div>
</div>
@@ -583,15 +765,15 @@
</div>
<!-- Footer -->
- <div class="border-t p-6 bg-background shrink-0">
- <div class="flex flex-row gap-3 justify-end">
+ <div class="bg-background shrink-0 border-t p-6">
+ <div class="flex flex-row justify-end gap-3">
<Button type="button" variant="outline" onclick={() => (open = false)} disabled={isLoading}>Cancel</Button>
<Button type="submit" disabled={isLoading}>
{#if isLoading}
- <Loader2 class="mr-2 size-4 animate-spin" />
+ <LoaderCircleIcon class="mr-2 size-4 animate-spin" />
Creating...
{:else}
- <Container class="mr-2 size-4" />
+ <ContainerIcon class="mr-2 size-4" />
Create Container
{/if}
</Button>
diff --git a/frontend/src/lib/components/sheets/create-network-sheet.svelte b/frontend/src/lib/components/sheets/create-network-sheet.svelte
index cb5454b80..e7595dae0 100644
--- a/frontend/src/lib/components/sheets/create-network-sheet.svelte
+++ b/frontend/src/lib/components/sheets/create-network-sheet.svelte
@@ -6,7 +6,9 @@
import { Label } from '$lib/components/ui/label/index.js';
import { Input } from '$lib/components/ui/input/index.js';
import { Textarea } from '$lib/components/ui/textarea/index.js';
- import { Loader2, Network, X } from '@lucide/svelte';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import NetworkIcon from '@lucide/svelte/icons/network';
+ import XIcon from '@lucide/svelte/icons/x';
import type { NetworkCreateOptions } from 'dockerode';
import { z } from 'zod/v4';
import { createForm, preventDefault } from '$lib/utils/form.utils';
@@ -149,14 +151,16 @@
<Sheet.Root bind:open onOpenChange={handleOpenChange}>
<Sheet.Content class="p-6">
- <Sheet.Header data-testid="create-network-dialog-header" class="space-y-3 pb-6 border-b">
+ <Sheet.Header data-testid="create-network-dialog-header" class="space-y-3 border-b pb-6">
<div class="flex items-center gap-3">
- <div class="flex size-10 items-center justify-center rounded-lg bg-primary/10 shrink-0">
- <Network class="size-5 text-primary" />
+ <div class="bg-primary/10 flex size-10 shrink-0 items-center justify-center rounded-lg">
+ <NetworkIcon class="text-primary size-5" />
</div>
<div>
<Sheet.Title class="text-xl font-semibold">Create New Network</Sheet.Title>
- <Sheet.Description class="text-sm text-muted-foreground mt-1">Configure and create a new Docker network.</Sheet.Description>
+ <Sheet.Description class="text-muted-foreground mt-1 text-sm"
+ >Configure and create a new Docker network.</Sheet.Description
+ >
</div>
</div>
</Sheet.Header>
@@ -164,14 +168,28 @@
<form onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-4">
<div class="space-y-2">
<Label for="network-name" class="text-sm font-medium">Network Name *</Label>
- <Input id="network-name" type="text" placeholder="e.g., my-app-network" disabled={isLoading} bind:value={$inputs.networkName.value} class={$inputs.networkName.error ? 'border-destructive' : ''} />
+ <Input
+ id="network-name"
+ type="text"
+ placeholder="e.g., my-app-network"
+ disabled={isLoading}
+ bind:value={$inputs.networkName.value}
+ class={$inputs.networkName.error ? 'border-destructive' : ''}
+ />
{#if $inputs.networkName.error}
- <p class="text-xs text-destructive">{$inputs.networkName.error}</p>
+ <p class="text-destructive text-xs">{$inputs.networkName.error}</p>
{/if}
- <p class="text-xs text-muted-foreground">Unique name for the network</p>
+ <p class="text-muted-foreground text-xs">Unique name for the network</p>
</div>
- <SelectWithLabel id="driver-select" bind:value={$inputs.networkDriver.value} label="Network Driver" description="Choose the network driver type" options={drivers} placeholder="Select a driver" />
+ <SelectWithLabel
+ id="driver-select"
+ bind:value={$inputs.networkDriver.value}
+ label="Network Driver"
+ description="Choose the network driver type"
+ options={drivers}
+ placeholder="Select a driver"
+ />
<div class="space-y-4">
<div class="flex items-center space-x-4">
@@ -197,8 +215,16 @@
<div class="flex items-center gap-2">
<Input type="text" placeholder="Key" bind:value={label.key} disabled={isLoading} class="flex-1" />
<Input type="text" placeholder="Value" bind:value={label.value} disabled={isLoading} class="flex-1" />
- <Button type="button" variant="ghost" size="icon" onclick={() => removeLabel(index)} disabled={isLoading || labels.length <= 1} class="text-destructive hover:text-destructive" title="Remove Label">
- <X class="size-4" />
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon"
+ onclick={() => removeLabel(index)}
+ disabled={isLoading || labels.length <= 1}
+ class="text-destructive hover:text-destructive"
+ title="Remove Label"
+ >
+ <XIcon class="size-4" />
</Button>
</div>
{/each}
@@ -207,11 +233,18 @@
<div class="space-y-2">
<Label for="network-labels" class="text-sm font-medium">Additional Labels (Text Format)</Label>
- <Textarea id="network-labels" placeholder="com.example.description=Production network&#10;com.example.department=Backend" disabled={isLoading} rows={3} bind:value={$inputs.networkLabels.value} class={$inputs.networkLabels.error ? 'border-destructive' : ''} />
+ <Textarea
+ id="network-labels"
+ placeholder="com.example.description=Production network&#10;com.example.department=Backend"
+ disabled={isLoading}
+ rows={3}
+ bind:value={$inputs.networkLabels.value}
+ class={$inputs.networkLabels.error ? 'border-destructive' : ''}
+ />
{#if $inputs.networkLabels.error}
- <p class="text-xs text-destructive">{$inputs.networkLabels.error}</p>
+ <p class="text-destructive text-xs">{$inputs.networkLabels.error}</p>
{/if}
- <p class="text-xs text-muted-foreground">Enter additional labels as key=value pairs, one per line</p>
+ <p class="text-muted-foreground text-xs">Enter additional labels as key=value pairs, one per line</p>
</div>
</div>
</Accordion.Content>
@@ -227,23 +260,37 @@
</div>
{#if $inputs.enableIpam.value}
- <div class="space-y-4 pl-6 border-l-2 border-muted">
+ <div class="border-muted space-y-4 border-l-2 pl-6">
<div class="space-y-2">
<Label for="subnet" class="text-sm font-medium">Subnet</Label>
- <Input id="subnet" type="text" placeholder="e.g., 172.20.0.0/16" disabled={isLoading} bind:value={$inputs.subnet.value} class={$inputs.subnet.error ? 'border-destructive' : ''} />
+ <Input
+ id="subnet"
+ type="text"
+ placeholder="e.g., 172.20.0.0/16"
+ disabled={isLoading}
+ bind:value={$inputs.subnet.value}
+ class={$inputs.subnet.error ? 'border-destructive' : ''}
+ />
{#if $inputs.subnet.error}
- <p class="text-xs text-destructive">{$inputs.subnet.error}</p>
+ <p class="text-destructive text-xs">{$inputs.subnet.error}</p>
{/if}
- <p class="text-xs text-muted-foreground">Network subnet in CIDR notation</p>
+ <p class="text-muted-foreground text-xs">Network subnet in CIDR notation</p>
</div>
<div class="space-y-2">
<Label for="gateway" class="text-sm font-medium">Gateway</Label>
- <Input id="gateway" type="text" placeholder="e.g., 172.20.0.1" disabled={isLoading} bind:value={$inputs.gateway.value} class={$inputs.gateway.error ? 'border-destructive' : ''} />
+ <Input
+ id="gateway"
+ type="text"
+ placeholder="e.g., 172.20.0.1"
+ disabled={isLoading}
+ bind:value={$inputs.gateway.value}
+ class={$inputs.gateway.error ? 'border-destructive' : ''}
+ />
{#if $inputs.gateway.error}
- <p class="text-xs text-destructive">{$inputs.gateway.error}</p>
+ <p class="text-destructive text-xs">{$inputs.gateway.error}</p>
{/if}
- <p class="text-xs text-muted-foreground">Gateway IP address for the network</p>
+ <p class="text-muted-foreground text-xs">Gateway IP address for the network</p>
</div>
</div>
{/if}
@@ -253,13 +300,19 @@
</Accordion.Root>
<Sheet.Footer class="flex flex-row gap-2">
- <Button type="button" class="arcane-button-cancel flex-1" variant="outline" onclick={() => (open = false)} disabled={isLoading}>Cancel</Button>
+ <Button
+ type="button"
+ class="arcane-button-cancel flex-1"
+ variant="outline"
+ onclick={() => (open = false)}
+ disabled={isLoading}>Cancel</Button
+ >
<Button type="submit" class="arcane-button-create flex-1" disabled={isLoading}>
{#if isLoading}
- <Loader2 class="mr-2 size-4 animate-spin" />
+ <LoaderCircleIcon class="mr-2 size-4 animate-spin" />
Creating...
{:else}
- <Network class="mr-2 size-4" />
+ <NetworkIcon class="mr-2 size-4" />
Create Network
{/if}
</Button>
diff --git a/frontend/src/lib/components/sheets/create-volume-sheet.svelte b/frontend/src/lib/components/sheets/create-volume-sheet.svelte
index b1412fe3b..48ed4899e 100644
--- a/frontend/src/lib/components/sheets/create-volume-sheet.svelte
+++ b/frontend/src/lib/components/sheets/create-volume-sheet.svelte
@@ -3,7 +3,8 @@
import { Button } from '$lib/components/ui/button/index.js';
import FormInput from '$lib/components/form/form-input.svelte';
import * as Accordion from '$lib/components/ui/accordion/index.js';
- import { Loader2, HardDrive } from '@lucide/svelte';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
import type { VolumeCreateOptions } from 'dockerode';
import { z } from 'zod/v4';
import { createForm, preventDefault } from '$lib/utils/form.utils';
@@ -92,44 +93,83 @@
<Sheet.Root bind:open onOpenChange={handleOpenChange}>
<Sheet.Content class="p-6">
- <Sheet.Header class="space-y-3 pb-6 border-b">
+ <Sheet.Header class="space-y-3 border-b pb-6">
<div class="flex items-center gap-3">
- <div class="flex size-10 items-center justify-center rounded-lg bg-primary/10 shrink-0">
- <HardDrive class="size-5 text-primary" />
+ <div class="bg-primary/10 flex size-10 shrink-0 items-center justify-center rounded-lg">
+ <HardDriveIcon class="text-primary size-5" />
</div>
<div>
<Sheet.Title data-testid="create-volume-header" class="text-xl font-semibold">Create New Volume</Sheet.Title>
- <Sheet.Description class="text-sm text-muted-foreground mt-1">Enter the details for the new Docker volume.</Sheet.Description>
+ <Sheet.Description class="text-muted-foreground mt-1 text-sm"
+ >Enter the details for the new Docker volume.</Sheet.Description
+ >
</div>
</div>
</Sheet.Header>
<form onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-4">
- <FormInput label="Volume Name *" id="volume-name" type="text" placeholder="e.g., my-app-data" description="Unique name for the volume" disabled={isLoading} bind:input={$inputs.volumeName} />
-
- <SelectWithLabel id="driver-select" bind:value={$inputs.volumeDriver.value} label="Volume Driver" description="Choose the storage driver for your volume" options={drivers} placeholder="Select a driver" />
+ <FormInput
+ label="Volume Name *"
+ id="volume-name"
+ type="text"
+ placeholder="e.g., my-app-data"
+ description="Unique name for the volume"
+ disabled={isLoading}
+ bind:input={$inputs.volumeName}
+ />
+
+ <SelectWithLabel
+ id="driver-select"
+ bind:value={$inputs.volumeDriver.value}
+ label="Volume Driver"
+ description="Choose the storage driver for your volume"
+ options={drivers}
+ placeholder="Select a driver"
+ />
<Accordion.Root type="single" class="w-full">
<Accordion.Item value="advanced">
<Accordion.Trigger class="text-sm font-medium">Advanced Settings</Accordion.Trigger>
<Accordion.Content class="pt-4">
<div class="space-y-4">
- <FormInput label="Driver Options" type="textarea" placeholder="key=value&#10;key2=value2" description="Enter driver-specific options as key=value pairs, one per line" disabled={isLoading} rows={3} bind:input={$inputs.volumeOptText} />
-
- <FormInput label="Labels" type="textarea" placeholder="com.example.description=Production data&#10;com.example.department=Finance" description="Enter metadata labels as key=value pairs, one per line" disabled={isLoading} rows={3} bind:input={$inputs.volumeLabels} />
+ <FormInput
+ label="Driver Options"
+ type="textarea"
+ placeholder="key=value&#10;key2=value2"
+ description="Enter driver-specific options as key=value pairs, one per line"
+ disabled={isLoading}
+ rows={3}
+ bind:input={$inputs.volumeOptText}
+ />
+
+ <FormInput
+ label="Labels"
+ type="textarea"
+ placeholder="com.example.description=Production data&#10;com.example.department=Finance"
+ description="Enter metadata labels as key=value pairs, one per line"
+ disabled={isLoading}
+ rows={3}
+ bind:input={$inputs.volumeLabels}
+ />
</div>
</Accordion.Content>
</Accordion.Item>
</Accordion.Root>
<Sheet.Footer class="flex flex-row gap-2">
- <Button type="button" class="arcane-button-cancel flex-1" variant="outline" onclick={() => (open = false)} disabled={isLoading}>Cancel</Button>
+ <Button
+ type="button"
+ class="arcane-button-cancel flex-1"
+ variant="outline"
+ onclick={() => (open = false)}
+ disabled={isLoading}>Cancel</Button
+ >
<Button type="submit" class="arcane-button-create flex-1" disabled={isLoading}>
{#if isLoading}
- <Loader2 class="mr-2 size-4 animate-spin" />
+ <LoaderCircleIcon class="mr-2 size-4 animate-spin" />
Creating...
{:else}
- <HardDrive class="mr-2 size-4" />
+ <HardDriveIcon class="mr-2 size-4" />
Create Volume
{/if}
</Button>
diff --git a/frontend/src/lib/components/sheets/image-pull-sheet.svelte b/frontend/src/lib/components/sheets/image-pull-sheet.svelte
index 21c8db8f6..40946076f 100644
--- a/frontend/src/lib/components/sheets/image-pull-sheet.svelte
+++ b/frontend/src/lib/components/sheets/image-pull-sheet.svelte
@@ -2,7 +2,8 @@
import * as Sheet from '$lib/components/ui/sheet/index.js';
import { Button } from '$lib/components/ui/button/index.js';
import FormInput from '$lib/components/form/form-input.svelte';
- import { Loader2, Download } from '@lucide/svelte';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import DownloadIcon from '@lucide/svelte/icons/download';
import { z } from 'zod/v4';
import { createForm, preventDefault } from '$lib/utils/form.utils';
import { toast } from 'svelte-sonner';
@@ -61,7 +62,9 @@
} else if (activeLayers > 0 && totalCurrentBytes > 0) {
pullProgress = 5;
} else if (Object.keys(layerProgress).length > 0 && activeLayers === 0) {
- const allDone = Object.values(layerProgress).every((l) => l.status && (l.status.toLowerCase().includes('pull complete') || l.status.toLowerCase().includes('already exists')));
+ const allDone = Object.values(layerProgress).every(
+ (l) => l.status && (l.status.toLowerCase().includes('pull complete') || l.status.toLowerCase().includes('already exists'))
+ );
if (allDone) pullProgress = 100;
}
}
@@ -109,7 +112,8 @@
const errorData = await response.json().catch(() => ({
error: 'Failed to pull image. Server returned an error.'
}));
- const errorMessage = typeof errorData.error === 'string' ? errorData.error : errorData.message || `HTTP error ${response.status}`;
+ const errorMessage =
+ typeof errorData.error === 'string' ? errorData.error : errorData.message || `HTTP error ${response.status}`;
throw new Error(errorMessage);
}
@@ -160,7 +164,13 @@
calculateOverallProgress();
if (!pullError && pullProgress < 100) {
- const allLayersCompleteOrExisting = Object.values(layerProgress).every((l) => l.status && (l.status.toLowerCase().includes('complete') || l.status.toLowerCase().includes('already exists') || l.status.toLowerCase().includes('downloaded newer image')));
+ const allLayersCompleteOrExisting = Object.values(layerProgress).every(
+ (l) =>
+ l.status &&
+ (l.status.toLowerCase().includes('complete') ||
+ l.status.toLowerCase().includes('already exists') ||
+ l.status.toLowerCase().includes('downloaded newer image'))
+ );
if (allLayersCompleteOrExisting && Object.keys(layerProgress).length > 0) {
pullProgress = 100;
}
@@ -213,14 +223,14 @@
<Sheet.Root bind:open onOpenChange={handleOpenChange}>
<Sheet.Content class="p-6">
- <Sheet.Header class="space-y-3 pb-6 border-b">
+ <Sheet.Header class="space-y-3 border-b pb-6">
<div class="flex items-center gap-3">
- <div class="flex size-10 items-center justify-center rounded-lg bg-primary/10 shrink-0">
- <Download class="size-5 text-primary" />
+ <div class="bg-primary/10 flex size-10 shrink-0 items-center justify-center rounded-lg">
+ <DownloadIcon class="text-primary size-5" />
</div>
<div>
<Sheet.Title class="text-xl font-semibold">Pull Docker Image</Sheet.Title>
- <Sheet.Description class="text-sm text-muted-foreground mt-1">
+ <Sheet.Description class="text-muted-foreground mt-1 text-sm">
Enter the image reference you want to pull from a registry.
{#if pullError}
<p class="text-destructive mt-2 text-sm">{pullError}</p>
@@ -231,8 +241,22 @@
</Sheet.Header>
<form onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-4">
- <FormInput label="Image Name *" type="text" placeholder="nginx, redis, ubuntu, etc." description="Enter the image name from Docker Hub or other registries" disabled={isPulling} bind:input={$inputs.imageRef} />
- <FormInput label="Tag" type="text" placeholder="latest" description="Specify a tag version (defaults to 'latest')" disabled={isPulling} bind:input={$inputs.tag} />
+ <FormInput
+ label="Image Name *"
+ type="text"
+ placeholder="nginx, redis, ubuntu, etc."
+ description="Enter the image name from Docker Hub or other registries"
+ disabled={isPulling}
+ bind:input={$inputs.imageRef}
+ />
+ <FormInput
+ label="Tag"
+ type="text"
+ placeholder="latest"
+ description="Specify a tag version (defaults to 'latest')"
+ disabled={isPulling}
+ bind:input={$inputs.tag}
+ />
{#if isPulling || pullStatusText}
<div class="mt-4">
@@ -248,19 +272,27 @@
<p class="mt-1 text-xs text-green-600">{pullStatusText}</p>
{/if}
{#if isPulling}
- <p class="text-muted-foreground mt-1 text-xs">This may take a while depending on the image size and your internet connection.</p>
+ <p class="text-muted-foreground mt-1 text-xs">
+ This may take a while depending on the image size and your internet connection.
+ </p>
{/if}
</div>
{/if}
<Sheet.Footer class="flex flex-row gap-2">
- <Button type="button" class="arcane-button-cancel flex-1" variant="outline" onclick={() => (open = false)} disabled={isPulling}>Cancel</Button>
+ <Button
+ type="button"
+ class="arcane-button-cancel flex-1"
+ variant="outline"
+ onclick={() => (open = false)}
+ disabled={isPulling}>Cancel</Button
+ >
<Button type="submit" class="arcane-button-create flex-1" disabled={isPulling}>
{#if isPulling}
- <Loader2 class="mr-2 size-4 animate-spin" />
+ <LoaderCircleIcon class="mr-2 size-4 animate-spin" />
<span class="opacity-0">Pull Image</span>
{:else}
- <Download class="mr-2 size-4" />
+ <DownloadIcon class="mr-2 size-4" />
Pull Image
{/if}
</Button>
diff --git a/frontend/src/lib/components/sheets/new-environment-sheet.svelte b/frontend/src/lib/components/sheets/new-environment-sheet.svelte
index 18f797ac2..d7b8ce690 100644
--- a/frontend/src/lib/components/sheets/new-environment-sheet.svelte
+++ b/frontend/src/lib/components/sheets/new-environment-sheet.svelte
@@ -5,11 +5,14 @@
import { Button } from '$lib/components/ui/button/index.js';
import FormInput from '$lib/components/form/form-input.svelte';
import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
- import { Loader2, Server, Trash2, TestTube } from '@lucide/svelte';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import ServerIcon from '@lucide/svelte/icons/server';
+ import Trash2Icon from '@lucide/svelte/icons/trash-2';
+ import TestTubeIcon from '@lucide/svelte/icons/test-tube';
import * as Card from '$lib/components/ui/card';
import { environmentManagementAPI } from '$lib/services/api';
import type { Environment } from '$lib/stores/environment.store';
- import type { CreateEnvironmentDTO } from '$lib/dto/environment-dto';
+ import type { CreateEnvironmentDTO } from '$lib/types/environment.type';
import { z } from 'zod/v4';
import { createForm, preventDefault } from '$lib/utils/form.utils';
@@ -120,15 +123,17 @@
</script>
<Sheet.Root bind:open onOpenChange={handleOpenChange}>
- <Sheet.Content class="p-6 w-full sm:max-w-lg">
- <Sheet.Header class="space-y-3 pb-6 border-b">
+ <Sheet.Content class="w-full p-6 sm:max-w-lg">
+ <Sheet.Header class="space-y-3 border-b pb-6">
<div class="flex items-center gap-3">
- <div class="flex size-10 items-center justify-center rounded-lg bg-primary/10 shrink-0">
- <Server class="size-5 text-primary" />
+ <div class="bg-primary/10 flex size-10 shrink-0 items-center justify-center rounded-lg">
+ <ServerIcon class="text-primary size-5" />
</div>
<div>
<Sheet.Title class="text-xl font-semibold">Manage Environments</Sheet.Title>
- <Sheet.Description class="text-sm text-muted-foreground mt-1">Add and manage remote Docker environments. Each environment should be an Arcane agent running as an API server.</Sheet.Description>
+ <Sheet.Description class="text-muted-foreground mt-1 text-sm"
+ >Add and manage remote Docker environments. Each environment should be an Arcane agent running as an API server.</Sheet.Description
+ >
</div>
</div>
</Sheet.Header>
@@ -140,17 +145,40 @@
</Card.Header>
<Card.Content>
<form onsubmit={preventDefault(handleSubmit)} class="space-y-4">
- <FormInput label="Hostname *" type="text" placeholder="docker-host-1" description="Display name for this environment" bind:input={$inputs.hostname} />
-
- <FormInput label="API URL *" type="text" placeholder="http://192.168.1.100:3552" description="Full URL to the agent's API endpoint" bind:input={$inputs.apiUrl} />
-
- <FormInput label="Description" type="text" placeholder="Production Docker host" description="Optional description for this environment" bind:input={$inputs.description} />
-
- <SwitchWithLabel id="enabledSwitch" label="Enabled" description="Enable this environment for use" bind:checked={$inputs.enabled.value} />
+ <FormInput
+ label="Hostname *"
+ type="text"
+ placeholder="docker-host-1"
+ description="Display name for this environment"
+ bind:input={$inputs.hostname}
+ />
+
+ <FormInput
+ label="API URL *"
+ type="text"
+ placeholder="http://192.168.1.100:3552"
+ description="Full URL to the agent's API endpoint"
+ bind:input={$inputs.apiUrl}
+ />
+
+ <FormInput
+ label="Description"
+ type="text"
+ placeholder="Production Docker host"
+ description="Optional description for this environment"
+ bind:input={$inputs.description}
+ />
+
+ <SwitchWithLabel
+ id="enabledSwitch"
+ label="Enabled"
+ description="Enable this environment for use"
+ bind:checked={$inputs.enabled.value}
+ />
<Button type="submit" class="w-full" disabled={isSubmitting}>
{#if isSubmitting}
- <Loader2 class="mr-2 size-4 animate-spin" />
+ <LoaderCircleIcon class="mr-2 size-4 animate-spin" />
{/if}
Add Environment
</Button>
@@ -164,30 +192,34 @@
</Card.Header>
<Card.Content>
{#if loading}
- <div class="text-center py-4">
- <Loader2 class="size-4 animate-spin mx-auto" />
+ <div class="py-4 text-center">
+ <LoaderCircleIcon class="mx-auto size-4 animate-spin" />
</div>
{:else if environments.length === 0}
- <div class="text-center py-4 text-muted-foreground">No environments configured</div>
+ <div class="text-muted-foreground py-4 text-center">No environments configured</div>
{:else}
<div class="space-y-3">
{#each environments as environment}
- <div class="flex items-center justify-between p-3 border rounded-lg">
- <div class="flex-1 min-w-0">
- <div class="font-medium truncate">{environment.hostname}</div>
- <div class="text-sm text-muted-foreground truncate">{environment.apiUrl}</div>
- <div class="flex items-center gap-2 mt-1">
- <span class="text-xs px-2 py-1 rounded-full {environment.status === 'online' ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'}">
+ <div class="flex items-center justify-between rounded-lg border p-3">
+ <div class="min-w-0 flex-1">
+ <div class="truncate font-medium">{environment.hostname}</div>
+ <div class="text-muted-foreground truncate text-sm">{environment.apiUrl}</div>
+ <div class="mt-1 flex items-center gap-2">
+ <span
+ class="rounded-full px-2 py-1 text-xs {environment.status === 'online'
+ ? 'bg-green-100 text-green-800'
+ : 'bg-red-100 text-red-800'}"
+ >
{environment.status}
</span>
</div>
</div>
- <div class="flex items-center gap-2 ml-2">
+ <div class="ml-2 flex items-center gap-2">
<Button variant="outline" size="sm" onclick={() => testConnection(environment.id)}>
- <TestTube class="h-4 w-4" />
+ <TestTubeIcon class="h-4 w-4" />
</Button>
<Button variant="destructive" size="sm" onclick={() => deleteEnvironment(environment.id)}>
- <Trash2 class="h-4 w-4" />
+ <Trash2Icon class="h-4 w-4" />
</Button>
</div>
</div>
diff --git a/frontend/src/lib/components/sheets/user-form-sheet.svelte b/frontend/src/lib/components/sheets/user-form-sheet.svelte
index e520e857a..ba2aaab9d 100644
--- a/frontend/src/lib/components/sheets/user-form-sheet.svelte
+++ b/frontend/src/lib/components/sheets/user-form-sheet.svelte
@@ -3,7 +3,9 @@
import { Button } from '$lib/components/ui/button/index.js';
import FormInput from '$lib/components/form/form-input.svelte';
import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
- import { Loader2, UserPlus, Save } from '@lucide/svelte';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import UserPlusIcon from '@lucide/svelte/icons/user-plus';
+ import SaveIcon from '@lucide/svelte/icons/save';
import type { User } from '$lib/types/user.type';
import { z } from 'zod/v4';
import { createForm, preventDefault } from '$lib/utils/form.utils';
@@ -12,11 +14,7 @@
open: boolean;
userToEdit: User | null;
roles: { id: string; name: string }[];
- onSubmit: (data: {
- user: Partial<User> & { password?: string };
- isEditMode: boolean;
- userId?: string;
- }) => void;
+ onSubmit: (data: { user: Partial<User> & { password?: string }; isEditMode: boolean; userId?: string }) => void;
isLoading: boolean;
allowUsernameEdit?: boolean;
};
@@ -32,7 +30,7 @@
let isEditMode = $derived(!!userToEdit);
let canEditUsername = $derived(!isEditMode || allowUsernameEdit);
- let SubmitIcon = $derived(isEditMode ? Save : UserPlus);
+ let SubmitIcon = $derived(isEditMode ? SaveIcon : UserPlusIcon);
// Disable most fields for OIDC users
let isOidcUser = $derived(!!userToEdit?.oidcSubjectId);
@@ -94,16 +92,16 @@
<Sheet.Root bind:open onOpenChange={handleOpenChange}>
<Sheet.Content class="p-6">
- <Sheet.Header class="space-y-3 pb-6 border-b">
+ <Sheet.Header class="space-y-3 border-b pb-6">
<div class="flex items-center gap-3">
- <div class="flex size-10 items-center justify-center rounded-lg bg-primary/10 shrink-0">
- <SubmitIcon class="size-5 text-primary" />
+ <div class="bg-primary/10 flex size-10 shrink-0 items-center justify-center rounded-lg">
+ <SubmitIcon class="text-primary size-5" />
</div>
<div>
<Sheet.Title class="text-xl font-semibold">
{isEditMode ? 'Edit User' : 'Create New User'}
</Sheet.Title>
- <Sheet.Description class="text-sm text-muted-foreground mt-1">
+ <Sheet.Description class="text-muted-foreground mt-1 text-sm">
{isEditMode
? `Update the details for ${userToEdit?.username || 'this user'}`
: 'Add a new user to your system with the required permissions'}
@@ -169,7 +167,7 @@
>
<Button type="submit" class="arcane-button-create flex-1" disabled={isLoading}>
{#if isLoading}
- <Loader2 class="mr-2 size-4 animate-spin" />
+ <LoaderCircleIcon class="mr-2 size-4 animate-spin" />
{/if}
<SubmitIcon class="mr-2 size-4" />
{isEditMode ? 'Save Changes' : 'Create User'}
diff --git a/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte b/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte
index 74404bc36..c42f17f89 100644
--- a/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte
@@ -5,7 +5,7 @@
import { useSidebar } from '$lib/components/ui/sidebar/index.js';
import ChevronsUpDownIcon from '@lucide/svelte/icons/chevrons-up-down';
import PlusIcon from '@lucide/svelte/icons/plus';
- import { GlobeIcon } from '@lucide/svelte';
+ import GlobeIcon from '@lucide/svelte/icons/globe';
import ServerIcon from '@lucide/svelte/icons/server';
import { environmentStore, type Environment } from '$lib/stores/environment.store';
import { goto } from '$app/navigation';
@@ -41,15 +41,21 @@
<Sidebar.Menu>
{#if sidebar.open}
- <Label class="px-2 mb-2 text-xs font-medium text-sidebar-foreground/60">Environment</Label>
+ <Label class="text-sidebar-foreground/60 mb-2 px-2 text-xs font-medium">Environment</Label>
{/if}
<Sidebar.MenuItem>
<DropdownMenu.Root>
<DropdownMenu.Trigger>
{#snippet child({ props: childProps })}
- <Sidebar.MenuButton {...childProps} size="lg" class="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground">
+ <Sidebar.MenuButton
+ {...childProps}
+ size="lg"
+ class="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
+ >
{#if currentSelectedEnvironment}
- <div class="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg">
+ <div
+ class="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg"
+ >
{#if currentSelectedEnvironment.isLocal}
<ServerIcon class="size-4" />
{:else}
@@ -65,7 +71,9 @@
</span>
</div>
{:else}
- <div class="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg">
+ <div
+ class="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg"
+ >
<ServerIcon class="size-4" />
</div>
<div class="grid flex-1 text-left text-sm leading-tight">
@@ -77,7 +85,12 @@
</Sidebar.MenuButton>
{/snippet}
</DropdownMenu.Trigger>
- <DropdownMenu.Content class="w-[var(--bits-dropdown-menu-anchor-width)] min-w-56 rounded-lg" align="start" side={sidebar.isMobile ? 'bottom' : 'right'} sideOffset={4}>
+ <DropdownMenu.Content
+ class="w-[var(--bits-dropdown-menu-anchor-width)] min-w-56 rounded-lg"
+ align="start"
+ side={sidebar.isMobile ? 'bottom' : 'right'}
+ sideOffset={4}
+ >
<DropdownMenu.Label class="text-muted-foreground text-xs">Select Environment</DropdownMenu.Label>
{#if availableEnvironments.length === 0}
<DropdownMenu.Item disabled class="gap-2 p-2">
@@ -101,7 +114,7 @@
{#if env.isLocal}
<span class="text-muted-foreground text-xs">unix:///var/run/docker.sock</span>
{:else}
- <span class="text-muted-foreground text-xs truncate max-w-32">{env.apiUrl}</span>
+ <span class="text-muted-foreground max-w-32 truncate text-xs">{env.apiUrl}</span>
{/if}
</div>
</DropdownMenu.Item>
diff --git a/frontend/src/lib/components/stat-card.svelte b/frontend/src/lib/components/stat-card.svelte
index aabda3623..043b9fa0f 100644
--- a/frontend/src/lib/components/stat-card.svelte
+++ b/frontend/src/lib/components/stat-card.svelte
@@ -13,11 +13,19 @@
class?: string;
}
- let { title, value, icon: Icon, iconColor = 'text-primary', bgColor = 'bg-primary/10', subtitle, class: className }: Props = $props();
+ let {
+ title,
+ value,
+ icon: Icon,
+ iconColor = 'text-primary',
+ bgColor = 'bg-primary/10',
+ subtitle,
+ class: className
+ }: Props = $props();
</script>
<Card.Root class={cn('', className)}>
- <Card.Content class="flex items-center justify-between p-4">
+ <Card.Content class="flex items-center justify-between">
<div>
<p class="text-muted-foreground text-sm font-medium">{title}</p>
<p class="text-2xl font-bold">{value}</p>
diff --git a/frontend/src/lib/components/ui/button/button.svelte b/frontend/src/lib/components/ui/button/button.svelte
index cee02c35f..cb2c566a3 100644
--- a/frontend/src/lib/components/ui/button/button.svelte
+++ b/frontend/src/lib/components/ui/button/button.svelte
@@ -66,7 +66,7 @@
</script>
<script lang="ts">
- import { cn } from '$lib/utils/utils.js';
+ import { cn } from '$lib/utils';
import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
let {
diff --git a/frontend/src/lib/components/ui/card/card-action.svelte b/frontend/src/lib/components/ui/card/card-action.svelte
new file mode 100644
index 000000000..9d725bcbd
--- /dev/null
+++ b/frontend/src/lib/components/ui/card/card-action.svelte
@@ -0,0 +1,20 @@
+<script lang="ts">
+ import { cn, type WithElementRef } from '$lib/utils.js';
+ import type { HTMLAttributes } from 'svelte/elements';
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ children,
+ ...restProps
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
+</script>
+
+<div
+ bind:this={ref}
+ data-slot="card-action"
+ class={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end ', className)}
+ {...restProps}
+>
+ {@render children?.()}
+</div>
diff --git a/frontend/src/lib/components/ui/card/card-content.svelte b/frontend/src/lib/components/ui/card/card-content.svelte
index 7c37e9180..bc90b8371 100644
--- a/frontend/src/lib/components/ui/card/card-content.svelte
+++ b/frontend/src/lib/components/ui/card/card-content.svelte
@@ -1,11 +1,15 @@
<script lang="ts">
- import type { WithElementRef } from '$lib/utils.js';
- import type { HTMLAttributes } from 'svelte/elements';
- import { cn } from '$lib/utils.js';
+ import type { HTMLAttributes } from "svelte/elements";
+ import { cn, type WithElementRef } from "$lib/utils.js";
- let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
+ let {
+ ref = $bindable(null),
+ class: className,
+ children,
+ ...restProps
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
-<div bind:this={ref} class={cn('p-6', className)} {...restProps}>
+<div bind:this={ref} data-slot="card-content" class={cn("px-6", className)} {...restProps}>
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/card/card-description.svelte b/frontend/src/lib/components/ui/card/card-description.svelte
index 471bf175f..9b20ac701 100644
--- a/frontend/src/lib/components/ui/card/card-description.svelte
+++ b/frontend/src/lib/components/ui/card/card-description.svelte
@@ -1,11 +1,20 @@
<script lang="ts">
- import type { WithElementRef } from '$lib/utils.js';
- import type { HTMLAttributes } from 'svelte/elements';
- import { cn } from '$lib/utils.js';
+ import type { HTMLAttributes } from "svelte/elements";
+ import { cn, type WithElementRef } from "$lib/utils.js";
- let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLParagraphElement>> = $props();
+ let {
+ ref = $bindable(null),
+ class: className,
+ children,
+ ...restProps
+ }: WithElementRef<HTMLAttributes<HTMLParagraphElement>> = $props();
</script>
-<p bind:this={ref} class={cn('text-muted-foreground text-sm', className)} {...restProps}>
+<p
+ bind:this={ref}
+ data-slot="card-description"
+ class={cn("text-muted-foreground text-sm", className)}
+ {...restProps}
+>
{@render children?.()}
</p>
diff --git a/frontend/src/lib/components/ui/card/card-footer.svelte b/frontend/src/lib/components/ui/card/card-footer.svelte
index bea56fdf0..cf4335399 100644
--- a/frontend/src/lib/components/ui/card/card-footer.svelte
+++ b/frontend/src/lib/components/ui/card/card-footer.svelte
@@ -1,11 +1,20 @@
<script lang="ts">
- import type { WithElementRef } from '$lib/utils.js';
- import type { HTMLAttributes } from 'svelte/elements';
- import { cn } from '$lib/utils.js';
+ import { cn, type WithElementRef } from "$lib/utils.js";
+ import type { HTMLAttributes } from "svelte/elements";
- let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
+ let {
+ ref = $bindable(null),
+ class: className,
+ children,
+ ...restProps
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
-<div bind:this={ref} class={cn('flex items-center p-6 pt-0', className)} {...restProps}>
+<div
+ bind:this={ref}
+ data-slot="card-footer"
+ class={cn("[.border-t]:pt-6 flex items-center px-6", className)}
+ {...restProps}
+>
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/card/card-header.svelte b/frontend/src/lib/components/ui/card/card-header.svelte
index 972b59d4f..28c8f568d 100644
--- a/frontend/src/lib/components/ui/card/card-header.svelte
+++ b/frontend/src/lib/components/ui/card/card-header.svelte
@@ -1,11 +1,23 @@
<script lang="ts">
- import type { WithElementRef } from '$lib/utils.js';
+ import { cn, type WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
- import { cn } from '$lib/utils.js';
- let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
+ let {
+ ref = $bindable(null),
+ class: className,
+ children,
+ ...restProps
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
-<div bind:this={ref} class={cn('flex flex-col space-y-1.5 p-6 pb-0', className)} {...restProps}>
+<div
+ bind:this={ref}
+ data-slot="card-header"
+ class={cn(
+ '@container/card-header has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6 grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6',
+ className
+ )}
+ {...restProps}
+>
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/card/card-title.svelte b/frontend/src/lib/components/ui/card/card-title.svelte
index 57d0627bc..3c2e74b7a 100644
--- a/frontend/src/lib/components/ui/card/card-title.svelte
+++ b/frontend/src/lib/components/ui/card/card-title.svelte
@@ -1,19 +1,20 @@
<script lang="ts">
- import type { WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
- import { cn } from '$lib/utils.js';
+ import { cn, type WithElementRef } from '$lib/utils.js';
let {
ref = $bindable(null),
class: className,
- level = 3,
children,
...restProps
- }: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
- level?: 1 | 2 | 3 | 4 | 5 | 6;
- } = $props();
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
-<div role="heading" aria-level={level} bind:this={ref} class={cn('text-2xl leading-none font-semibold tracking-tight', className)} {...restProps}>
+<div
+ bind:this={ref}
+ data-slot="card-title"
+ class={cn('flex flex-row gap-2 text-2xl font-semibold leading-none', className)}
+ {...restProps}
+>
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/card/card.svelte b/frontend/src/lib/components/ui/card/card.svelte
index cb3596a14..45a53f9ba 100644
--- a/frontend/src/lib/components/ui/card/card.svelte
+++ b/frontend/src/lib/components/ui/card/card.svelte
@@ -1,11 +1,20 @@
<script lang="ts">
- import type { WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
- import { cn } from '$lib/utils.js';
+ import { cn, type WithElementRef } from '$lib/utils.js';
- let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
+ let {
+ ref = $bindable(null),
+ class: className,
+ children,
+ ...restProps
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
-<div bind:this={ref} class={cn('bg-card text-card-foreground rounded-lg border shadow-sm', className)} {...restProps}>
+<div
+ bind:this={ref}
+ data-slot="card"
+ class={cn('bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-3 shadow-sm', className)}
+ {...restProps}
+>
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/card/index.ts b/frontend/src/lib/components/ui/card/index.ts
index 5c11597d9..4d3fce489 100644
--- a/frontend/src/lib/components/ui/card/index.ts
+++ b/frontend/src/lib/components/ui/card/index.ts
@@ -1,9 +1,10 @@
-import Root from './card.svelte';
-import Content from './card-content.svelte';
-import Description from './card-description.svelte';
-import Footer from './card-footer.svelte';
-import Header from './card-header.svelte';
-import Title from './card-title.svelte';
+import Root from "./card.svelte";
+import Content from "./card-content.svelte";
+import Description from "./card-description.svelte";
+import Footer from "./card-footer.svelte";
+import Header from "./card-header.svelte";
+import Title from "./card-title.svelte";
+import Action from "./card-action.svelte";
export {
Root,
@@ -12,11 +13,13 @@ export {
Footer,
Header,
Title,
+ Action,
//
Root as Card,
Content as CardContent,
Description as CardDescription,
Footer as CardFooter,
Header as CardHeader,
- Title as CardTitle
+ Title as CardTitle,
+ Action as CardAction,
};
diff --git a/frontend/src/lib/components/ui/checkbox/checkbox.svelte b/frontend/src/lib/components/ui/checkbox/checkbox.svelte
index c3ad54f7c..1622e05c3 100644
--- a/frontend/src/lib/components/ui/checkbox/checkbox.svelte
+++ b/frontend/src/lib/components/ui/checkbox/checkbox.svelte
@@ -1,16 +1,23 @@
<script lang="ts">
- import { Checkbox as CheckboxPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
- import Check from '@lucide/svelte/icons/check';
- import Minus from '@lucide/svelte/icons/minus';
- import { cn } from '$lib/utils.js';
+ import { Checkbox as CheckboxPrimitive } from "bits-ui";
+ import CheckIcon from "@lucide/svelte/icons/check";
+ import MinusIcon from "@lucide/svelte/icons/minus";
+ import { cn, type WithoutChildrenOrChild } from "$lib/utils.js";
- let { ref = $bindable(null), checked = $bindable(false), indeterminate = $bindable(false), class: className, ...restProps }: WithoutChildrenOrChild<CheckboxPrimitive.RootProps> = $props();
+ let {
+ ref = $bindable(null),
+ checked = $bindable(false),
+ indeterminate = $bindable(false),
+ class: className,
+ ...restProps
+ }: WithoutChildrenOrChild<CheckboxPrimitive.RootProps> = $props();
</script>
<CheckboxPrimitive.Root
bind:ref
+ data-slot="checkbox"
class={cn(
- 'border-primary ring-offset-background focus-visible:ring-ring data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground peer box-content size-4 shrink-0 rounded-sm border focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50',
+ "border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive shadow-xs peer flex size-4 shrink-0 items-center justify-center rounded-[4px] border outline-none transition-shadow focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
className
)}
bind:checked
@@ -18,11 +25,11 @@
{...restProps}
>
{#snippet children({ checked, indeterminate })}
- <div class="flex size-4 items-center justify-center text-current">
- {#if indeterminate}
- <Minus class="size-3.5" />
- {:else}
- <Check class={cn('size-3.5', !checked && 'text-transparent')} />
+ <div data-slot="checkbox-indicator" class="text-current transition-none">
+ {#if checked}
+ <CheckIcon class="size-3.5" />
+ {:else if indeterminate}
+ <MinusIcon class="size-3.5" />
{/if}
</div>
{/snippet}
diff --git a/frontend/src/lib/components/ui/checkbox/index.ts b/frontend/src/lib/components/ui/checkbox/index.ts
index 5c276719b..6d92d9458 100644
--- a/frontend/src/lib/components/ui/checkbox/index.ts
+++ b/frontend/src/lib/components/ui/checkbox/index.ts
@@ -1,6 +1,6 @@
-import Root from './checkbox.svelte';
+import Root from "./checkbox.svelte";
export {
Root,
//
- Root as Checkbox
+ Root as Checkbox,
};
diff --git a/frontend/src/lib/components/ui/command/command-dialog.svelte b/frontend/src/lib/components/ui/command/command-dialog.svelte
new file mode 100644
index 000000000..5c9a82a8d
--- /dev/null
+++ b/frontend/src/lib/components/ui/command/command-dialog.svelte
@@ -0,0 +1,40 @@
+<script lang="ts">
+ import type { Command as CommandPrimitive, Dialog as DialogPrimitive } from "bits-ui";
+ import type { Snippet } from "svelte";
+ import Command from "./command.svelte";
+ import * as Dialog from "$lib/components/ui/dialog/index.js";
+ import type { WithoutChildrenOrChild } from "$lib/utils.js";
+
+ let {
+ open = $bindable(false),
+ ref = $bindable(null),
+ value = $bindable(""),
+ title = "Command Palette",
+ description = "Search for a command to run",
+ portalProps,
+ children,
+ ...restProps
+ }: WithoutChildrenOrChild<DialogPrimitive.RootProps> &
+ WithoutChildrenOrChild<CommandPrimitive.RootProps> & {
+ portalProps?: DialogPrimitive.PortalProps;
+ children: Snippet;
+ title?: string;
+ description?: string;
+ } = $props();
+</script>
+
+<Dialog.Root bind:open {...restProps}>
+ <Dialog.Header class="sr-only">
+ <Dialog.Title>{title}</Dialog.Title>
+ <Dialog.Description>{description}</Dialog.Description>
+ </Dialog.Header>
+ <Dialog.Content class="overflow-hidden p-0" {portalProps}>
+ <Command
+ class="**:data-[slot=command-input-wrapper]:h-12 [&_[data-command-group]:not([hidden])_~[data-command-group]]:pt-0 [&_[data-command-group]]:px-2 [&_[data-command-input-wrapper]_svg]:h-5 [&_[data-command-input-wrapper]_svg]:w-5 [&_[data-command-input]]:h-12 [&_[data-command-item]]:px-2 [&_[data-command-item]]:py-3 [&_[data-command-item]_svg]:h-5 [&_[data-command-item]_svg]:w-5"
+ {...restProps}
+ bind:value
+ bind:ref
+ {children}
+ />
+ </Dialog.Content>
+</Dialog.Root>
diff --git a/frontend/src/lib/components/ui/command/command-empty.svelte b/frontend/src/lib/components/ui/command/command-empty.svelte
new file mode 100644
index 000000000..6726cd8d1
--- /dev/null
+++ b/frontend/src/lib/components/ui/command/command-empty.svelte
@@ -0,0 +1,17 @@
+<script lang="ts">
+ import { Command as CommandPrimitive } from "bits-ui";
+ import { cn } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: CommandPrimitive.EmptyProps = $props();
+</script>
+
+<CommandPrimitive.Empty
+ bind:ref
+ data-slot="command-empty"
+ class={cn("py-6 text-center text-sm", className)}
+ {...restProps}
+/>
diff --git a/frontend/src/lib/components/ui/command/command-group.svelte b/frontend/src/lib/components/ui/command/command-group.svelte
new file mode 100644
index 000000000..104f81701
--- /dev/null
+++ b/frontend/src/lib/components/ui/command/command-group.svelte
@@ -0,0 +1,32 @@
+<script lang="ts">
+ import { Command as CommandPrimitive, useId } from "bits-ui";
+ import { cn } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ children,
+ heading,
+ value,
+ ...restProps
+ }: CommandPrimitive.GroupProps & {
+ heading?: string;
+ } = $props();
+</script>
+
+<CommandPrimitive.Group
+ bind:ref
+ data-slot="command-group"
+ class={cn("text-foreground overflow-hidden p-1", className)}
+ value={value ?? heading ?? `----${useId()}`}
+ {...restProps}
+>
+ {#if heading}
+ <CommandPrimitive.GroupHeading
+ class="text-muted-foreground px-2 py-1.5 text-xs font-medium"
+ >
+ {heading}
+ </CommandPrimitive.GroupHeading>
+ {/if}
+ <CommandPrimitive.GroupItems {children} />
+</CommandPrimitive.Group>
diff --git a/frontend/src/lib/components/ui/command/command-input.svelte b/frontend/src/lib/components/ui/command/command-input.svelte
new file mode 100644
index 000000000..611b00dc2
--- /dev/null
+++ b/frontend/src/lib/components/ui/command/command-input.svelte
@@ -0,0 +1,26 @@
+<script lang="ts">
+ import { Command as CommandPrimitive } from "bits-ui";
+ import SearchIcon from "@lucide/svelte/icons/search";
+ import { cn } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ value = $bindable(""),
+ ...restProps
+ }: CommandPrimitive.InputProps = $props();
+</script>
+
+<div class="flex h-9 items-center gap-2 border-b pl-3 pr-8" data-slot="command-input-wrapper">
+ <SearchIcon class="size-4 shrink-0 opacity-50" />
+ <CommandPrimitive.Input
+ data-slot="command-input"
+ class={cn(
+ "placeholder:text-muted-foreground outline-hidden flex h-10 w-full rounded-md bg-transparent py-3 text-sm disabled:cursor-not-allowed disabled:opacity-50",
+ className
+ )}
+ bind:ref
+ {...restProps}
+ bind:value
+ />
+</div>
diff --git a/frontend/src/lib/components/ui/command/command-item.svelte b/frontend/src/lib/components/ui/command/command-item.svelte
new file mode 100644
index 000000000..d94d07f6e
--- /dev/null
+++ b/frontend/src/lib/components/ui/command/command-item.svelte
@@ -0,0 +1,20 @@
+<script lang="ts">
+ import { Command as CommandPrimitive } from "bits-ui";
+ import { cn } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: CommandPrimitive.ItemProps = $props();
+</script>
+
+<CommandPrimitive.Item
+ bind:ref
+ data-slot="command-item"
+ class={cn(
+ "aria-selected:bg-accent aria-selected:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
+ className
+ )}
+ {...restProps}
+/>
diff --git a/frontend/src/lib/components/ui/command/command-link-item.svelte b/frontend/src/lib/components/ui/command/command-link-item.svelte
new file mode 100644
index 000000000..944c22dc6
--- /dev/null
+++ b/frontend/src/lib/components/ui/command/command-link-item.svelte
@@ -0,0 +1,20 @@
+<script lang="ts">
+ import { Command as CommandPrimitive } from "bits-ui";
+ import { cn } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: CommandPrimitive.LinkItemProps = $props();
+</script>
+
+<CommandPrimitive.LinkItem
+ bind:ref
+ data-slot="command-item"
+ class={cn(
+ "aria-selected:bg-accent aria-selected:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
+ className
+ )}
+ {...restProps}
+/>
diff --git a/frontend/src/lib/components/ui/command/command-list.svelte b/frontend/src/lib/components/ui/command/command-list.svelte
new file mode 100644
index 000000000..569f59570
--- /dev/null
+++ b/frontend/src/lib/components/ui/command/command-list.svelte
@@ -0,0 +1,17 @@
+<script lang="ts">
+ import { Command as CommandPrimitive } from "bits-ui";
+ import { cn } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: CommandPrimitive.ListProps = $props();
+</script>
+
+<CommandPrimitive.List
+ bind:ref
+ data-slot="command-list"
+ class={cn("max-h-[300px] scroll-py-1 overflow-y-auto overflow-x-hidden", className)}
+ {...restProps}
+/>
diff --git a/frontend/src/lib/components/ui/command/command-separator.svelte b/frontend/src/lib/components/ui/command/command-separator.svelte
new file mode 100644
index 000000000..35c4c9575
--- /dev/null
+++ b/frontend/src/lib/components/ui/command/command-separator.svelte
@@ -0,0 +1,17 @@
+<script lang="ts">
+ import { Command as CommandPrimitive } from "bits-ui";
+ import { cn } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: CommandPrimitive.SeparatorProps = $props();
+</script>
+
+<CommandPrimitive.Separator
+ bind:ref
+ data-slot="command-separator"
+ class={cn("bg-border -mx-1 h-px", className)}
+ {...restProps}
+/>
diff --git a/frontend/src/lib/components/ui/command/command-shortcut.svelte b/frontend/src/lib/components/ui/command/command-shortcut.svelte
new file mode 100644
index 000000000..3d68bc565
--- /dev/null
+++ b/frontend/src/lib/components/ui/command/command-shortcut.svelte
@@ -0,0 +1,20 @@
+<script lang="ts">
+ import { cn, type WithElementRef } from "$lib/utils.js";
+ import type { HTMLAttributes } from "svelte/elements";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ children,
+ ...restProps
+ }: WithElementRef<HTMLAttributes<HTMLSpanElement>> = $props();
+</script>
+
+<span
+ bind:this={ref}
+ data-slot="command-shortcut"
+ class={cn("text-muted-foreground ml-auto text-xs tracking-widest", className)}
+ {...restProps}
+>
+ {@render children?.()}
+</span>
diff --git a/frontend/src/lib/components/ui/command/command.svelte b/frontend/src/lib/components/ui/command/command.svelte
new file mode 100644
index 000000000..c64a77efb
--- /dev/null
+++ b/frontend/src/lib/components/ui/command/command.svelte
@@ -0,0 +1,22 @@
+<script lang="ts">
+ import { Command as CommandPrimitive } from "bits-ui";
+ import { cn } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ value = $bindable(""),
+ class: className,
+ ...restProps
+ }: CommandPrimitive.RootProps = $props();
+</script>
+
+<CommandPrimitive.Root
+ bind:value
+ bind:ref
+ data-slot="command"
+ class={cn(
+ "bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
+ className
+ )}
+ {...restProps}
+/>
diff --git a/frontend/src/lib/components/ui/command/index.ts b/frontend/src/lib/components/ui/command/index.ts
new file mode 100644
index 000000000..d3dbadeae
--- /dev/null
+++ b/frontend/src/lib/components/ui/command/index.ts
@@ -0,0 +1,40 @@
+import { Command as CommandPrimitive } from "bits-ui";
+
+import Root from "./command.svelte";
+import Dialog from "./command-dialog.svelte";
+import Empty from "./command-empty.svelte";
+import Group from "./command-group.svelte";
+import Item from "./command-item.svelte";
+import Input from "./command-input.svelte";
+import List from "./command-list.svelte";
+import Separator from "./command-separator.svelte";
+import Shortcut from "./command-shortcut.svelte";
+import LinkItem from "./command-link-item.svelte";
+
+const Loading = CommandPrimitive.Loading;
+
+export {
+ Root,
+ Dialog,
+ Empty,
+ Group,
+ Item,
+ LinkItem,
+ Input,
+ List,
+ Separator,
+ Shortcut,
+ Loading,
+ //
+ Root as Command,
+ Dialog as CommandDialog,
+ Empty as CommandEmpty,
+ Group as CommandGroup,
+ Item as CommandItem,
+ LinkItem as CommandLinkItem,
+ Input as CommandInput,
+ List as CommandList,
+ Separator as CommandSeparator,
+ Shortcut as CommandShortcut,
+ Loading as CommandLoading,
+};
diff --git a/frontend/src/lib/components/ui/copy-button/copy-button.svelte b/frontend/src/lib/components/ui/copy-button/copy-button.svelte
index 7ec9c7aec..a0cd7fb08 100644
--- a/frontend/src/lib/components/ui/copy-button/copy-button.svelte
+++ b/frontend/src/lib/components/ui/copy-button/copy-button.svelte
@@ -5,7 +5,7 @@
<script lang="ts">
import { Button } from '$lib/components/ui/button';
import { UseClipboard } from '$lib/hooks/use-clipboard.svelte';
- import { cn } from '$lib/utils/utils';
+ import { cn } from '$lib/utils';
import CheckIcon from '@lucide/svelte/icons/check';
import CopyIcon from '@lucide/svelte/icons/copy';
import XIcon from '@lucide/svelte/icons/x';
diff --git a/frontend/src/lib/components/ui/popover/index.ts b/frontend/src/lib/components/ui/popover/index.ts
new file mode 100644
index 000000000..9f30922f7
--- /dev/null
+++ b/frontend/src/lib/components/ui/popover/index.ts
@@ -0,0 +1,17 @@
+import { Popover as PopoverPrimitive } from "bits-ui";
+import Content from "./popover-content.svelte";
+import Trigger from "./popover-trigger.svelte";
+const Root = PopoverPrimitive.Root;
+const Close = PopoverPrimitive.Close;
+
+export {
+ Root,
+ Content,
+ Trigger,
+ Close,
+ //
+ Root as Popover,
+ Content as PopoverContent,
+ Trigger as PopoverTrigger,
+ Close as PopoverClose,
+};
diff --git a/frontend/src/lib/components/ui/popover/popover-content.svelte b/frontend/src/lib/components/ui/popover/popover-content.svelte
new file mode 100644
index 000000000..9bced7aa5
--- /dev/null
+++ b/frontend/src/lib/components/ui/popover/popover-content.svelte
@@ -0,0 +1,29 @@
+<script lang="ts">
+ import { cn } from "$lib/utils.js";
+ import { Popover as PopoverPrimitive } from "bits-ui";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ sideOffset = 4,
+ align = "center",
+ portalProps,
+ ...restProps
+ }: PopoverPrimitive.ContentProps & {
+ portalProps?: PopoverPrimitive.PortalProps;
+ } = $props();
+</script>
+
+<PopoverPrimitive.Portal {...portalProps}>
+ <PopoverPrimitive.Content
+ bind:ref
+ data-slot="popover-content"
+ {sideOffset}
+ {align}
+ class={cn(
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--bits-popover-content-transform-origin) outline-hidden z-50 w-72 rounded-md border p-4 shadow-md",
+ className
+ )}
+ {...restProps}
+ />
+</PopoverPrimitive.Portal>
diff --git a/frontend/src/lib/components/ui/popover/popover-trigger.svelte b/frontend/src/lib/components/ui/popover/popover-trigger.svelte
new file mode 100644
index 000000000..586323c71
--- /dev/null
+++ b/frontend/src/lib/components/ui/popover/popover-trigger.svelte
@@ -0,0 +1,17 @@
+<script lang="ts">
+ import { cn } from "$lib/utils.js";
+ import { Popover as PopoverPrimitive } from "bits-ui";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: PopoverPrimitive.TriggerProps = $props();
+</script>
+
+<PopoverPrimitive.Trigger
+ bind:ref
+ data-slot="popover-trigger"
+ class={cn("", className)}
+ {...restProps}
+/>
diff --git a/frontend/src/lib/components/ui/snippet/snippet.svelte b/frontend/src/lib/components/ui/snippet/snippet.svelte
index 9a2c0eec4..04b5f405f 100644
--- a/frontend/src/lib/components/ui/snippet/snippet.svelte
+++ b/frontend/src/lib/components/ui/snippet/snippet.svelte
@@ -3,7 +3,7 @@
-->
<script lang="ts" module>
- import { cn } from '$lib/utils/utils';
+ import { cn } from '$lib/utils';
import { tv, type VariantProps } from 'tailwind-variants';
import { CopyButton } from '$lib/components/ui/copy-button';
import type { UseClipboard } from '$lib/hooks/use-clipboard.svelte';
@@ -36,19 +36,19 @@
<div class={cn(style({ variant, className: className }))}>
{#if typeof text == 'string'}
- <pre class={cn('overflow-y-auto text-left font-mono text-sm font-light whitespace-nowrap')}>
+ <pre class={cn('overflow-y-auto whitespace-nowrap text-left font-mono text-sm font-light')}>
{text}
</pre>
{:else}
{#each text as line, i (i)}
- <pre class={cn('overflow-y-auto text-left font-mono text-sm font-light whitespace-nowrap')}>
+ <pre class={cn('overflow-y-auto whitespace-nowrap text-left font-mono text-sm font-light')}>
{line}
</pre>
{/each}
{/if}
<CopyButton
- class="hover:text-opacity-80 absolute top-1/2 right-2 size-7 -translate-y-1/2 transition-opacity ease-in-out hover:bg-transparent dark:hover:bg-transparent"
+ class="absolute right-2 top-1/2 size-7 -translate-y-1/2 transition-opacity ease-in-out hover:bg-transparent hover:text-opacity-80 dark:hover:bg-transparent"
text={typeof text === 'string' ? text : text.join('\n')}
{onCopy}
/>
diff --git a/frontend/src/lib/config/sidebar-config.ts b/frontend/src/lib/config/sidebar-config.ts
index 66cd9c32e..e6cb2de8a 100644
--- a/frontend/src/lib/config/sidebar-config.ts
+++ b/frontend/src/lib/config/sidebar-config.ts
@@ -1,20 +1,18 @@
import type { Icon as IconType } from '@lucide/svelte';
-import {
- FileStack,
- HardDrive,
- Home,
- Network,
- Container,
- ImageIcon,
- SettingsIcon,
- DatabaseIcon,
- LayoutTemplate,
- UserIcon,
- Shield,
- ComputerIcon,
- LockKeyholeIcon,
- LucideAlarmClock
-} from '@lucide/svelte';
+import FileStackIcon from '@lucide/svelte/icons/file-stack';
+import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
+import HouseIcon from '@lucide/svelte/icons/home';
+import NetworkIcon from '@lucide/svelte/icons/network';
+import ContainerIcon from '@lucide/svelte/icons/container';
+import ImageIcon from '@lucide/svelte/icons/image';
+import SettingsIcon from '@lucide/svelte/icons/settings';
+import DatabaseIcon from '@lucide/svelte/icons/database';
+import LayoutTemplateIcon from '@lucide/svelte/icons/layout-template';
+import UserIcon from '@lucide/svelte/icons/user';
+import ShieldIcon from '@lucide/svelte/icons/shield';
+import ComputerIcon from '@lucide/svelte/icons/computer';
+import LockKeyholeIcon from '@lucide/svelte/icons/lock-keyhole';
+import AlarmClockIcon from '@lucide/svelte/icons/alarm-clock';
export type SidebarItem = {
title: string;
@@ -25,18 +23,18 @@ export type SidebarItem = {
export const sidebarItems: Record<string, SidebarItem[]> = {
managementItems: [
- { title: 'Dashboard', url: '/dashboard', icon: Home },
- { title: 'Containers', url: '/containers', icon: Container },
- { title: 'Projects', url: '/compose', icon: FileStack },
+ { title: 'Dashboard', url: '/dashboard', icon: HouseIcon },
+ { title: 'Containers', url: '/containers', icon: ContainerIcon },
+ { title: 'Projects', url: '/compose', icon: FileStackIcon },
{ title: 'Images', url: '/images', icon: ImageIcon },
- { title: 'Networks', url: '/networks', icon: Network },
- { title: 'Volumes', url: '/volumes', icon: HardDrive }
+ { title: 'Networks', url: '/networks', icon: NetworkIcon },
+ { title: 'Volumes', url: '/volumes', icon: HardDriveIcon }
],
customizationItems: [
{
title: 'Templates',
url: '/customize/templates',
- icon: LayoutTemplate
+ icon: LayoutTemplateIcon
},
{
title: 'Container Registries',
@@ -55,7 +53,7 @@ export const sidebarItems: Record<string, SidebarItem[]> = {
{
title: 'Events',
url: '/events',
- icon: LucideAlarmClock
+ icon: AlarmClockIcon
},
{
title: 'Settings',
@@ -65,7 +63,7 @@ export const sidebarItems: Record<string, SidebarItem[]> = {
{ title: 'General', url: '/settings/general', icon: SettingsIcon },
{ title: 'Docker', url: '/settings/docker', icon: DatabaseIcon },
{ title: 'Users', url: '/settings/users', icon: UserIcon },
- { title: 'Security', url: '/settings/security', icon: Shield }
+ { title: 'Security', url: '/settings/security', icon: ShieldIcon }
]
}
]
diff --git a/frontend/src/lib/constants.ts b/frontend/src/lib/constants.ts
index 1c75b6897..e1a2af0e7 100644
--- a/frontend/src/lib/constants.ts
+++ b/frontend/src/lib/constants.ts
@@ -1,7 +1,3 @@
-export const defaultEnvTemplate = `# Environment Variables
-# Format: VARIABLE_NAME=value
-`;
-
export const defaultComposeTemplate = `services:
nginx:
image: nginx:alpine
diff --git a/frontend/src/lib/models/container-registry.ts b/frontend/src/lib/models/container-registry.ts
deleted file mode 100644
index 62a6af472..000000000
--- a/frontend/src/lib/models/container-registry.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-export interface ContainerRegistry {
- id: string;
- url: string;
- username: string;
- token: string;
- description?: string;
- insecure?: boolean;
- enabled?: boolean;
- createdAt?: string;
- updatedAt?: string;
-}
diff --git a/frontend/src/lib/services/api/container-registry-api-service.ts b/frontend/src/lib/services/api/container-registry-api-service.ts
index 0bc48a72e..3b01516c7 100644
--- a/frontend/src/lib/services/api/container-registry-api-service.ts
+++ b/frontend/src/lib/services/api/container-registry-api-service.ts
@@ -1,63 +1,35 @@
import BaseAPIService from './api-service';
-import type { ContainerRegistryCreateDto, ContainerRegistryUpdateDto } from '$lib/dto/container-registry-dto';
-import type { ContainerRegistry } from '$lib/models/container-registry';
-import type { PaginationRequest, SortRequest, Paginated } from '$lib/types/pagination.type';
+import type { ContainerRegistryCreateDto, ContainerRegistryUpdateDto } from '$lib/types/container-registry.type';
+import type { ContainerRegistry } from '$lib/types/container-registry.type';
+import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
export default class ContainerRegistryAPIService extends BaseAPIService {
- async getRegistries(
- pagination?: PaginationRequest,
- sort?: SortRequest,
- search?: string,
- filters?: Record<string, string>
- ): Promise<ContainerRegistry[] | Paginated<ContainerRegistry>> {
- if (!pagination) {
- return this.handleResponse(this.api.get(`/container-registries`));
- }
-
- const params: any = {
- 'pagination[page]': pagination.page,
- 'pagination[limit]': pagination.limit
- };
-
- if (sort) {
- params['sort[column]'] = sort.column;
- params['sort[direction]'] = sort.direction;
- }
-
- if (search) {
- params.search = search;
- }
-
- if (filters) {
- Object.entries(filters).forEach(([key, value]) => {
- params[key] = value;
- });
- }
-
- return this.handleResponse(this.api.get(`/container-registries`, { params }));
- }
-
- async getAllRegistries(): Promise<ContainerRegistry[]> {
- return this.handleResponse(this.api.get(`/container-registries`));
- }
-
- async getRegistry(id: string): Promise<ContainerRegistry> {
- return this.handleResponse(this.api.get(`/container-registries/${id}`));
- }
-
- async createRegistry(registry: ContainerRegistryCreateDto): Promise<ContainerRegistry> {
- return this.handleResponse(this.api.post(`/container-registries`, registry));
- }
-
- async updateRegistry(id: string, registry: ContainerRegistryUpdateDto): Promise<ContainerRegistry> {
- return this.handleResponse(this.api.put(`/container-registries/${id}`, registry));
- }
-
- async deleteRegistry(id: string): Promise<void> {
- return this.handleResponse(this.api.delete(`/container-registries/${id}`));
- }
-
- async testRegistry(id: string): Promise<any> {
- return this.handleResponse(this.api.post(`/container-registries/${id}/test`));
- }
+ async getRegistries(options?: SearchPaginationSortRequest): Promise<Paginated<ContainerRegistry>> {
+ const res = await this.api.get('/container-registries', { params: options });
+ return res.data;
+ }
+
+ async getAllRegistries(): Promise<ContainerRegistry[]> {
+ return this.handleResponse(this.api.get(`/container-registries`));
+ }
+
+ async getRegistry(id: string): Promise<ContainerRegistry> {
+ return this.handleResponse(this.api.get(`/container-registries/${id}`));
+ }
+
+ async createRegistry(registry: ContainerRegistryCreateDto): Promise<ContainerRegistry> {
+ return this.handleResponse(this.api.post(`/container-registries`, registry));
+ }
+
+ async updateRegistry(id: string, registry: ContainerRegistryUpdateDto): Promise<ContainerRegistry> {
+ return this.handleResponse(this.api.put(`/container-registries/${id}`, registry));
+ }
+
+ async deleteRegistry(id: string): Promise<void> {
+ return this.handleResponse(this.api.delete(`/container-registries/${id}`));
+ }
+
+ async testRegistry(id: string): Promise<any> {
+ return this.handleResponse(this.api.post(`/container-registries/${id}/test`));
+ }
}
diff --git a/frontend/src/lib/services/api/environment-management-api-service.ts b/frontend/src/lib/services/api/environment-management-api-service.ts
index 0e17eeeef..4f295d85d 100644
--- a/frontend/src/lib/services/api/environment-management-api-service.ts
+++ b/frontend/src/lib/services/api/environment-management-api-service.ts
@@ -1,34 +1,41 @@
import BaseAPIService from './api-service';
import type { Environment } from '$lib/stores/environment.store';
-import type { CreateEnvironmentDTO, UpdateEnvironmentDTO, EnvironmentResponse, EnvironmentsListResponse } from '$lib/dto/environment-dto';
+import type { CreateEnvironmentDTO, UpdateEnvironmentDTO } from '$lib/types/environment.type';
+import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
export default class EnvironmentManagementAPIService extends BaseAPIService {
async create(dto: CreateEnvironmentDTO): Promise<Environment> {
- const response = await this.handleResponse<EnvironmentResponse>(this.api.post('/environments', dto));
- return response.environment;
+ const res = await this.api.post('/environments', dto);
+ return res.data.data as Environment;
}
+ async getEnvironments(options: SearchPaginationSortRequest): Promise<Paginated<Environment>> {
+ const res = await this.api.get('/environments', { params: options });
+ return res.data;
+ }
+
+ // Back-compat helper used by layout/env switcher
async list(): Promise<Environment[]> {
- const response = await this.handleResponse<EnvironmentsListResponse>(this.api.get('/environments'));
- return response.environments;
+ const res = await this.api.get('/environments', { params: { 'pagination.page': 1, 'pagination.limit': 1000 } });
+ return (res.data?.data as Environment[]) ?? [];
}
async get(environmentId: string): Promise<Environment> {
- const response = await this.handleResponse<EnvironmentResponse>(this.api.get(`/environments/${environmentId}`));
- return response.environment;
+ const res = await this.api.get(`/environments/${environmentId}`);
+ return res.data.data as Environment;
}
async update(environmentId: string, dto: UpdateEnvironmentDTO): Promise<Environment> {
- const response = await this.handleResponse<EnvironmentResponse>(this.api.put(`/environments/${environmentId}`, dto));
- return response.environment;
+ const res = await this.api.put(`/environments/${environmentId}`, dto);
+ return res.data.data as Environment;
}
async delete(environmentId: string): Promise<void> {
- await this.handleResponse(this.api.delete(`/environments/${environmentId}`));
+ await this.api.delete(`/environments/${environmentId}`);
}
async testConnection(environmentId: string): Promise<{ status: 'online' | 'offline'; message?: string }> {
- const response = await this.handleResponse<{ status: 'online' | 'offline'; message?: string }>(this.api.post(`/environments/${environmentId}/test`));
- return response;
+ const res = await this.api.post(`/environments/${environmentId}/test`);
+ return res.data.data as { status: 'online' | 'offline'; message?: string };
}
}
diff --git a/frontend/src/lib/services/api/event-api-service.ts b/frontend/src/lib/services/api/event-api-service.ts
index af0e7c9f3..027b3c3f5 100644
--- a/frontend/src/lib/services/api/event-api-service.ts
+++ b/frontend/src/lib/services/api/event-api-service.ts
@@ -2,7 +2,9 @@ import BaseAPIService from './api-service';
import type {
PaginationRequest,
SortRequest,
- PaginatedApiResponse
+ PaginatedApiResponse,
+ SearchPaginationSortRequest,
+ Paginated
} from '$lib/types/pagination.type';
import type { Event, CreateEvent } from '$lib/types/event.type';
@@ -11,29 +13,9 @@ export default class EventAPIService extends BaseAPIService {
return this.handleResponse(this.api.get('/events', { params: { filters } }));
}
- async getEvents(
- pagination?: PaginationRequest,
- sort?: SortRequest,
- search?: string,
- filters?: Record<string, string>
- ): Promise<PaginatedApiResponse<Event>> {
- const params: any = {};
- if (pagination) {
- params.page = pagination.page;
- params.limit = pagination.limit;
- }
- if (sort) {
- params.sortColumn = sort.column;
- params.sortDirection = sort.direction;
- }
- if (search) params.search = search;
- if (filters) {
- Object.entries(filters).forEach(([key, value]) => {
- if (value !== undefined && value !== null && value !== '') params[key] = value;
- });
- }
- const res = await this.api.get('/events', { params });
- return res.data as PaginatedApiResponse<Event>;
+ async getEvents(options?: SearchPaginationSortRequest): Promise<Paginated<Event>> {
+ const res = await this.api.get('/events', { params: options });
+ return res.data;
}
async listPaginated(
@@ -61,32 +43,6 @@ export default class EventAPIService extends BaseAPIService {
return res.data as PaginatedApiResponse<Event>;
}
- async listByEnvironmentPaginated(
- environmentId: string,
- pagination?: PaginationRequest,
- sort?: SortRequest,
- search?: string,
- filters?: Record<string, string>
- ): Promise<PaginatedApiResponse<Event>> {
- const params: any = {};
- if (pagination) {
- params.page = pagination.page;
- params.limit = pagination.limit;
- }
- if (sort) {
- params.sortColumn = sort.column;
- params.sortDirection = sort.direction;
- }
- if (search) params.search = search;
- if (filters) {
- Object.entries(filters).forEach(([key, value]) => {
- if (value !== undefined && value !== null && value !== '') params[key] = value;
- });
- }
- const res = await this.api.get(`/environments/${environmentId}/events`, { params });
- return res.data as PaginatedApiResponse<Event>;
- }
-
async get(id: string): Promise<Event> {
return this.handleResponse(this.api.get(`/events/${id}`));
}
diff --git a/frontend/src/lib/services/api/system-api-service.ts b/frontend/src/lib/services/api/system-api-service.ts
index 7b7bf33d7..e1049f2eb 100644
--- a/frontend/src/lib/services/api/system-api-service.ts
+++ b/frontend/src/lib/services/api/system-api-service.ts
@@ -1,38 +1,44 @@
-import type { PruneType } from '$lib/types/actions.type';
-import type { DockerInfo } from '$lib/models/docker-info.type';
+import type { DockerInfo } from '$lib/types/docker-info.type';
import BaseAPIService from './api-service';
export default class SystemAPIService extends BaseAPIService {
- async pruneAll(options: { containers?: boolean; images?: boolean; volumes?: boolean; networks?: boolean; dangling?: boolean; until?: string }) {
- return this.handleResponse(this.api.post('/system/prune', options));
- }
-
- async startAllContainers() {
- return this.handleResponse(this.api.post('/system/containers/start-all'));
- }
-
- async startAllStoppedContainers() {
- return this.handleResponse(this.api.post('/system/containers/start-stopped'));
- }
-
- async stopAllContainers() {
- return this.handleResponse(this.api.post('/system/containers/stop-all'));
- }
-
- async getDockerInfo(): Promise<DockerInfo> {
- return this.handleResponse(this.api.get('/system/docker/info'));
- }
-
- async getStats() {
- return this.handleResponse(this.api.get('/system/stats'));
- }
-
- async testConnection(host?: string) {
- const params = host ? { host } : {};
- return this.handleResponse(this.api.get('/system/docker/test', { params }));
- }
-
- async getSystemInfo(): Promise<DockerInfo> {
- return this.handleResponse(this.api.get('/system/info'));
- }
+ async pruneAll(options: {
+ containers?: boolean;
+ images?: boolean;
+ volumes?: boolean;
+ networks?: boolean;
+ dangling?: boolean;
+ until?: string;
+ }) {
+ return this.handleResponse(this.api.post('/system/prune', options));
+ }
+
+ async startAllContainers() {
+ return this.handleResponse(this.api.post('/system/containers/start-all'));
+ }
+
+ async startAllStoppedContainers() {
+ return this.handleResponse(this.api.post('/system/containers/start-stopped'));
+ }
+
+ async stopAllContainers() {
+ return this.handleResponse(this.api.post('/system/containers/stop-all'));
+ }
+
+ async getDockerInfo(): Promise<DockerInfo> {
+ return this.handleResponse(this.api.get('/system/docker/info'));
+ }
+
+ async getStats() {
+ return this.handleResponse(this.api.get('/system/stats'));
+ }
+
+ async testConnection(host?: string) {
+ const params = host ? { host } : {};
+ return this.handleResponse(this.api.get('/system/docker/test', { params }));
+ }
+
+ async getSystemInfo(): Promise<DockerInfo> {
+ return this.handleResponse(this.api.get('/system/info'));
+ }
}
diff --git a/frontend/src/lib/services/api/user-api-service.ts b/frontend/src/lib/services/api/user-api-service.ts
index e1c51539f..f4eb904d8 100644
--- a/frontend/src/lib/services/api/user-api-service.ts
+++ b/frontend/src/lib/services/api/user-api-service.ts
@@ -3,7 +3,9 @@ import type { User, CreateUser } from '$lib/types/user.type';
import type {
PaginationRequest,
SortRequest,
- PaginatedApiResponse
+ PaginatedApiResponse,
+ Paginated,
+ SearchPaginationSortRequest
} from '$lib/types/pagination.type';
export interface Role {
@@ -14,42 +16,16 @@ export interface Role {
}
export default class UserAPIService extends BaseAPIService {
- async getUsers(
- pagination?: PaginationRequest,
- sort?: SortRequest,
- search?: string,
- filters?: Record<string, string>
- ): Promise<any[] | PaginatedApiResponse<any>> {
- if (!pagination) {
- const response = await this.handleResponse<{ users?: any[] }>(this.api.get('/users'));
- return Array.isArray(response.users)
- ? response.users
- : Array.isArray(response)
- ? response
- : [];
- }
-
- const params: any = {
- 'pagination[page]': pagination.page,
- 'pagination[limit]': pagination.limit
- };
-
- if (sort) {
- params['sort[column]'] = sort.column;
- params['sort[direction]'] = sort.direction;
- }
-
- if (search) {
- params.search = search;
- }
-
- if (filters) {
- Object.entries(filters).forEach(([key, value]) => {
- params[key] = value;
- });
- }
-
- return this.handleResponse(this.api.get('/users', { params }));
+ // async getVolumes(options?: SearchPaginationSortRequest): Promise<Paginated<VolumeSummaryDto>> {
+ // const envId = await this.getCurrentEnvironmentId();
+
+ // const res = await this.api.get(`/environments/${envId}/volumes`, { params: options });
+ // return res.data;
+ // }
+
+ async getUsers(options?: SearchPaginationSortRequest): Promise<Paginated<User>> {
+ const res = await this.api.get('/users', { params: options });
+ return res.data;
}
async get(id: string): Promise<User> {
@@ -93,15 +69,11 @@ export default class UserAPIService extends BaseAPIService {
}
async getByUsername(username: string): Promise<User> {
- return this.handleResponse(
- this.api.get(`/users/by-username/${encodeURIComponent(username)}`)
- ) as Promise<User>;
+ return this.handleResponse(this.api.get(`/users/by-username/${encodeURIComponent(username)}`)) as Promise<User>;
}
async getByOidcSubjectId(oidcSubjectId: string): Promise<User> {
- return this.handleResponse(
- this.api.get(`/users/by-oidc-subject/${encodeURIComponent(oidcSubjectId)}`)
- ) as Promise<User>;
+ return this.handleResponse(this.api.get(`/users/by-oidc-subject/${encodeURIComponent(oidcSubjectId)}`)) as Promise<User>;
}
async getRoles(): Promise<Role[]> {
@@ -125,15 +97,11 @@ export default class UserAPIService extends BaseAPIService {
}
async assignRole(userId: string, roleId: string): Promise<void> {
- return this.handleResponse(
- this.api.post(`/users/${userId}/roles`, { roleId })
- ) as Promise<void>;
+ return this.handleResponse(this.api.post(`/users/${userId}/roles`, { roleId })) as Promise<void>;
}
async removeRole(userId: string, roleId: string): Promise<void> {
- return this.handleResponse(
- this.api.delete(`/users/${userId}/roles/${roleId}`)
- ) as Promise<void>;
+ return this.handleResponse(this.api.delete(`/users/${userId}/roles/${roleId}`)) as Promise<void>;
}
async getUserRoles(userId: string): Promise<Role[]> {
diff --git a/frontend/src/lib/stores/table-store.ts b/frontend/src/lib/stores/table-store.ts
deleted file mode 100644
index eb540798c..000000000
--- a/frontend/src/lib/stores/table-store.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import { PersistedState } from 'runed';
-
-export interface PageSizes {
- default: number;
- containers: number;
- images: number;
- volumes: number;
- networks: number;
- stacks: number;
- [key: string]: number; // Allow additional dynamic keys
-}
-
-// Create default values
-const DEFAULT_PAGE_SIZES: PageSizes = {
- default: 10,
- containers: 10,
- images: 10,
- volumes: 10,
- networks: 10,
- stacks: 10
-};
-
-// Single persisted state for all page sizes
-export const tablePageSizes = new PersistedState<PageSizes>('arcane-table-page-sizes', DEFAULT_PAGE_SIZES, {
- storage: 'local',
- syncTabs: true
-});
-
-// Backward compatibility helpers
-export const tablePersistence = {
- // Get a page size value for a specific table
- getPageSize: (tableKey: string): number => {
- return tablePageSizes.current[tableKey] || 10;
- },
-
- // Set a page size value for a specific table
- setPageSize: (tableKey: string, value: number): void => {
- tablePageSizes.current = {
- ...tablePageSizes.current,
- [tableKey]: value
- };
- }
-};
-
-// Usage examples:
-// Access directly:
-// const containerPageSize = tablePageSizes.current.containers;
-//
-// Update directly:
-// tablePageSizes.current = { ...tablePageSizes.current, containers: 20 };
-//
-// Or use the compatibility helpers:
-// tablePersistence.setPageSize('images', 20);
diff --git a/frontend/src/lib/types/actions.type.ts b/frontend/src/lib/types/actions.type.ts
deleted file mode 100644
index 818aa28b0..000000000
--- a/frontend/src/lib/types/actions.type.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export type StackActions = 'start' | 'stop' | 'restart' | 'redeploy' | 'import' | 'destroy' | 'pull' | 'migrate' | 'update';
-export type ContainerActions = 'start' | 'stop' | 'restart' | 'pull' | 'remove';
-export type PruneType = 'containers' | 'images' | 'networks' | 'volumes';
diff --git a/frontend/src/lib/dto/container-registry-dto.ts b/frontend/src/lib/types/container-registry.type.ts
similarity index 61%
rename from frontend/src/lib/dto/container-registry-dto.ts
rename to frontend/src/lib/types/container-registry.type.ts
index a0dd51466..55a063e14 100644
--- a/frontend/src/lib/dto/container-registry-dto.ts
+++ b/frontend/src/lib/types/container-registry.type.ts
@@ -15,3 +15,15 @@ export interface ContainerRegistryUpdateDto {
insecure?: boolean;
enabled?: boolean;
}
+
+export interface ContainerRegistry {
+ id: string;
+ url: string;
+ username: string;
+ token: string;
+ description?: string;
+ insecure?: boolean;
+ enabled?: boolean;
+ createdAt?: string;
+ updatedAt?: string;
+}
diff --git a/frontend/src/lib/models/docker-info.type.ts b/frontend/src/lib/types/docker-info.type.ts
similarity index 100%
rename from frontend/src/lib/models/docker-info.type.ts
rename to frontend/src/lib/types/docker-info.type.ts
diff --git a/frontend/src/lib/dto/environment-dto.ts b/frontend/src/lib/types/environment.type.ts
similarity index 64%
rename from frontend/src/lib/dto/environment-dto.ts
rename to frontend/src/lib/types/environment.type.ts
index f365ec4c1..79ca97e51 100644
--- a/frontend/src/lib/dto/environment-dto.ts
+++ b/frontend/src/lib/types/environment.type.ts
@@ -13,12 +13,18 @@ export interface UpdateEnvironmentDTO {
}
export interface EnvironmentResponse {
- environment: Environment;
+ data: Environment;
success: boolean;
message?: string;
}
-export interface EnvironmentsListResponse {
- environments: Environment[];
+export interface EnvironmentsListResponse<T = Environment> {
+ data: T[];
success: boolean;
+ pagination?: {
+ totalPages: number;
+ totalItems: number;
+ currentPage: number;
+ itemsPerPage: number;
+ };
}
diff --git a/frontend/src/lib/types/loading-states.type.ts b/frontend/src/lib/types/loading-states.type.ts
deleted file mode 100644
index a00004e6c..000000000
--- a/frontend/src/lib/types/loading-states.type.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-export type LoadingStates = {
- start?: boolean;
- stop?: boolean;
- restart?: boolean;
- pull?: boolean;
- deploy?: boolean;
- redeploy?: boolean;
- remove?: boolean;
- validating?: boolean;
-};
\ No newline at end of file
diff --git a/frontend/src/lib/types/network.type.ts b/frontend/src/lib/types/network.type.ts
index 69e2895c0..ed1effaa3 100644
--- a/frontend/src/lib/types/network.type.ts
+++ b/frontend/src/lib/types/network.type.ts
@@ -67,16 +67,6 @@ export interface IPAMSubnetInfo {
AuxAddress?: Record<string, string>;
}
-export interface NetworkConnect {
- containerId: string;
- config?: NetworkEndpointSettings;
-}
-
-export interface NetworkDisconnect {
- containerId: string;
- force?: boolean;
-}
-
export interface NetworkEndpointSettings {
ipamConfig?: EndpointIPAMConfig;
links?: string[];
@@ -99,11 +89,6 @@ export interface EndpointIPAMConfig {
linkLocalIPs?: string[];
}
-export interface NetworkPruneResponse {
- networksDeleted: string[];
- spaceReclaimed: number;
-}
-
export interface ContainerEndpointDto {
Name: string;
EndpointID: string;
diff --git a/frontend/src/lib/types/project.type.ts b/frontend/src/lib/types/project.type.ts
index 4a023f247..596653bd3 100644
--- a/frontend/src/lib/types/project.type.ts
+++ b/frontend/src/lib/types/project.type.ts
@@ -1,13 +1,3 @@
-export interface ProjectMeta {
- id: string;
- name: string;
- createdAt: string;
- updatedAt: string;
- autoUpdate?: boolean;
- dirName?: string;
- path: string;
-}
-
export interface ProjectPort {
PublicPort?: number;
PrivatePort?: number;
@@ -54,24 +44,3 @@ export interface Project {
composeContent?: string;
envContent?: string;
}
-
-// export interface Project {
-// id: string;
-// name: string;
-// services?: ProjectService[];
-// serviceCount?: number;
-// runningCount?: number;
-// status: 'running' | 'stopped' | 'partially running' | 'unknown';
-// isExternal?: boolean;
-// createdAt?: string;
-// updatedAt?: string;
-// composeContent?: string;
-// envContent?: string;
-// isLegacy?: boolean;
-// agentId?: string;
-// agentHostname?: string;
-// isRemote?: boolean;
-// dirName?: string;
-// lastPolled?: string;
-// path?: string;
-// }
diff --git a/frontend/src/lib/types/settings.type.ts b/frontend/src/lib/types/settings.type.ts
index 159b172ec..0b4029b93 100644
--- a/frontend/src/lib/types/settings.type.ts
+++ b/frontend/src/lib/types/settings.type.ts
@@ -6,7 +6,6 @@ export type SettingRawResponse = {
}[];
export type Settings = {
- // Docker settings
stacksDirectory: string;
autoUpdateEnabled: boolean;
autoUpdateInterval: number;
@@ -15,7 +14,6 @@ export type Settings = {
dockerPruneMode: 'all' | 'dangling';
baseServerUrl: string;
- // Authentication settings
authLocalEnabled: boolean;
authOidcEnabled: boolean;
authSessionTimeout: number;
@@ -23,7 +21,6 @@ export type Settings = {
authRbacEnabled: boolean;
authOidcConfig: string;
- // Onboarding settings
onboardingCompleted: boolean;
onboardingSteps: {
welcome?: boolean;
@@ -33,7 +30,6 @@ export type Settings = {
settings?: boolean;
};
- // Registry settings
registryCredentials: RegistryCredential[];
templateRegistries: TemplateRegistryConfig[];
};
diff --git a/frontend/src/lib/types/statuses.ts b/frontend/src/lib/types/statuses.ts
deleted file mode 100644
index 87f4748fa..000000000
--- a/frontend/src/lib/types/statuses.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-export const statusVariantMap: Record<
- string,
- 'red' | 'purple' | 'green' | 'blue' | 'gray' | 'amber'
-> = {
- running: 'green',
- deployed: 'green',
- stopped: 'red',
- failed: 'red',
- pending: 'amber',
- creating: 'blue',
- updating: 'blue',
- deleting: 'purple',
- exited: 'red'
-};
diff --git a/frontend/src/lib/models/system-stats.ts b/frontend/src/lib/types/system-stats.type.ts
similarity index 100%
rename from frontend/src/lib/models/system-stats.ts
rename to frontend/src/lib/types/system-stats.type.ts
diff --git a/frontend/src/lib/utils.ts b/frontend/src/lib/utils.ts
index d15671fb1..f92bfcbb3 100644
--- a/frontend/src/lib/utils.ts
+++ b/frontend/src/lib/utils.ts
@@ -11,17 +11,3 @@ export type WithoutChild<T> = T extends { child?: any } ? Omit<T, 'child'> : T;
export type WithoutChildren<T> = T extends { children?: any } ? Omit<T, 'children'> : T;
export type WithoutChildrenOrChild<T> = WithoutChildren<WithoutChild<T>>;
export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & { ref?: U | null };
-
-export function debounced<T extends (...args: any[]) => void>(func: T, delay: number) {
- let debounceTimeout: ReturnType<typeof setTimeout>;
-
- return (...args: Parameters<T>) => {
- if (debounceTimeout !== undefined) {
- clearTimeout(debounceTimeout);
- }
-
- debounceTimeout = setTimeout(() => {
- func(...args);
- }, delay);
- };
-}
diff --git a/frontend/src/lib/utils/api.util.ts b/frontend/src/lib/utils/api.util.ts
index aeb074378..529b261ad 100644
--- a/frontend/src/lib/utils/api.util.ts
+++ b/frontend/src/lib/utils/api.util.ts
@@ -1,8 +1,36 @@
-import type { Result } from './try-catch'; // Assuming Result<T, Error> is { data?: T, error?: Error }
+import type { Result } from './try-catch';
import { toast } from 'svelte-sonner';
-import { extractDockerErrorMessage } from '$lib/utils/errors.util';
-export function handleApiResultWithCallbacks<T>({ result, message, setLoadingState = () => {}, onSuccess, onError = () => {} }: { result: Result<T, Error>; message: string; setLoadingState?: (value: boolean) => void; onSuccess: (data: T) => void; onError?: (error: Error) => void }) {
+function extractDockerErrorMessage(error: any): string {
+ if (!error) return 'Unknown error';
+
+ if (error.response && error.response.data) {
+ if (typeof error.response.data === 'string') return error.response.data;
+ if (error.response.data.error) return error.response.data.error;
+ }
+
+ if (error.body && error.body.error) return error.body.error;
+ if (error.error) return error.error;
+ if (error.reason) return error.reason;
+ if (error.stderr) return error.stderr;
+ if (error.data && typeof error.data === 'string') return error.data;
+ if (error.message) return error.message;
+ return JSON.stringify(error);
+}
+
+export function handleApiResultWithCallbacks<T>({
+ result,
+ message,
+ setLoadingState = () => {},
+ onSuccess,
+ onError = () => {}
+}: {
+ result: Result<T, Error>;
+ message: string;
+ setLoadingState?: (value: boolean) => void;
+ onSuccess: (data: T) => void;
+ onError?: (error: Error) => void;
+}) {
setLoadingState(true);
if (result.error) {
diff --git a/frontend/src/lib/utils/bytes.util.ts b/frontend/src/lib/utils/bytes.util.ts
deleted file mode 100644
index 9e4cca1de..000000000
--- a/frontend/src/lib/utils/bytes.util.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-const units: { [key: string]: number } = {
- b: 1,
- k: 1024,
- m: 1024 * 1024,
- g: 1024 * 1024 * 1024
-};
-
-export function parseBytes(input: string): number {
- const valueStr = input.toLowerCase().trim();
- const unit = valueStr.charAt(valueStr.length - 1);
- const value = parseFloat(valueStr.substring(0, valueStr.length - 1));
-
- if (isNaN(value)) {
- throw new Error(`Invalid numeric value in memory string: ${input}`);
- }
-
- if (units[unit]) {
- return Math.floor(value * units[unit]);
- } else if (!isNaN(parseFloat(valueStr))) {
- // Assume bytes if no unit
- return Math.floor(parseFloat(valueStr));
- } else {
- throw new Error(`Invalid memory unit: ${unit}. Use b, k, m, or g.`);
- }
-}
-
-export function formatBytes(bytes: number, decimals = 2): string {
- if (!+bytes) return '0 Bytes';
- const k = 1024;
- const dm = decimals < 0 ? 0 : decimals;
- const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
- const i = Math.floor(Math.log(bytes) / Math.log(k));
- return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
-}
diff --git a/frontend/src/lib/utils/date.utils.ts b/frontend/src/lib/utils/date.utils.ts
deleted file mode 100644
index ffc6f2357..000000000
--- a/frontend/src/lib/utils/date.utils.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Format date to relative time (e.g., "2 days ago", "3 hours ago")
- */
-export function formatRelativeTime(dateString: string): string {
- const date = new Date(dateString);
- const now = new Date();
- const diffMs = now.getTime() - date.getTime();
- const diffSeconds = Math.floor(diffMs / 1000);
- const diffMinutes = Math.floor(diffSeconds / 60);
- const diffHours = Math.floor(diffMinutes / 60);
- const diffDays = Math.floor(diffHours / 24);
- const diffWeeks = Math.floor(diffDays / 7);
- const diffMonths = Math.floor(diffDays / 30);
- const diffYears = Math.floor(diffDays / 365);
-
- if (diffSeconds < 60) return 'Just now';
- if (diffMinutes < 60) return `${diffMinutes}m ago`;
- if (diffHours < 24) return `${diffHours}h ago`;
- if (diffDays < 7) return `${diffDays}d ago`;
- if (diffWeeks < 4) return `${diffWeeks}w ago`;
- if (diffMonths < 12) return `${diffMonths}mo ago`;
- return `${diffYears}y ago`;
-}
-
-/**
- * Format date to human-readable format (e.g., "May 4, 2025 at 4:58 AM")
- */
-export function formatFriendlyDate(dateString: string): string {
- const date = new Date(dateString);
- return date.toLocaleDateString('en-US', {
- month: 'short',
- day: 'numeric',
- year: 'numeric',
- hour: 'numeric',
- minute: '2-digit',
- hour12: true
- });
-}
-
-/**
- * Format date to short format (e.g., "May 4, 2025")
- */
-export function formatShortDate(dateString: string): string {
- const date = new Date(dateString);
- return date.toLocaleDateString('en-US', {
- month: 'short',
- day: 'numeric',
- year: 'numeric'
- });
-}
diff --git a/frontend/src/lib/utils/errors.util.ts b/frontend/src/lib/utils/errors.util.ts
deleted file mode 100644
index 7aadaeb6b..000000000
--- a/frontend/src/lib/utils/errors.util.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-export function extractDockerErrorMessage(error: any): string {
- if (!error) return 'Unknown error';
-
- if (error.response && error.response.data) {
- if (typeof error.response.data === 'string') return error.response.data;
- if (error.response.data.error) return error.response.data.error;
- }
-
- if (error.body && error.body.error) return error.body.error;
- if (error.error) return error.error;
- if (error.reason) return error.reason;
- if (error.stderr) return error.stderr;
- if (error.data && typeof error.data === 'string') return error.data;
- if (error.message) return error.message;
- return JSON.stringify(error);
-}
diff --git a/frontend/src/lib/utils/status.utils.ts b/frontend/src/lib/utils/status.utils.ts
new file mode 100644
index 000000000..e4c91bdb2
--- /dev/null
+++ b/frontend/src/lib/utils/status.utils.ts
@@ -0,0 +1,20 @@
+export type StatusVariant = 'red' | 'purple' | 'green' | 'blue' | 'gray' | 'amber';
+
+const STATUS_VARIANT_MAP: Record<string, StatusVariant> = {
+ running: 'green',
+ deployed: 'green',
+ stopped: 'red',
+ failed: 'red',
+ pending: 'amber',
+ creating: 'blue',
+ updating: 'blue',
+ deleting: 'purple',
+ exited: 'red'
+};
+
+export function getStatusVariant(status?: string | null): StatusVariant {
+ if (!status) return 'gray';
+ return STATUS_VARIANT_MAP[String(status).toLowerCase()] ?? 'gray';
+}
+
+export { STATUS_VARIANT_MAP as statusVariantMap };
diff --git a/frontend/src/lib/utils/string.utils.ts b/frontend/src/lib/utils/string.utils.ts
index a8b940c23..a7d605829 100644
--- a/frontend/src/lib/utils/string.utils.ts
+++ b/frontend/src/lib/utils/string.utils.ts
@@ -15,67 +15,3 @@ export function truncateString(str: string | undefined, maxLength: number): stri
}
return str.substring(0, maxLength - 3) + '...';
}
-
-export function formatDate(dateString: string | undefined | null): string {
- if (!dateString) return 'Unknown';
- try {
- return new Date(dateString).toLocaleString();
- } catch (e) {
- return 'Invalid Date';
- }
-}
-
-// Function to format logs with some basic highlighting
-export function formatLogLine(line: string): string {
- if (line.includes('ERROR') || line.includes('FATAL') || line.includes('WARN')) {
- return `<span class="text-red-400">${line}</span>`;
- }
- if (line.includes('INFO')) {
- return `<span class="text-blue-400">${line}</span>`;
- }
- return line;
-}
-
-export function parseStatusTime(status: string): number {
- // Extract time information from status strings like "Up 2 days" or "Exited (0) 12 hours ago"
- const timeRegex = /(\d+)\s+(second|minute|hour|day|week|month|year)s?\s*(ago)?/i;
- const match = status.match(timeRegex);
-
- if (!match) {
- // If no time found, treat as 0 (just started)
- return 0;
- }
-
- const value = parseInt(match[1]);
- const unit = match[2].toLowerCase();
- const isAgo = !!match[3]; // "ago" means it's been stopped for that time
-
- // Convert everything to hours for comparison
- let hours = 0;
- switch (unit) {
- case 'second':
- hours = value / 3600;
- break;
- case 'minute':
- hours = value / 60;
- break;
- case 'hour':
- hours = value;
- break;
- case 'day':
- hours = value * 24;
- break;
- case 'week':
- hours = value * 24 * 7;
- break;
- case 'month':
- hours = value * 24 * 30;
- break;
- case 'year':
- hours = value * 24 * 365;
- break;
- }
-
- // For "ago" times (stopped containers), make them negative so they sort after running ones
- return isAgo ? -hours : hours;
-}
diff --git a/frontend/src/lib/utils/utils.ts b/frontend/src/lib/utils/utils.ts
index 85bb32379..340fd9a26 100644
--- a/frontend/src/lib/utils/utils.ts
+++ b/frontend/src/lib/utils/utils.ts
@@ -1,17 +1,13 @@
-/*
- Installed from @ieedan/shadcn-svelte-extras
-*/
+export function debounced<T extends (...args: any[]) => void>(func: T, delay: number) {
+ let debounceTimeout: ReturnType<typeof setTimeout>;
-import { type ClassValue, clsx } from 'clsx';
-import { twMerge } from 'tailwind-merge';
+ return (...args: Parameters<T>) => {
+ if (debounceTimeout !== undefined) {
+ clearTimeout(debounceTimeout);
+ }
-export function cn(...inputs: ClassValue[]) {
- return twMerge(clsx(inputs));
+ debounceTimeout = setTimeout(() => {
+ func(...args);
+ }, delay);
+ };
}
-
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-export type WithoutChild<T> = T extends { child?: any } ? Omit<T, 'child'> : T;
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-export type WithoutChildren<T> = T extends { children?: any } ? Omit<T, 'children'> : T;
-export type WithoutChildrenOrChild<T> = WithoutChildren<WithoutChild<T>>;
-export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & { ref?: U | null };
diff --git a/frontend/src/routes/auth/login/+page.svelte b/frontend/src/routes/auth/login/+page.svelte
index 3073d1f98..ef9cd27d6 100644
--- a/frontend/src/routes/auth/login/+page.svelte
+++ b/frontend/src/routes/auth/login/+page.svelte
@@ -4,7 +4,10 @@
import { Label } from '$lib/components/ui/label/index.js';
import * as Card from '$lib/components/ui/card/index.js';
import * as Alert from '$lib/components/ui/alert/index.js';
- import { AlertCircle, LogIn, Lock, User } from '@lucide/svelte';
+ import CircleAlertIcon from '@lucide/svelte/icons/alert-circle';
+ import LogInIcon from '@lucide/svelte/icons/log-in';
+ import LockIcon from '@lucide/svelte/icons/lock';
+ import UserIcon from '@lucide/svelte/icons/user';
import type { PageData } from './$types';
import { goto, invalidateAll } from '$app/navigation';
import { authService } from '$lib/services/api/auth-api-service';
@@ -71,21 +74,20 @@
{#if data.error}
<Alert.Root variant="destructive">
- <AlertCircle class="size-4" />
+ <CircleAlertIcon class="size-4" />
<Alert.Title>Login Problem</Alert.Title>
<Alert.Description>
{#if data.error === 'oidc_invalid_response'}
There was an issue with the OIDC login response. Please try again.
{:else if data.error === 'oidc_misconfigured'}
- OIDC is not configured correctly on the server. Please contact an
- administrator.
+ OIDC is not configured correctly on the server. Please contact an administrator.
{:else if data.error === 'oidc_userinfo_failed'}
Could not retrieve your user information from the OIDC provider.
{:else if data.error === 'oidc_missing_sub'}
Your OIDC provider did not return a subject identifier.
{:else if data.error === 'oidc_email_collision'}
- An account with your email already exists but is linked to a different OIDC
- identity. Please contact an administrator.
+ An account with your email already exists but is linked to a different OIDC identity. Please contact an
+ administrator.
{:else if data.error === 'oidc_token_error'}
There was an error obtaining tokens from the OIDC provider.
{:else if data.error === 'user_processing_failed'}
@@ -99,7 +101,7 @@
{#if error}
<Alert.Root variant="destructive">
- <AlertCircle class="size-4" />
+ <CircleAlertIcon class="size-4" />
<Alert.Title>Authentication Failed</Alert.Title>
<Alert.Description>{error}</Alert.Description>
</Alert.Root>
@@ -107,7 +109,7 @@
{#if !showLocalLoginForm && !showOidcLoginButton}
<Alert.Root variant="destructive">
- <AlertCircle class="size-4" />
+ <CircleAlertIcon class="size-4" />
<Alert.Title>No Login Methods Configured</Alert.Title>
<Alert.Description>
There are currently no login methods enabled. Please contact an administrator.
@@ -117,7 +119,7 @@
{#if showOidcLoginButton && !showLocalLoginForm}
<Button onclick={handleOidcLogin} class="w-full">
- <LogIn class="mr-2 size-4" />
+ <LogInIcon class="mr-2 size-4" />
Sign in with OIDC Provider
</Button>
{/if}
@@ -127,10 +129,8 @@
<div class="grid gap-3">
<Label for="username">Username</Label>
<div class="relative">
- <div
- class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"
- >
- <User class="size-4 text-muted-foreground" />
+ <div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
+ <UserIcon class="text-muted-foreground size-4" />
</div>
<Input
id="username"
@@ -148,10 +148,8 @@
<div class="grid gap-3">
<Label for="password">Password</Label>
<div class="relative">
- <div
- class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"
- >
- <Lock class="size-4 text-muted-foreground" />
+ <div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
+ <LockIcon class="text-muted-foreground size-4" />
</div>
<Input
id="password"
@@ -168,12 +166,10 @@
</div>
<Button type="submit" class="w-full" disabled={loading} aria-busy={loading}>
{#if loading}
- <div
- class="mr-2 size-4 animate-spin rounded-full border-2 border-white/30 border-t-white"
- ></div>
+ <div class="mr-2 size-4 animate-spin rounded-full border-2 border-white/30 border-t-white"></div>
Signing in...
{:else}
- <LogIn class="mr-2 size-4" />
+ <LogInIcon class="mr-2 size-4" />
Sign in to Arcane
{/if}
</Button>
@@ -183,15 +179,13 @@
<div
class="after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t"
>
- <span class="bg-card text-muted-foreground relative z-10 px-2">
- Or continue with
- </span>
+ <span class="bg-card text-muted-foreground relative z-10 px-2"> Or continue with </span>
</div>
{/if}
{#if showOidcLoginButton && showDivider}
<Button onclick={handleOidcLogin} variant="outline" class="w-full">
- <LogIn class="mr-2 size-4" />
+ <LogInIcon class="mr-2 size-4" />
Sign in with OIDC Provider
</Button>
{/if}
@@ -200,22 +194,18 @@
</div>
<div class="bg-muted relative hidden md:block">
- <div
- class="absolute inset-0 bg-gradient-to-br from-blue-600/10 via-indigo-600/10 to-purple-600/10"
- >
+ <div class="absolute inset-0 bg-gradient-to-br from-blue-600/10 via-indigo-600/10 to-purple-600/10">
<div
- class="absolute inset-0 bg-[url(&quot;data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23e2e8f0' fill-opacity='0.2'%3E%3Ccircle cx='7' cy='7' r='1'/%3E%3Ccircle cx='7' cy='37' r='1'/%3E%3Ccircle cx='37' cy='7' r='1'/%3E%3Ccircle cx='37' cy='37' r='1'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E&quot;)] dark:bg-[url(&quot;data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23475569' fill-opacity='0.1'%3E%3Ccircle cx='7' cy='7' r='1'/%3E%3Ccircle cx='7' cy='37' r='1'/%3E%3Ccircle cx='37' cy='7' r='1'/%3E%3Ccircle cx='37' cy='37' r='1'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E&quot;)]"
+ class="bg-[url(&quot;data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23e2e8f0' fill-opacity='0.2'%3E%3Ccircle cx='7' cy='7' r='1'/%3E%3Ccircle cx='7' cy='37' r='1'/%3E%3Ccircle cx='37' cy='7' r='1'/%3E%3Ccircle cx='37' cy='37' r='1'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E&quot;)] dark:bg-[url(&quot;data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23475569' fill-opacity='0.1'%3E%3Ccircle cx='7' cy='7' r='1'/%3E%3Ccircle cx='7' cy='37' r='1'/%3E%3Ccircle cx='37' cy='7' r='1'/%3E%3Ccircle cx='37' cy='37' r='1'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E&quot;)] absolute inset-0"
></div>
</div>
<div class="absolute inset-0 flex items-center justify-center">
- <div class="text-center space-y-4 p-8">
+ <div class="space-y-4 p-8 text-center">
<div class="mb-8">
- <img class="h-32 w-auto mx-auto opacity-60" src="/img/arcane.svg" alt="Arcane" />
+ <img class="mx-auto h-32 w-auto opacity-60" src="/img/arcane.svg" alt="Arcane" />
</div>
- <h2 class="text-2xl font-bold text-foreground/80">Arcane</h2>
- <p class="text-muted-foreground text-balance max-w-xs">
- Modern Docker Management, Designed for Everyone.
- </p>
+ <h2 class="text-foreground/80 text-2xl font-bold">Arcane</h2>
+ <p class="text-muted-foreground max-w-xs text-balance">Modern Docker Management, Designed for Everyone.</p>
</div>
</div>
</div>
diff --git a/frontend/src/routes/compose/+page.svelte b/frontend/src/routes/compose/+page.svelte
index 97e12fac9..df239e028 100644
--- a/frontend/src/routes/compose/+page.svelte
+++ b/frontend/src/routes/compose/+page.svelte
@@ -1,11 +1,11 @@
<script lang="ts">
- import { AlertCircle, FileStack, Loader2, PlayCircle, StopCircle } from '@lucide/svelte';
- import * as Alert from '$lib/components/ui/alert/index.js';
- import * as Card from '$lib/components/ui/card/index.js';
+ import FileStackIcon from '@lucide/svelte/icons/file-stack';
+ import PlayCircleIcon from '@lucide/svelte/icons/play-circle';
+ import StopCircleIcon from '@lucide/svelte/icons/stop-circle';
import { toast } from 'svelte-sonner';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import { autoUpdateAPI, environmentAPI } from '$lib/services/api';
import StatCard from '$lib/components/stat-card.svelte';
import ProjectsTable from './compose-table.svelte';
@@ -15,9 +15,7 @@
let projects = $state(data.projects);
let projectRequestOptions = $state(data.projectRequestOptions);
- let error = $state<string | null>(null);
let selectedIds = $state<string[]>([]);
- let isLoadingCompose = $state(false);
let isLoading = $state({
updating: false,
@@ -40,6 +38,18 @@
}
});
}
+
+ async function refreshCompose() {
+ isLoading.refreshing = true;
+ handleApiResultWithCallbacks({
+ result: await tryCatch(environmentAPI.getProjects(projectRequestOptions)),
+ message: 'Failed to Refresh Projects',
+ setLoadingState: (v) => (isLoading.refreshing = v),
+ async onSuccess(newProjects) {
+ projects = newProjects;
+ }
+ });
+ }
</script>
<div class="space-y-6">
@@ -49,94 +59,52 @@
<p class="text-muted-foreground mt-1 text-sm">View and Manage Compose Projects</p>
</div>
<div class="flex items-center gap-2">
- <!-- <ArcaneButton
+ <ArcaneButton
+ action="inspect"
+ customLabel="Update Projects"
+ onclick={handleCheckForUpdates}
+ loading={isLoading.updating}
+ disabled={isLoading.updating}
+ />
+ <ArcaneButton action="create" customLabel="Create Project" onclick={() => goto(`/compose/new`)} />
+ <ArcaneButton
action="restart"
- onClick={refreshCompose}
- label="Refresh"
+ customLabel="Refresh"
+ onclick={refreshCompose}
loading={isLoading.refreshing}
disabled={isLoading.refreshing}
- /> -->
- <ArcaneButton
- action="create"
- customLabel="Create Project"
- onClick={() => goto(`/compose/new`)}
/>
</div>
</div>
- {#if error}
- <Alert.Root variant="destructive">
- <AlertCircle class="size-4" />
- <Alert.Title>Error Loading Compose Projects</Alert.Title>
- <Alert.Description>{error}</Alert.Description>
- </Alert.Root>
- {/if}
-
- {#if isLoadingCompose}
- <div class="grid grid-cols-1 gap-4 sm:grid-cols-3">
- {#each Array(3) as _}
- <Card.Root>
- <Card.Content class="flex items-center justify-between p-4">
- <div class="space-y-2">
- <div class="bg-muted h-4 w-24 animate-pulse rounded"></div>
- <div class="bg-muted h-8 w-12 animate-pulse rounded"></div>
- </div>
- <div class="bg-muted size-10 animate-pulse rounded-full"></div>
- </Card.Content>
- </Card.Root>
- {/each}
- </div>
-
- <Card.Root class="border shadow-sm">
- <Card.Header class="px-6">
- <div class="flex items-center justify-between">
- <div>
- <Card.Title>Projects List</Card.Title>
- </div>
- <div class="flex items-center gap-2">
- <div class="bg-muted h-9 w-32 animate-pulse rounded"></div>
- <div class="bg-muted h-9 w-28 animate-pulse rounded"></div>
- </div>
- </div>
- </Card.Header>
- <Card.Content>
- <div class="flex flex-col items-center justify-center px-6 py-12 text-center">
- <Loader2 class="text-muted-foreground mb-4 size-8 animate-spin" />
- <p class="text-lg font-medium">Loading Projects...</p>
- <p class="text-muted-foreground mt-1 text-sm">Please wait while we fetch your projects</p>
- </div>
- </Card.Content>
- </Card.Root>
- {:else}
- <div class="grid grid-cols-1 gap-4 sm:grid-cols-3">
- <StatCard
- title="Total Projects"
- value={totalCompose}
- icon={FileStack}
- iconColor="text-amber-500"
- class="border-l-4 border-l-amber-500"
- />
- <StatCard
- title="Running"
- value={runningCompose}
- icon={PlayCircle}
- iconColor="text-green-500"
- class="border-l-4 border-l-green-500"
- />
- <StatCard
- title="Stopped"
- value={stoppedCompose}
- icon={StopCircle}
- iconColor="text-red-500"
- class="border-l-4 border-l-red-500"
- />
- </div>
-
- <ProjectsTable
- bind:projects
- bind:selectedIds
- requestOptions={projectRequestOptions}
- onCheckForUpdates={handleCheckForUpdates}
+ <div class="grid grid-cols-1 gap-4 sm:grid-cols-3">
+ <StatCard
+ title="Total Projects"
+ value={totalCompose}
+ icon={FileStackIcon}
+ iconColor="text-amber-500"
+ class="border-l-4 border-l-amber-500"
+ />
+ <StatCard
+ title="Running"
+ value={runningCompose}
+ icon={PlayCircleIcon}
+ iconColor="text-green-500"
+ class="border-l-4 border-l-green-500"
+ />
+ <StatCard
+ title="Stopped"
+ value={stoppedCompose}
+ icon={StopCircleIcon}
+ iconColor="text-red-500"
+ class="border-l-4 border-l-red-500"
/>
- {/if}
+ </div>
+
+ <ProjectsTable
+ bind:projects
+ bind:selectedIds
+ requestOptions={projectRequestOptions}
+ onCheckForUpdates={handleCheckForUpdates}
+ />
</div>
diff --git a/frontend/src/routes/compose/[projectId]/+page.svelte b/frontend/src/routes/compose/[projectId]/+page.svelte
index 9c6365257..a12c23509 100644
--- a/frontend/src/routes/compose/[projectId]/+page.svelte
+++ b/frontend/src/routes/compose/[projectId]/+page.svelte
@@ -3,24 +3,22 @@
import type { Project, ProjectService, ProjectPort } from '$lib/types/project.type';
import * as Card from '$lib/components/ui/card/index.js';
import { Button } from '$lib/components/ui/button/index.js';
- import {
- ArrowLeft,
- AlertCircle,
- FileStack,
- Layers,
- ArrowRight,
- ExternalLink,
- RefreshCw,
- Terminal,
- Settings,
- Activity
- } from '@lucide/svelte';
+ import ArrowLeftIcon from '@lucide/svelte/icons/arrow-left';
+ import CircleAlertIcon from '@lucide/svelte/icons/alert-circle';
+ import FileStackIcon from '@lucide/svelte/icons/file-stack';
+ import LayersIcon from '@lucide/svelte/icons/layers';
+ import ArrowRightIcon from '@lucide/svelte/icons/arrow-right';
+ import ExternalLinkIcon from '@lucide/svelte/icons/external-link';
+ import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
+ import TerminalIcon from '@lucide/svelte/icons/terminal';
+ import SettingsIcon from '@lucide/svelte/icons/settings';
+ import ActivityIcon from '@lucide/svelte/icons/activity';
import * as Alert from '$lib/components/ui/alert/index.js';
import { Input } from '$lib/components/ui/input/index.js';
import { Label } from '$lib/components/ui/label/index.js';
import ActionButtons from '$lib/components/action-buttons.svelte';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
- import { statusVariantMap } from '$lib/types/statuses';
+ import { getStatusVariant } from '$lib/utils/status.utils';
import { capitalizeFirstLetter } from '$lib/utils/string.utils';
import { invalidateAll } from '$app/navigation';
import { toast } from 'svelte-sonner';
@@ -28,8 +26,8 @@
import { tryCatch } from '$lib/utils/try-catch';
import { environmentAPI } from '$lib/services/api';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
- import LogViewer from '$lib/components/LogViewer.svelte';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import LogViewer from '$lib/components/log-viewer.svelte';
import { browser } from '$app/environment';
let { data }: { data: PageData } = $props();
@@ -55,9 +53,7 @@
let originalEnvContent = $derived(editorState.originalEnvContent || '');
let hasChanges = $derived(
- name !== originalName ||
- composeContent !== originalComposeContent ||
- envContent !== originalEnvContent
+ name !== originalName || composeContent !== originalComposeContent || envContent !== originalEnvContent
);
const baseServerUrl = $derived(settings?.baseServerUrl || 'localhost');
@@ -126,11 +122,7 @@
return baseServerUrl;
}
- function getServicePortUrl(
- service: ProjectService,
- port: string | number | ProjectPort,
- protocol = 'http'
- ): string {
+ function getServicePortUrl(service: ProjectService, port: string | number | ProjectPort, protocol = 'http'): string {
const host = getHostForService(service);
if (typeof port === 'string') {
@@ -172,10 +164,10 @@
function handleToggleStackAutoScroll() {}
const navigationSections = [
- { id: 'overview', label: 'Overview', icon: FileStack },
- { id: 'services', label: 'Services', icon: Layers },
- { id: 'config', label: 'Configuration', icon: Settings },
- { id: 'logs', label: 'Logs', icon: Terminal }
+ { id: 'overview', label: 'Overview', icon: FileStackIcon },
+ { id: 'services', label: 'Services', icon: LayersIcon },
+ { id: 'config', label: 'Configuration', icon: SettingsIcon },
+ { id: 'logs', label: 'Logs', icon: TerminalIcon }
] as const;
type SectionId = (typeof navigationSections)[number]['id'];
@@ -193,15 +185,13 @@
{#if project}
<div
class="bg-background/95 sticky top-0 z-20 border-b backdrop-blur transition-all duration-300"
- style="opacity: {showFloatingHeader ? 0 : 1}; pointer-events: {showFloatingHeader
- ? 'none'
- : 'auto'};"
+ style="opacity: {showFloatingHeader ? 0 : 1}; pointer-events: {showFloatingHeader ? 'none' : 'auto'};"
>
<div class="max-w-full px-4 py-3">
<div class="flex items-center justify-between">
<div class="flex items-center gap-3">
<Button variant="ghost" size="sm" href="/compose">
- <ArrowLeft class="mr-2 size-4" />
+ <ArrowLeftIcon class="mr-2 size-4" />
Back
</Button>
<div class="bg-border h-4 w-px"></div>
@@ -210,10 +200,7 @@
{project.name}
</h1>
{#if project.status}
- <StatusBadge
- variant={statusVariantMap[project.status.toLowerCase()] || 'gray'}
- text={capitalizeFirstLetter(project.status)}
- />
+ <StatusBadge variant={getStatusVariant(project.status)} text={capitalizeFirstLetter(project.status)} />
{/if}
</div>
</div>
@@ -236,20 +223,16 @@
</div>
{#if showFloatingHeader}
- <div
- class="fixed top-4 left-1/2 -translate-x-1/2 z-30 transition-all duration-300 ease-in-out"
- >
- <div
- class="bg-background/90 backdrop-blur-xl border border-border/50 rounded-lg shadow-xl px-4 py-3"
- >
+ <div class="fixed left-1/2 top-4 z-30 -translate-x-1/2 transition-all duration-300 ease-in-out">
+ <div class="bg-background/90 border-border/50 rounded-lg border px-4 py-3 shadow-xl backdrop-blur-xl">
<div class="flex items-center gap-4">
<div class="flex items-center gap-2">
- <h2 class="text-sm font-medium truncate max-w-[150px]" title={project.name}>
+ <h2 class="max-w-[150px] truncate text-sm font-medium" title={project.name}>
{project.name}
</h2>
{#if project.status}
<StatusBadge
- variant={statusVariantMap[project.status.toLowerCase()] || 'gray'}
+ variant={getStatusVariant(project.status)}
text={capitalizeFirstLetter(project.status)}
class="text-xs"
/>
@@ -276,7 +259,7 @@
{#if data.error}
<div class="max-w-full px-4 py-4">
<Alert.Root variant="destructive">
- <AlertCircle class="size-4" />
+ <CircleAlertIcon class="size-4" />
<Alert.Title>Error Loading Stack</Alert.Title>
<Alert.Description>{data.error}</Alert.Description>
</Alert.Root>
@@ -300,7 +283,7 @@
<IconComponent class="size-4" />
{#if section.id === 'services' && project.serviceCount}
<span
- class="bg-primary text-primary-foreground absolute -top-1 -right-1 rounded-full text-xs min-w-[18px] h-[18px] flex items-center justify-center px-1"
+ class="bg-primary text-primary-foreground absolute -right-1 -top-1 flex h-[18px] min-w-[18px] items-center justify-center rounded-full px-1 text-xs"
>
{project.serviceCount}
</span>
@@ -311,12 +294,12 @@
</div>
</div>
- <div class="flex-1 min-w-0 overflow-hidden">
+ <div class="min-w-0 flex-1 overflow-hidden">
<div class="max-w-none p-6">
<div class="space-y-8">
<section id="overview" class="scroll-mt-20">
<h2 class="mb-6 flex items-center gap-2 text-xl font-semibold">
- <FileStack class="size-5" />
+ <FileStackIcon class="size-5" />
Overview
</h2>
@@ -328,7 +311,7 @@
<p class="text-2xl font-bold">{project.serviceCount}</p>
</div>
<div class="bg-primary/10 rounded-full p-3">
- <Layers class="text-primary size-5" />
+ <LayersIcon class="text-primary size-5" />
</div>
</Card.Content>
</Card.Root>
@@ -340,7 +323,7 @@
<p class="text-2xl font-bold">{project.runningCount}</p>
</div>
<div class="rounded-full bg-green-500/10 p-3">
- <Activity class="size-5 text-green-500" />
+ <ActivityIcon class="size-5 text-green-500" />
</div>
</Card.Content>
</Card.Root>
@@ -354,7 +337,7 @@
</p>
</div>
<div class="rounded-full bg-blue-500/10 p-3">
- <FileStack class="size-5 text-blue-500" />
+ <FileStackIcon class="size-5 text-blue-500" />
</div>
</Card.Content>
</Card.Root>
@@ -369,14 +352,14 @@
<div class="flex flex-wrap gap-2">
{#each allUniquePorts as port (port)}
{@const portValue =
- typeof port === 'string' ||
- typeof port === 'number' ||
- (typeof port === 'object' && port !== null)
+ typeof port === 'string' || typeof port === 'number' || (typeof port === 'object' && port !== null)
? port
: String(port)}
- {@const serviceWithPort = project.services?.find((s) =>
- s.ports?.includes(String(port))
- ) || { container_id: '', name: '', status: '' }}
+ {@const serviceWithPort = project.services?.find((s) => s.ports?.includes(String(port))) || {
+ container_id: '',
+ name: '',
+ status: ''
+ }}
<a
href={getServicePortUrl(serviceWithPort, portValue)}
target="_blank"
@@ -384,7 +367,7 @@
class="inline-flex items-center rounded-md bg-blue-500/10 px-3 py-2 font-medium text-blue-600 transition-colors hover:bg-blue-500/20 dark:text-blue-400"
>
Port {port}
- <ExternalLink class="ml-2 size-4" />
+ <ExternalLinkIcon class="ml-2 size-4" />
</a>
{/each}
</div>
@@ -403,14 +386,14 @@
<div class="flex flex-wrap gap-2">
{#each allUniquePorts as port (port)}
{@const portValue =
- typeof port === 'string' ||
- typeof port === 'number' ||
- (typeof port === 'object' && port !== null)
+ typeof port === 'string' || typeof port === 'number' || (typeof port === 'object' && port !== null)
? port
: String(port)}
- {@const serviceWithPort = project.services?.find((s) =>
- s.ports?.includes(String(port))
- ) || { container_id: '', name: '', status: '' }}
+ {@const serviceWithPort = project.services?.find((s) => s.ports?.includes(String(port))) || {
+ container_id: '',
+ name: '',
+ status: ''
+ }}
<a
href={getServicePortUrl(serviceWithPort, portValue)}
target="_blank"
@@ -418,7 +401,7 @@
class="inline-flex items-center rounded-md bg-blue-500/10 px-3 py-2 font-medium text-blue-600 transition-colors hover:bg-blue-500/20 dark:text-blue-400"
>
Port {port}
- <ExternalLink class="ml-2 size-4" />
+ <ExternalLinkIcon class="ml-2 size-4" />
</a>
{/each}
</div>
@@ -429,44 +412,38 @@
<section id="services" class="scroll-mt-20">
<h2 class="mb-6 flex items-center gap-2 text-xl font-semibold">
- <Layers class="size-5" />
+ <LayersIcon class="size-5" />
Services ({project.serviceCount})
</h2>
{#if project.services && project.services.length > 0}
- <div class="rounded-lg border bg-card">
+ <div class="bg-card rounded-lg border">
<div class="grid grid-cols-1 gap-2 p-4 sm:grid-cols-2 lg:grid-cols-3">
{#each project.services as service (service.container_id || service.name)}
{@const status = service.status || 'unknown'}
- {@const variant = statusVariantMap[status.toLowerCase()] || 'gray'}
+ {@const variant = getStatusVariant(status)}
{#if service.container_id}
<a
href={`/containers/${service.container_id}`}
- class="group flex items-center gap-3 rounded-lg border bg-background p-3 transition-all hover:bg-muted/50"
+ class="bg-background hover:bg-muted/50 group flex items-center gap-3 rounded-lg border p-3 transition-all"
>
- <div class="bg-primary/10 rounded-full p-2 shrink-0">
- <Layers class="text-primary size-3" />
+ <div class="bg-primary/10 shrink-0 rounded-full p-2">
+ <LayersIcon class="text-primary size-3" />
</div>
<div class="min-w-0 flex-1">
<div class="flex items-center justify-between">
- <p class="text-sm font-medium truncate" title={service.name}>
+ <p class="truncate text-sm font-medium" title={service.name}>
{service.name}
</p>
- <ArrowRight
- class="text-primary size-3 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity"
+ <ArrowRightIcon
+ class="text-primary size-3 shrink-0 opacity-0 transition-opacity group-hover:opacity-100"
/>
</div>
- <div class="flex items-center gap-2 mt-1">
- <StatusBadge
- {variant}
- text={capitalizeFirstLetter(status)}
- class="text-xs"
- />
+ <div class="mt-1 flex items-center gap-2">
+ <StatusBadge {variant} text={capitalizeFirstLetter(status)} class="text-xs" />
{#if service.ports && service.ports.length > 0}
- <span
- class="bg-muted text-muted-foreground px-1.5 py-0.5 rounded text-xs"
- >
+ <span class="bg-muted text-muted-foreground rounded px-1.5 py-0.5 text-xs">
{service.ports.length} port{service.ports.length > 1 ? 's' : ''}
</span>
{/if}
@@ -474,20 +451,16 @@
</div>
</a>
{:else}
- <div class="flex items-center gap-3 rounded-lg border bg-muted/10 p-3">
- <div class="bg-muted/50 rounded-full p-2 shrink-0">
- <Layers class="text-muted-foreground size-3" />
+ <div class="bg-muted/10 flex items-center gap-3 rounded-lg border p-3">
+ <div class="bg-muted/50 shrink-0 rounded-full p-2">
+ <LayersIcon class="text-muted-foreground size-3" />
</div>
<div class="min-w-0 flex-1">
- <p class="text-sm font-medium truncate" title={service.name}>
+ <p class="truncate text-sm font-medium" title={service.name}>
{service.name}
</p>
- <div class="flex items-center gap-2 mt-1">
- <StatusBadge
- {variant}
- text={capitalizeFirstLetter(status)}
- class="text-xs"
- />
+ <div class="mt-1 flex items-center gap-2">
+ <StatusBadge {variant} text={capitalizeFirstLetter(status)} class="text-xs" />
<span class="text-muted-foreground text-xs">Not created</span>
</div>
</div>
@@ -498,10 +471,8 @@
</div>
{:else}
<div class="py-12 text-center">
- <div
- class="bg-muted/50 mx-auto mb-4 flex size-16 items-center justify-center rounded-full"
- >
- <Layers class="text-muted-foreground size-6" />
+ <div class="bg-muted/50 mx-auto mb-4 flex size-16 items-center justify-center rounded-full">
+ <LayersIcon class="text-muted-foreground size-6" />
</div>
<div class="text-muted-foreground">No services found for this project</div>
</div>
@@ -511,16 +482,16 @@
<section id="config" class="scroll-mt-20">
<div class="mb-6 flex items-center justify-between">
<h2 class="flex items-center gap-2 text-xl font-semibold">
- <Settings class="size-5" />
+ <SettingsIcon class="size-5" />
Configuration
</h2>
{#if hasChanges}
<ArcaneButton
action="save"
loading={isLoading.saving}
- onClick={handleSaveChanges}
+ onclick={handleSaveChanges}
disabled={!hasChanges}
- label="Save Changes"
+ customLabel="Save Changes"
loadingLabel="Saving..."
class="bg-green-600 text-white hover:bg-green-700"
/>
@@ -528,7 +499,7 @@
</div>
<div class="mb-6 space-y-2">
- <Label for="name" class="text-sm mb-10 font-medium">Project Name</Label>
+ <Label for="name" class="mb-10 text-sm font-medium">Project Name</Label>
<div class="max-w-md">
<Input
type="text"
@@ -537,9 +508,7 @@
bind:value={name}
required
class="my-2"
- disabled={isLoading.saving ||
- project?.status === 'running' ||
- project?.status === 'partially running'}
+ disabled={isLoading.saving || project?.status === 'running' || project?.status === 'partially running'}
/>
{#if project?.status === 'running' || project?.status === 'partially running'}
<p class="text-muted-foreground mt-2 text-sm">
@@ -549,29 +518,21 @@
</div>
</div>
- <div class="grid grid-cols-1 gap-6 lg:grid-cols-3 min-w-0 overflow-hidden">
- <div class="lg:col-span-2 min-w-0 overflow-hidden">
+ <div class="grid min-w-0 grid-cols-1 gap-6 overflow-hidden lg:grid-cols-3">
+ <div class="min-w-0 overflow-hidden lg:col-span-2">
<div class="space-y-4">
<h3 class="text-lg">Compose File</h3>
<div class="h-[590px] w-full min-w-0 overflow-hidden rounded-md">
- <CodeEditor
- bind:value={composeContent}
- language="yaml"
- placeholder="Enter YAML..."
- />
+ <CodeEditor bind:value={composeContent} language="yaml" placeholder="Enter YAML..." />
</div>
</div>
</div>
- <div class="lg:col-span-1 min-w-0 overflow-hidden">
+ <div class="min-w-0 overflow-hidden lg:col-span-1">
<div class="space-y-4">
<h3 class="text-lg font-semibold">Environment (.env)</h3>
<div class="h-[590px] w-full min-w-0 overflow-hidden rounded-md">
- <CodeEditor
- bind:value={envContent}
- language="env"
- placeholder="Enter environment variables..."
- />
+ <CodeEditor bind:value={envContent} language="env" placeholder="Enter environment variables..." />
</div>
</div>
</div>
@@ -582,7 +543,7 @@
<section id="logs" class="scroll-mt-20">
<div class="mb-6 flex items-center justify-between">
<h2 class="flex items-center gap-2 text-xl font-semibold">
- <Terminal class="size-5" />
+ <TerminalIcon class="size-5" />
Project Logs
</h2>
<div class="flex items-center gap-3">
@@ -590,25 +551,16 @@
<input type="checkbox" bind:checked={autoScrollStackLogs} class="size-4" />
Auto-scroll
</label>
- <Button variant="outline" size="sm" onclick={() => stackLogViewer?.clearLogs()}
- >Clear</Button
- >
+ <Button variant="outline" size="sm" onclick={() => stackLogViewer?.clearLogs()}>Clear</Button>
{#if isStackLogsStreaming}
<div class="flex items-center gap-2">
<div class="size-2 animate-pulse rounded-full bg-green-500"></div>
<span class="text-sm font-medium text-green-600">Live</span>
</div>
- <Button
- variant="outline"
- size="sm"
- onclick={() => stackLogViewer?.stopLogStream()}>Stop</Button
- >
+ <Button variant="outline" size="sm" onclick={() => stackLogViewer?.stopLogStream()}>Stop</Button>
{:else}
- <Button
- variant="outline"
- size="sm"
- onclick={() => stackLogViewer?.startLogStream()}
- disabled={!project?.id}>Start</Button
+ <Button variant="outline" size="sm" onclick={() => stackLogViewer?.startLogStream()} disabled={!project?.id}
+ >Start</Button
>
{/if}
<Button
@@ -619,13 +571,13 @@
stackLogViewer?.startLogStream();
}}
>
- <RefreshCw class="size-4" />
+ <RefreshCwIcon class="size-4" />
</Button>
</div>
</div>
- <Card.Root class="border min-w-0 overflow-hidden">
- <Card.Content class="p-0 min-w-0 overflow-hidden">
+ <Card.Root class="min-w-0 overflow-hidden border">
+ <Card.Content class="min-w-0 overflow-hidden p-0">
<div class="w-full min-w-0 overflow-hidden">
<LogViewer
bind:this={stackLogViewer}
@@ -653,15 +605,14 @@
<div class="flex min-h-screen items-center justify-center">
<div class="text-center">
<div class="bg-muted/50 mb-6 inline-flex rounded-full p-6">
- <FileStack class="text-muted-foreground size-10" />
+ <FileStackIcon class="text-muted-foreground size-10" />
</div>
<h2 class="mb-3 text-2xl font-medium">Project Not Found</h2>
<p class="text-muted-foreground mb-8 max-w-md text-center">
- Could not load Project data. It may have been removed or the Docker engine is not
- accessible.
+ Could not load Project data. It may have been removed or the Docker engine is not accessible.
</p>
<Button variant="outline" href="/compose">
- <ArrowLeft class="mr-2 size-4" />
+ <ArrowLeftIcon class="mr-2 size-4" />
Back to Projects
</Button>
</div>
diff --git a/frontend/src/routes/compose/compose-table.svelte b/frontend/src/routes/compose/compose-table.svelte
index fde7c2222..7a48a1b3c 100644
--- a/frontend/src/routes/compose/compose-table.svelte
+++ b/frontend/src/routes/compose/compose-table.svelte
@@ -1,32 +1,28 @@
<script lang="ts">
import type { Project } from '$lib/types/project.type';
- import ArcaneTable from '$lib/components/arcane-table.svelte';
+ import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import { Button } from '$lib/components/ui/button/index.js';
- import {
- Trash2,
- Loader2,
- Ellipsis,
- Pen,
- Play,
- RotateCcw,
- StopCircle,
- FileStack
- } from '@lucide/svelte';
+ import EllipsisIcon from '@lucide/svelte/icons/ellipsis';
+ import PenIcon from '@lucide/svelte/icons/pen';
+ import PlayIcon from '@lucide/svelte/icons/play';
+ import RotateCcwIcon from '@lucide/svelte/icons/rotate-ccw';
+ import StopCircleIcon from '@lucide/svelte/icons/stop-circle';
+ import Trash2Icon from '@lucide/svelte/icons/trash-2';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
import * as Card from '$lib/components/ui/card/index.js';
import { goto } from '$app/navigation';
import { toast } from 'svelte-sonner';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
- import * as Table from '$lib/components/ui/table';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
import { environmentAPI } from '$lib/services/api';
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
- import { statusVariantMap } from '$lib/types/statuses';
+ import { getStatusVariant } from '$lib/utils/status.utils';
import { capitalizeFirstLetter } from '$lib/utils/string.utils';
- import { formatFriendlyDate } from '$lib/utils/date.utils';
+ import { format } from 'date-fns';
+ import type { ColumnSpec } from '$lib/components/arcane-table';
let {
projects = $bindable(),
@@ -116,160 +112,121 @@
});
}
} catch (error) {
- console.error('Project action failed:', error);
- toast.error('An error occurred while performing the action');
- isLoading[action as keyof typeof isLoading] = false;
+ toast.error(`Something Went Wrong ${error}`);
}
}
const isAnyLoading = $derived(Object.values(isLoading).some((loading) => loading));
+
+ const columns = [
+ { accessorKey: 'name', title: 'Name', sortable: true, cell: NameCell },
+ { accessorKey: 'serviceCount', title: 'Services', sortable: true },
+ { accessorKey: 'status', title: 'Status', sortable: true, cell: StatusCell },
+ { accessorKey: 'createdAt', title: 'Created', sortable: true, cell: CreatedCell }
+ ] satisfies ColumnSpec<Project>[];
</script>
-{#if projects.data.length > 0}
- <Card.Root class="border shadow-sm">
- <Card.Header class="px-6">
- <div class="flex items-center justify-between">
- <div>
- <Card.Title>Projects List</Card.Title>
- </div>
- <div class="flex items-center gap-2">
- <ArcaneButton
- action="inspect"
- label="Update Projects"
- onClick={onCheckForUpdates}
- loading={isLoading.updating}
- loadingLabel="Updating..."
- disabled={isLoading.updating}
- />
- </div>
- </div>
- </Card.Header>
- <Card.Content>
- <ArcaneTable
- items={projects}
- bind:requestOptions
- bind:selectedIds
- columns={[
- { label: 'Name', sortColumn: 'name' },
- { label: 'Services', sortColumn: 'service_count' },
- { label: 'Status', sortColumn: 'status' },
- { label: 'Created', sortColumn: 'created_at' },
- { label: ' ' }
- ]}
- filterPlaceholder="Search projects..."
- noResultsMessage="No projects found"
- onRefresh={async (options) => (projects = await environmentAPI.getProjects(options))}
- >
- {#snippet rows({ item })}
- {@const stateVariant = item.status ? statusVariantMap[item.status.toLowerCase()] : 'gray'}
- <Table.Cell>
- <a class="font-medium hover:underline" href="/compose/{item.id}/">
- {item.name}
- </a>
- </Table.Cell>
- <Table.Cell>{item.serviceCount || 0}</Table.Cell>
- <Table.Cell>
- <StatusBadge variant={stateVariant} text={capitalizeFirstLetter(item.status)} />
- </Table.Cell>
- <Table.Cell>{formatFriendlyDate(item.createdAt || '')}</Table.Cell>
- <Table.Cell>
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <Button {...props} variant="ghost" size="icon" class="relative size-8 p-0">
- <span class="sr-only">Open menu</span>
- <Ellipsis />
- </Button>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item
- onclick={() => goto(`/compose/${item.id}`)}
- disabled={isAnyLoading}
- >
- <Pen class="size-4" />
- Edit
- </DropdownMenu.Item>
+{#snippet NameCell({ item }: { item: Project })}
+ <a class="font-medium hover:underline" href="/compose/{item.id}/">
+ {item.name}
+ </a>
+{/snippet}
+
+{#snippet StatusCell({ item }: { item: Project })}
+ {@const stateVariant = getStatusVariant(item.status)}
+ <StatusBadge variant={stateVariant} text={capitalizeFirstLetter(item.status)} />
+{/snippet}
+
+{#snippet CreatedCell({ value }: { value: unknown })}
+ {#if value}{format(new Date(String(value)), 'PP p')}{/if}
+{/snippet}
+
+{#snippet RowActions({ item }: { item: Project })}
+ <DropdownMenu.Root>
+ <DropdownMenu.Trigger>
+ {#snippet child({ props })}
+ <Button {...props} variant="ghost" size="icon" class="relative size-8 p-0">
+ <span class="sr-only">Open menu</span>
+ <EllipsisIcon />
+ </Button>
+ {/snippet}
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Content align="end">
+ <DropdownMenu.Group>
+ <DropdownMenu.Item onclick={() => goto(`/compose/${item.id}`)} disabled={isAnyLoading}>
+ <PenIcon class="size-4" />
+ Edit
+ </DropdownMenu.Item>
+
+ {#if item.status !== 'running'}
+ <DropdownMenu.Item onclick={() => performProjectAction('start', item.id)} disabled={isLoading.start || isAnyLoading}>
+ {#if isLoading.start}
+ <LoaderCircleIcon class="size-4 animate-spin" />
+ {:else}
+ <PlayIcon class="size-4" />
+ {/if}
+ Start
+ </DropdownMenu.Item>
+ {:else}
+ <DropdownMenu.Item
+ onclick={() => performProjectAction('restart', item.id)}
+ disabled={isLoading.restart || isAnyLoading}
+ >
+ {#if isLoading.restart}
+ <LoaderCircleIcon class="size-4 animate-spin" />
+ {:else}
+ <RotateCcwIcon class="size-4" />
+ {/if}
+ Restart
+ </DropdownMenu.Item>
- {#if item.status !== 'running'}
- <DropdownMenu.Item
- onclick={() => performProjectAction('start', item.id)}
- disabled={isLoading.start || isAnyLoading}
- >
- {#if isLoading.start}
- <Loader2 class="size-4 animate-spin" />
- {:else}
- <Play class="size-4" />
- {/if}
- Start
- </DropdownMenu.Item>
- {:else}
- <DropdownMenu.Item
- onclick={() => performProjectAction('restart', item.id)}
- disabled={isLoading.restart || isAnyLoading}
- >
- {#if isLoading.restart}
- <Loader2 class="size-4 animate-spin" />
- {:else}
- <RotateCcw class="size-4" />
- {/if}
- Restart
- </DropdownMenu.Item>
+ <DropdownMenu.Item onclick={() => performProjectAction('stop', item.id)} disabled={isLoading.stop || isAnyLoading}>
+ {#if isLoading.stop}
+ <LoaderCircleIcon class="size-4 animate-spin" />
+ {:else}
+ <StopCircleIcon class="size-4" />
+ {/if}
+ Stop
+ </DropdownMenu.Item>
+ {/if}
- <DropdownMenu.Item
- onclick={() => performProjectAction('stop', item.id)}
- disabled={isLoading.stop || isAnyLoading}
- >
- {#if isLoading.stop}
- <Loader2 class="size-4 animate-spin" />
- {:else}
- <StopCircle class="size-4" />
- {/if}
- Stop
- </DropdownMenu.Item>
- {/if}
+ <DropdownMenu.Item onclick={() => performProjectAction('pull', item.id)} disabled={isLoading.pull || isAnyLoading}>
+ {#if isLoading.pull}
+ <LoaderCircleIcon class="size-4 animate-spin" />
+ {:else}
+ <RotateCcwIcon class="size-4" />
+ {/if}
+ Pull & Redeploy
+ </DropdownMenu.Item>
- <DropdownMenu.Item
- onclick={() => performProjectAction('pull', item.id)}
- disabled={isLoading.pull || isAnyLoading}
- >
- {#if isLoading.pull}
- <Loader2 class="size-4 animate-spin" />
- {:else}
- <RotateCcw class="size-4" />
- {/if}
- Pull & Redeploy
- </DropdownMenu.Item>
+ <DropdownMenu.Separator />
- <DropdownMenu.Separator />
+ <DropdownMenu.Item
+ variant="destructive"
+ onclick={() => performProjectAction('destroy', item.id)}
+ disabled={isLoading.remove || isAnyLoading}
+ >
+ {#if isLoading.remove}
+ <LoaderCircleIcon class="size-4 animate-spin" />
+ {:else}
+ <Trash2Icon class="size-4" />
+ {/if}
+ Destroy
+ </DropdownMenu.Item>
+ </DropdownMenu.Group>
+ </DropdownMenu.Content>
+ </DropdownMenu.Root>
+{/snippet}
- <DropdownMenu.Item
- variant="destructive"
- onclick={() => performProjectAction('destroy', item.id)}
- disabled={isLoading.remove || isAnyLoading}
- >
- {#if isLoading.remove}
- <Loader2 class="size-4 animate-spin" />
- {:else}
- <Trash2 class="size-4" />
- {/if}
- Destroy
- </DropdownMenu.Item>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
- </Table.Cell>
- {/snippet}
- </ArcaneTable>
- </Card.Content>
- </Card.Root>
-{:else}
- <div class="flex flex-col items-center justify-center px-6 py-12 text-center">
- <FileStack class="text-muted-foreground mb-4 size-12 opacity-40" />
- <p class="text-lg font-medium">No Projects found</p>
- <p class="text-muted-foreground mt-1 max-w-md text-sm">
- Create a new stack using the "Create Project" button above
- </p>
- </div>
-{/if}
+<Card.Root>
+ <Card.Content class="py-5">
+ <ArcaneTable
+ items={projects}
+ bind:requestOptions
+ bind:selectedIds
+ onRefresh={async (options) => (projects = await environmentAPI.getProjects(options))}
+ {columns}
+ rowActions={RowActions}
+ />
+ </Card.Content>
+</Card.Root>
diff --git a/frontend/src/routes/compose/new/+page.svelte b/frontend/src/routes/compose/new/+page.svelte
index def6314d0..ff0dc4bb5 100644
--- a/frontend/src/routes/compose/new/+page.svelte
+++ b/frontend/src/routes/compose/new/+page.svelte
@@ -1,6 +1,10 @@
<script lang="ts">
import { Button } from '$lib/components/ui/button/index.js';
- import { ArrowLeft, Terminal, Copy, Loader2, Wand } from '@lucide/svelte';
+ import ArrowLeftIcon from '@lucide/svelte/icons/arrow-left';
+ import TerminalIcon from '@lucide/svelte/icons/terminal';
+ import CopyIcon from '@lucide/svelte/icons/copy';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import WandIcon from '@lucide/svelte/icons/wand';
import { Input } from '$lib/components/ui/input/index.js';
import { Label } from '$lib/components/ui/label/index.js';
import { goto, invalidateAll } from '$app/navigation';
@@ -9,16 +13,15 @@
import { preventDefault } from '$lib/utils/form.utils';
import { tryCatch } from '$lib/utils/try-catch';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
- import { defaultEnvTemplate, defaultComposeTemplate } from '$lib/constants';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
+ import { defaultComposeTemplate } from '$lib/constants';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import { Textarea } from '$lib/components/ui/textarea/index.js';
import * as Dialog from '$lib/components/ui/dialog/index.js';
import TemplateSelectionDialog from '$lib/components/dialogs/template-selection-dialog.svelte';
import { environmentAPI, converterAPI } from '$lib/services/api';
import type { Template } from '$lib/types/template.type';
- import type { PageProps } from './+page';
- let { data }: { data: PageProps } = $props();
+ let { data } = $props();
let saving = $state(false);
let converting = $state(false);
@@ -28,7 +31,7 @@
let name = $state('');
let composeContent = $state(data.defaultTemplate || defaultComposeTemplate);
- let envContent = $state(data.envTemplate || defaultEnvTemplate);
+ let envContent = $state(data.envTemplate);
let dockerRunCommand = $state('');
async function handleSubmit() {
@@ -75,8 +78,6 @@
composeContent = template.content;
if (template.envContent) {
envContent = template.envContent;
- } else {
- envContent = defaultEnvTemplate;
}
if (!name.trim()) {
@@ -102,7 +103,7 @@
<div class="flex items-center justify-between">
<div class="flex items-center gap-3">
<Button variant="ghost" size="sm" href="/compose">
- <ArrowLeft class="mr-2 size-4" />
+ <ArrowLeftIcon class="size-4" />
Back
</Button>
<div class="bg-border h-4 w-px"></div>
@@ -113,23 +114,17 @@
<div class="flex items-center gap-2">
<Dialog.Root bind:open={showConverterDialog}>
<Dialog.Trigger>
- <Button
- variant="outline"
- class="arcane-button-restart"
- disabled={saving || converting || isLoadingTemplateContent}
- >
- <Terminal class="mr-2 size-4" />
+ <Button variant="outline" class="arcane-button-restart" disabled={saving || converting || isLoadingTemplateContent}>
+ <TerminalIcon class="mr-2 size-4" />
Convert Docker Run
</Button>
</Dialog.Trigger>
- <Dialog.Content class="sm:max-w-[800px] max-h-[80vh]">
+ <Dialog.Content class="max-h-[80vh] sm:max-w-[800px]">
<Dialog.Header>
<Dialog.Title>Docker Run to Compose Converter</Dialog.Title>
- <Dialog.Description>
- Convert existing docker run commands to Docker Compose format
- </Dialog.Description>
+ <Dialog.Description>Convert existing docker run commands to Docker Compose format</Dialog.Description>
</Dialog.Header>
- <div class="space-y-4 max-h-[60vh] overflow-y-auto">
+ <div class="max-h-[60vh] space-y-4 overflow-y-auto">
<div class="space-y-2">
<Label for="dockerRunCommand">Docker Run Command</Label>
<Textarea
@@ -150,10 +145,10 @@
type="button"
variant="ghost"
size="sm"
- class="h-auto w-full justify-start p-2 text-left font-mono text-xs break-all whitespace-normal"
+ class="h-auto w-full justify-start whitespace-normal break-all p-2 text-left font-mono text-xs"
onclick={() => useExample(command)}
>
- <Copy class="mr-2 size-3 shrink-0" />
+ <CopyIcon class="mr-2 size-3 shrink-0" />
<span class="truncate">{command}</span>
</Button>
{/each}
@@ -161,16 +156,12 @@
</div>
</div>
<div class="flex w-full justify-end pt-4">
- <Button
- type="button"
- disabled={!dockerRunCommand.trim() || converting}
- onclick={handleConvertDockerRun}
- >
+ <Button type="button" disabled={!dockerRunCommand.trim() || converting} onclick={handleConvertDockerRun}>
{#if converting}
- <Loader2 class="mr-2 size-4 animate-spin" />
+ <LoaderCircleIcon class="mr-2 size-4 animate-spin" />
Converting...
{:else}
- <Wand class="mr-2 size-4" />
+ <WandIcon class="mr-2 size-4" />
Convert to Compose
{/if}
</Button>
@@ -179,13 +170,13 @@
</Dialog.Root>
<ArcaneButton
action="template"
- onClick={() => (showTemplateDialog = true)}
+ onclick={() => (showTemplateDialog = true)}
loading={saving || isLoadingTemplateContent}
disabled={saving || converting || isLoadingTemplateContent}
/>
<ArcaneButton
action="create"
- onClick={() => handleSubmit()}
+ onclick={() => handleSubmit()}
loading={saving}
disabled={!name || !composeContent || saving || converting || isLoadingTemplateContent}
/>
diff --git a/frontend/src/routes/compose/new/+page.ts b/frontend/src/routes/compose/new/+page.ts
index f6c3e8ba9..dc344aa67 100644
--- a/frontend/src/routes/compose/new/+page.ts
+++ b/frontend/src/routes/compose/new/+page.ts
@@ -1,5 +1,5 @@
import { templateAPI, environmentManagementAPI } from '$lib/services/api';
-import { defaultComposeTemplate, defaultEnvTemplate } from '$lib/constants';
+import { defaultComposeTemplate } from '$lib/constants';
import type { Template } from '$lib/types/template.type';
import type { Environment } from '$lib/stores/environment.store';
@@ -18,7 +18,7 @@ export const load = async (): Promise<PageProps> => {
}),
templateAPI.getEnvTemplate().catch((err) => {
console.warn('Failed to load env template:', err);
- return defaultEnvTemplate;
+ return '';
}),
environmentManagementAPI.list().catch((err) => {
console.warn('Failed to load environments:', err);
diff --git a/frontend/src/routes/containers/+page.svelte b/frontend/src/routes/containers/+page.svelte
index 663b841b0..0c377fb32 100644
--- a/frontend/src/routes/containers/+page.svelte
+++ b/frontend/src/routes/containers/+page.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import { Box } from '@lucide/svelte';
+ import BoxIcon from '@lucide/svelte/icons/box';
import CreateContainerSheet from '$lib/components/sheets/create-container-sheet.svelte';
import { toast } from 'svelte-sonner';
import { tryCatch } from '$lib/utils/try-catch';
@@ -7,7 +7,7 @@
import StatCard from '$lib/components/stat-card.svelte';
import { autoUpdateAPI, environmentAPI } from '$lib/services/api';
import ContainerTable from './container-table.svelte';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
let { data } = $props();
@@ -60,15 +60,22 @@
<div class="flex items-center gap-2">
<ArcaneButton
action="create"
- label="Create Container"
- onClick={() => (isCreateDialogOpen = true)}
+ customLabel="Create Container"
+ onclick={() => (isCreateDialogOpen = true)}
loading={isLoading.create}
disabled={isLoading.create}
/>
+ <ArcaneButton
+ action="inspect"
+ customLabel="Update Containers"
+ onclick={handleCheckForUpdates}
+ loading={isLoading.checking}
+ disabled={isLoading.checking}
+ />
<ArcaneButton
action="restart"
- onClick={refreshContainers}
- label="Refresh"
+ onclick={refreshContainers}
+ customLabel="Refresh"
loading={isLoading.refreshing}
disabled={isLoading.refreshing}
/>
@@ -79,13 +86,13 @@
<StatCard
title="Total"
value={containers.pagination.totalItems}
- icon={Box}
+ icon={BoxIcon}
class="border-l-primary border-l-4 transition-shadow hover:shadow-lg"
/>
<StatCard
title="Running"
value={runningContainers}
- icon={Box}
+ icon={BoxIcon}
iconColor="text-green-500"
bgColor="bg-green-500/10"
class="border-l-4 border-l-green-500"
@@ -93,18 +100,13 @@
<StatCard
title="Stopped"
value={stoppedContainers}
- icon={Box}
+ icon={BoxIcon}
iconColor="text-amber-500"
class="border-l-4 border-l-amber-500"
/>
</div>
- <ContainerTable
- bind:containers
- bind:selectedIds
- bind:requestOptions
- onCheckForUpdates={handleCheckForUpdates}
- />
+ <ContainerTable bind:containers bind:selectedIds bind:requestOptions />
<CreateContainerSheet
bind:open={isCreateDialogOpen}
diff --git a/frontend/src/routes/containers/[containerId]/+page.svelte b/frontend/src/routes/containers/[containerId]/+page.svelte
index 788895c52..12db3f941 100644
--- a/frontend/src/routes/containers/[containerId]/+page.svelte
+++ b/frontend/src/routes/containers/[containerId]/+page.svelte
@@ -1,30 +1,27 @@
<script lang="ts">
- import type { PageData } from './$types';
import * as Card from '$lib/components/ui/card/index.js';
import { Button } from '$lib/components/ui/button/index.js';
- import {
- ArrowLeft,
- AlertCircle,
- RefreshCw,
- HardDrive,
- Clock,
- Network,
- Terminal,
- Settings,
- Activity,
- FileText,
- Database
- } from '@lucide/svelte';
+ import ArrowLeftIcon from '@lucide/svelte/icons/arrow-left';
+ import CircleAlertIcon from '@lucide/svelte/icons/alert-circle';
+ import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
+ import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
+ import ClockIcon from '@lucide/svelte/icons/clock';
+ import NetworkIcon from '@lucide/svelte/icons/network';
+ import TerminalIcon from '@lucide/svelte/icons/terminal';
+ import SettingsIcon from '@lucide/svelte/icons/settings';
+ import ActivityIcon from '@lucide/svelte/icons/activity';
+ import FileTextIcon from '@lucide/svelte/icons/file-text';
+ import DatabaseIcon from '@lucide/svelte/icons/database';
import { invalidateAll } from '$app/navigation';
import { Badge } from '$lib/components/ui/badge/index.js';
import ActionButtons from '$lib/components/action-buttons.svelte';
- import { formatDate } from '$lib/utils/string.utils';
- import { formatBytes } from '$lib/utils/bytes.util';
+ import { format } from 'date-fns';
+ import bytes from 'bytes';
import type Docker from 'dockerode';
import type { ContainerInspectInfo } from 'dockerode';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { onDestroy } from 'svelte';
- import LogViewer from '$lib/components/LogViewer.svelte';
+ import LogViewer from '$lib/components/log-viewer.svelte';
import Meter from '$lib/components/ui/meter/meter.svelte';
import { browser } from '$app/environment';
import Separator from '$lib/components/ui/separator/separator.svelte';
@@ -43,9 +40,8 @@
return config as NetworkConfig;
}
- let { data }: { data: PageData } = $props();
+ let { data } = $props();
let { container, stats } = $derived(data);
- console.log(data);
let starting = $state(false);
let stopping = $state(false);
@@ -127,13 +123,9 @@
return 0;
}
- const cpuDelta =
- statsData.cpu_stats.cpu_usage.total_usage -
- (statsData.precpu_stats.cpu_usage?.total_usage || 0);
- const systemDelta =
- statsData.cpu_stats.system_cpu_usage - (statsData.precpu_stats.system_cpu_usage || 0);
- const numberCPUs =
- statsData.cpu_stats.online_cpus || statsData.cpu_stats.cpu_usage?.percpu_usage?.length || 1;
+ const cpuDelta = statsData.cpu_stats.cpu_usage.total_usage - (statsData.precpu_stats.cpu_usage?.total_usage || 0);
+ const systemDelta = statsData.cpu_stats.system_cpu_usage - (statsData.precpu_stats.system_cpu_usage || 0);
+ const numberCPUs = statsData.cpu_stats.online_cpus || statsData.cpu_stats.cpu_usage?.percpu_usage?.length || 1;
if (systemDelta > 0 && cpuDelta > 0) {
const cpuPercent = (cpuDelta / systemDelta) * numberCPUs * 100.0;
@@ -145,15 +137,11 @@
const cpuUsagePercent = $derived(calculateCPUPercent(stats));
const memoryUsageBytes = $derived(stats?.memory_stats?.usage || 0);
const memoryLimitBytes = $derived(stats?.memory_stats?.limit || 0);
- const memoryUsageFormatted = $derived(formatBytes(memoryUsageBytes));
- const memoryLimitFormatted = $derived(formatBytes(memoryLimitBytes));
- const memoryUsagePercent = $derived(
- memoryLimitBytes > 0 ? (memoryUsageBytes / memoryLimitBytes) * 100 : 0
- );
+ const memoryUsageFormatted = $derived(bytes.format(memoryUsageBytes));
+ const memoryLimitFormatted = $derived(bytes.format(memoryLimitBytes));
+ const memoryUsagePercent = $derived(memoryLimitBytes > 0 ? (memoryUsageBytes / memoryLimitBytes) * 100 : 0);
- const getPrimaryIpAddress = (
- networkSettings: ContainerInspectInfo['NetworkSettings'] | undefined | null
- ): string => {
+ const getPrimaryIpAddress = (networkSettings: ContainerInspectInfo['NetworkSettings'] | undefined | null): string => {
if (!networkSettings) return 'N/A';
if (networkSettings.IPAddress) {
@@ -207,31 +195,24 @@
// Data presence flags
const hasEnvVars = $derived(!!(container?.Config?.Env && container.Config.Env.length > 0));
- const hasPorts = $derived(
- !!(container?.NetworkSettings?.Ports && Object.keys(container.NetworkSettings.Ports).length > 0)
- );
- const hasLabels = $derived(
- !!(container?.Config?.Labels && Object.keys(container.Config.Labels).length > 0)
- );
+ const hasPorts = $derived(!!(container?.NetworkSettings?.Ports && Object.keys(container.NetworkSettings.Ports).length > 0));
+ const hasLabels = $derived(!!(container?.Config?.Labels && Object.keys(container.Config.Labels).length > 0));
const showConfiguration = $derived(hasEnvVars || hasPorts || hasLabels);
const hasNetworks = $derived(
- !!(
- container?.NetworkSettings?.Networks &&
- Object.keys(container.NetworkSettings.Networks).length > 0
- )
+ !!(container?.NetworkSettings?.Networks && Object.keys(container.NetworkSettings.Networks).length > 0)
);
const hasMounts = $derived(!!(container?.Mounts && container.Mounts.length > 0));
const showStats = $derived(!!(container?.State?.Running && stats));
// Navigation sections for single-page layout
const navigationSections = [
- { id: 'overview', label: 'Overview', icon: HardDrive },
- { id: 'stats', label: 'Metrics', icon: Activity },
- { id: 'logs', label: 'Logs', icon: FileText },
- { id: 'config', label: 'Configuration', icon: Settings },
- { id: 'network', label: 'Networks', icon: Network },
- { id: 'storage', label: 'Storage', icon: Database }
+ { id: 'overview', label: 'Overview', icon: HardDriveIcon },
+ { id: 'stats', label: 'Metrics', icon: ActivityIcon },
+ { id: 'logs', label: 'Logs', icon: FileTextIcon },
+ { id: 'config', label: 'Configuration', icon: SettingsIcon },
+ { id: 'network', label: 'Networks', icon: NetworkIcon },
+ { id: 'storage', label: 'Storage', icon: DatabaseIcon }
] as const;
const visibleNavigationSections = $derived(
@@ -240,11 +221,10 @@
if (s.id === 'config') return showConfiguration;
if (s.id === 'network') return hasNetworks;
if (s.id === 'storage') return hasMounts;
- return true; // overview, logs
+ return true;
})
);
- // Ensure activeSection is always visible
$effect(() => {
if (!visibleNavigationSections.some((s) => s.id === activeSection)) {
activeSection = visibleNavigationSections[0]?.id ?? 'overview';
@@ -274,18 +254,15 @@
<div class="bg-background min-h-screen">
{#if container}
- <!-- Fixed Header (matches compose) -->
<div
class="bg-background/95 sticky top-0 z-20 border-b backdrop-blur transition-all duration-300"
- style="opacity: {showFloatingHeader ? 0 : 1}; pointer-events: {showFloatingHeader
- ? 'none'
- : 'auto'};"
+ style="opacity: {showFloatingHeader ? 0 : 1}; pointer-events: {showFloatingHeader ? 'none' : 'auto'};"
>
<div class="max-w-full px-4 py-3">
<div class="flex items-center justify-between">
<div class="flex items-center gap-3">
<Button variant="ghost" size="sm" href="/containers">
- <ArrowLeft class="mr-2 size-4" />
+ <ArrowLeftIcon class="mr-2 size-4" />
Back
</Button>
<div class="bg-border h-4 w-px"></div>
@@ -295,11 +272,7 @@
</h1>
{#if container?.State}
<StatusBadge
- variant={container.State.Status === 'running'
- ? 'green'
- : container.State.Status === 'exited'
- ? 'red'
- : 'amber'}
+ variant={container.State.Status === 'running' ? 'green' : container.State.Status === 'exited' ? 'red' : 'amber'}
text={container.State.Status}
/>
{/if}
@@ -307,10 +280,6 @@
</div>
<div class="flex items-center gap-2">
- <Button variant="ghost" size="sm" onclick={refreshData} disabled={isRefreshing}>
- <RefreshCw class={`mr-2 size-4 ${isRefreshing ? 'animate-spin' : ''}`} />
- Refresh
- </Button>
{#if container}
<ActionButtons
id={container.Id}
@@ -325,13 +294,8 @@
</div>
{#if showFloatingHeader}
- <!-- Floating mini header (like compose) -->
- <div
- class="fixed left-1/2 top-4 z-30 -translate-x-1/2 transition-all duration-300 ease-in-out"
- >
- <div
- class="bg-background/90 rounded-lg border border-border/50 px-4 py-3 shadow-xl backdrop-blur-xl"
- >
+ <div class="fixed left-1/2 top-4 z-30 -translate-x-1/2 transition-all duration-300 ease-in-out">
+ <div class="bg-background/90 border-border/50 rounded-lg border px-4 py-3 shadow-xl backdrop-blur-xl">
<div class="flex items-center gap-4">
<div class="flex items-center gap-2">
<h2 class="max-w-[150px] truncate text-sm font-medium" title={containerDisplayName}>
@@ -339,11 +303,7 @@
</h2>
{#if container?.State}
<StatusBadge
- variant={container.State.Status === 'running'
- ? 'green'
- : container.State.Status === 'exited'
- ? 'red'
- : 'amber'}
+ variant={container.State.Status === 'running' ? 'green' : container.State.Status === 'exited' ? 'red' : 'amber'}
text={container.State.Status}
class="text-xs"
/>
@@ -362,7 +322,6 @@
{/if}
<div class="flex min-h-0 overflow-hidden">
- <!-- Left rail (align to compose proportions) -->
<div class="bg-background/50 w-16 shrink-0 border-r">
<div class="sticky top-16 p-2">
<nav class="space-y-1">
@@ -376,85 +335,75 @@
: 'text-muted-foreground hover:text-foreground hover:bg-muted/50'}"
title={section.label}
>
- <IconComponent class="size-4" />
+ - <IconComponent class="size-4" />
+ + <IconComponent class="size-4" />
</button>
{/each}
</nav>
</div>
</div>
- <!-- Main content -->
<div class="min-w-0 flex-1 overflow-hidden">
<div class="max-w-none p-6">
<div class="space-y-8">
- <!-- Overview -->
<section id="overview" class="scroll-mt-20">
<h2 class="mb-6 flex items-center gap-2 text-xl font-semibold">
- <HardDrive class="size-5" />
+ <HardDriveIcon class="size-5" />
Overview
</h2>
- <!-- Single card that spans full width on mobile, stays in grid on lg+ -->
<div class="mb-6">
<Card.Root class="rounded-lg border shadow-sm">
<Card.Header class="pb-4">
<Card.Title>Container Details</Card.Title>
- <Card.Description class="text-sm text-muted-foreground">
+ <Card.Description class="text-muted-foreground text-sm">
Identity, runtime, and system metadata
</Card.Description>
</Card.Header>
<Card.Content class="space-y-6">
- <!-- Identity -->
<div class="space-y-4">
- <!-- Image -->
<div class="flex items-center gap-3">
<div class="rounded bg-blue-50 p-2 dark:bg-blue-950/20">
- <HardDrive class="size-4 text-blue-600" />
+ <HardDriveIcon class="size-4 text-blue-600" />
</div>
<div class="min-w-0 flex-1">
- <div class="text-sm text-muted-foreground">Image</div>
+ <div class="text-muted-foreground text-sm">Image</div>
<div class="truncate font-medium" title={container.Config?.Image}>
{container.Config?.Image || 'N/A'}
</div>
</div>
</div>
- <!-- Created -->
<div class="flex items-center gap-3">
<div class="rounded bg-green-50 p-2 dark:bg-green-950/20">
- <Clock class="size-4 text-green-600" />
+ <ClockIcon class="size-4 text-green-600" />
</div>
<div class="min-w-0 flex-1">
- <div class="text-sm text-muted-foreground">Created</div>
- <div class="font-medium" title={formatDate(container.Created)}>
- {formatDate(container.Created)}
+ <div class="text-muted-foreground text-sm">Created</div>
+ <div class="font-medium" title={format(new Date(container.Created), 'PP p')}>
+ {format(new Date(container.Created), 'PP p')}
</div>
</div>
</div>
- <!-- IP -->
<div class="flex items-center gap-3">
<div class="rounded bg-purple-50 p-2 dark:bg-purple-950/20">
- <Network class="size-4 text-purple-600" />
+ <NetworkIcon class="size-4 text-purple-600" />
</div>
<div class="min-w-0 flex-1">
- <div class="text-sm text-muted-foreground">IP Address</div>
+ <div class="text-muted-foreground text-sm">IP Address</div>
<div class="font-medium">{primaryIpAddress}</div>
</div>
</div>
- <!-- Command -->
<div class="flex items-center gap-3">
<div class="rounded bg-amber-50 p-2 dark:bg-amber-950/20">
- <Terminal class="size-4 text-amber-600" />
+ <TerminalIcon class="size-4 text-amber-600" />
</div>
<div class="min-w-0 flex-1">
- <div class="text-sm text-muted-foreground">Command</div>
- <div
- class="truncate font-medium"
- title={container.Config?.Cmd?.join(' ')}
- >
+ <div class="text-muted-foreground text-sm">Command</div>
+ <div class="truncate font-medium" title={container.Config?.Cmd?.join(' ')}>
{container.Config?.Cmd?.join(' ') || 'N/A'}
</div>
</div>
@@ -463,49 +412,38 @@
<Separator />
- <!-- System -->
<div class="space-y-3">
<h4 class="text-sm font-semibold tracking-tight">System</h4>
<div class="grid grid-cols-1 gap-3 sm:grid-cols-2">
- <!-- Container ID -->
<div class="space-y-1">
- <div class="text-xs text-muted-foreground">Container ID</div>
- <div
- class="bg-muted/50 max-w-full truncate rounded px-2 py-1.5 font-mono text-xs"
- >
+ <div class="text-muted-foreground text-xs">Container ID</div>
+ <div class="bg-muted/50 max-w-full truncate rounded px-2 py-1.5 font-mono text-xs">
{container.Id}
</div>
</div>
- <!-- Working Dir -->
{#if container.Config?.WorkingDir}
<div class="space-y-1">
- <div class="text-xs text-muted-foreground">Working Directory</div>
- <div
- class="bg-muted/50 max-w-full truncate rounded px-2 py-1.5 font-mono text-xs"
- >
+ <div class="text-muted-foreground text-xs">Working Directory</div>
+ <div class="bg-muted/50 max-w-full truncate rounded px-2 py-1.5 font-mono text-xs">
{container.Config.WorkingDir}
</div>
</div>
{/if}
- <!-- User -->
{#if container.Config?.User}
<div class="space-y-1">
- <div class="text-xs text-muted-foreground">User</div>
- <div
- class="bg-muted/50 inline-flex rounded px-2 py-1.5 font-mono text-xs"
- >
+ <div class="text-muted-foreground text-xs">User</div>
+ <div class="bg-muted/50 inline-flex rounded px-2 py-1.5 font-mono text-xs">
{container.Config.User}
</div>
</div>
{/if}
- <!-- Health -->
{#if container.State?.Health}
<div class="space-y-1 sm:col-span-2">
- <div class="text-xs text-muted-foreground">Health</div>
+ <div class="text-muted-foreground text-xs">Health</div>
<div class="flex flex-wrap items-center gap-3">
<StatusBadge
variant={container.State.Health.Status === 'healthy'
@@ -516,10 +454,8 @@
text={container.State.Health.Status}
/>
{#if container.State.Health.Log && container.State.Health.Log.length > 0}
- <span class="text-xs text-muted-foreground">
- Last check: {new Date(
- container.State.Health.Log[0].Start
- ).toLocaleString()}
+ <span class="text-muted-foreground text-xs">
+ Last check: {new Date(container.State.Health.Log[0].Start).toLocaleString()}
</span>
{/if}
</div>
@@ -532,11 +468,10 @@
</div>
</section>
- <!-- Stats -->
{#if showStats}
<section id="stats" class="scroll-mt-20">
<h2 class="mb-6 flex items-center gap-2 text-xl font-semibold">
- <Activity class="size-5" />
+ <ActivityIcon class="size-5" />
Resource Metrics
</h2>
@@ -544,54 +479,42 @@
<Card.Content class="p-6">
{#if stats && container.State?.Running}
<div class="grid grid-cols-1 gap-8 lg:grid-cols-2">
- <!-- CPU and Memory -->
<div class="space-y-6">
<Meter
label="CPU Usage"
valueLabel="{cpuUsagePercent.toFixed(2)}%"
value={cpuUsagePercent}
max={100}
- variant={cpuUsagePercent > 80
- ? 'destructive'
- : cpuUsagePercent > 60
- ? 'warning'
- : 'default'}
+ variant={cpuUsagePercent > 80 ? 'destructive' : cpuUsagePercent > 60 ? 'warning' : 'default'}
size="lg"
/>
<Meter
label="Memory Usage"
- valueLabel="{memoryUsageFormatted} / {memoryLimitFormatted} ({memoryUsagePercent.toFixed(
- 1
- )}%)"
+ valueLabel="{memoryUsageFormatted} / {memoryLimitFormatted} ({memoryUsagePercent.toFixed(1)}%)"
value={memoryUsagePercent}
max={100}
- variant={memoryUsagePercent > 80
- ? 'destructive'
- : memoryUsagePercent > 60
- ? 'warning'
- : 'default'}
+ variant={memoryUsagePercent > 80 ? 'destructive' : memoryUsagePercent > 60 ? 'warning' : 'default'}
size="lg"
/>
</div>
- <!-- Network I/O -->
<div class="space-y-6">
<div>
<h4 class="mb-4 flex items-center gap-2 font-medium">
- <Network class="size-4" /> Network I/O
+ <NetworkIcon class="size-4" /> Network I/O + <NetworkIcon class="size-4" /> Network I/O
</h4>
<div class="grid grid-cols-2 gap-4">
<div class="bg-muted/30 rounded p-4">
<div class="text-muted-foreground text-sm">Received</div>
<div class="mt-1 font-medium">
- {formatBytes(stats.networks?.eth0?.rx_bytes || 0)}
+ {bytes.format(stats.networks?.eth0?.rx_bytes || 0)}
</div>
</div>
<div class="bg-muted/30 rounded p-4">
<div class="text-muted-foreground text-sm">Transmitted</div>
<div class="mt-1 font-medium">
- {formatBytes(stats.networks?.eth0?.tx_bytes || 0)}
+ {bytes.format(stats.networks?.eth0?.tx_bytes || 0)}
</div>
</div>
</div>
@@ -604,7 +527,7 @@
<div class="bg-muted/30 rounded p-4">
<div class="text-muted-foreground text-sm">Read</div>
<div class="mt-1 font-medium">
- {formatBytes(
+ {bytes.format(
stats.blkio_stats.io_service_bytes_recursive
.filter((item) => item.op === 'Read')
.reduce((acc, item) => acc + item.value, 0)
@@ -614,7 +537,7 @@
<div class="bg-muted/30 rounded p-4">
<div class="text-muted-foreground text-sm">Write</div>
<div class="mt-1 font-medium">
- {formatBytes(
+ {bytes.format(
stats.blkio_stats.io_service_bytes_recursive
.filter((item) => item.op === 'Write')
.reduce((acc, item) => acc + item.value, 0)
@@ -636,22 +559,19 @@
</div>
{/if}
{:else if !container.State?.Running}
- <div class="py-12 text-center text-muted-foreground">
- Container is not running. Stats unavailable.
- </div>
+ <div class="text-muted-foreground py-12 text-center">Container is not running. Stats unavailable.</div>
{:else}
- <div class="py-12 text-center text-muted-foreground">Loading stats...</div>
+ <div class="text-muted-foreground py-12 text-center">Loading stats...</div>
{/if}
</Card.Content>
</Card.Root>
</section>
{/if}
- <!-- Logs (kept visible if container exists) -->
<section id="logs" class="scroll-mt-20">
<div class="mb-6 flex items-center justify-between">
<h2 class="flex items-center gap-2 text-xl font-semibold">
- <FileText class="size-5" />
+ <FileTextIcon class="size-5" />
Container Logs
</h2>
@@ -660,24 +580,15 @@
<input type="checkbox" bind:checked={autoScrollLogs} class="size-4" />
Auto-scroll
</label>
- <Button variant="outline" size="sm" onclick={() => logViewer?.clearLogs()}
- >Clear</Button
- >
+ <Button variant="outline" size="sm" onclick={() => logViewer?.clearLogs()}>Clear</Button>
{#if isStreaming}
<div class="flex items-center gap-2">
<div class="size-2 animate-pulse rounded-full bg-green-500"></div>
<span class="text-sm font-medium text-green-600">Live</span>
</div>
- <Button variant="outline" size="sm" onclick={() => logViewer?.stopLogStream()}
- >Stop</Button
- >
+ <Button variant="outline" size="sm" onclick={() => logViewer?.stopLogStream()}>Stop</Button>
{:else}
- <Button
- variant="outline"
- size="sm"
- onclick={() => logViewer?.startLogStream()}
- disabled={!container?.Id}
- >
+ <Button variant="outline" size="sm" onclick={() => logViewer?.startLogStream()} disabled={!container?.Id}>
Start
</Button>
{/if}
@@ -703,29 +614,25 @@
</Card.Root>
</section>
- <!-- Configuration: only if any of Env, Ports, Labels exist -->
{#if showConfiguration}
<section id="config" class="scroll-mt-20">
<h2 class="mb-6 flex items-center gap-2 text-xl font-semibold">
- <Settings class="size-5" />
+ <SettingsIcon class="size-5" />
Configuration
</h2>
<Card.Root class="rounded-lg border shadow-sm">
<Card.Header class="pb-4">
<Card.Title>Environment, Ports & Labels</Card.Title>
- <Card.Description class="text-sm text-muted-foreground">
+ <Card.Description class="text-muted-foreground text-sm">
Runtime configuration and metadata for this container
</Card.Description>
</Card.Header>
<Card.Content class="space-y-8">
{#if hasEnvVars}
- <!-- Environment Variables -->
<div>
- <h3 class="mb-3 text-sm font-semibold tracking-tight">
- Environment Variables
- </h3>
+ <h3 class="mb-3 text-sm font-semibold tracking-tight">Environment Variables</h3>
{#if container.Config?.Env && container.Config.Env.length > 0}
<ul class="divide-border/60 divide-y">
@@ -738,8 +645,7 @@
<Badge variant="secondary">
{key}:
</Badge>
- <span class="truncate font-semibold" title={value}>{value}</span
- >
+ <span class="truncate font-semibold" title={value}>{value}</span>
</div>
</li>
{:else}
@@ -753,9 +659,7 @@
{/each}
</ul>
{:else}
- <div class="text-muted-foreground py-8 text-center">
- No environment variables
- </div>
+ <div class="text-muted-foreground py-8 text-center">No environment variables</div>
{/if}
</div>
{/if}
@@ -765,7 +669,6 @@
{/if}
{#if hasPorts}
- <!-- Port Mappings -->
<div>
<h3 class="mb-3 text-sm font-semibold tracking-tight">Port Mappings</h3>
@@ -781,16 +684,11 @@
{#if Array.isArray(hostBindings) && hostBindings.length > 0}
<span class="truncate font-semibold">
{hostBindings
- .map(
- (binding) =>
- `${binding.HostIp || '0.0.0.0'}:${binding.HostPort}`
- )
+ .map((binding) => `${binding.HostIp || '0.0.0.0'}:${binding.HostPort}`)
.join(', ')}
</span>
{:else}
- <span class="text-muted-foreground font-semibold"
- >Not published</span
- >
+ <span class="text-muted-foreground font-semibold">Not published</span>
{/if}
</div>
</li>
@@ -807,7 +705,6 @@
{/if}
{#if hasLabels}
- <!-- Labels -->
<div>
<h3 class="mb-3 text-sm font-semibold tracking-tight">Labels</h3>
@@ -827,9 +724,7 @@
{/each}
</ul>
{:else}
- <div class="text-muted-foreground py-8 text-center">
- No labels defined
- </div>
+ <div class="text-muted-foreground py-8 text-center">No labels defined</div>
{/if}
</div>
{/if}
@@ -838,11 +733,10 @@
</section>
{/if}
- <!-- Network -->
{#if hasNetworks}
<section id="network" class="scroll-mt-20">
<h2 class="mb-6 flex items-center gap-2 text-xl font-semibold">
- <Network class="size-5" />
+ <NetworkIcon class="size-5" />
Networks
</h2>
@@ -870,9 +764,7 @@
<div>
<div class="text-muted-foreground text-sm">Subnet</div>
<div class="font-mono">
- {networkConfig.IPPrefixLen
- ? `${networkConfig.IPAddress}/${networkConfig.IPPrefixLen}`
- : 'N/A'}
+ {networkConfig.IPPrefixLen ? `${networkConfig.IPAddress}/${networkConfig.IPPrefixLen}` : 'N/A'}
</div>
</div>
{#if networkConfig.Aliases && networkConfig.Aliases.length > 0}
@@ -886,20 +778,17 @@
{/each}
</div>
{:else}
- <div class="py-12 text-center text-muted-foreground">
- No networks connected
- </div>
+ <div class="text-muted-foreground py-12 text-center">No networks connected</div>
{/if}
</Card.Content>
</Card.Root>
</section>
{/if}
- <!-- Storage -->
{#if hasMounts}
<section id="storage" class="scroll-mt-20">
<h2 class="mb-6 flex items-center gap-2 text-xl font-semibold">
- <Database class="size-5" />
+ <DatabaseIcon class="size-5" />
Storage & Mounts
</h2>
@@ -919,11 +808,11 @@
: 'bg-amber-100 dark:bg-amber-950'}"
>
{#if mount.Type === 'volume'}
- <Database class="size-4 text-purple-600" />
+ <DatabaseIcon class="size-4 text-purple-600" />
{:else if mount.Type === 'bind'}
- <HardDrive class="size-4 text-blue-600" />
+ <HardDriveIcon class="size-4 text-blue-600" />
{:else}
- <Terminal class="size-4 text-amber-600" />
+ <TerminalIcon class="size-4 text-amber-600" />
{/if}
</div>
<div>
@@ -945,24 +834,14 @@
</div>
<div class="space-y-3 p-4">
<div class="flex">
- <span class="text-muted-foreground w-24 font-medium"
- >Container:</span
- >
- <span class="bg-muted/50 flex-1 rounded px-2 py-1 font-mono"
- >{mount.Destination}</span
- >
+ <span class="text-muted-foreground w-24 font-medium">Container:</span>
+ <span class="bg-muted/50 flex-1 rounded px-2 py-1 font-mono">{mount.Destination}</span>
</div>
<div class="flex">
<span class="text-muted-foreground w-24 font-medium">
- {mount.Type === 'volume'
- ? 'Volume:'
- : mount.Type === 'bind'
- ? 'Host:'
- : 'Source:'}
+ {mount.Type === 'volume' ? 'Volume:' : mount.Type === 'bind' ? 'Host:' : 'Source:'}
</span>
- <span class="bg-muted/50 flex-1 rounded px-2 py-1 font-mono"
- >{mount.Source}</span
- >
+ <span class="bg-muted/50 flex-1 rounded px-2 py-1 font-mono">{mount.Source}</span>
</div>
</div>
</div>
@@ -970,10 +849,8 @@
</div>
{:else}
<div class="py-12 text-center">
- <div
- class="bg-muted/50 mx-auto mb-4 flex size-16 items-center justify-center rounded-full"
- >
- <Database class="text-muted-foreground size-6" />
+ <div class="bg-muted/50 mx-auto mb-4 flex size-16 items-center justify-center rounded-full">
+ <DatabaseIcon class="text-muted-foreground size-6" />
</div>
<div class="text-muted-foreground">No volumes or mounts configured</div>
</div>
@@ -990,20 +867,19 @@
<div class="flex min-h-screen items-center justify-center">
<div class="text-center">
<div class="bg-muted/50 mb-6 inline-flex rounded-full p-6">
- <AlertCircle class="text-muted-foreground size-10" />
+ <CircleAlertIcon class="text-muted-foreground size-10" />
</div>
<h2 class="mb-3 text-2xl font-medium">Container Not Found</h2>
<p class="text-muted-foreground mb-8 max-w-md text-center">
- Could not load container data. It may have been removed or the Docker engine is not
- accessible.
+ Could not load container data. It may have been removed or the Docker engine is not accessible.
</p>
<div class="flex justify-center gap-4">
<Button variant="outline" href="/containers">
- <ArrowLeft class="mr-2 size-4" />
+ <ArrowLeftIcon class="mr-2 size-4" />
Back to Containers
</Button>
<Button variant="default" onclick={refreshData}>
- <RefreshCw class="mr-2 size-4" />
+ <RefreshCwIcon class="mr-2 size-4" />
Retry
</Button>
</div>
diff --git a/frontend/src/routes/containers/container-table.svelte b/frontend/src/routes/containers/container-table.svelte
index 3bad7e167..1637e982e 100644
--- a/frontend/src/routes/containers/container-table.svelte
+++ b/frontend/src/routes/containers/container-table.svelte
@@ -1,16 +1,13 @@
<script lang="ts">
- import ArcaneTable from '$lib/components/arcane-table.svelte';
+ import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import { Button } from '$lib/components/ui/button/index.js';
- import {
- ScanSearch,
- Play,
- RotateCcw,
- StopCircle,
- Trash2,
- Loader2,
- Ellipsis,
- Box
- } from '@lucide/svelte';
+ import ScanSearchIcon from '@lucide/svelte/icons/scan-search';
+ import PlayIcon from '@lucide/svelte/icons/play';
+ import RotateCcwIcon from '@lucide/svelte/icons/rotate-ccw';
+ import StopCircleIcon from '@lucide/svelte/icons/stop-circle';
+ import Trash2Icon from '@lucide/svelte/icons/trash-2';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import EllipsisIcon from '@lucide/svelte/icons/ellipsis';
import * as Card from '$lib/components/ui/card/index.js';
import { goto } from '$app/navigation';
import { toast } from 'svelte-sonner';
@@ -18,25 +15,22 @@
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
import { environmentAPI } from '$lib/services/api';
import type { SearchPaginationSortRequest, Paginated } from '$lib/types/pagination.type';
- import * as Table from '$lib/components/ui/table';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
- import { formatFriendlyDate } from '$lib/utils/date.utils';
+ import { format } from 'date-fns';
import { capitalizeFirstLetter } from '$lib/utils/string.utils';
import type { ContainerSummaryDto } from '$lib/types/container.type';
+ import type { ColumnSpec } from '$lib/components/arcane-table';
let {
containers = $bindable(),
selectedIds = $bindable(),
- requestOptions = $bindable(),
- onCheckForUpdates
+ requestOptions = $bindable()
}: {
containers: Paginated<ContainerSummaryDto>;
selectedIds: string[];
requestOptions: SearchPaginationSortRequest;
- onCheckForUpdates: () => Promise<void>;
} = $props();
let isLoading = $state({
@@ -112,166 +106,122 @@
}
const isAnyLoading = $derived(Object.values(isLoading).some((loading) => loading));
- const hasContainers = $derived(containers?.data?.length > 0);
+
+ const columns = [
+ { accessorKey: 'names', title: 'Name', sortable: true, cell: NameCell },
+ { accessorKey: 'id', title: 'ID', cell: IdCell },
+ { accessorKey: 'image', title: 'Image', sortable: true },
+ { accessorKey: 'state', title: 'State', sortable: true, cell: StateCell },
+ { accessorKey: 'status', title: 'Status' },
+ { accessorKey: 'created', title: 'Created', sortable: true, cell: CreatedCell }
+ ] satisfies ColumnSpec<ContainerSummaryDto>[];
</script>
-{#if hasContainers}
- <Card.Root class="border shadow-sm">
- <Card.Header class="px-6">
- <div class="flex items-center justify-between">
- <div>
- <Card.Title>Container List</Card.Title>
- </div>
- <div class="flex items-center gap-2">
- <ArcaneButton
- action="inspect"
- label="Update Containers"
- onClick={onCheckForUpdates}
- loading={isLoading.updating}
- loadingLabel="Updating..."
- disabled={isLoading.updating}
- />
- </div>
- </div>
- </Card.Header>
- <Card.Content>
- <ArcaneTable
- items={containers}
- bind:requestOptions
- bind:selectedIds
- onRefresh={async (options) => (containers = await environmentAPI.getContainers(options))}
- columns={[
- { label: 'Name', sortColumn: 'names' },
- { label: 'ID' },
- { label: 'Image', sortColumn: 'image' },
- { label: 'State', sortColumn: 'state' },
- { label: 'Status', sortColumn: 'status' },
- { label: 'Created', sortColumn: 'created' },
- { label: ' ' }
- ]}
- filterPlaceholder="Search containers..."
- noResultsMessage="No containers found"
- >
- {#snippet rows({ item })}
- <Table.Cell>
- <a class="font-medium hover:underline" href="/containers/{item.id}/">
- {#if item.names && item.names.length > 0}
- {item.names[0].startsWith('/') ? item.names[0].substring(1) : item.names[0]}
- {:else}
- {item.id.substring(0, 12)}
- {/if}
- </a>
- </Table.Cell>
- <Table.Cell>
- <span class="font-mono text-sm">{item.id.substring(0, 12)}</span>
- </Table.Cell>
- <Table.Cell>
- <span class="text-sm">{item.image}</span>
- </Table.Cell>
- <Table.Cell>
- <StatusBadge
- variant={item.state === 'running'
- ? 'green'
- : item.state === 'exited'
- ? 'red'
- : 'amber'}
- text={capitalizeFirstLetter(item.state)}
- />
- </Table.Cell>
- <Table.Cell>
- <span class="text-sm">{item.status}</span>
- </Table.Cell>
- <Table.Cell>
- <span class="text-sm">
- {item.created ? formatFriendlyDate(new Date(item.created * 1000).toISOString()) : ''}
- </span>
- </Table.Cell>
- <Table.Cell>
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <Button {...props} variant="ghost" size="icon" class="relative size-8 p-0">
- <span class="sr-only">Open menu</span>
- <Ellipsis />
- </Button>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item
- onclick={() => goto(`/containers/${item.id}`)}
- disabled={isAnyLoading}
- >
- <ScanSearch class="size-4" />
- Inspect
- </DropdownMenu.Item>
+{#snippet NameCell({ item }: { item: ContainerSummaryDto })}
+ <a class="font-medium hover:underline" href="/containers/{item.id}/">
+ {#if item.names && item.names.length > 0}
+ {item.names[0].startsWith('/') ? item.names[0].substring(1) : item.names[0]}
+ {:else}
+ {item.id.substring(0, 12)}
+ {/if}
+ </a>
+{/snippet}
+
+{#snippet IdCell({ item }: { item: ContainerSummaryDto })}
+ <span class="font-mono text-sm">{String(item.id).substring(0, 12)}</span>
+{/snippet}
+
+{#snippet StateCell({ item }: { item: ContainerSummaryDto })}
+ <StatusBadge
+ variant={item.state === 'running' ? 'green' : item.state === 'exited' ? 'red' : 'amber'}
+ text={capitalizeFirstLetter(item.state)}
+ />
+{/snippet}
+
+{#snippet CreatedCell({ item }: { item: ContainerSummaryDto })}
+ <span class="text-sm">
+ {item.created ? format(new Date(item.created * 1000), 'PP p') : ''}
+ </span>
+{/snippet}
+
+{#snippet RowActions({ item }: { item: ContainerSummaryDto })}
+ <DropdownMenu.Root>
+ <DropdownMenu.Trigger>
+ {#snippet child({ props })}
+ <Button {...props} variant="ghost" size="icon" class="relative size-8 p-0">
+ <span class="sr-only">Open menu</span>
+ <EllipsisIcon />
+ </Button>
+ {/snippet}
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Content align="end">
+ <DropdownMenu.Group>
+ <DropdownMenu.Item onclick={() => goto(`/containers/${item.id}`)} disabled={isAnyLoading}>
+ <ScanSearchIcon class="size-4" />
+ Inspect
+ </DropdownMenu.Item>
+
+ {#if item.state !== 'running'}
+ <DropdownMenu.Item onclick={() => performContainerAction('start', item.id)} disabled={isLoading.start || isAnyLoading}>
+ {#if isLoading.start}
+ <LoaderCircleIcon class="size-4 animate-spin" />
+ {:else}
+ <PlayIcon class="size-4" />
+ {/if}
+ Start
+ </DropdownMenu.Item>
+ {:else}
+ <DropdownMenu.Item
+ onclick={() => performContainerAction('restart', item.id)}
+ disabled={isLoading.restart || isAnyLoading}
+ >
+ {#if isLoading.restart}
+ <LoaderCircleIcon class="size-4 animate-spin" />
+ {:else}
+ <RotateCcwIcon class="size-4" />
+ {/if}
+ Restart
+ </DropdownMenu.Item>
- {#if item.state !== 'running'}
- <DropdownMenu.Item
- onclick={() => performContainerAction('start', item.id)}
- disabled={isLoading.start || isAnyLoading}
- >
- {#if isLoading.start}
- <Loader2 class="size-4 animate-spin" />
- {:else}
- <Play class="size-4" />
- {/if}
- Start
- </DropdownMenu.Item>
- {:else}
- <DropdownMenu.Item
- onclick={() => performContainerAction('restart', item.id)}
- disabled={isLoading.restart || isAnyLoading}
- >
- {#if isLoading.restart}
- <Loader2 class="size-4 animate-spin" />
- {:else}
- <RotateCcw class="size-4" />
- {/if}
- Restart
- </DropdownMenu.Item>
+ <DropdownMenu.Item onclick={() => performContainerAction('stop', item.id)} disabled={isLoading.stop || isAnyLoading}>
+ {#if isLoading.stop}
+ <LoaderCircleIcon class="size-4 animate-spin" />
+ {:else}
+ <StopCircleIcon class="size-4" />
+ {/if}
+ Stop
+ </DropdownMenu.Item>
+ {/if}
- <DropdownMenu.Item
- onclick={() => performContainerAction('stop', item.id)}
- disabled={isLoading.stop || isAnyLoading}
- >
- {#if isLoading.stop}
- <Loader2 class="size-4 animate-spin" />
- {:else}
- <StopCircle class="size-4" />
- {/if}
- Stop
- </DropdownMenu.Item>
- {/if}
+ <DropdownMenu.Separator />
- <DropdownMenu.Separator />
+ <DropdownMenu.Item
+ variant="destructive"
+ onclick={() => handleRemoveContainer(item.id)}
+ disabled={isLoading.remove || isAnyLoading}
+ >
+ {#if isLoading.remove}
+ <LoaderCircleIcon class="size-4 animate-spin" />
+ {:else}
+ <Trash2Icon class="size-4" />
+ {/if}
+ Remove
+ </DropdownMenu.Item>
+ </DropdownMenu.Group>
+ </DropdownMenu.Content>
+ </DropdownMenu.Root>
+{/snippet}
- <DropdownMenu.Item
- variant="destructive"
- onclick={() => handleRemoveContainer(item.id)}
- disabled={isLoading.remove || isAnyLoading}
- >
- {#if isLoading.remove}
- <Loader2 class="size-4 animate-spin" />
- {:else}
- <Trash2 class="size-4" />
- {/if}
- Remove
- </DropdownMenu.Item>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
- </Table.Cell>
- {/snippet}
- </ArcaneTable>
- </Card.Content>
- </Card.Root>
-{:else}
- <div class="flex flex-col items-center justify-center px-6 py-12 text-center">
- <Box class="text-muted-foreground mb-4 size-12 opacity-40" />
- <p class="text-lg font-medium">No containers found</p>
- <p class="text-muted-foreground mt-1 text-sm">
- Create a new container using the "Create Container" button above
- </p>
- </div>
-{/if}
+<Card.Root class="border shadow-sm">
+ <Card.Content>
+ <ArcaneTable
+ items={containers}
+ bind:requestOptions
+ bind:selectedIds
+ onRefresh={async (options) => (containers = await environmentAPI.getContainers(options))}
+ {columns}
+ rowActions={RowActions}
+ selectionDisabled
+ />
+ </Card.Content>
+</Card.Root>
diff --git a/frontend/src/routes/customize/registries/+page.svelte b/frontend/src/routes/customize/registries/+page.svelte
index 0bb6ff400..914e0fa34 100644
--- a/frontend/src/routes/customize/registries/+page.svelte
+++ b/frontend/src/routes/customize/registries/+page.svelte
@@ -1,27 +1,23 @@
<script lang="ts">
import * as Card from '$lib/components/ui/card/index.js';
- import { Key } from '@lucide/svelte';
+ import KeyIcon from '@lucide/svelte/icons/key';
import { toast } from 'svelte-sonner';
- import type { ContainerRegistry } from '$lib/models/container-registry';
- import type {
- ContainerRegistryCreateDto,
- ContainerRegistryUpdateDto
- } from '$lib/dto/container-registry-dto';
+ import type { ContainerRegistry } from '$lib/types/container-registry.type';
+ import type { ContainerRegistryCreateDto, ContainerRegistryUpdateDto } from '$lib/types/container-registry.type';
import { containerRegistryAPI } from '$lib/services/api';
import ContainerRegistryFormSheet from '$lib/components/sheets/container-registry-sheet.svelte';
import RegistryTable from './registry-table.svelte';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
- import type { SearchPaginationSortRequest, Paginated } from '$lib/types/pagination.type';
- import type { PageData } from './$types';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
+ import { tryCatch } from '$lib/utils/try-catch';
- let { data }: { data: PageData } = $props();
+ let { data } = $props();
- let registries = $state<ContainerRegistry[]>([]);
- let paginatedRegistries = $state<Paginated<ContainerRegistry> | null>(null);
+ let registries = $state(data.registries);
let selectedIds = $state<string[]>([]);
let isRegistryDialogOpen = $state(false);
let registryToEdit = $state<ContainerRegistry | null>(null);
- let requestOptions = $state<SearchPaginationSortRequest>(data.registryRequestOptions);
+ let requestOptions = $state(data.registryRequestOptions);
let isLoading = $state({
create: false,
@@ -29,79 +25,17 @@
refresh: false
});
- $effect(() => {
- if (data.registries) {
- if (Array.isArray(data.registries)) {
- registries = data.registries;
- const paginatedData: Paginated<ContainerRegistry> = {
- data: data.registries,
- pagination: {
- totalPages: 1,
- totalItems: data.registries.length,
- currentPage: 1,
- itemsPerPage: data.registries.length
- }
- };
- paginatedRegistries = paginatedData;
- } else {
- const paginatedData: Paginated<ContainerRegistry> = {
- data: data.registries.data,
- pagination: data.registries.pagination
- };
- paginatedRegistries = paginatedData;
- registries = data.registries.data || [];
- }
- }
- });
-
- async function onRefresh(
- options: SearchPaginationSortRequest
- ): Promise<Paginated<ContainerRegistry>> {
- const response = await containerRegistryAPI.getRegistries(
- options.pagination,
- options.sort,
- options.search,
- options.filters
- );
-
- if (Array.isArray(response)) {
- registries = response;
- const paginatedResponse: Paginated<ContainerRegistry> = {
- data: response,
- pagination: {
- totalPages: 1,
- totalItems: response.length,
- currentPage: options.pagination?.page || 1,
- itemsPerPage: response.length
- }
- };
- paginatedRegistries = paginatedResponse;
- return paginatedResponse;
- } else {
- const paginatedResponse: Paginated<ContainerRegistry> = {
- data: response.data,
- pagination: response.pagination
- };
- paginatedRegistries = paginatedResponse;
- registries = response.data || [];
- return paginatedResponse;
- }
- }
-
async function refreshRegistries() {
isLoading.refresh = true;
- try {
- await onRefresh(requestOptions);
- } catch (error) {
- console.error('Failed to refresh registries:', error);
- toast.error('Failed to refresh registries');
- } finally {
- isLoading.refresh = false;
- }
- }
-
- async function onRegistriesChanged() {
- await refreshRegistries();
+ handleApiResultWithCallbacks({
+ result: await tryCatch(containerRegistryAPI.getRegistries(requestOptions)),
+ message: 'Failed to Refresh Registries',
+ setLoadingState: (value) => (isLoading.refresh = value),
+ onSuccess: async (newRegistries) => {
+ registries = newRegistries;
+ toast.success('Registries Refreshed!');
+ }
+ });
}
function openCreateRegistryDialog() {
@@ -124,17 +58,14 @@
try {
if (isEditMode && registryToEdit?.id) {
- await containerRegistryAPI.updateRegistry(
- registryToEdit.id,
- registry as ContainerRegistryUpdateDto
- );
+ await containerRegistryAPI.updateRegistry(registryToEdit.id, registry as ContainerRegistryUpdateDto);
toast.success('Registry updated successfully');
} else {
await containerRegistryAPI.createRegistry(registry as ContainerRegistryCreateDto);
toast.success('Registry created successfully');
}
- await refreshRegistries();
+ registries = await containerRegistryAPI.getRegistries(requestOptions);
isRegistryDialogOpen = false;
} catch (error) {
console.error('Error saving registry:', error);
@@ -145,15 +76,6 @@
}
</script>
-<svelte:head><title>Arcane</title></svelte:head>
-
-<ContainerRegistryFormSheet
- bind:open={isRegistryDialogOpen}
- bind:registryToEdit
- onSubmit={handleRegistryDialogSubmit}
- isLoading={isLoading.create || isLoading.edit}
-/>
-
<div class="space-y-6">
<div class="flex flex-col justify-between gap-4 sm:flex-row sm:items-center">
<div>
@@ -163,14 +85,14 @@
</p>
</div>
<div class="flex items-center gap-2">
+ <ArcaneButton action="create" onclick={openCreateRegistryDialog} customLabel="Add Registry" />
<ArcaneButton
action="restart"
- onClick={refreshRegistries}
- label="Refresh"
+ onclick={refreshRegistries}
+ customLabel="Refresh"
loading={isLoading.refresh}
disabled={isLoading.refresh}
/>
- <ArcaneButton action="create" onClick={openCreateRegistryDialog} label="Add Registry" />
</div>
</div>
@@ -178,35 +100,19 @@
<Card.Header class="pb-4">
<div class="flex items-center gap-3">
<div class="rounded-full bg-green-500/10 p-2">
- <Key class="size-5 text-green-500" />
+ <KeyIcon class="size-5 text-green-500" />
</div>
<div>
<Card.Title>Docker Registry Credentials</Card.Title>
<Card.Description>
- Manage authentication credentials for private Docker registries like Docker Hub, GitHub
- Container Registry, Google Container Registry, and custom registries
+ Manage authentication credentials for private Docker registries like Docker Hub, GitHub Container Registry, Google
+ Container Registry, and custom registries
</Card.Description>
</div>
</div>
</Card.Header>
<Card.Content>
- <RegistryTable
- registries={paginatedRegistries || {
- data: registries,
- pagination: {
- totalPages: 1,
- totalItems: registries.length,
- currentPage: 1,
- itemsPerPage: registries.length
- }
- }}
- bind:selectedIds
- bind:requestOptions
- {onRefresh}
- {onRegistriesChanged}
- onCreateRegistry={openCreateRegistryDialog}
- onEditRegistry={openEditRegistryDialog}
- />
+ <RegistryTable bind:registries bind:selectedIds bind:requestOptions onEditRegistry={openEditRegistryDialog} />
</Card.Content>
</Card.Root>
@@ -251,3 +157,10 @@
</Card.Content>
</Card.Root>
</div>
+
+<ContainerRegistryFormSheet
+ bind:open={isRegistryDialogOpen}
+ bind:registryToEdit
+ onSubmit={handleRegistryDialogSubmit}
+ isLoading={isLoading.create || isLoading.edit}
+/>
diff --git a/frontend/src/routes/customize/registries/+page.ts b/frontend/src/routes/customize/registries/+page.ts
index 4b01591e1..6d665529f 100644
--- a/frontend/src/routes/customize/registries/+page.ts
+++ b/frontend/src/routes/customize/registries/+page.ts
@@ -3,23 +3,18 @@ import type { SearchPaginationSortRequest } from '$lib/types/pagination.type';
import type { PageLoad } from './$types';
export const load: PageLoad = async () => {
- const registryRequestOptions: SearchPaginationSortRequest = {
- pagination: {
- page: 1,
- limit: 20
- },
- sort: {
- column: 'url',
- direction: 'asc' as const
- }
- };
+ const registryRequestOptions: SearchPaginationSortRequest = {
+ pagination: {
+ page: 1,
+ limit: 20
+ },
+ sort: {
+ column: 'url',
+ direction: 'asc' as const
+ }
+ };
- const registries = await containerRegistryAPI.getRegistries(
- registryRequestOptions.pagination,
- registryRequestOptions.sort,
- registryRequestOptions.search,
- registryRequestOptions.filters
- );
+ const registries = await containerRegistryAPI.getRegistries(registryRequestOptions);
- return { registries, registryRequestOptions };
+ return { registries, registryRequestOptions };
};
diff --git a/frontend/src/routes/customize/registries/registry-table.svelte b/frontend/src/routes/customize/registries/registry-table.svelte
index 417aa2e34..585b77417 100644
--- a/frontend/src/routes/customize/registries/registry-table.svelte
+++ b/frontend/src/routes/customize/registries/registry-table.svelte
@@ -1,278 +1,232 @@
<script lang="ts">
- import type { ContainerRegistry } from '$lib/models/container-registry';
- import ArcaneTable from '$lib/components/arcane-table.svelte';
+ import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import { Button } from '$lib/components/ui/button/index.js';
- import { Trash2, Ellipsis, Pencil, TestTube, Key } from '@lucide/svelte';
- import * as Card from '$lib/components/ui/card/index.js';
- import { toast } from 'svelte-sonner';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import EllipsisIcon from '@lucide/svelte/icons/ellipsis';
+ import PencilIcon from '@lucide/svelte/icons/pencil';
+ import TestTubeIcon from '@lucide/svelte/icons/test-tube';
+ import Trash2Icon from '@lucide/svelte/icons/trash-2';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
- import * as Table from '$lib/components/ui/table';
+ import { toast } from 'svelte-sonner';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
import { containerRegistryAPI } from '$lib/services/api';
- import type { SearchPaginationSortRequest, Paginated } from '$lib/types/pagination.type';
-
- interface RegistryWithId extends ContainerRegistry {
- id: string;
- }
+ import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
+ import type { ContainerRegistry } from '$lib/types/container-registry.type';
+ import type { ColumnSpec } from '$lib/components/arcane-table';
+ import { format } from 'date-fns';
let {
- registries,
+ registries = $bindable(),
selectedIds = $bindable(),
requestOptions = $bindable(),
- onRefresh,
- onRegistriesChanged,
- onCreateRegistry,
onEditRegistry
}: {
registries: Paginated<ContainerRegistry>;
selectedIds: string[];
requestOptions: SearchPaginationSortRequest;
- onRefresh: (options: SearchPaginationSortRequest) => Promise<Paginated<ContainerRegistry>>;
- onRegistriesChanged: () => Promise<void>;
- onCreateRegistry: () => void;
onEditRegistry: (registry: ContainerRegistry) => void;
} = $props();
let isLoading = $state({
- remove: false,
- test: false
+ removing: false,
+ testing: false
});
- const transformedRegistries = $derived.by(() => {
- const transformed: RegistryWithId[] = registries.data.map((registry) => ({
- ...registry,
- id: registry.id
- }));
-
- return {
- data: transformed,
- pagination: registries.pagination
- };
- });
-
- async function handleRefresh(
- options: SearchPaginationSortRequest
- ): Promise<Paginated<RegistryWithId>> {
- const result = await onRefresh(options);
- const transformed: RegistryWithId[] = result.data.map((registry) => ({
- ...registry,
- id: registry.id
- }));
-
- return {
- data: transformed,
- pagination: result.pagination
- };
- }
-
- async function handleDeleteRegistry(id: string, url: string) {
- openConfirmDialog({
- title: 'Remove Registry',
- message: `Are you sure you want to remove the registry "${url}"? This action cannot be undone.`,
- confirm: {
- label: 'Remove',
- destructive: true,
- action: async () => {
- handleApiResultWithCallbacks({
- result: await tryCatch(containerRegistryAPI.deleteRegistry(id)),
- message: `Failed to remove registry "${url}"`,
- setLoadingState: (value) => (isLoading.remove = value),
- onSuccess: async () => {
- toast.success(`Registry "${url}" removed successfully.`);
- await onRegistriesChanged();
- }
- });
- }
- }
- });
+ function getRegistryDisplayName(url: string) {
+ if (!url || url === 'docker.io') return 'Docker Hub';
+ if (url.includes('ghcr.io')) return 'GitHub Container Registry';
+ if (url.includes('gcr.io')) return 'Google Container Registry';
+ if (url.includes('quay.io')) return 'Quay.io Registry';
+ return url;
}
- async function handleDeleteSelectedRegistries() {
- const selectedRegistryList = registries.data.filter((registry) =>
- selectedIds.includes(registry.id)
- );
+ async function handleDeleteSelected(ids: string[]) {
+ if (!ids?.length) return;
openConfirmDialog({
- title: 'Remove Selected Registries',
- message: `Are you sure you want to remove ${selectedIds.length} selected registr${selectedIds.length === 1 ? 'y' : 'ies'}? This action cannot be undone.`,
+ title: `Remove ${ids.length} Registr${ids.length === 1 ? 'y' : 'ies'}`,
+ message: `Are you sure you want to remove the selected registr${ids.length === 1 ? 'y' : 'ies'}? This action cannot be undone.`,
confirm: {
label: 'Remove',
destructive: true,
action: async () => {
- isLoading.remove = true;
+ isLoading.removing = true;
let successCount = 0;
let failureCount = 0;
-
- for (const registryId of selectedIds) {
- const registry = registries.data.find((r) => r.id === registryId);
- if (!registry) continue;
-
- const result = await tryCatch(containerRegistryAPI.deleteRegistry(registryId));
+ for (const id of ids) {
+ const reg = registries.data.find((r) => r.id === id);
+ const result = await tryCatch(containerRegistryAPI.deleteRegistry(id));
if (result.error) {
failureCount++;
- toast.error(`Failed to delete registry "${registry.url}": ${result.error.message}`);
+ toast.error(`Failed to delete registry "${reg?.url ?? id}"`);
} else {
successCount++;
- toast.success(`Registry "${registry.url}" deleted successfully.`);
}
}
- isLoading.remove = false;
if (successCount > 0) {
- setTimeout(async () => {
- await onRegistriesChanged();
- }, 500);
+ toast.success(`Removed ${successCount} registr${successCount === 1 ? 'y' : 'ies'}`);
+ registries = await containerRegistryAPI.getRegistries(requestOptions);
}
+ if (failureCount > 0) toast.error(`Failed to remove ${failureCount}`);
+
selectedIds = [];
+ isLoading.removing = false;
}
}
});
}
- async function handleTestRegistry(id: string, url: string) {
- isLoading.test = true;
- try {
- const result = await containerRegistryAPI.testRegistry(id);
- toast.success(`Registry test passed: ${result.message || 'Connection successful'}`);
- } catch (error) {
- console.error('Error testing registry:', error);
- toast.error(error instanceof Error ? error.message : 'Failed to test registry');
- } finally {
- isLoading.test = false;
- }
- }
+ async function handleDeleteOne(id: string, url: string) {
+ openConfirmDialog({
+ title: 'Remove Registry',
+ message: `Are you sure you want to remove the registry "${url}"? This action cannot be undone.`,
+ confirm: {
+ label: 'Remove',
+ destructive: true,
+ action: async () => {
+ isLoading.removing = true;
+
+ const result = await tryCatch(containerRegistryAPI.deleteRegistry(id));
+ handleApiResultWithCallbacks({
+ result,
+ message: `Failed to remove registry "${url}"`,
+ setLoadingState: () => {},
+ onSuccess: async () => {
+ toast.success(`Registry "${url}" removed successfully.`);
+ registries = await containerRegistryAPI.getRegistries(requestOptions);
+ }
+ });
- const isAnyLoading = $derived(Object.values(isLoading).some((loading) => loading));
- const hasRegistries = $derived(registries?.data?.length > 0);
+ isLoading.removing = false;
+ }
+ }
+ });
+ }
- function getRegistryDisplayName(url: string) {
- if (!url || url === 'docker.io') return 'Docker Hub';
- if (url.includes('ghcr.io')) return 'GitHub Container Registry';
- if (url.includes('gcr.io')) return 'Google Container Registry';
- if (url.includes('quay.io')) return 'Quay.io Registry';
- return url;
+ async function handleTest(id: string, url: string) {
+ isLoading.testing = true;
+ const result = await tryCatch(containerRegistryAPI.testRegistry(id));
+ handleApiResultWithCallbacks({
+ result,
+ message: `Failed to test registry "${url}"`,
+ setLoadingState: () => {},
+ onSuccess: (resp) => {
+ const msg = (resp as any)?.message || 'Connection successful';
+ toast.success(`Registry test passed: ${msg}`);
+ }
+ });
+ isLoading.testing = false;
}
+
+ const columns = [
+ { accessorKey: 'id', title: 'ID', hidden: true },
+ {
+ accessorKey: 'url',
+ title: 'Registry URL',
+ sortable: true,
+ cell: UrlCell
+ },
+ {
+ accessorKey: 'username',
+ title: 'Username',
+ sortable: true,
+ cell: UsernameCell
+ },
+ {
+ accessorKey: 'description',
+ title: 'Description',
+ sortable: true,
+ cell: DescriptionCell
+ },
+ {
+ accessorKey: 'enabled',
+ title: 'Status',
+ sortable: true,
+ cell: StatusCell
+ },
+ {
+ accessorKey: 'createdAt',
+ title: 'Created',
+ sortable: true,
+ cell: CreatedCell
+ }
+ ] satisfies ColumnSpec<ContainerRegistry>[];
</script>
-{#if hasRegistries}
- <Card.Root class="border shadow-sm">
- <Card.Header class="px-6">
- <div class="flex items-center justify-between">
- <div>
- <Card.Title>Registry Credentials</Card.Title>
- </div>
- <div class="flex items-center gap-2">
- {#if selectedIds.length > 0}
- <ArcaneButton
- action="remove"
- onClick={handleDeleteSelectedRegistries}
- loading={isLoading.remove}
- disabled={isLoading.remove}
- />
- {/if}
- <ArcaneButton action="create" label="Add Registry" onClick={onCreateRegistry} />
- </div>
- </div>
- </Card.Header>
- <Card.Content>
- <ArcaneTable
- items={transformedRegistries}
- bind:requestOptions
- bind:selectedIds
- onRefresh={handleRefresh}
- columns={[
- { label: 'Registry URL', sortColumn: 'url' },
- { label: 'Username', sortColumn: 'username' },
- { label: 'Description', sortColumn: 'description' },
- { label: 'Status', sortColumn: 'enabled' },
- { label: 'Created', sortColumn: 'createdAt' },
- { label: ' ' }
- ]}
- filterPlaceholder="Search registries..."
- noResultsMessage="No registry credentials found"
- >
- {#snippet rows({ item })}
- <Table.Cell class="font-medium">
- <div class="flex flex-col">
- <span class="font-medium">
- {item.url || 'docker.io'}
- </span>
- <span class="text-muted-foreground text-xs">
- {getRegistryDisplayName(item.url)}
- </span>
- </div>
- </Table.Cell>
- <Table.Cell>
- <span class="font-mono text-sm">{item.username || '-'}</span>
- </Table.Cell>
- <Table.Cell>
- <span class="text-muted-foreground text-sm">
- {item.description || 'No description provided'}
- </span>
- </Table.Cell>
- <Table.Cell>
- <span
- class="inline-flex items-center rounded-full px-2 py-1 text-xs font-medium {item.enabled
- ? 'bg-green-100 text-green-800'
- : 'bg-gray-100 text-gray-800'}"
- >
- {item.enabled ? 'Enabled' : 'Disabled'}
- </span>
- </Table.Cell>
- <Table.Cell>
- <span class="text-sm">
- {item.createdAt ? new Date(item.createdAt).toLocaleDateString() : 'N/A'}
- </span>
- </Table.Cell>
- <Table.Cell>
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <Button {...props} variant="ghost" size="icon" class="relative size-8 p-0">
- <span class="sr-only">Open menu</span>
- <Ellipsis />
- </Button>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item
- onclick={() => handleTestRegistry(item.id, item.url)}
- disabled={isAnyLoading}
- >
- <TestTube class="size-4" />
- Test Connection
- </DropdownMenu.Item>
- <DropdownMenu.Item onclick={() => onEditRegistry(item)} disabled={isAnyLoading}>
- <Pencil class="size-4" />
- Edit
- </DropdownMenu.Item>
- <DropdownMenu.Item
- class="focus:text-red-700! text-red-500"
- onclick={() => handleDeleteRegistry(item.id, item.url)}
- disabled={isAnyLoading}
- >
- <Trash2 class="size-4" />
- Remove
- </DropdownMenu.Item>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
- </Table.Cell>
- {/snippet}
- </ArcaneTable>
- </Card.Content>
- </Card.Root>
-{:else}
- <div class="flex flex-col items-center justify-center px-6 py-12 text-center">
- <Key class="text-muted-foreground mb-4 size-12 opacity-40" />
- <p class="text-lg font-medium">No registry credentials found</p>
- <p class="text-muted-foreground mt-1 text-sm">
- Add registry credentials to authenticate with private Docker registries when pulling images.
- </p>
+{#snippet UrlCell({ item }: { item: ContainerRegistry })}
+ <div class="flex flex-col">
+ <span class="font-medium">{item.url || 'docker.io'}</span>
+ <span class="text-muted-foreground text-xs">{getRegistryDisplayName(item.url)}</span>
</div>
-{/if}
+{/snippet}
+
+{#snippet UsernameCell({ value }: { value: unknown })}
+ <span class="font-mono text-sm">{(value as string) || '-'}</span>
+{/snippet}
+
+{#snippet DescriptionCell({ value }: { value: unknown })}
+ <span class="text-muted-foreground text-sm">{(value as string) || 'No description provided'}</span>
+{/snippet}
+
+{#snippet StatusCell({ value }: { value: unknown })}
+ {@const enabled = Boolean(value)}
+ <span
+ class="inline-flex items-center rounded-full px-2 py-1 text-xs font-medium {enabled
+ ? 'bg-green-100 text-green-800'
+ : 'bg-gray-100 text-gray-800'}"
+ >
+ {enabled ? 'Enabled' : 'Disabled'}
+ </span>
+{/snippet}
+
+{#snippet CreatedCell({ value }: { value: unknown })}
+ <span class="text-sm">{value ? format(new Date(String(value)), 'PP p') : 'N/A'}</span>
+{/snippet}
+
+{#snippet RowActions({ item }: { item: ContainerRegistry })}
+ <DropdownMenu.Root>
+ <DropdownMenu.Trigger>
+ {#snippet child({ props })}
+ <Button {...props} variant="ghost" size="icon" class="relative size-8 p-0">
+ <span class="sr-only">Open menu</span>
+ <EllipsisIcon />
+ </Button>
+ {/snippet}
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Content align="end">
+ <DropdownMenu.Group>
+ <DropdownMenu.Item onclick={() => handleTest(item.id, item.url)} disabled={isLoading.testing}>
+ <TestTubeIcon class="size-4" />
+ Test Connection
+ </DropdownMenu.Item>
+ <DropdownMenu.Item onclick={() => onEditRegistry(item)}>
+ <PencilIcon class="size-4" />
+ Edit
+ </DropdownMenu.Item>
+ <DropdownMenu.Item
+ class="focus:text-red-700! text-red-500"
+ onclick={() => handleDeleteOne(item.id, item.url)}
+ disabled={isLoading.removing}
+ >
+ <Trash2Icon class="size-4" />
+ Remove
+ </DropdownMenu.Item>
+ </DropdownMenu.Group>
+ </DropdownMenu.Content>
+ </DropdownMenu.Root>
+{/snippet}
+
+<div>
+ <ArcaneTable
+ items={registries}
+ bind:requestOptions
+ bind:selectedIds
+ onRemoveSelected={(ids) => handleDeleteSelected(ids)}
+ onRefresh={async (options) => (registries = await containerRegistryAPI.getRegistries(options))}
+ {columns}
+ rowActions={RowActions}
+ />
+</div>
diff --git a/frontend/src/routes/customize/templates/+page.svelte b/frontend/src/routes/customize/templates/+page.svelte
index 4ebd900a3..3f891524d 100644
--- a/frontend/src/routes/customize/templates/+page.svelte
+++ b/frontend/src/routes/customize/templates/+page.svelte
@@ -6,7 +6,14 @@
import { Separator } from '$lib/components/ui/separator/index.js';
import { Switch } from '$lib/components/ui/switch/index.js';
import { Snippet } from '$lib/components/ui/snippet';
- import { Trash2, Plus, ExternalLink, RefreshCw, FileText, Globe, FolderOpen, Users } from '@lucide/svelte';
+ import Trash2Icon from '@lucide/svelte/icons/trash-2';
+ import PlusIcon from '@lucide/svelte/icons/plus';
+ import ExternalLinkIcon from '@lucide/svelte/icons/external-link';
+ import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
+ import FileTextIcon from '@lucide/svelte/icons/file-text';
+ import GlobeIcon from '@lucide/svelte/icons/globe';
+ import FolderOpenIcon from '@lucide/svelte/icons/folder-open';
+ import UsersIcon from '@lucide/svelte/icons/users';
import { templateAPI } from '$lib/services/api';
import { toast } from 'svelte-sonner';
import AddTemplateRegistrySheet from '$lib/components/sheets/add-template-registry-sheet.svelte';
@@ -118,7 +125,7 @@
</div>
<Button onclick={refreshTemplates} class="h-10" variant="outline">
- <RefreshCw class="mr-2 size-4" />
+ <RefreshCwIcon class="mr-2 size-4" />
Refresh Templates
</Button>
</div>
@@ -127,21 +134,21 @@
<StatCard
title="Local Templates"
value={localTemplateCount}
- icon={FolderOpen}
+ icon={FolderOpenIcon}
iconColor="text-blue-500"
class="border-l-4 border-l-blue-500"
/>
<StatCard
title="Remote Templates"
value={remoteTemplateCount}
- icon={Globe}
+ icon={GlobeIcon}
iconColor="text-green-500"
class="border-l-4 border-l-green-500"
/>
<StatCard
title="Registries"
value={registries.length}
- icon={FileText}
+ icon={FileTextIcon}
iconColor="text-purple-500"
class="border-l-4 border-l-purple-500"
/>
@@ -153,13 +160,13 @@
<div class="flex items-center justify-between">
<h2 class="text-xl font-semibold">Template Registries</h2>
<Button onclick={() => (showAddRegistrySheet = true)}>
- <Plus class="mr-2 size-4" />
+ <PlusIcon class="mr-2 size-4" />
Add Registry
</Button>
</div>
{#if registries.length == 0}
<Alert.Root>
- <Globe class="size-4" />
+ <GlobeIcon class="size-4" />
<Alert.Title>Remote Registries</Alert.Title>
<Alert.Description
>Add remote template registries to access community templates. Registries should provide a JSON manifest with template
@@ -168,7 +175,7 @@
</Alert.Root>
<Alert.Root class="border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-950">
- <Users class="size-4" />
+ <UsersIcon class="size-4" />
<Alert.Title>Community Registry</Alert.Title>
<Alert.Description class="space-y-2">
<p>Get started quickly with our community registry containing popular templates:</p>
@@ -203,7 +210,7 @@
/>
<Button variant="outline" size="sm" onclick={() => window.open(registry.url, '_blank')}>
- <ExternalLink class="size-4" />
+ <ExternalLinkIcon class="size-4" />
</Button>
<Button
@@ -213,9 +220,9 @@
disabled={isLoading.removing.has(registry.id)}
>
{#if isLoading.removing.has(registry.id)}
- <RefreshCw class="size-4 animate-spin" />
+ <RefreshCwIcon class="size-4 animate-spin" />
{:else}
- <Trash2 class="size-4" />
+ <Trash2Icon class="size-4" />
{/if}
</Button>
</div>
@@ -225,7 +232,7 @@
</div>
{:else}
<div class="text-muted-foreground py-6 text-center">
- <Globe class="mx-auto mb-4 size-12 opacity-50" />
+ <GlobeIcon class="mx-auto mb-4 size-12 opacity-50" />
<p class="mb-2">No registries configured</p>
<p class="text-sm">Add a remote template registry to access community templates</p>
</div>
diff --git a/frontend/src/routes/dashboard/+page.svelte b/frontend/src/routes/dashboard/+page.svelte
index 9ed32dca0..eba60ae82 100644
--- a/frontend/src/routes/dashboard/+page.svelte
+++ b/frontend/src/routes/dashboard/+page.svelte
@@ -1,19 +1,17 @@
<script lang="ts">
import * as Card from '$lib/components/ui/card/index.js';
- import { Button } from '$lib/components/ui/button/index.js';
- import {
- Box,
- HardDrive,
- RefreshCw,
- Loader2,
- Monitor,
- PlayCircle,
- StopCircle,
- Trash2,
- MemoryStick,
- Cpu,
- Container
- } from '@lucide/svelte';
+ import BoxIcon from '@lucide/svelte/icons/box';
+ import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
+ import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
+ import MonitorIcon from '@lucide/svelte/icons/monitor';
+ import MemoryStickIcon from '@lucide/svelte/icons/memory-stick';
+ import CpuIcon from '@lucide/svelte/icons/cpu';
+ import ContainerIcon from '@lucide/svelte/icons/container';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import CirclePlayIcon from '@lucide/svelte/icons/circle-play';
+ import CircleStopIcon from '@lucide/svelte/icons/circle-stop';
+ import Trash2Icon from '@lucide/svelte/icons/trash-2';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import { capitalizeFirstLetter } from '$lib/utils/string.utils';
import { toast } from 'svelte-sonner';
import PruneConfirmationDialog from '$lib/components/dialogs/prune-confirmation-dialog.svelte';
@@ -22,11 +20,10 @@
import { systemAPI, settingsAPI } from '$lib/services/api';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import { onMount } from 'svelte';
- import type { PruneType } from '$lib/types/actions.type';
import DropdownCard from '$lib/components/dropdown-card.svelte';
import MeterMetric from '$lib/components/meter-metric.svelte';
import DockerIcon from '$lib/icons/docker-icon.svelte';
- import type { SystemStats } from '$lib/models/system-stats';
+ import type { SystemStats } from '$lib/types/system-stats.type';
import DashboardContainerTable from './dash-container-table.svelte';
import DashboardImageTable from './dash-image-table.svelte';
@@ -42,6 +39,8 @@
isPruneDialogOpen: false
});
+ type PruneType = 'containers' | 'images' | 'networks' | 'volumes';
+
let isLoading = $state({
starting: false,
stopping: false,
@@ -197,8 +196,7 @@
}
async function handleStopAll() {
- if (isLoading.stopping || !dashboardStates.dockerInfo || dockerInfo?.containersRunning === 0)
- return;
+ if (isLoading.stopping || !dashboardStates.dockerInfo || dockerInfo?.containersRunning === 0) return;
openConfirmDialog({
title: 'Stop All Containers',
message: 'Are you sure you want to stop all running containers?',
@@ -239,9 +237,7 @@
onSuccess: async () => {
dashboardStates.isPruneDialogOpen = false;
const formattedTypes = selectedTypes.map((type) => capitalizeFirstLetter(type)).join(', ');
- toast.success(
- `${formattedTypes} ${selectedTypes.length > 1 ? 'were' : 'was'} pruned successfully.`
- );
+ toast.success(`${formattedTypes} ${selectedTypes.length > 1 ? 'were' : 'was'} pruned successfully.`);
await refreshData();
}
});
@@ -254,23 +250,18 @@
<h1 class="text-3xl font-bold tracking-tight">Dashboard</h1>
<p class="text-muted-foreground max-w-2xl text-sm">Overview of your Container Environment</p>
</div>
- <Button
- variant="outline"
- size="sm"
- class="arcane-button-restart h-9"
+ <ArcaneButton
+ action="restart"
onclick={refreshData}
- disabled={isLoading.refreshing ||
- isLoading.starting ||
- isLoading.stopping ||
- isLoading.pruning}
+ disabled={isLoading.refreshing || isLoading.starting || isLoading.stopping || isLoading.pruning}
>
{#if isLoading.refreshing}
- <Loader2 class="mr-2 size-4 animate-spin" />
+ <LoaderCircleIcon class="mr-2 size-4 animate-spin" />
{:else}
- <RefreshCw class="mr-2 size-4" />
+ <RefreshCwIcon class="mr-2 size-4" />
{/if}
Refresh
- </Button>
+ </ArcaneButton>
</div>
<section>
@@ -290,7 +281,7 @@
{:else}
<div class="grid grid-cols-1 gap-3 sm:grid-cols-3">
<button
- class="group bg-card flex items-center rounded-lg border p-3 shadow-sm ring-offset-background transition-all hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-60"
+ class="bg-card ring-offset-background focus-visible:ring-ring group flex items-center rounded-lg border p-3 shadow-sm transition-all hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-60"
disabled={!dashboardStates.dockerInfo ||
stoppedContainers === 0 ||
isLoading.starting ||
@@ -302,9 +293,9 @@
class="mr-3 flex size-6 items-center justify-center rounded-full bg-green-500/10 transition-colors group-hover:bg-green-500/20"
>
{#if isLoading.starting}
- <Loader2 class="size-3 animate-spin text-green-500" />
+ <LoaderCircleIcon class="size-3 animate-spin text-green-500" />
{:else}
- <PlayCircle class="size-3 text-green-500" />
+ <CirclePlayIcon class="size-3 text-green-500" />
{/if}
</div>
<div class="flex-1 text-left">
@@ -314,7 +305,7 @@
</button>
<button
- class="group bg-card flex items-center rounded-lg border p-3 shadow-sm ring-offset-background transition-all hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-60"
+ class="bg-card ring-offset-background focus-visible:ring-ring group flex items-center rounded-lg border p-3 shadow-sm transition-all hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-60"
disabled={!dashboardStates.dockerInfo ||
dockerInfo?.containersRunning === 0 ||
isLoading.starting ||
@@ -326,34 +317,29 @@
class="mr-3 flex size-6 items-center justify-center rounded-full bg-blue-500/10 transition-colors group-hover:bg-blue-500/20"
>
{#if isLoading.stopping}
- <Loader2 class="size-3 animate-spin text-blue-500" />
+ <LoaderCircleIcon class="size-3 animate-spin text-blue-500" />
{:else}
- <StopCircle class="size-3 text-blue-500" />
+ <CircleStopIcon class="size-3 text-blue-500" />
{/if}
</div>
<div class="flex-1 text-left">
<div class="text-sm font-medium">Stop All Running</div>
- <div class="text-muted-foreground text-xs">
- {containers.pagination.totalItems} containers
- </div>
+ <div class="text-muted-foreground text-xs">{containers.pagination.totalItems} containers</div>
</div>
</button>
<button
- class="group bg-card hover:border-destructive/50 disabled:hover:border-border flex items-center rounded-lg border p-3 shadow-sm ring-offset-background transition-all hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-60"
- disabled={!dashboardStates.dockerInfo ||
- isLoading.starting ||
- isLoading.stopping ||
- isLoading.pruning}
+ class="bg-card hover:border-destructive/50 disabled:hover:border-border ring-offset-background focus-visible:ring-ring group flex items-center rounded-lg border p-3 shadow-sm transition-all hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-60"
+ disabled={!dashboardStates.dockerInfo || isLoading.starting || isLoading.stopping || isLoading.pruning}
onclick={() => (dashboardStates.isPruneDialogOpen = true)}
>
<div
class="mr-3 flex size-6 items-center justify-center rounded-full bg-red-500/10 transition-colors group-hover:bg-red-500/20"
>
{#if isLoading.pruning}
- <Loader2 class="size-3 animate-spin text-red-500" />
+ <LoaderCircleIcon class="size-3 animate-spin text-red-500" />
{:else}
- <Trash2 class="size-3 text-red-500" />
+ <Trash2Icon class="size-3 text-red-500" />
{/if}
</div>
<div class="flex-1 text-left">
@@ -370,13 +356,13 @@
id="system-overview"
title="System Overview"
description="Hardware and Docker engine information"
- icon={Monitor}
+ icon={MonitorIcon}
defaultExpanded={true}
>
<div class="grid grid-cols-2 gap-4 md:grid-cols-4">
<MeterMetric
title="Running Containers"
- icon={Container}
+ icon={ContainerIcon}
description="Active containers"
currentValue={isLoading.loadingStats ? undefined : dockerInfo?.containersRunning}
formatValue={(v) => v.toString()}
@@ -388,11 +374,9 @@
<MeterMetric
title="CPU Usage"
- icon={Cpu}
+ icon={CpuIcon}
description="Processor utilization"
- currentValue={isLoading.loadingStats || !hasInitialStatsLoaded
- ? undefined
- : currentStats?.cpuUsage}
+ currentValue={isLoading.loadingStats || !hasInitialStatsLoaded ? undefined : currentStats?.cpuUsage}
unit="%"
maxValue={100}
loading={isLoading.loadingStats || !hasInitialStatsLoaded}
@@ -400,7 +384,7 @@
<MeterMetric
title="Memory Usage"
- icon={MemoryStick}
+ icon={MemoryStickIcon}
description="RAM utilization"
currentValue={isLoading.loadingStats || !hasInitialStatsLoaded
? undefined
@@ -414,7 +398,7 @@
/>
<MeterMetric
- icon={HardDrive}
+ icon={HardDriveIcon}
title="Disk Usage"
description="Storage utilization"
currentValue={isLoading.loadingStats || !hasInitialStatsLoaded
@@ -430,25 +414,25 @@
</div>
<div class="mt-6 grid grid-cols-1 gap-4 md:grid-cols-3">
- <Card.Root class="rounded-lg border shadow-sm">
+ <Card.Root>
<Card.Content class="p-4">
<div class="flex items-center gap-3">
<div class="rounded-lg bg-blue-500/10 p-2">
{#if isLoading.loadingDockerInfo}
- <Loader2 class="size-5 text-blue-500 animate-spin" />
+ <LoaderCircleIcon class="size-5 animate-spin text-blue-500" />
{:else}
<DockerIcon class="size-5 text-blue-500" />
{/if}
</div>
- <div class="flex-1 min-w-0">
+ <div class="min-w-0 flex-1">
{#if isLoading.loadingDockerInfo}
<div class="space-y-2">
- <div class="h-4 w-24 bg-muted animate-pulse rounded"></div>
- <div class="h-3 w-32 bg-muted animate-pulse rounded"></div>
+ <div class="bg-muted h-4 w-24 animate-pulse rounded"></div>
+ <div class="bg-muted h-3 w-32 animate-pulse rounded"></div>
</div>
{:else}
<p class="text-sm font-medium">Docker Engine</p>
- <p class="text-xs text-muted-foreground">
+ <p class="text-muted-foreground text-xs">
{dashboardStates.dockerInfo?.version || 'Unknown'} •
{dashboardStates.dockerInfo?.os || 'Unknown'}
</p>
@@ -463,20 +447,20 @@
<div class="flex items-center gap-3">
<div class="rounded-lg bg-green-500/10 p-2">
{#if isLoading.loadingStats}
- <Loader2 class="size-5 text-green-500 animate-spin" />
+ <LoaderCircleIcon class="size-5 animate-spin text-green-500" />
{:else}
- <Box class="size-5 text-green-500" />
+ <BoxIcon class="size-5 text-green-500" />
{/if}
</div>
- <div class="flex-1 min-w-0">
+ <div class="min-w-0 flex-1">
{#if isLoading.loadingStats}
<div class="space-y-2">
- <div class="h-4 w-28 bg-muted animate-pulse rounded"></div>
- <div class="h-3 w-20 bg-muted animate-pulse rounded"></div>
+ <div class="bg-muted h-4 w-24 animate-pulse rounded"></div>
+ <div class="bg-muted h-3 w-32 animate-pulse rounded"></div>
</div>
{:else}
<p class="text-sm font-medium">Total Containers</p>
- <p class="text-xs text-muted-foreground">
+ <p class="text-muted-foreground text-xs">
{totalContainers} total • {stoppedContainers} stopped
</p>
{/if}
@@ -490,20 +474,20 @@
<div class="flex items-center gap-3">
<div class="rounded-lg bg-purple-500/10 p-2">
{#if isLoading.loadingImages}
- <Loader2 class="size-5 text-purple-500 animate-spin" />
+ <LoaderCircleIcon class="size-5 animate-spin text-purple-500" />
{:else}
- <HardDrive class="size-5 text-purple-500" />
+ <HardDriveIcon class="size-5 text-purple-500" />
{/if}
</div>
- <div class="flex-1 min-w-0">
+ <div class="min-w-0 flex-1">
{#if isLoading.loadingImages}
<div class="space-y-2">
- <div class="h-4 w-24 bg-muted animate-pulse rounded"></div>
- <div class="h-3 w-28 bg-muted animate-pulse rounded"></div>
+ <div class="bg-muted h-4 w-24 animate-pulse rounded"></div>
+ <div class="bg-muted h-3 w-28 animate-pulse rounded"></div>
</div>
{:else}
<p class="text-sm font-medium">Docker Images</p>
- <p class="text-xs text-muted-foreground">
+ <p class="text-muted-foreground text-xs">
{images.pagination.totalItems} images
</p>
{/if}
diff --git a/frontend/src/routes/dashboard/dash-container-table.svelte b/frontend/src/routes/dashboard/dash-container-table.svelte
index 5a3b52ad9..d1646466f 100644
--- a/frontend/src/routes/dashboard/dash-container-table.svelte
+++ b/frontend/src/routes/dashboard/dash-container-table.svelte
@@ -1,15 +1,15 @@
<script lang="ts">
- import ArcaneTable from '$lib/components/arcane-table.svelte';
+ import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import { Button } from '$lib/components/ui/button/index.js';
- import { ArrowRight, Box, Loader2 } from '@lucide/svelte';
+ import ArrowRightIcon from '@lucide/svelte/icons/arrow-right';
import * as Card from '$lib/components/ui/card/index.js';
- import * as Table from '$lib/components/ui/table';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
- import { statusVariantMap } from '$lib/types/statuses';
- import { capitalizeFirstLetter, truncateString } from '$lib/utils/string.utils';
+ import { getStatusVariant } from '$lib/utils/status.utils';
+ import { capitalizeFirstLetter } from '$lib/utils/string.utils';
import type { SearchPaginationSortRequest, Paginated } from '$lib/types/pagination.type';
import type { ContainerSummaryDto } from '$lib/types/container.type';
import { environmentAPI } from '$lib/services/api';
+ import type { ColumnSpec } from '$lib/components/arcane-table';
let {
containers = $bindable(),
@@ -25,8 +25,30 @@
pagination: { page: 1, limit: 5 },
sort: { column: 'created', direction: 'desc' }
});
+
+ const columns = [
+ { accessorKey: 'names', title: 'Name', cell: NameCell },
+ { accessorKey: 'image', title: 'Image' },
+ { accessorKey: 'state', title: 'State', cell: StateCell },
+ { accessorKey: 'status', title: 'Status' }
+ ] satisfies ColumnSpec<ContainerSummaryDto>[];
</script>
+{#snippet NameCell({ item }: { item: ContainerSummaryDto })}
+ <a class="font-medium hover:underline" href="/containers/{item.id}/">
+ {#if item.names && item.names.length > 0}
+ {item.names[0].startsWith('/') ? item.names[0].substring(1) : item.names[0]}
+ {:else}
+ {item.id.substring(0, 12)}
+ {/if}
+ </a>
+{/snippet}
+
+{#snippet StateCell({ item }: { item: ContainerSummaryDto })}
+ {@const stateVariant = getStatusVariant(item.state)}
+ <StatusBadge variant={stateVariant} text={capitalizeFirstLetter(item.state)} />
+{/snippet}
+
<Card.Root class="relative flex flex-col rounded-lg border shadow-sm">
<Card.Header class="px-6 pb-3 pt-5">
<div class="flex items-center justify-between">
@@ -38,64 +60,27 @@
</div>
<Button variant="ghost" size="sm" href="/containers" disabled={isLoading}>
View All
- <ArrowRight class="ml-2 size-4" />
+ <ArrowRightIcon class="ml-2 size-4" />
</Button>
</div>
</Card.Header>
<Card.Content class="flex-1 p-0">
- {#if containers.data.length > 0}
- <div class="flex h-full flex-col">
- <ArcaneTable
- items={containers}
- bind:requestOptions
- bind:selectedIds
- onRefresh={async (options) => (containers = await environmentAPI.getContainers(options))}
- withoutSearch={true}
- withoutPagination={true}
- selectionDisabled={true}
- columns={[
- { label: 'Name', sortColumn: 'name' },
- { label: 'Image', sortColumn: 'image' },
- { label: 'State', sortColumn: 'state' },
- { label: 'Status', sortColumn: 'status' }
- ]}
- filterPlaceholder="Search containers..."
- noResultsMessage="No containers found"
- >
- {#snippet rows({ item })}
- <Table.Cell class="py-3 md:py-3.5">
- <a class="font-medium hover:underline" href="/containers/{item.id}/">
- {#if item.names && item.names.length > 0}
- {item.names[0].startsWith('/') ? item.names[0].substring(1) : item.names[0]}
- {:else}
- {item.id.substring(0, 12)}
- {/if}
- </a>
- </Table.Cell>
- <Table.Cell>
- <span class="text-sm">{item.image}</span>
- </Table.Cell>
- <Table.Cell class="py-3 md:py-3.5">
- {@const stateVariant = statusVariantMap[item.state.toLowerCase()] || 'gray'}
- <StatusBadge variant={stateVariant} text={capitalizeFirstLetter(item.state)} />
- </Table.Cell>
- <Table.Cell class="py-3 md:py-3.5">{item.status}</Table.Cell>
- {/snippet}
- </ArcaneTable>
- {#if containers.data.length > 5}
- <div class="bg-muted/40 text-muted-foreground border-t px-6 py-2 text-xs">
- Showing 5 of {containers.pagination.totalItems} containers
- </div>
- {/if}
- </div>
- {:else}
- <div class="flex flex-col items-center justify-center px-6 py-10 text-center">
- <Box class="text-muted-foreground mb-2 size-8 opacity-40" />
- <p class="text-muted-foreground text-sm">No containers found</p>
- <p class="text-muted-foreground mt-1 text-xs">
- Use Docker CLI or another tool to create containers
- </p>
- </div>
- {/if}
+ <div class="flex h-full flex-col">
+ <ArcaneTable
+ items={containers}
+ bind:requestOptions
+ bind:selectedIds
+ onRefresh={async (options) => (containers = await environmentAPI.getContainers(options))}
+ withoutSearch={true}
+ withoutPagination={true}
+ selectionDisabled={true}
+ {columns}
+ />
+ {#if containers.data.length > 5}
+ <div class="bg-muted/40 text-muted-foreground border-t px-6 py-2 text-xs">
+ Showing 5 of {containers.pagination.totalItems} containers
+ </div>
+ {/if}
+ </div>
</Card.Content>
</Card.Root>
diff --git a/frontend/src/routes/dashboard/dash-image-table.svelte b/frontend/src/routes/dashboard/dash-image-table.svelte
index d9d974d5f..e33363008 100644
--- a/frontend/src/routes/dashboard/dash-image-table.svelte
+++ b/frontend/src/routes/dashboard/dash-image-table.svelte
@@ -1,14 +1,14 @@
<script lang="ts">
- import ArcaneTable from '$lib/components/arcane-table.svelte';
+ import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import { Button } from '$lib/components/ui/button/index.js';
- import { ArrowRight, HardDrive, Loader2 } from '@lucide/svelte';
+ import ArrowRightIcon from '@lucide/svelte/icons/arrow-right';
import * as Card from '$lib/components/ui/card/index.js';
- import * as Table from '$lib/components/ui/table';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import type { SearchPaginationSortRequest, Paginated } from '$lib/types/pagination.type';
import type { ImageSummaryDto } from '$lib/types/image.type';
import { environmentAPI } from '$lib/services/api';
- import { formatBytes } from '$lib/utils/bytes.util';
+ import bytes from 'bytes';
+ import type { ColumnSpec } from '$lib/components/arcane-table';
let {
images = $bindable(),
@@ -25,9 +25,48 @@
let selectedIds = $state<string[]>([]);
- // Size display removed on dashboard; keep sorting by size to show largest but do not render sizes
+ const columns = [
+ { accessorKey: 'repoTags', title: 'Name', cell: NameCell },
+ { accessorKey: 'inUse', title: 'Status', cell: StatusCell },
+ { id: 'tag', title: 'Tag', cell: TagCell },
+ { accessorKey: 'size', title: 'Size', cell: SizeCell }
+ ] satisfies ColumnSpec<ImageSummaryDto>[];
</script>
+{#snippet NameCell({ item }: { item: ImageSummaryDto })}
+ <div class="flex items-center gap-2">
+ <div class="flex flex-1 items-center">
+ <a class="shrink truncate font-medium hover:underline" href="/images/{item.id}/">
+ {#if item.repoTags && item.repoTags.length > 0 && item.repoTags[0] !== '<none>:<none>'}
+ {item.repoTags[0].split(':')[0]}
+ {:else}
+ <span class="text-muted-foreground italic">Untagged</span>
+ {/if}
+ </a>
+ </div>
+ </div>
+{/snippet}
+
+{#snippet StatusCell({ item }: { item: ImageSummaryDto })}
+ {#if item.inUse}
+ <StatusBadge text="In Use" variant="green" />
+ {:else}
+ <StatusBadge text="Unused" variant="amber" />
+ {/if}
+{/snippet}
+
+{#snippet TagCell({ item }: { item: ImageSummaryDto })}
+ {#if item.repoTags && item.repoTags.length > 0 && item.repoTags[0] !== '<none>:<none>'}
+ {item.repoTags[0].split(':')[1] || 'latest'}
+ {:else}
+ <span class="text-muted-foreground italic">&lt;none&gt;</span>
+ {/if}
+{/snippet}
+
+{#snippet SizeCell({ item }: { item: ImageSummaryDto })}
+ {bytes.format(item.size)}
+{/snippet}
+
<Card.Root class="relative flex flex-col rounded-lg border shadow-sm">
<Card.Header class="px-6 pb-3 pt-5">
<div class="flex items-center justify-between">
@@ -40,76 +79,28 @@
<div class="flex items-center gap-3">
<Button variant="ghost" size="sm" href="/images" disabled={isLoading}>
View All
- <ArrowRight class="ml-2 size-4" />
+ <ArrowRightIcon class="ml-2 size-4" />
</Button>
</div>
</div>
</Card.Header>
<Card.Content class="flex-1 p-0">
- {#if images.data.length > 0}
- <div class="flex h-full flex-col">
- <ArcaneTable
- items={images}
- bind:requestOptions
- bind:selectedIds
- onRefresh={async (options) => (images = await environmentAPI.getImages(options))}
- withoutSearch={true}
- selectionDisabled={true}
- withoutPagination={true}
- columns={[
- { label: 'Name', sortColumn: 'repoTags' },
- { label: 'Status', sortColumn: 'inUse' },
- { label: 'Tag', sortColumn: 'tag' },
- { label: 'Size', sortColumn: 'size' }
- ]}
- filterPlaceholder="Search images..."
- noResultsMessage="No images found"
- >
- {#snippet rows({ item })}
- <Table.Cell class="py-3 md:py-3.5">
- <div class="flex items-center gap-2">
- <div class="flex flex-1 items-center">
- <a class="shrink truncate font-medium hover:underline" href="/images/{item.id}/">
- {#if item.repoTags && item.repoTags.length > 0 && item.repoTags[0] !== '<none>:<none>'}
- {item.repoTags[0].split(':')[0]}
- {:else}
- <span class="text-muted-foreground italic">Untagged</span>
- {/if}
- </a>
- </div>
- </div>
- </Table.Cell>
- <Table.Cell class="py-3 md:py-3.5">
- {#if item.inUse}
- <StatusBadge text="In Use" variant="green" />
- {:else}
- <StatusBadge text="Unused" variant="amber" />
- {/if}
- </Table.Cell>
- <Table.Cell class="py-3 md:py-3.5">
- {#if item.repoTags && item.repoTags.length > 0 && item.repoTags[0] !== '<none>:<none>'}
- {item.repoTags[0].split(':')[1] || 'latest'}
- {:else}
- <span class="text-muted-foreground italic">&lt;none&gt;</span>
- {/if}
- </Table.Cell>
- <Table.Cell class="py-3 md:py-3.5">{formatBytes(item.size)}</Table.Cell>
- {/snippet}
- </ArcaneTable>
- {#if images.data.length > 5}
- <div class="bg-muted/40 text-muted-foreground border-t px-6 py-2 text-xs">
- Showing 5 of {images.pagination.totalItems} images
- </div>
- {/if}
- </div>
- {:else}
- <div class="flex flex-col items-center justify-center px-6 py-10 text-center">
- <HardDrive class="text-muted-foreground mb-2 size-8 opacity-40" />
- <p class="text-muted-foreground text-sm">No images found</p>
- <p class="text-muted-foreground mt-1 text-xs">
- Pull images using Docker CLI or another tool
- </p>
- </div>
- {/if}
+ <div class="flex h-full flex-col">
+ <ArcaneTable
+ items={images}
+ bind:requestOptions
+ bind:selectedIds
+ onRefresh={async (options) => (images = await environmentAPI.getImages(options))}
+ withoutSearch={true}
+ selectionDisabled={true}
+ withoutPagination={true}
+ {columns}
+ />
+ {#if images.data.length > 5}
+ <div class="bg-muted/40 text-muted-foreground border-t px-6 py-2 text-xs">
+ Showing 5 of {images.pagination.totalItems} images
+ </div>
+ {/if}
+ </div>
</Card.Content>
</Card.Root>
diff --git a/frontend/src/routes/environments/+page.svelte b/frontend/src/routes/environments/+page.svelte
index 0f7e04470..3516d2cfb 100644
--- a/frontend/src/routes/environments/+page.svelte
+++ b/frontend/src/routes/environments/+page.svelte
@@ -1,466 +1,125 @@
<script lang="ts">
- import { onMount } from 'svelte';
- import { goto } from '$app/navigation';
- import type { Environment } from '$lib/stores/environment.store';
- import { formatDistanceToNow } from 'date-fns';
- import {
- RefreshCw,
- AlertCircle,
- Loader2,
- Monitor,
- Eye,
- Trash2,
- Terminal,
- Server,
- Ellipsis,
- Plus
- } from '@lucide/svelte';
+ import ServerIcon from '@lucide/svelte/icons/server';
import { toast } from 'svelte-sonner';
- import { openConfirmDialog } from '$lib/components/confirm-dialog/index.js';
- import { handleApiResultWithCallbacks } from '$lib/utils/api.util.js';
- import { tryCatch } from '$lib/utils/try-catch.js';
- import { Button } from '$lib/components/ui/button/index.js';
import * as Card from '$lib/components/ui/card/index.js';
- import ArcaneTable from '$lib/components/arcane-table.svelte';
- import * as Table from '$lib/components/ui/table';
- import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
- import StatusBadge from '$lib/components/badges/status-badge.svelte';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import NewEnvironmentSheet from '$lib/components/sheets/new-environment-sheet.svelte';
+ import EnvironmentTable from './environment-table.svelte';
+ import { tryCatch } from '$lib/utils/try-catch';
+ import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
+ import { openConfirmDialog } from '$lib/components/confirm-dialog';
import { environmentManagementAPI } from '$lib/services/api';
- import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
let { data } = $props();
- let environments: Environment[] = $state(data.environments || []);
- let loading = $state(false);
- let error = $state('');
- let selectedEnvironmentIds = $state<string[]>([]);
+ let environments = $state(data.environments);
+ let selectedIds = $state<string[]>([]);
+ let requestOptions = $state(data.environmentRequestOptions);
let showEnvironmentSheet = $state(false);
- let refreshInProgress = false;
- // Convert environments array to Paginated structure for ArcaneTable
- let paginatedEnvironments = $derived<Paginated<Environment & { id: string }>>({
- data: environments.map((env) => ({ ...env, id: env.id })),
- pagination: {
- totalPages: 1,
- totalItems: environments.length,
- currentPage: 1,
- itemsPerPage: environments.length
- }
- });
-
- let requestOptions = $state<SearchPaginationSortRequest>({
- search: '',
- pagination: { page: 1, limit: 100 },
- sort: { column: 'lastSeen', direction: 'desc' }
+ let isLoading = $state({
+ refresh: false,
+ creating: false,
+ deleting: false
});
- const columns = [
- { label: 'Environment', sortColumn: 'hostname' },
- { label: 'Status', sortColumn: 'status' },
- { label: 'API URL' },
- { label: 'Enabled', sortColumn: 'enabled' },
- { label: 'Last Seen', sortColumn: 'lastSeen' },
- { label: ' ' }
- ];
-
- // Define valid sortable keys for Environment
- const validSortColumns: (keyof Environment)[] = [
- 'hostname',
- 'status',
- 'enabled',
- 'lastSeen',
- 'apiUrl',
- 'id'
- ];
-
- function isValidEnvironmentKey(key: string): key is keyof Environment {
- return validSortColumns.includes(key as keyof Environment);
- }
-
- function sortEnvironments(
- data: Environment[],
- column: keyof Environment,
- direction: 'asc' | 'desc'
- ): Environment[] {
- return [...data].sort((a, b) => {
- const aVal = a[column];
- const bVal = b[column];
-
- // Handle date fields
- if (column === 'lastSeen') {
- const aTime = aVal ? new Date(aVal as string).getTime() : 0;
- const bTime = bVal ? new Date(bVal as string).getTime() : 0;
- return direction === 'asc' ? aTime - bTime : bTime - aTime;
- }
-
- // Handle string comparison
- if (typeof aVal === 'string' && typeof bVal === 'string') {
- const comparison = aVal.toLowerCase().localeCompare(bVal.toLowerCase());
- return direction === 'asc' ? comparison : -comparison;
- }
-
- // Handle boolean comparison
- if (typeof aVal === 'boolean' && typeof bVal === 'boolean') {
- if (aVal === bVal) return 0;
- const comparison = aVal ? 1 : -1;
- return direction === 'asc' ? comparison : -comparison;
- }
-
- // Handle undefined values
- const aComp = aVal ?? '';
- const bComp = bVal ?? '';
-
- if (aComp < bComp) return direction === 'asc' ? -1 : 1;
- if (aComp > bComp) return direction === 'asc' ? 1 : -1;
- return 0;
- });
- }
-
- function filterEnvironments(data: Environment[], searchTerm: string): Environment[] {
- if (!searchTerm) return data;
-
- const term = searchTerm.toLowerCase();
- return data.filter(
- (env) =>
- env.hostname.toLowerCase().includes(term) ||
- env.apiUrl.toLowerCase().includes(term) ||
- env.status.toLowerCase().includes(term)
- );
- }
-
- onMount(() => {
- const interval = setInterval(refreshEnvironments, 30000);
- return () => clearInterval(interval);
- });
-
- async function refreshEnvironments() {
- if (refreshInProgress) return;
- refreshInProgress = true;
-
+ async function refresh() {
+ isLoading.refresh = true;
try {
- loading = true;
- environments = await environmentManagementAPI.list();
- error = '';
+ environments = await environmentManagementAPI.getEnvironments(requestOptions);
} catch (err) {
console.error('Failed to refresh environments:', err);
+ toast.error('Failed to refresh environments');
} finally {
- loading = false;
- refreshInProgress = false;
- }
- }
-
- async function loadEnvironments() {
- try {
- loading = true;
- error = '';
- environments = await environmentManagementAPI.list();
- } catch (err) {
- console.error('Failed to load environments:', err);
- error = err instanceof Error ? err.message : 'Unknown error';
- } finally {
- loading = false;
- }
- }
-
- /**
- * Handle local filtering and sorting of environments data
- * Used by ArcaneTable for client-side data manipulation
- */
- async function handleLocalFilter(
- options: SearchPaginationSortRequest
- ): Promise<Paginated<Environment & { id: string }>> {
- // Apply search filter
- let filteredData = filterEnvironments(environments, options.search || '');
-
- // Apply sorting if provided
- if (options.sort) {
- const { column, direction } = options.sort;
-
- // Validate column is a valid Environment key before sorting
- if (!isValidEnvironmentKey(column)) {
- console.warn(`Invalid sort column: ${column}. Skipping sort.`);
- } else {
- filteredData = sortEnvironments(filteredData, column, direction);
- }
- }
-
- return {
- data: filteredData.map((env) => ({ ...env, id: env.id })),
- pagination: {
- totalPages: 1,
- totalItems: filteredData.length,
- currentPage: 1,
- itemsPerPage: filteredData.length
- }
- };
- }
-
- async function deleteEnvironment(environmentId: string, hostname: string) {
- openConfirmDialog({
- title: `Confirm Removal`,
- message: `Are you sure you want to remove environment "${hostname}"? This action cannot be undone.`,
- confirm: {
- label: 'Remove',
- destructive: true,
- action: async () => {
- handleApiResultWithCallbacks({
- result: await tryCatch(environmentManagementAPI.delete(environmentId)),
- message: 'Failed to Remove Environment',
- onSuccess: async () => {
- toast.success('Environment Removed Successfully');
- await loadEnvironments();
- }
- });
- }
- }
- });
- }
-
- async function testConnection(environmentId: string) {
- try {
- const result = await environmentManagementAPI.testConnection(environmentId);
- if (result.status === 'online') {
- toast.success('Connection successful');
- } else {
- toast.error(`Connection failed: ${result.message || 'Unknown error'}`);
- }
- await loadEnvironments();
- } catch (error) {
- toast.error('Failed to test connection');
- console.error(error);
+ isLoading.refresh = false;
}
}
async function handleBulkDelete() {
- if (selectedEnvironmentIds.length === 0) return;
+ if (selectedIds.length === 0) return;
openConfirmDialog({
- title: 'Confirm Bulk Removal',
- message: `Are you sure you want to remove ${selectedEnvironmentIds.length} environment(s)? This action cannot be undone.`,
+ title: `Remove ${selectedIds.length} Environment${selectedIds.length > 1 ? 's' : ''}`,
+ message: 'Are you sure? This action cannot be undone.',
confirm: {
- label: 'Remove All',
+ label: 'Remove',
destructive: true,
action: async () => {
- try {
- const results = await Promise.allSettled(
- selectedEnvironmentIds.map((id) => environmentManagementAPI.delete(id))
- );
-
- const successful = results.filter((result) => result.status === 'fulfilled');
- const failed = results.filter((result) => result.status === 'rejected');
-
- if (successful.length > 0) {
- toast.success(`${successful.length} environment(s) removed successfully`);
- }
+ isLoading.deleting = true;
+ let successCount = 0;
+ let failureCount = 0;
+
+ for (const id of selectedIds) {
+ const result = await tryCatch(environmentManagementAPI.delete(id));
+ handleApiResultWithCallbacks({
+ result,
+ message: `Failed to remove environment`,
+ setLoadingState: () => {},
+ onSuccess: () => (successCount += 1)
+ });
+ if (result.error) failureCount += 1;
+ }
- if (failed.length > 0) {
- console.error('Failed delete operations:', failed);
- toast.error(
- `Failed to remove ${failed.length} environment(s). Check console for details.`
- );
- }
+ isLoading.deleting = false;
- selectedEnvironmentIds = [];
- await loadEnvironments();
- } catch (err) {
- console.error('Unexpected error during bulk delete:', err);
- toast.error('An unexpected error occurred during bulk deletion');
+ if (successCount > 0) {
+ toast.success(`Removed ${successCount} environment${successCount > 1 ? 's' : ''}`);
+ await refresh();
}
+ if (failureCount > 0) {
+ toast.error(`Failed to remove ${failureCount} environment${failureCount > 1 ? 's' : ''}`);
+ }
+
+ selectedIds = [];
}
}
});
}
- function handleEnvironmentCreated() {
+ function onEnvironmentCreated() {
showEnvironmentSheet = false;
- toast.success(
- 'Environment added successfully! You can now select it from the environment switcher.'
- );
- loadEnvironments();
+ toast.success('Environment added successfully');
+ refresh();
}
</script>
<div class="space-y-6">
- <div>
- <h1 class="text-3xl font-bold tracking-tight">Environment Management</h1>
- <p class="text-muted-foreground mt-1 text-sm">Manage and monitor your arcane environments</p>
- </div>
-
- {#if error}
- <div
- class="rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-red-700 dark:border-red-800 dark:bg-red-900/20 dark:text-red-400"
- >
- <div class="flex items-center gap-2">
- <AlertCircle class="h-5 w-5" />
- <strong>Error:</strong>
- {error}
+ <div class="flex flex-col justify-between gap-4 sm:flex-row sm:items-center">
+ <div class="flex items-center gap-2">
+ <div class="rounded-full bg-blue-500/10 p-2">
+ <ServerIcon class="size-5 text-blue-500" />
+ </div>
+ <div>
+ <h1 class="text-3xl font-bold tracking-tight">Environment Management</h1>
+ <p class="text-muted-foreground mt-1 text-sm">Manage and monitor your Arcane environments</p>
</div>
</div>
- {/if}
-
- <div class="grid h-full grid-cols-1 gap-6">
- <Card.Root class="flex flex-col border shadow-sm">
- <Card.Header class="flex flex-row items-center justify-between space-y-0 pb-3">
- <div class="flex items-center gap-2">
- <div class="rounded-full bg-blue-500/10 p-2">
- <Server class="size-5 text-blue-500" />
- </div>
- <div>
- <Card.Title>Environments</Card.Title>
- <Card.Description>Created Environments</Card.Description>
- </div>
- </div>
- <div class="flex items-center gap-2">
- {#if selectedEnvironmentIds.length > 0}
- <Button variant="destructive" onclick={handleBulkDelete}>
- <Trash2 class="mr-2 h-4 w-4" />
- Delete Selected ({selectedEnvironmentIds.length})
- </Button>
- {/if}
- <Button onclick={() => (showEnvironmentSheet = true)}>
- <Plus class="mr-2 h-4 w-4" />
- Add Environment
- </Button>
- <Button onclick={loadEnvironments} disabled={loading}>
- {#if loading}
- <Loader2 class="mr-2 h-4 w-4 animate-spin" />
- {:else}
- <RefreshCw class="mr-2 h-4 w-4" />
- {/if}
- {loading ? 'Loading...' : 'Refresh'}
- </Button>
- </div>
- </Card.Header>
- <Card.Content class="flex flex-1 flex-col">
- {#if environments.length === 0 && !loading}
- <div class="py-16 text-center">
- <Monitor class="mx-auto mb-4 h-16 w-16 text-gray-400" />
- <h3 class="mb-2 text-lg font-medium text-gray-900 dark:text-white">
- No environments registered
- </h3>
- <p class="mb-4 text-gray-600 dark:text-gray-400">
- Get started by adding your first environment
- </p>
- <div class="mx-auto max-w-md rounded-lg bg-gray-50 p-4 dark:bg-gray-800">
- <p class="text-sm text-gray-600 dark:text-gray-400 mb-3">
- Add a new environment to connect to an Arcane agent running as an API server.
- </p>
- <Button onclick={() => (showEnvironmentSheet = true)} class="w-full">
- <Plus class="mr-2 h-4 w-4" />
- Add Environment
- </Button>
- </div>
- </div>
- {:else if environments.length > 0}
- <div class="flex h-full flex-1 flex-col">
- <ArcaneTable
- items={paginatedEnvironments}
- bind:requestOptions
- bind:selectedIds={selectedEnvironmentIds}
- withoutPagination={true}
- onRefresh={handleLocalFilter}
- {columns}
- filterPlaceholder="Search environments..."
- noResultsMessage="No environments found"
- >
- {#snippet rows({ item })}
- <Table.Cell>
- <div class="flex items-center gap-3">
- <div class="relative">
- <div
- class="flex size-8 items-center justify-center rounded-lg bg-gray-100 dark:bg-gray-700"
- >
- <Monitor class="size-4 text-gray-600 dark:text-gray-400" />
- </div>
- <div
- class="absolute -top-1 -right-1 size-3 {item.status === 'online'
- ? 'bg-green-500'
- : 'bg-red-500'} rounded-full border-2 border-white dark:border-gray-800"
- ></div>
- </div>
- <div>
- <div class="font-medium text-gray-900 dark:text-white">{item.hostname}</div>
- <div class="text-xs text-gray-500 dark:text-gray-400 font-mono">
- {item.id}
- </div>
- </div>
- </div>
- </Table.Cell>
- <Table.Cell>
- <StatusBadge
- text={item.status === 'online' ? 'Online' : 'Offline'}
- variant={item.status === 'online' ? 'green' : 'red'}
- />
- </Table.Cell>
- <Table.Cell>
- <span class="text-sm font-mono text-muted-foreground">{item.apiUrl}</span>
- </Table.Cell>
- <Table.Cell>
- <StatusBadge
- text={item.enabled ? 'Enabled' : 'Disabled'}
- variant={item.enabled ? 'green' : 'gray'}
- />
- </Table.Cell>
- <Table.Cell>
- {#if item.lastSeen}
- <span class="text-sm text-gray-600 dark:text-gray-400"
- >{formatDistanceToNow(new Date(item.lastSeen))} ago</span
- >
- {:else}
- <span class="text-sm text-gray-400">Never</span>
- {/if}
- </Table.Cell>
- <Table.Cell>
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- <Button variant="ghost" size="icon" class="size-8">
- <Ellipsis class="size-4" />
- <span class="sr-only">Open menu</span>
- </Button>
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item onclick={() => testConnection(item.id)}>
- <Terminal class="size-4" />
- Test Connection
- </DropdownMenu.Item>
- <DropdownMenu.Item onclick={() => goto(`/environments/${item.id}`)}>
- <Eye class="size-4" />
- View Details
- </DropdownMenu.Item>
- <DropdownMenu.Item
- class="text-red-500 focus:text-red-700!"
- onclick={() => deleteEnvironment(item.id, item.hostname)}
- >
- <Trash2 class="size-4" />
- Delete Environment
- </DropdownMenu.Item>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
- </Table.Cell>
- {/snippet}
- </ArcaneTable>
- </div>
- {:else}
- <div class="text-muted-foreground py-8 text-center italic">Loading environments...</div>
- {/if}
- </Card.Content>
- </Card.Root>
+ <div class="flex items-center gap-2">
+ {#if selectedIds.length > 0}
+ <ArcaneButton
+ action="remove"
+ customLabel="Remove Selected"
+ onclick={handleBulkDelete}
+ loading={isLoading.deleting}
+ disabled={isLoading.deleting}
+ />
+ {/if}
+ <ArcaneButton action="create" customLabel="Add Environment" onclick={() => (showEnvironmentSheet = true)} />
+ <ArcaneButton
+ action="restart"
+ customLabel="Refresh"
+ onclick={refresh}
+ loading={isLoading.refresh}
+ disabled={isLoading.refresh}
+ />
+ </div>
</div>
- {#if loading && environments.length > 0}
- <div
- class="fixed right-4 bottom-4 flex items-center gap-2 rounded-lg bg-blue-600 px-3 py-2 text-white shadow-lg"
- >
- <Loader2 class="h-4 w-4 animate-spin" />
- <span class="text-sm">Refreshing...</span>
- </div>
- {/if}
+ <Card.Root class="border shadow-sm">
+ <Card.Content>
+ <EnvironmentTable bind:environments bind:selectedIds bind:requestOptions />
+ </Card.Content>
+ </Card.Root>
</div>
-<NewEnvironmentSheet
- bind:open={showEnvironmentSheet}
- onEnvironmentCreated={handleEnvironmentCreated}
-/>
+<NewEnvironmentSheet bind:open={showEnvironmentSheet} {onEnvironmentCreated} />
diff --git a/frontend/src/routes/environments/+page.ts b/frontend/src/routes/environments/+page.ts
index 6f84a5cfc..aa94449e7 100644
--- a/frontend/src/routes/environments/+page.ts
+++ b/frontend/src/routes/environments/+page.ts
@@ -1,23 +1,20 @@
import type { PageLoad } from './$types';
import { environmentManagementAPI } from '$lib/services/api';
-import { error } from '@sveltejs/kit';
+import type { SearchPaginationSortRequest } from '$lib/types/pagination.type';
export const load: PageLoad = async () => {
- try {
- const environments = await environmentManagementAPI.list();
-
- return {
- environments
- };
- } catch (err) {
- console.error('Failed to load environments:', err);
-
- if (err && typeof err === 'object' && 'status' in err) {
- throw err;
+ const environmentRequestOptions: SearchPaginationSortRequest = {
+ pagination: {
+ page: 1,
+ limit: 20
+ },
+ sort: {
+ column: 'timestamp',
+ direction: 'desc' as const
}
+ };
+
+ const environments = await environmentManagementAPI.getEnvironments(environmentRequestOptions);
- throw error(500, {
- message: err instanceof Error ? err.message : 'Failed to load environments'
- });
- }
+ return { environments, environmentRequestOptions };
};
diff --git a/frontend/src/routes/environments/[id]/+page.svelte b/frontend/src/routes/environments/[id]/+page.svelte
index 212e03d93..75d5cb137 100644
--- a/frontend/src/routes/environments/[id]/+page.svelte
+++ b/frontend/src/routes/environments/[id]/+page.svelte
@@ -2,9 +2,16 @@
import type { PageData } from './$types';
import * as Card from '$lib/components/ui/card/index.js';
import { Button } from '$lib/components/ui/button/index.js';
- import { ArrowLeft, RefreshCw, Monitor, Terminal, Settings, Activity, Globe, Database } from '@lucide/svelte';
+ import ArrowLeftIcon from '@lucide/svelte/icons/arrow-left';
+ import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
+ import MonitorIcon from '@lucide/svelte/icons/monitor';
+ import TerminalIcon from '@lucide/svelte/icons/terminal';
+ import SettingsIcon from '@lucide/svelte/icons/settings';
+ import ActivityIcon from '@lucide/svelte/icons/activity';
+ import GlobeIcon from '@lucide/svelte/icons/globe';
+ import DatabaseIcon from '@lucide/svelte/icons/database';
import { goto, invalidateAll } from '$app/navigation';
- import { formatDate } from '$lib/utils/string.utils';
+ import { format } from 'date-fns';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { environmentManagementAPI } from '$lib/services/api';
import { toast } from 'svelte-sonner';
@@ -19,9 +26,9 @@
let activeSection = $state<string>('overview');
const sections = [
- { id: 'overview', Label: 'Overview', icon: Monitor },
- { id: 'connection', Label: 'Connection', icon: Globe },
- { id: 'activity', Label: 'Activity', icon: Activity }
+ { id: 'overview', Label: 'Overview', icon: MonitorIcon },
+ { id: 'connection', Label: 'Connection', icon: GlobeIcon },
+ { id: 'activity', Label: 'Activity', icon: ActivityIcon }
];
onMount(() => {
@@ -72,7 +79,7 @@
<div class="flex items-center justify-between">
<div class="flex items-center gap-4">
<Button variant="ghost" size="icon" onclick={() => goto('/environments')}>
- <ArrowLeft class="h-4 w-4" />
+ <ArrowLeftIcon class="h-4 w-4" />
</Button>
<div>
<h1 class="text-3xl font-bold tracking-tight">{environmentDisplayName}</h1>
@@ -82,24 +89,24 @@
<div class="flex items-center gap-2">
<Button variant="outline" onclick={testConnection} disabled={isTestingConnection}>
{#if isTestingConnection}
- <RefreshCw class="mr-2 h-4 w-4 animate-spin" />
+ <RefreshCwIcon class="mr-2 h-4 w-4 animate-spin" />
{:else}
- <Terminal class="mr-2 h-4 w-4" />
+ <TerminalIcon class="mr-2 h-4 w-4" />
{/if}
Test Connection
</Button>
<Button onclick={refreshEnvironment} disabled={isRefreshing}>
{#if isRefreshing}
- <RefreshCw class="mr-2 h-4 w-4 animate-spin" />
+ <RefreshCwIcon class="mr-2 h-4 w-4 animate-spin" />
{:else}
- <RefreshCw class="mr-2 h-4 w-4" />
+ <RefreshCwIcon class="mr-2 h-4 w-4" />
{/if}
Refresh
</Button>
</div>
</div>
- <div class="grid grid-cols-1 lg:grid-cols-4 gap-6">
+ <div class="grid grid-cols-1 gap-6 lg:grid-cols-4">
<div class="lg:col-span-1">
<Card.Root>
<Card.Header>
@@ -109,7 +116,13 @@
<nav class="space-y-1">
{#each sections as section}
{@const Icon = section.icon}
- <button onclick={() => (activeSection = section.id)} class="w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-muted transition-colors {activeSection === section.id ? 'bg-muted border-r-2 border-primary' : ''}">
+ <button
+ onclick={() => (activeSection = section.id)}
+ class="hover:bg-muted flex w-full items-center gap-3 px-4 py-3 text-left transition-colors {activeSection ===
+ section.id
+ ? 'bg-muted border-primary border-r-2'
+ : ''}"
+ >
<Icon class="size-4" />
{section.Label}
</button>
@@ -125,50 +138,56 @@
<Card.Root>
<Card.Header>
<Card.Title class="flex items-center gap-2">
- <Monitor class="size-5" />
+ <MonitorIcon class="size-5" />
Environment Overview
</Card.Title>
</Card.Header>
<Card.Content class="space-y-6">
- <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
+ <div class="grid grid-cols-1 gap-6 md:grid-cols-2">
<div class="space-y-4">
<div>
- <Label class="text-sm font-medium text-muted-foreground">Hostname</Label>
+ <Label class="text-muted-foreground text-sm font-medium">Hostname</Label>
<div class="mt-1 text-lg font-semibold">{environment.hostname}</div>
</div>
<div>
- <Label class="text-sm font-medium text-muted-foreground">Status</Label>
+ <Label class="text-muted-foreground text-sm font-medium">Status</Label>
<div class="mt-1">
- <StatusBadge text={environment.status === 'online' ? 'Online' : 'Offline'} variant={environment.status === 'online' ? 'green' : 'red'} />
+ <StatusBadge
+ text={environment.status === 'online' ? 'Online' : 'Offline'}
+ variant={environment.status === 'online' ? 'green' : 'red'}
+ />
</div>
</div>
<div>
- <Label class="text-sm font-medium text-muted-foreground">Enabled</Label>
+ <Label class="text-muted-foreground text-sm font-medium">Enabled</Label>
<div class="mt-1">
- <StatusBadge text={environment.enabled ? 'Enabled' : 'Disabled'} variant={environment.enabled ? 'green' : 'gray'} />
+ <StatusBadge
+ text={environment.enabled ? 'Enabled' : 'Disabled'}
+ variant={environment.enabled ? 'green' : 'gray'}
+ />
</div>
</div>
</div>
<div class="space-y-4">
<div>
- <Label class="text-sm font-medium text-muted-foreground">Environment ID</Label>
- <div class="mt-1 font-mono text-sm bg-muted px-2 py-1 rounded">{environment.id}</div>
+ <Label class="text-muted-foreground text-sm font-medium">Environment ID</Label>
+ <div class="bg-muted mt-1 rounded px-2 py-1 font-mono text-sm">{environment.id}</div>
</div>
<div>
- <Label class="text-sm font-medium text-muted-foreground">Created</Label>
- <div class="mt-1 text-sm">{formatDate(environment.createdAt)}</div>
+ <Label class="text-muted-foreground text-sm font-medium">Created</Label>
+ <div class="mt-1 text-sm">{format(new Date(environment.createdAt), 'PP p')}</div>
</div>
{#if environment.updatedAt}
<div>
- <Label class="text-sm font-medium text-muted-foreground">Last Updated</Label>
- <div class="mt-1 text-sm">{formatDate(environment.updatedAt)}</div>
+ <Label class="text-muted-foreground text-sm font-medium">Last Updated</Label>
+ <div class="mt-1 text-sm">{format(new Date(environment.updatedAt), 'PP p')}</div>
</div>
{/if}
</div>
</div>
{#if environment.description}
<div>
- <Label class="text-sm font-medium text-muted-foreground">Description</Label>
+ <Label class="text-muted-foreground text-sm font-medium">Description</Label>
<div class="mt-1 text-sm">{environment.description}</div>
</div>
{/if}
@@ -180,33 +199,33 @@
<Card.Root>
<Card.Header>
<Card.Title class="flex items-center gap-2">
- <Globe class="h-5 w-5" />
+ <GlobeIcon class="h-5 w-5" />
Connection Details
</Card.Title>
</Card.Header>
<Card.Content class="space-y-4">
<div>
- <Label class="text-sm font-medium text-muted-foreground">API URL</Label>
- <div class="mt-1 font-mono text-sm bg-muted px-3 py-2 rounded-md break-all">{environment.apiUrl}</div>
+ <Label class="text-muted-foreground text-sm font-medium">API URL</Label>
+ <div class="bg-muted mt-1 break-all rounded-md px-3 py-2 font-mono text-sm">{environment.apiUrl}</div>
</div>
{#if environment.lastSeen}
<div>
- <Label class="text-sm font-medium text-muted-foreground">Last Seen</Label>
- <div class="mt-1 text-sm">{formatDate(environment.lastSeen)}</div>
+ <Label class="text-muted-foreground text-sm font-medium">Last Seen</Label>
+ <div class="mt-1 text-sm">{format(new Date(environment.lastSeen), 'PP p')}</div>
</div>
{:else}
<div>
- <Label class="text-sm font-medium text-muted-foreground">Last Seen</Label>
- <div class="mt-1 text-sm text-muted-foreground">Never</div>
+ <Label class="text-muted-foreground text-sm font-medium">Last Seen</Label>
+ <div class="text-muted-foreground mt-1 text-sm">Never</div>
</div>
{/if}
<div class="pt-4">
<Button onclick={testConnection} disabled={isTestingConnection} class="w-full">
{#if isTestingConnection}
- <RefreshCw class="mr-2 h-4 w-4 animate-spin" />
+ <RefreshCwIcon class="mr-2 h-4 w-4 animate-spin" />
Testing Connection...
{:else}
- <Terminal class="mr-2 h-4 w-4" />
+ <TerminalIcon class="mr-2 h-4 w-4" />
Test Connection
{/if}
</Button>
@@ -217,7 +236,7 @@
<Card.Root>
<Card.Header>
<Card.Title class="flex items-center gap-2">
- <Settings class="h-5 w-5" />
+ <SettingsIcon class="h-5 w-5" />
Connection Health
</Card.Title>
</Card.Header>
@@ -225,7 +244,10 @@
<div class="space-y-3">
<div class="flex items-center justify-between">
<span class="text-sm">Connection Status</span>
- <StatusBadge text={environment.status === 'online' ? 'Connected' : 'Disconnected'} variant={environment.status === 'online' ? 'green' : 'red'} />
+ <StatusBadge
+ text={environment.status === 'online' ? 'Connected' : 'Disconnected'}
+ variant={environment.status === 'online' ? 'green' : 'red'}
+ />
</div>
<div class="flex items-center justify-between">
<span class="text-sm">Environment Enabled</span>
@@ -240,13 +262,13 @@
<Card.Root>
<Card.Header>
<Card.Title class="flex items-center gap-2">
- <Activity class="h-5 w-5" />
+ <ActivityIcon class="h-5 w-5" />
Activity Log
</Card.Title>
</Card.Header>
<Card.Content>
- <div class="text-center py-8 text-muted-foreground">
- <Database class="mx-auto h-12 w-12 mb-3 opacity-50" />
+ <div class="text-muted-foreground py-8 text-center">
+ <DatabaseIcon class="mx-auto mb-3 h-12 w-12 opacity-50" />
<p>Activity logging coming soon</p>
<p class="text-sm">Environment activity and logs will be displayed here</p>
</div>
@@ -258,8 +280,8 @@
</div>
{#if isRefreshing}
- <div class="fixed right-4 bottom-4 flex items-center gap-2 rounded-lg bg-blue-600 px-3 py-2 text-white shadow-lg">
- <RefreshCw class="h-4 w-4 animate-spin" />
+ <div class="fixed bottom-4 right-4 flex items-center gap-2 rounded-lg bg-blue-600 px-3 py-2 text-white shadow-lg">
+ <RefreshCwIcon class="h-4 w-4 animate-spin" />
<span class="text-sm">Refreshing...</span>
</div>
{/if}
diff --git a/frontend/src/routes/environments/environment-table.svelte b/frontend/src/routes/environments/environment-table.svelte
new file mode 100644
index 000000000..5561018ce
--- /dev/null
+++ b/frontend/src/routes/environments/environment-table.svelte
@@ -0,0 +1,243 @@
+<script lang="ts">
+ import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
+ import { Button } from '$lib/components/ui/button/index.js';
+ import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import EllipsisIcon from '@lucide/svelte/icons/ellipsis';
+ import EyeIcon from '@lucide/svelte/icons/eye';
+ import TerminalIcon from '@lucide/svelte/icons/terminal';
+ import Trash2Icon from '@lucide/svelte/icons/trash-2';
+ import MonitorIcon from '@lucide/svelte/icons/monitor';
+ import StatusBadge from '$lib/components/badges/status-badge.svelte';
+ import * as Card from '$lib/components/ui/card/index.js';
+ import * as Table from '$lib/components/ui/table/index.js';
+ import { goto } from '$app/navigation';
+ import { openConfirmDialog } from '$lib/components/confirm-dialog';
+ import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
+ import { tryCatch } from '$lib/utils/try-catch';
+ import { toast } from 'svelte-sonner';
+ import { formatDistanceToNow } from 'date-fns';
+ import { environmentManagementAPI } from '$lib/services/api';
+ import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
+ import type { ColumnSpec } from '$lib/components/arcane-table';
+ import type { Environment } from '$lib/stores/environment.store';
+
+ let {
+ environments = $bindable(),
+ selectedIds = $bindable(),
+ requestOptions = $bindable()
+ }: {
+ environments: Paginated<Environment>;
+ selectedIds: string[];
+ requestOptions: SearchPaginationSortRequest;
+ } = $props();
+
+ let isLoading = $state({ removing: false, testing: false });
+
+ async function handleDeleteSelected(ids: string[]) {
+ if (!ids?.length) return;
+
+ openConfirmDialog({
+ title: `Remove ${ids.length} Environment${ids.length > 1 ? 's' : ''}`,
+ message: `Are you sure you want to remove the selected environment${ids.length > 1 ? 's' : ''}? This action cannot be undone.`,
+ confirm: {
+ label: 'Remove',
+ destructive: true,
+ action: async () => {
+ isLoading.removing = true;
+ let successCount = 0;
+ let failureCount = 0;
+
+ for (const id of ids) {
+ const result = await tryCatch(environmentManagementAPI.delete(id));
+ handleApiResultWithCallbacks({
+ result,
+ message: `Failed to remove environment`,
+ setLoadingState: () => {},
+ onSuccess: () => {
+ successCount++;
+ }
+ });
+ if (result.error) failureCount++;
+ }
+
+ isLoading.removing = false;
+
+ if (successCount > 0) {
+ toast.success(`Removed ${successCount} environment${successCount > 1 ? 's' : ''}`);
+ environments = await environmentManagementAPI.getEnvironments(requestOptions);
+ }
+ if (failureCount > 0) {
+ toast.error(`Failed to remove ${failureCount} environment${failureCount > 1 ? 's' : ''}`);
+ }
+
+ selectedIds = [];
+ }
+ }
+ });
+ }
+
+ async function handleDeleteOne(id: string, hostname: string) {
+ openConfirmDialog({
+ title: 'Remove Environment',
+ message: `Are you sure you want to remove "${hostname}"? This action cannot be undone.`,
+ confirm: {
+ label: 'Remove',
+ destructive: true,
+ action: async () => {
+ isLoading.removing = true;
+ const result = await tryCatch(environmentManagementAPI.delete(id));
+ handleApiResultWithCallbacks({
+ result,
+ message: `Failed to remove environment "${hostname}"`,
+ setLoadingState: () => {},
+ onSuccess: async () => {
+ toast.success(`Removed "${hostname}"`);
+ environments = await environmentManagementAPI.getEnvironments(requestOptions);
+ }
+ });
+ isLoading.removing = false;
+ }
+ }
+ });
+ }
+
+ async function handleTest(id: string) {
+ isLoading.testing = true;
+ const result = await tryCatch(environmentManagementAPI.testConnection(id));
+ handleApiResultWithCallbacks({
+ result,
+ message: 'Failed to test connection',
+ setLoadingState: () => {},
+ onSuccess: (resp) => {
+ const status = (resp as { status: string; message?: string }).status;
+ if (status === 'online') toast.success('Connection successful');
+ else toast.error('Connection failed');
+ }
+ });
+ isLoading.testing = false;
+ }
+
+ function formatLastSeen(lastSeen?: string | null) {
+ if (!lastSeen) return 'Never';
+ return `${formatDistanceToNow(new Date(lastSeen))} ago`;
+ }
+
+ const columns = [
+ { accessorKey: 'id', title: 'ID', hidden: true },
+ {
+ id: 'environment',
+ title: 'Environment',
+ sortable: true,
+ accessorFn: (row) => row.hostname,
+ cell: EnvironmentCell
+ },
+ {
+ accessorKey: 'status',
+ title: 'Status',
+ sortable: true,
+ cell: StatusCell
+ },
+ {
+ accessorKey: 'apiUrl',
+ title: 'API URL',
+ cell: ApiCell
+ },
+ {
+ accessorKey: 'enabled',
+ title: 'Enabled',
+ sortable: true,
+ cell: EnabledCell
+ },
+ {
+ accessorKey: 'lastSeen',
+ title: 'Last Seen',
+ sortable: true,
+ cell: LastSeenCell
+ }
+ ] satisfies ColumnSpec<Environment>[];
+</script>
+
+{#snippet EnvironmentCell({ item }: { item: Environment })}
+ <div class="flex items-center gap-3">
+ <div class="relative">
+ <div class="bg-muted flex size-8 items-center justify-center rounded-lg">
+ <MonitorIcon class="text-muted-foreground size-4" />
+ </div>
+ <div
+ class="border-background absolute -right-1 -top-1 size-3 rounded-full border-2 {item.status === 'online'
+ ? 'bg-green-500'
+ : 'bg-red-500'}"
+ ></div>
+ </div>
+ <div>
+ <div class="font-medium">{item.hostname}</div>
+ <div class="text-muted-foreground font-mono text-xs">{item.id}</div>
+ </div>
+ </div>
+{/snippet}
+
+{#snippet StatusCell({ value }: { value: unknown })}
+ <StatusBadge text={String(value ?? 'offline')} variant={String(value) === 'online' ? 'green' : 'red'} />
+{/snippet}
+
+{#snippet ApiCell({ value }: { value: unknown })}
+ <span class="text-muted-foreground font-mono text-sm">{String(value ?? '')}</span>
+{/snippet}
+
+{#snippet EnabledCell({ value }: { value: unknown })}
+ <StatusBadge text={Boolean(value) ? 'Enabled' : 'Disabled'} variant={Boolean(value) ? 'green' : 'gray'} />
+{/snippet}
+
+{#snippet LastSeenCell({ value }: { value: unknown })}
+ <span class="text-sm">{formatLastSeen((value as string) ?? '')}</span>
+{/snippet}
+
+{#snippet RowActions({ item }: { item: Environment })}
+ <DropdownMenu.Root>
+ <DropdownMenu.Trigger>
+ {#snippet child({ props })}
+ <Button {...props} variant="ghost" size="icon" class="relative size-8 p-0">
+ <span class="sr-only">Open menu</span>
+ <EllipsisIcon />
+ </Button>
+ {/snippet}
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Content align="end">
+ <DropdownMenu.Group>
+ <DropdownMenu.Item onclick={() => handleTest(item.id)} disabled={isLoading.testing}>
+ <TerminalIcon class="size-4" />
+ Test Connection
+ </DropdownMenu.Item>
+ <DropdownMenu.Item onclick={() => goto(`/environments/${item.id}`)}>
+ <EyeIcon class="size-4" />
+ View Details
+ </DropdownMenu.Item>
+ <DropdownMenu.Separator />
+ <DropdownMenu.Item
+ class="focus:text-red-700! text-red-500"
+ onclick={() => handleDeleteOne(item.id, item.hostname)}
+ disabled={isLoading.removing}
+ >
+ <Trash2Icon class="size-4" />
+ Delete
+ </DropdownMenu.Item>
+ </DropdownMenu.Group>
+ </DropdownMenu.Content>
+ </DropdownMenu.Root>
+{/snippet}
+
+<div>
+ <Card.Root>
+ <Card.Content class="py-5">
+ <ArcaneTable
+ items={environments}
+ bind:requestOptions
+ bind:selectedIds
+ onRemoveSelected={(ids) => handleDeleteSelected(ids)}
+ onRefresh={async (options) => (environments = await environmentManagementAPI.getEnvironments(options))}
+ {columns}
+ rowActions={RowActions}
+ />
+ </Card.Content>
+ </Card.Root>
+</div>
diff --git a/frontend/src/routes/events/+page.svelte b/frontend/src/routes/events/+page.svelte
index 2715e7600..7d6224b15 100644
--- a/frontend/src/routes/events/+page.svelte
+++ b/frontend/src/routes/events/+page.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import { Activity, RefreshCw } from '@lucide/svelte';
+ import ActivityIcon from '@lucide/svelte/icons/activity';
import { toast } from 'svelte-sonner';
import { tryCatch } from '$lib/utils/try-catch';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
@@ -7,75 +7,31 @@
import StatCard from '$lib/components/stat-card.svelte';
import type { Event } from '$lib/types/event.type';
import { eventAPI } from '$lib/services/api';
- import type { SearchPaginationSortRequest, Paginated } from '$lib/types/pagination.type';
import EventTable from './event-table.svelte';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import { openConfirmDialog } from '$lib/components/confirm-dialog';
let { data }: { data: PageData } = $props();
- let events = $state<Paginated<Event>>(data.events);
+ let events = $state(data.events);
let selectedIds = $state<string[]>([]);
- let requestOptions = $state<SearchPaginationSortRequest>(data.eventRequestOptions);
+ let requestOptions = $state(data.eventRequestOptions);
let isLoading = $state({
refreshing: false,
deleting: false
});
- const infoEvents = $derived(
- events?.data?.filter((e: Event) => e.severity === 'info').length || 0
- );
- const warningEvents = $derived(
- events?.data?.filter((e: Event) => e.severity === 'warning').length || 0
- );
- const errorEvents = $derived(
- events?.data?.filter((e: Event) => e.severity === 'error').length || 0
- );
- const successEvents = $derived(
- events?.data?.filter((e: Event) => e.severity === 'success').length || 0
- );
+ const infoEvents = $derived(events?.data?.filter((e: Event) => e.severity === 'info').length || 0);
+ const warningEvents = $derived(events?.data?.filter((e: Event) => e.severity === 'warning').length || 0);
+ const errorEvents = $derived(events?.data?.filter((e: Event) => e.severity === 'error').length || 0);
+ const successEvents = $derived(events?.data?.filter((e: Event) => e.severity === 'success').length || 0);
const totalEvents = $derived(events?.pagination?.totalItems || 0);
- async function loadEvents() {
- try {
- isLoading.refreshing = true;
- const response = await eventAPI.listPaginated(
- requestOptions.pagination,
- requestOptions.sort,
- requestOptions.search,
- requestOptions.filters
- );
- events = response;
- } catch (err) {
- console.error('Failed to load events:', err);
- toast.error('Failed to load events');
- events = {
- data: [],
- pagination: {
- totalPages: 0,
- totalItems: 0,
- currentPage: 1,
- itemsPerPage: 20
- }
- };
- } finally {
- isLoading.refreshing = false;
- }
- }
-
- async function onRefresh(options: SearchPaginationSortRequest) {
- requestOptions = options;
- await loadEvents();
- return events;
- }
-
- async function onEventsChanged() {
- await refreshEvents();
- }
-
async function refreshEvents() {
isLoading.refreshing = true;
try {
- await loadEvents();
+ events = await eventAPI.getEvents(requestOptions);
} catch (error) {
console.error('Failed to refresh events:', error);
toast.error('Failed to refresh events');
@@ -83,27 +39,84 @@
isLoading.refreshing = false;
}
}
+
+ async function handleDeleteSelected() {
+ if (selectedIds.length === 0) return;
+
+ openConfirmDialog({
+ title: `Delete ${selectedIds.length} Event${selectedIds.length > 1 ? 's' : ''}`,
+ message: `Are you sure you want to delete the selected event${selectedIds.length > 1 ? 's' : ''}? This action cannot be undone.`,
+ confirm: {
+ label: 'Delete',
+ destructive: true,
+ action: async () => {
+ isLoading.deleting = true;
+ let successCount = 0;
+ let failureCount = 0;
+
+ for (const eventId of selectedIds) {
+ const result = await tryCatch(eventAPI.delete(eventId));
+ handleApiResultWithCallbacks({
+ result,
+ message: `Failed to delete event ${eventId}`,
+ setLoadingState: () => {},
+ onSuccess: () => {
+ successCount++;
+ }
+ });
+
+ if (result.error) failureCount++;
+ }
+
+ isLoading.deleting = false;
+
+ if (successCount > 0) {
+ toast.success(`Successfully deleted ${successCount} event${successCount > 1 ? 's' : ''}`);
+ await refreshEvents();
+ }
+ if (failureCount > 0) {
+ toast.error(`Failed to delete ${failureCount} event${failureCount > 1 ? 's' : ''}`);
+ }
+
+ selectedIds = [];
+ }
+ }
+ });
+ }
</script>
<div class="flex h-full flex-col space-y-6">
<div class="flex items-center justify-between">
<div class="space-y-1">
<h2 class="text-2xl font-semibold tracking-tight">Event Log</h2>
- <p class="text-sm text-muted-foreground">Monitor events that have taken place in Arcane.</p>
+ <p class="text-muted-foreground text-sm">Monitor events that have taken place in Arcane.</p>
+ </div>
+ <div class="flex items-center gap-2">
+ {#if selectedIds.length > 0}
+ <ArcaneButton
+ action="remove"
+ customLabel="Remove Selected"
+ onclick={handleDeleteSelected}
+ loading={isLoading.deleting}
+ disabled={isLoading.deleting}
+ />
+ {/if}
+ <ArcaneButton
+ action="restart"
+ customLabel="Refresh"
+ onclick={refreshEvents}
+ loading={isLoading.refreshing}
+ disabled={isLoading.refreshing}
+ />
</div>
</div>
<div class="grid gap-4 md:grid-cols-5">
- <StatCard
- title="Total Events"
- value={totalEvents}
- icon={Activity}
- subtitle="All recorded events"
- />
+ <StatCard title="Total Events" value={totalEvents} icon={ActivityIcon} subtitle="All recorded events" />
<StatCard
title="Info"
value={infoEvents}
- icon={Activity}
+ icon={ActivityIcon}
iconColor="text-blue-500"
bgColor="bg-blue-500/10"
subtitle="Information events"
@@ -111,7 +124,7 @@
<StatCard
title="Success"
value={successEvents}
- icon={Activity}
+ icon={ActivityIcon}
iconColor="text-green-500"
bgColor="bg-green-500/10"
subtitle="Successful operations"
@@ -119,7 +132,7 @@
<StatCard
title="Warning"
value={warningEvents}
- icon={Activity}
+ icon={ActivityIcon}
iconColor="text-yellow-500"
bgColor="bg-yellow-500/10"
subtitle="Warning events"
@@ -127,7 +140,7 @@
<StatCard
title="Error"
value={errorEvents}
- icon={Activity}
+ icon={ActivityIcon}
iconColor="text-red-500"
bgColor="bg-red-500/10"
subtitle="Error events"
@@ -135,6 +148,6 @@
</div>
<div class="flex-1 overflow-hidden">
- <EventTable {events} bind:selectedIds bind:requestOptions {onRefresh} {onEventsChanged} />
+ <EventTable bind:events bind:selectedIds bind:requestOptions />
</div>
</div>
diff --git a/frontend/src/routes/events/+page.ts b/frontend/src/routes/events/+page.ts
index f5288854a..305c33d6d 100644
--- a/frontend/src/routes/events/+page.ts
+++ b/frontend/src/routes/events/+page.ts
@@ -14,12 +14,7 @@ export const load: PageLoad = async () => {
}
};
- const events = await eventAPI.listPaginated(
- eventRequestOptions.pagination,
- eventRequestOptions.sort,
- eventRequestOptions.search,
- eventRequestOptions.filters
- );
+ const events = await eventAPI.getEvents(eventRequestOptions);
return { events, eventRequestOptions };
};
diff --git a/frontend/src/routes/events/event-table.svelte b/frontend/src/routes/events/event-table.svelte
index 852e46cd6..df792507a 100644
--- a/frontend/src/routes/events/event-table.svelte
+++ b/frontend/src/routes/events/event-table.svelte
@@ -1,107 +1,56 @@
<script lang="ts">
- import ArcaneTable from '$lib/components/arcane-table.svelte';
- import { Button } from '$lib/components/ui/button/index.js';
- import { Trash2, Activity, Ellipsis } from '@lucide/svelte';
+ import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import * as Card from '$lib/components/ui/card/index.js';
- import { toast } from 'svelte-sonner';
+ import { Button } from '$lib/components/ui/button/index.js';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import EllipsisIcon from '@lucide/svelte/icons/ellipsis';
+ import Trash2Icon from '@lucide/svelte/icons/trash-2';
+ import { toast } from 'svelte-sonner';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
- import * as Table from '$lib/components/ui/table';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { Badge } from '$lib/components/ui/badge';
- import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
+ import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { formatDistanceToNow } from 'date-fns';
import { eventAPI } from '$lib/services/api';
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
import type { Event } from '$lib/types/event.type';
- import { capitalizeFirstLetter } from '$lib/utils/string.utils';
+ import type { ColumnSpec } from '$lib/components/arcane-table';
let {
- events,
+ events = $bindable(),
selectedIds = $bindable(),
- requestOptions = $bindable(),
- onRefresh,
- onEventsChanged
+ requestOptions = $bindable()
}: {
events: Paginated<Event>;
selectedIds: string[];
requestOptions: SearchPaginationSortRequest;
- onRefresh: (options: SearchPaginationSortRequest) => Promise<any>;
- onEventsChanged: () => Promise<void>;
} = $props();
- let isLoading = $state({
- removing: false
- });
-
- type EventWithId = Event & { id: string };
-
- const eventsWithId = $derived(
- (events.data || []).map((event) => ({
- ...event,
- id: event.id
- }))
- );
+ let isLoading = $state({ removing: false });
- const paginatedEvents: Paginated<EventWithId> = $derived({
- data: eventsWithId as EventWithId[],
- pagination: events.pagination
- });
-
- async function handleDeleteSelected() {
- if (selectedIds.length === 0) return;
-
- openConfirmDialog({
- title: `Delete ${selectedIds.length} Event${selectedIds.length > 1 ? 's' : ''}`,
- message: `Are you sure you want to delete the selected event${selectedIds.length > 1 ? 's' : ''}? This action cannot be undone.`,
- confirm: {
- label: 'Delete',
- destructive: true,
- action: async () => {
- isLoading.removing = true;
- let successCount = 0;
- let failureCount = 0;
-
- for (const eventId of selectedIds) {
- const result = await tryCatch(eventAPI.delete(eventId));
- handleApiResultWithCallbacks({
- result,
- message: `Failed to delete event ${eventId}`,
- setLoadingState: () => {},
- onSuccess: () => {
- successCount++;
- }
- });
-
- if (result.error) {
- failureCount++;
- }
- }
-
- isLoading.removing = false;
-
- if (successCount > 0) {
- toast.success(
- `Successfully deleted ${successCount} event${successCount > 1 ? 's' : ''}`
- );
- await onEventsChanged();
- }
-
- if (failureCount > 0) {
- toast.error(`Failed to delete ${failureCount} event${failureCount > 1 ? 's' : ''}`);
- }
+ function getSeverityBadgeVariant(severity: string) {
+ switch (severity) {
+ case 'success':
+ return 'green';
+ case 'error':
+ return 'red';
+ case 'warning':
+ return 'amber';
+ case 'info':
+ default:
+ return 'blue';
+ }
+ }
- selectedIds = [];
- }
- }
- });
+ function formatTimestamp(timestamp: string) {
+ const date = new Date(timestamp);
+ return formatDistanceToNow(date, { addSuffix: true });
}
async function handleDeleteEvent(eventId: string, title: string) {
openConfirmDialog({
- title: `Delete Event`,
+ title: 'Delete Event',
message: `Are you sure you want to delete the event "${title}"? This action cannot be undone.`,
confirm: {
label: 'Delete',
@@ -114,7 +63,12 @@
setLoadingState: (value) => (isLoading.removing = value),
onSuccess: async () => {
toast.success(`Event "${title}" deleted successfully.`);
- await onEventsChanged();
+ events = await eventAPI.listPaginated(
+ requestOptions.pagination,
+ requestOptions.sort,
+ requestOptions.search,
+ requestOptions.filters
+ );
}
});
}
@@ -122,126 +76,109 @@
});
}
- function getSeverityBadgeVariant(severity: string) {
- switch (severity) {
- case 'success':
- return 'green';
- case 'error':
- return 'red';
- case 'warning':
- return 'amber';
- case 'info':
- default:
- return 'blue';
+ const columns = [
+ {
+ accessorKey: 'severity',
+ title: 'Severity',
+ sortable: true,
+ cell: SeverityCell
+ },
+ {
+ accessorKey: 'type',
+ title: 'Type',
+ sortable: true,
+ cell: TypeCell
+ },
+ {
+ id: 'resource',
+ title: 'Resource',
+ cell: ResourceCell
+ },
+ {
+ accessorKey: 'username',
+ title: 'User',
+ sortable: true,
+ cell: UserCell
+ },
+ {
+ accessorKey: 'timestamp',
+ title: 'Time',
+ sortable: true,
+ cell: TimeCell
}
- }
-
- function formatTimestamp(timestamp: string) {
- const date = new Date(timestamp);
- return formatDistanceToNow(date, { addSuffix: true });
- }
+ ] satisfies ColumnSpec<Event>[];
</script>
-{#if eventsWithId.length > 0}
- <Card.Root class="border shadow-sm">
- <Card.Header class="px-6">
- <div class="flex items-center justify-between">
- <Card.Title>Events List</Card.Title>
- <div class="flex items-center gap-2">
- {#if selectedIds.length > 0}
- <ArcaneButton
- action="remove"
- onClick={handleDeleteSelected}
- loading={isLoading.removing}
- disabled={isLoading.removing}
- label="Remove Selected"
- />
- {/if}
- </div>
- </div>
- </Card.Header>
- <Card.Content>
+{#snippet SeverityCell({ value }: { value: unknown })}
+ <StatusBadge text={String(value ?? '')} variant={getSeverityBadgeVariant(String(value ?? 'info'))} />
+{/snippet}
+
+{#snippet TypeCell({ value }: { value: unknown })}
+ <Badge variant="outline">{String(value ?? '-')}</Badge>
+{/snippet}
+
+{#snippet ResourceCell({ item }: { item: Event })}
+ {#if item.resourceType}
+ <div class="space-y-1">
+ <span class="text-sm">{item.resourceType}</span>
+ {#if item.resourceName}
+ <p class="text-muted-foreground text-xs">{item.resourceName}</p>
+ {/if}
+ </div>
+ {:else}
+ -
+ {/if}
+{/snippet}
+
+{#snippet UserCell({ value }: { value: unknown })}
+ {#if String(value ?? '') === 'System'}
+ <span class="text-red-500/50">{String(value ?? '-')}</span>
+ {:else}
+ {String(value ?? '-')}
+ {/if}
+{/snippet}
+
+{#snippet TimeCell({ value }: { value: unknown })}
+ <span class="text-sm">{formatTimestamp(String(value ?? new Date().toISOString()))}</span>
+{/snippet}
+
+{#snippet RowActions({ item }: { item: Event })}
+ <DropdownMenu.Root>
+ <DropdownMenu.Trigger>
+ {#snippet child({ props })}
+ <Button {...props} variant="ghost" size="icon" class="relative size-8 p-0">
+ <span class="sr-only">Open menu</span>
+ <EllipsisIcon />
+ </Button>
+ {/snippet}
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Content align="end">
+ <DropdownMenu.Group>
+ <DropdownMenu.Item
+ variant="destructive"
+ onclick={() => handleDeleteEvent(item.id, item.title)}
+ disabled={isLoading.removing}
+ >
+ <Trash2Icon class="size-4" />
+ Delete
+ </DropdownMenu.Item>
+ </DropdownMenu.Group>
+ </DropdownMenu.Content>
+ </DropdownMenu.Root>
+{/snippet}
+
+<div>
+ <Card.Root>
+ <Card.Content class="py-5">
<ArcaneTable
- items={paginatedEvents}
+ items={events}
bind:requestOptions
bind:selectedIds
- {onRefresh}
- columns={[
- { label: 'Severity', sortColumn: 'severity' },
- { label: 'Type', sortColumn: 'type' },
- { label: 'Resource', sortColumn: 'resourceType' },
- { label: 'User', sortColumn: 'username' },
- { label: 'Time', sortColumn: 'timestamp' },
- { label: ' ' }
- ]}
- filterPlaceholder="Search events..."
- noResultsMessage="No events found"
- >
- {#snippet rows({ item })}
- <Table.Cell>
- <StatusBadge
- text={capitalizeFirstLetter(item.severity)}
- variant={getSeverityBadgeVariant(item.severity)}
- />
- </Table.Cell>
- <Table.Cell>
- <Badge variant="outline">{item.type}</Badge>
- </Table.Cell>
- <Table.Cell>
- {#if item.resourceType}
- <div class="space-y-1">
- <span class="text-sm">{item.resourceType}</span>
- {#if item.resourceName}
- <p class="text-xs text-muted-foreground">{item.resourceName}</p>
- {/if}
- </div>
- {:else}
- -
- {/if}
- </Table.Cell>
- <Table.Cell>
- {#if item.username === 'System'}
- <span class="text-red-500/50">{item.username || '-'}</span>
- {:else}
- {item.username || '-'}
- {/if}
- </Table.Cell>
- <Table.Cell>
- <span class="text-sm">{formatTimestamp(item.timestamp)}</span>
- </Table.Cell>
- <Table.Cell>
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <Button {...props} variant="ghost" size="icon" class="relative size-8 p-0">
- <span class="sr-only">Open menu</span>
- <Ellipsis />
- </Button>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item
- variant="destructive"
- onclick={() => handleDeleteEvent(item.id, item.title)}
- >
- <Trash2 class="size-4" />
- Delete
- </DropdownMenu.Item>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
- </Table.Cell>
- {/snippet}
- </ArcaneTable>
+ onRefresh={async (options) =>
+ (events = await eventAPI.listPaginated(options.pagination, options.sort, options.search, options.filters))}
+ {columns}
+ rowActions={RowActions}
+ />
</Card.Content>
</Card.Root>
-{:else}
- <div class="flex flex-col items-center justify-center px-6 py-12 text-center">
- <Activity class="text-muted-foreground mb-4 size-12 opacity-40" />
- <p class="text-lg font-medium">No events found</p>
- <p class="text-muted-foreground mt-1 max-w-md text-sm">
- Events will appear here as they are generated by system activities
- </p>
- </div>
-{/if}
+</div>
diff --git a/frontend/src/routes/images/+page.svelte b/frontend/src/routes/images/+page.svelte
index 42dc9ed54..9ec768021 100644
--- a/frontend/src/routes/images/+page.svelte
+++ b/frontend/src/routes/images/+page.svelte
@@ -1,27 +1,24 @@
<script lang="ts">
import { Button } from '$lib/components/ui/button/index.js';
- import { AlertCircle, HardDrive, Loader2, Package } from '@lucide/svelte';
- import * as Alert from '$lib/components/ui/alert/index.js';
- import * as Card from '$lib/components/ui/card/index.js';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
+ import PackageIcon from '@lucide/svelte/icons/package';
import { toast } from 'svelte-sonner';
import ImagePullSheet from '$lib/components/sheets/image-pull-sheet.svelte';
- import { formatBytes } from '$lib/utils/bytes.util';
+ import bytes from 'bytes';
import * as Dialog from '$lib/components/ui/dialog/index.js';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import { environmentAPI, imageUpdateAPI } from '$lib/services/api';
import StatCard from '$lib/components/stat-card.svelte';
- import ImageTable from './image-table.svelte';
+ import ImageTableNew from './image-table.svelte';
let { data } = $props();
let images = $state(data.images);
let requestOptions = $state(data.imageRequestOptions);
-
- let error = $state<string | null>(null);
let selectedIds = $state<string[]>([]);
- let isLoadingImages = $state(false);
let isLoading = $state({
pulling: false,
@@ -82,113 +79,77 @@
<p class="text-muted-foreground mt-1 text-sm">View and Manage your Container Images</p>
</div>
<div class="flex items-center gap-2">
+ <ArcaneButton action="pull" customLabel="Pull Image" onclick={() => (isPullDialogOpen = true)} />
+ <ArcaneButton
+ action="inspect"
+ customLabel="Check Updates"
+ onclick={handleTriggerBulkUpdateCheck}
+ loading={isLoading.checking}
+ loadingLabel="Checking..."
+ disabled={isLoading.checking}
+ />
<ArcaneButton
action="remove"
- label="Prune Unused"
- onClick={() => (isConfirmPruneDialogOpen = true)}
+ customLabel="Prune Unused"
+ onclick={() => (isConfirmPruneDialogOpen = true)}
loading={isLoading.pruning}
loadingLabel="Pruning..."
disabled={isLoading.pruning}
/>
<ArcaneButton
action="restart"
- onClick={refreshImages}
- label="Refresh"
+ onclick={refreshImages}
+ customLabel="Refresh"
loading={isLoading.refreshing}
disabled={isLoading.refreshing}
/>
</div>
</div>
- {#if error}
- <Alert.Root variant="destructive">
- <AlertCircle class="mr-2 size-4" />
- <Alert.Title>Error Loading Images</Alert.Title>
- <Alert.Description>{error}</Alert.Description>
- </Alert.Root>
- {/if}
-
- {#if isLoadingImages}
- <Card.Root class="border shadow-sm">
- <Card.Header class="px-6">
- <div class="flex items-center justify-between">
- <div>
- <Card.Title>Images List</Card.Title>
- </div>
- <div class="flex items-center gap-2">
- <div class="bg-muted h-9 w-32 animate-pulse rounded"></div>
- <div class="bg-muted h-9 w-28 animate-pulse rounded"></div>
- </div>
- </div>
- </Card.Header>
- <Card.Content>
- <div class="flex flex-col items-center justify-center px-6 py-12 text-center">
- <Loader2 class="text-muted-foreground mb-4 size-8 animate-spin" />
- <p class="text-lg font-medium">Loading Images...</p>
- <p class="text-muted-foreground mt-1 text-sm">Please wait while we fetch your images</p>
- </div>
- </Card.Content>
- </Card.Root>
- {:else}
- <div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
- <StatCard
- title="Total Images"
- value={images.pagination.totalItems}
- icon={HardDrive}
- iconColor="text-blue-500"
- class="border-l-4 border-l-blue-500"
- />
- <StatCard
- title="Total Size"
- value={formatBytes(data.totalSize)}
- icon={Package}
- iconColor="text-amber-500"
- class="border-l-4 border-l-amber-500"
- />
- </div>
-
- <ImageTable
- bind:images
- bind:selectedIds
- bind:requestOptions
- onPullDialogOpen={() => (isPullDialogOpen = true)}
- onTriggerBulkUpdateCheck={handleTriggerBulkUpdateCheck}
+ <div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
+ <StatCard
+ title="Total Images"
+ value={images.pagination.totalItems}
+ icon={HardDriveIcon}
+ iconColor="text-blue-500"
+ class="border-l-4 border-l-blue-500"
/>
-
- <ImagePullSheet
- bind:open={isPullDialogOpen}
- onPullFinished={async () => (images = await environmentAPI.getImages(requestOptions))}
+ <StatCard
+ title="Total Size"
+ value={String(bytes.format(data.totalSize))}
+ icon={PackageIcon}
+ iconColor="text-amber-500"
+ class="border-l-4 border-l-amber-500"
/>
-
- <Dialog.Root bind:open={isConfirmPruneDialogOpen}>
- <Dialog.Content>
- <Dialog.Header>
- <Dialog.Title>Prune Unused Images</Dialog.Title>
- <Dialog.Description>
- Are you sure you want to remove all unused (dangling) Docker images? This will free up
- disk space but cannot be undone. Images actively used by containers will not be
- affected.
- </Dialog.Description>
- </Dialog.Header>
- <div class="flex justify-end gap-3 pt-6">
- <Button
- variant="outline"
- onclick={() => (isConfirmPruneDialogOpen = false)}
- disabled={isLoading.pruning}
- >
- Cancel
- </Button>
- <Button variant="destructive" onclick={handlePruneImages} disabled={isLoading.pruning}>
- {#if isLoading.pruning}
- <Loader2 class="mr-2 size-4 animate-spin" /> Prune Images
- {:else}
- Prune Images
- {/if}
- </Button>
- </div>
- </Dialog.Content>
- </Dialog.Root>
- {/if}
+ </div>
+ <ImageTableNew bind:images bind:selectedIds bind:requestOptions />
+
+ <ImagePullSheet
+ bind:open={isPullDialogOpen}
+ onPullFinished={async () => (images = await environmentAPI.getImages(requestOptions))}
+ />
+
+ <Dialog.Root bind:open={isConfirmPruneDialogOpen}>
+ <Dialog.Content>
+ <Dialog.Header>
+ <Dialog.Title>Prune Unused Images</Dialog.Title>
+ <Dialog.Description>
+ Are you sure you want to remove all unused (dangling) Docker images? This will free up disk space but cannot be undone.
+ Images actively used by containers will not be affected.
+ </Dialog.Description>
+ </Dialog.Header>
+ <div class="flex justify-end gap-3 pt-6">
+ <Button variant="outline" onclick={() => (isConfirmPruneDialogOpen = false)} disabled={isLoading.pruning}>Cancel</Button>
+ <Button variant="destructive" onclick={handlePruneImages} disabled={isLoading.pruning}>
+ {#if isLoading.pruning}
+ <LoaderCircleIcon class="mr-2 size-4 animate-spin" /> Prune Images
+ {:else}
+ Prune Images
+ {/if}
+ </Button>
+ </div>
+ </Dialog.Content>
+ </Dialog.Root>
</div>
<style>
diff --git a/frontend/src/routes/images/[imageId]/+page.svelte b/frontend/src/routes/images/[imageId]/+page.svelte
index 7e7506eb4..32640474c 100644
--- a/frontend/src/routes/images/[imageId]/+page.svelte
+++ b/frontend/src/routes/images/[imageId]/+page.svelte
@@ -1,21 +1,25 @@
<script lang="ts">
- import type { PageData } from './$types';
import * as Card from '$lib/components/ui/card/index.js';
- import { HardDrive, Clock, Tag, Layers, Hash, Cpu } from '@lucide/svelte';
+ import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
+ import ClockIcon from '@lucide/svelte/icons/clock';
+ import TagIcon from '@lucide/svelte/icons/tag';
+ import LayersIcon from '@lucide/svelte/icons/layers';
+ import HashIcon from '@lucide/svelte/icons/hash';
+ import CpuIcon from '@lucide/svelte/icons/cpu';
import * as Breadcrumb from '$lib/components/ui/breadcrumb/index.js';
import { goto } from '$app/navigation';
import { Separator } from '$lib/components/ui/separator/index.js';
import { Badge } from '$lib/components/ui/badge/index.js';
- import { formatDate } from '$lib/utils/string.utils';
- import { formatBytes } from '$lib/utils/bytes.util';
+ import { format } from 'date-fns';
+ import bytes from 'bytes';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
import { toast } from 'svelte-sonner';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import { environmentAPI } from '$lib/services/api';
- let { data }: { data: PageData } = $props();
+ let { data } = $props();
let { image } = $derived(data);
let isLoading = $state({
@@ -35,13 +39,13 @@
if (isNaN(date.getTime())) {
return 'N/A';
}
- return formatDate(date.toISOString());
+ return format(date, 'PP p');
} catch {
return 'N/A';
}
});
- const imageSize = $derived(formatBytes(image?.size || 0));
+ const imageSize = $derived(bytes.format(image?.size || 0));
const architecture = $derived(image?.architecture || 'N/A');
const osName = $derived(image?.os || 'N/A');
@@ -83,7 +87,7 @@
</Breadcrumb.List>
</Breadcrumb.Root>
<div class="mt-2 flex items-center gap-2">
- <h1 class="text-2xl font-bold tracking-tight break-all">
+ <h1 class="break-all text-2xl font-bold tracking-tight">
{image?.repoTags?.[0] || shortId}
</h1>
</div>
@@ -92,7 +96,7 @@
<div class="flex flex-wrap gap-2">
<ArcaneButton
action="remove"
- onClick={() => handleImageRemove(image.id)}
+ onclick={() => handleImageRemove(image.id)}
loading={isLoading.removing}
disabled={isLoading.removing}
size="sm"
@@ -110,10 +114,8 @@
<div class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
<!-- ID -->
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-500/10 p-2"
- >
- <Hash class="size-5 text-gray-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-500/10 p-2">
+ <HashIcon class="size-5 text-gray-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">ID</p>
@@ -123,10 +125,8 @@
<!-- Size -->
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-blue-500/10 p-2"
- >
- <HardDrive class="size-5 text-blue-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-blue-500/10 p-2">
+ <HardDriveIcon class="size-5 text-blue-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">Size</p>
@@ -136,10 +136,8 @@
<!-- Created -->
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-green-500/10 p-2"
- >
- <Clock class="size-5 text-green-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-green-500/10 p-2">
+ <ClockIcon class="size-5 text-green-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">Created</p>
@@ -149,10 +147,8 @@
<!-- Architecture -->
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-orange-500/10 p-2"
- >
- <Cpu class="size-5 text-orange-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-orange-500/10 p-2">
+ <CpuIcon class="size-5 text-orange-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">Architecture</p>
@@ -162,10 +158,8 @@
<!-- OS -->
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-indigo-500/10 p-2"
- >
- <Layers class="size-5 text-indigo-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-indigo-500/10 p-2">
+ <LayersIcon class="size-5 text-indigo-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">OS</p>
@@ -180,9 +174,7 @@
{#if image.repoTags && image.repoTags.length > 0}
<Card.Root class="border shadow-sm">
<Card.Header>
- <Card.Title class="flex items-center gap-2"
- ><Tag class="text-muted-foreground size-5" /> Tags</Card.Title
- >
+ <Card.Title class="flex items-center gap-2"><TagIcon class="text-muted-foreground size-5" /> Tags</Card.Title>
</Card.Header>
<Card.Content>
<div class="flex flex-wrap gap-2">
@@ -205,10 +197,8 @@
{@const [key, ...valueParts] = env.split('=')}
{@const value = valueParts.join('=')}
<div class="flex flex-col text-sm sm:flex-row sm:items-center">
- <span class="text-muted-foreground w-full font-medium break-all sm:w-1/4"
- >{key}:</span
- >
- <span class="w-full font-mono text-xs break-all sm:w-3/4 sm:text-sm">{value}</span>
+ <span class="text-muted-foreground w-full break-all font-medium sm:w-1/4">{key}:</span>
+ <span class="w-full break-all font-mono text-xs sm:w-3/4 sm:text-sm">{value}</span>
</div>
{#if env !== image.config.env[image.config.env.length - 1]}
<Separator class="my-2" />
@@ -221,13 +211,7 @@
{:else}
<div class="py-12 text-center">
<p class="text-muted-foreground text-lg font-medium">Image not found.</p>
- <ArcaneButton
- action="cancel"
- customLabel="Back to Images"
- onClick={() => goto('/images')}
- size="sm"
- class="mt-4"
- />
+ <ArcaneButton action="cancel" customLabel="Back to Images" onclick={() => goto('/images')} size="sm" class="mt-4" />
</div>
{/if}
</div>
diff --git a/frontend/src/routes/images/image-table.svelte b/frontend/src/routes/images/image-table.svelte
index bb1c13d5c..8d328b8a4 100644
--- a/frontend/src/routes/images/image-table.svelte
+++ b/frontend/src/routes/images/image-table.svelte
@@ -1,46 +1,37 @@
<script lang="ts">
- import ArcaneTable from '$lib/components/arcane-table.svelte';
+ import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import { Button } from '$lib/components/ui/button/index.js';
- import { Download, HardDrive, Trash2, Loader2, Ellipsis, ScanSearch } from '@lucide/svelte';
+ import DownloadIcon from '@lucide/svelte/icons/download';
+ import Trash2Icon from '@lucide/svelte/icons/trash-2';
+ import EllipsisIcon from '@lucide/svelte/icons/ellipsis';
+ import ScanSearchIcon from '@lucide/svelte/icons/scan-search';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
import * as Card from '$lib/components/ui/card/index.js';
import { goto } from '$app/navigation';
import { toast } from 'svelte-sonner';
- import { formatBytes } from '$lib/utils/bytes.util';
+ import bytes from 'bytes';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
- import * as Table from '$lib/components/ui/table';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
import ImageUpdateItem from '$lib/components/image-update-item.svelte';
import { environmentAPI } from '$lib/services/api';
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
- import FilterDropdown from '$lib/components/dropdowns/filter-dropdown.svelte';
import type { ImageSummaryDto } from '$lib/types/image.type';
- import { formatFriendlyDate } from '$lib/utils/date.utils';
+ import { format } from 'date-fns';
+ import type { ColumnSpec } from '$lib/components/arcane-table';
let {
images = $bindable(),
selectedIds = $bindable(),
- requestOptions = $bindable(),
- onPullDialogOpen,
- onTriggerBulkUpdateCheck
+ requestOptions = $bindable()
}: {
images: Paginated<ImageSummaryDto>;
selectedIds: string[];
requestOptions: SearchPaginationSortRequest;
- onPullDialogOpen: () => void;
- onTriggerBulkUpdateCheck: () => Promise<void>;
} = $props();
- let imageFilters = $state({
- showUsed: true,
- showUnused: true,
- showWithUpdates: true,
- showWithoutUpdates: true
- });
-
let isLoading = $state({
removing: false,
checking: false
@@ -48,65 +39,12 @@
let isPullingInline = $state<Record<string, boolean>>({});
- const filteredImages: Paginated<ImageSummaryDto> = $derived({
- ...images,
- data: images.data.filter((img) => {
- // Usage filtering
- const showBecauseUsed = imageFilters.showUsed && img.inUse;
- const showBecauseUnused = imageFilters.showUnused && !img.inUse;
- const usageMatch = showBecauseUsed || showBecauseUnused;
-
- // Update status filtering
- const updateStatus = getImageUpdateStatus(img.updateInfo);
- const showBecauseHasUpdates = imageFilters.showWithUpdates && updateStatus === 'has-updates';
- const showBecauseNoUpdates = imageFilters.showWithoutUpdates && updateStatus === 'no-updates';
- const updateMatch = showBecauseHasUpdates || showBecauseNoUpdates;
-
- return usageMatch && updateMatch;
- })
- });
-
- function getImageUpdateStatus(updateInfo: any): 'has-updates' | 'no-updates' {
- if (!updateInfo) return 'no-updates';
-
- if (updateInfo.error) return 'no-updates';
-
- return updateInfo.hasUpdate === true ? 'has-updates' : 'no-updates';
- }
-
- async function deleteImage(id: string) {
- openConfirmDialog({
- title: 'Remove Image',
- message: 'Are you sure you want to remove this image? This action cannot be undone.',
- confirm: {
- label: 'Remove',
- destructive: true,
- action: async () => {
- isLoading.removing = true;
-
- const result = await tryCatch(environmentAPI.deleteImage(id));
- handleApiResultWithCallbacks({
- result,
- message: 'Failed to remove image',
- setLoadingState: () => {},
- onSuccess: async () => {
- toast.success('Image removed successfully');
- images = await environmentAPI.getImages(requestOptions);
- }
- });
-
- isLoading.removing = false;
- }
- }
- });
- }
-
- async function handleDeleteSelected() {
- if (selectedIds.length === 0) return;
+ async function handleDeleteSelected(ids: string[]) {
+ if (!ids || ids.length === 0) return;
openConfirmDialog({
- title: `Remove ${selectedIds.length} Image${selectedIds.length > 1 ? 's' : ''}`,
- message: `Are you sure you want to remove the selected image${selectedIds.length > 1 ? 's' : ''}? This action cannot be undone.`,
+ title: `Remove ${ids.length} Image${ids.length > 1 ? 's' : ''}`,
+ message: `Are you sure you want to remove the selected image${ids.length > 1 ? 's' : ''}? This action cannot be undone.`,
confirm: {
label: 'Remove',
destructive: true,
@@ -115,7 +53,7 @@
let successCount = 0;
let failureCount = 0;
- for (const id of selectedIds) {
+ for (const id of ids) {
const result = await tryCatch(environmentAPI.deleteImage(id));
handleApiResultWithCallbacks({
result,
@@ -125,21 +63,15 @@
successCount++;
}
});
-
- if (result.error) {
- failureCount++;
- }
+ if (result.error) failureCount++;
}
isLoading.removing = false;
if (successCount > 0) {
- toast.success(
- `Successfully removed ${successCount} image${successCount > 1 ? 's' : ''}`
- );
+ toast.success(`Successfully removed ${successCount} image${successCount > 1 ? 's' : ''}`);
images = await environmentAPI.getImages(requestOptions);
}
-
if (failureCount > 0) {
toast.error(`Failed to remove ${failureCount} image${failureCount > 1 ? 's' : ''}`);
}
@@ -150,6 +82,33 @@
});
}
+ async function deleteImage(id: string) {
+ openConfirmDialog({
+ title: 'Remove Image',
+ message: 'Are you sure you want to remove this image? This action cannot be undone.',
+ confirm: {
+ label: 'Remove',
+ destructive: true,
+ action: async () => {
+ isLoading.removing = true;
+
+ const result = await tryCatch(environmentAPI.deleteImage(id));
+ handleApiResultWithCallbacks({
+ result,
+ message: 'Failed to remove image',
+ setLoadingState: () => {},
+ onSuccess: async () => {
+ toast.success('Image removed successfully');
+ images = await environmentAPI.getImages(requestOptions);
+ }
+ });
+
+ isLoading.removing = false;
+ }
+ }
+ });
+ }
+
async function handleInlineImagePull(imageId: string, repoTag: string) {
if (!repoTag || repoTag === '<none>:<none>') {
toast.error('Cannot pull image without repository tag');
@@ -172,12 +131,6 @@
isPullingInline[imageId] = false;
}
- async function handleTriggerBulkUpdateCheckInternal() {
- isLoading.checking = true;
- await onTriggerBulkUpdateCheck();
- isLoading.checking = false;
- }
-
function extractRepoAndTag(repoTags: string[] | undefined) {
if (!repoTags || repoTags.length === 0 || repoTags[0] === '<none>:<none>') {
return { repo: '<none>', tag: '<none>' };
@@ -185,206 +138,134 @@
const repoTag = repoTags[0];
const lastColonIndex = repoTag.lastIndexOf(':');
-
- if (lastColonIndex === -1) {
- return { repo: repoTag, tag: 'latest' };
- }
+ if (lastColonIndex === -1) return { repo: repoTag, tag: 'latest' };
const repo = repoTag.substring(0, lastColonIndex);
const tag = repoTag.substring(lastColonIndex + 1);
-
return { repo: repo || '<none>', tag: tag || '<none>' };
}
+
+ const columns = [
+ { accessorKey: 'id', title: 'ID', hidden: true },
+ { accessorKey: 'repoTags', title: 'Repository', sortable: true, cell: RepoCell },
+ { id: 'imageId', title: 'Image ID', cell: ImageIdCell },
+ { accessorKey: 'size', title: 'Size', sortable: true, cell: SizeCell },
+ { accessorKey: 'created', title: 'Created', sortable: true, cell: CreatedCell },
+ {
+ accessorKey: 'inUse',
+ title: 'Status',
+ sortable: true,
+ cell: StatusCell,
+ filterFn: (row, columnId, filterValue) => {
+ const selected = Array.isArray(filterValue) ? (filterValue as boolean[]) : [];
+ if (selected.length === 0) return true;
+ const value = Boolean(row.getValue<boolean>(columnId));
+ return selected.includes(value);
+ }
+ },
+ {
+ id: 'updates',
+ accessorFn: (row) => row.updateInfo?.hasUpdate ?? false,
+ title: 'Updates',
+ cell: UpdatesCell,
+ filterFn: (row, columnId, filterValue) => {
+ const selected = Array.isArray(filterValue) ? (filterValue as boolean[]) : [];
+ if (selected.length === 0) return true;
+
+ const hasUpdate = row.getValue(columnId) as boolean;
+ return selected.includes(hasUpdate);
+ }
+ }
+ ] satisfies ColumnSpec<ImageSummaryDto>[];
</script>
-{#if images.data.length > 0}
- <Card.Root class="border shadow-sm">
- <Card.Header class="px-6">
- <div class="flex items-center justify-between">
- <div>
- <Card.Title>Images List</Card.Title>
- </div>
- <div class="flex items-center gap-2">
- <FilterDropdown bind:filters={imageFilters}>
- {#snippet children({ filters })}
- <DropdownMenu.Label>Image Usage</DropdownMenu.Label>
- <DropdownMenu.CheckboxItem
- checked={filters.showUsed}
- onCheckedChange={(checked) => {
- filters.showUsed = checked;
- }}
- >
- Show Used Images
- </DropdownMenu.CheckboxItem>
- <DropdownMenu.CheckboxItem
- checked={filters.showUnused}
- onCheckedChange={(checked) => {
- filters.showUnused = checked;
- }}
- >
- Show Unused Images
- </DropdownMenu.CheckboxItem>
- <DropdownMenu.Separator />
- <DropdownMenu.Label>Update Status</DropdownMenu.Label>
- <DropdownMenu.CheckboxItem
- checked={filters.showWithUpdates}
- onCheckedChange={(checked) => {
- filters.showWithUpdates = checked;
- }}
- >
- Show Images with Updates
- </DropdownMenu.CheckboxItem>
- <DropdownMenu.CheckboxItem
- checked={filters.showWithoutUpdates}
- onCheckedChange={(checked) => {
- filters.showWithoutUpdates = checked;
- }}
- >
- Show Images without Updates
- </DropdownMenu.CheckboxItem>
- {/snippet}
- </FilterDropdown>
- {#if selectedIds.length > 0}
- <ArcaneButton
- action="remove"
- onClick={() => handleDeleteSelected()}
- loading={isLoading.removing}
- disabled={isLoading.removing}
- label="Remove Selected"
- />
- {/if}
- <ArcaneButton action="pull" label="Pull Image" onClick={onPullDialogOpen} />
- <ArcaneButton
- action="inspect"
- label="Check Updates"
- onClick={handleTriggerBulkUpdateCheckInternal}
- loading={isLoading.checking}
- loadingLabel="Checking..."
- disabled={isLoading.checking}
- />
- </div>
- </div>
- </Card.Header>
- <Card.Content>
- {#if filteredImages.data.length > 0}
- <ArcaneTable
- items={filteredImages}
- bind:requestOptions
- bind:selectedIds
- onRefresh={async (options) => (images = await environmentAPI.getImages(options))}
- columns={[
- { label: 'Repository', sortColumn: 'repoTags' },
- { label: 'Image ID' },
- { label: 'Size', sortColumn: 'size' },
- { label: 'Created', sortColumn: 'created' },
- { label: 'Status', sortColumn: 'inUse' },
- { label: 'Updates' },
- { label: ' ' }
- ]}
- filterPlaceholder="Search images..."
- noResultsMessage="No images found"
+{#snippet RepoCell({ item }: { item: ImageSummaryDto })}
+ {#if item.repoTags && item.repoTags.length > 0 && item.repoTags[0] !== '<none>:<none>'}
+ <a class="font-medium hover:underline" href="/images/{item.id}/">{item.repoTags[0]}</a>
+ {:else}
+ <span class="text-muted-foreground italic">Untagged</span>
+ {/if}
+{/snippet}
+
+{#snippet ImageIdCell({ item }: { item: ImageSummaryDto })}
+ <code class="bg-muted rounded px-2 py-1 text-xs">{item.id?.substring(7, 19) || 'N/A'}</code>
+{/snippet}
+
+{#snippet SizeCell({ value }: { value: unknown })}
+ {bytes.format(Number(value ?? 0))}
+{/snippet}
+
+{#snippet CreatedCell({ value }: { value: unknown })}
+ {format(new Date(Number(value || 0) * 1000), 'PP p')}
+{/snippet}
+
+{#snippet StatusCell({ item }: { item: ImageSummaryDto })}
+ {#if item.inUse}
+ <StatusBadge text="In Use" variant="green" />
+ {:else}
+ <StatusBadge text="Unused" variant="amber" />
+ {/if}
+{/snippet}
+
+{#snippet UpdatesCell({ item }: { item: ImageSummaryDto })}
+ {@const { repo, tag } = extractRepoAndTag(item.repoTags)}
+ <ImageUpdateItem updateInfo={item.updateInfo} imageId={item.id} {repo} {tag} />
+{/snippet}
+
+{#snippet RowActions({ item }: { item: ImageSummaryDto })}
+ <DropdownMenu.Root>
+ <DropdownMenu.Trigger>
+ {#snippet child({ props })}
+ <Button {...props} variant="ghost" size="icon" class="relative size-8 p-0">
+ <span class="sr-only">Open menu</span>
+ <EllipsisIcon />
+ </Button>
+ {/snippet}
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Content align="end">
+ <DropdownMenu.Group>
+ <DropdownMenu.Item onclick={() => goto(`/images/${item.id}`)}>
+ <ScanSearchIcon class="size-4" />
+ Inspect
+ </DropdownMenu.Item>
+ <DropdownMenu.Item
+ onclick={() => handleInlineImagePull(item.id, item.repoTags?.[0] || '')}
+ disabled={isPullingInline[item.id] || !item.repoTags?.[0]}
>
- {#snippet rows({ item })}
- {@const { repo, tag } = extractRepoAndTag(item.repoTags)}
- <Table.Cell>
- {#if item.repoTags && item.repoTags.length > 0 && item.repoTags[0] !== '<none>:<none>'}
- <a class="font-medium hover:underline" href="/images/{item.id}/"
- >{item.repoTags[0]}</a
- >
- {:else}
- <span class="text-muted-foreground italic">Untagged</span>
- {/if}
- </Table.Cell>
- <Table.Cell>
- <code class="bg-muted rounded px-2 py-1 text-xs"
- >{item.id?.substring(7, 19) || 'N/A'}</code
- >
- </Table.Cell>
- <Table.Cell class="py-3 md:py-3.5">{formatBytes(item.size)}</Table.Cell>
- <Table.Cell
- >{formatFriendlyDate(new Date((item.created || 0) * 1000).toISOString())}</Table.Cell
- >
- <Table.Cell>
- {#if item.inUse}
- <StatusBadge text="In Use" variant="green" />
- {:else}
- <StatusBadge text="Unused" variant="amber" />
- {/if}
- </Table.Cell>
- <Table.Cell>
- <ImageUpdateItem updateInfo={item.updateInfo} imageId={item.id} {repo} {tag} />
- </Table.Cell>
- <Table.Cell>
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <Button {...props} variant="ghost" size="icon" class="relative size-8 p-0">
- <span class="sr-only">Open menu</span>
- <Ellipsis />
- </Button>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item onclick={() => goto(`/images/${item.id}`)}>
- <ScanSearch class="size-4" />
- Inspect
- </DropdownMenu.Item>
- <DropdownMenu.Item
- onclick={() => handleInlineImagePull(item.id, item.repoTags?.[0] || '')}
- disabled={isPullingInline[item.id] || !item.repoTags?.[0]}
- >
- {#if isPullingInline[item.id]}
- <Loader2 class="size-4 animate-spin" />
- Pulling...
- {:else}
- <Download class="size-4" />
- Pull
- {/if}
- </DropdownMenu.Item>
- <DropdownMenu.Separator />
- <DropdownMenu.Item
- variant="destructive"
- onclick={() => deleteImage(item.id)}
- disabled={isLoading.removing}
- >
- {#if isLoading.removing}
- <Loader2 class="size-4 animate-spin" />
- {:else}
- <Trash2 class="size-4" />
- {/if}
- Remove
- </DropdownMenu.Item>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
- </Table.Cell>
- {/snippet}
- </ArcaneTable>
- {:else}
- <div class="flex flex-col items-center justify-center px-6 py-12 text-center">
- <HardDrive class="text-muted-foreground mb-4 size-12 opacity-40" />
- <p class="text-lg font-medium">No images match current filters</p>
- <p class="text-muted-foreground mt-1 max-w-md text-sm">
- Adjust your filters to see images, or pull new images using the "Pull Image" button
- above
- </p>
- </div>
- {/if}
+ {#if isPullingInline[item.id]}
+ <LoaderCircleIcon class="size-4 animate-spin" />
+ Pulling...
+ {:else}
+ <DownloadIcon class="size-4" />
+ Pull
+ {/if}
+ </DropdownMenu.Item>
+ <DropdownMenu.Separator />
+ <DropdownMenu.Item variant="destructive" onclick={() => deleteImage(item.id)} disabled={isLoading.removing}>
+ {#if isLoading.removing}
+ <LoaderCircleIcon class="size-4 animate-spin" />
+ {:else}
+ <Trash2Icon class="size-4" />
+ {/if}
+ Remove
+ </DropdownMenu.Item>
+ </DropdownMenu.Group>
+ </DropdownMenu.Content>
+ </DropdownMenu.Root>
+{/snippet}
+
+<div>
+ <Card.Root>
+ <Card.Content class="py-5">
+ <ArcaneTable
+ items={images}
+ bind:requestOptions
+ bind:selectedIds
+ onRemoveSelected={(ids) => handleDeleteSelected(ids)}
+ onRefresh={async (options) => (images = await environmentAPI.getImages(options))}
+ {columns}
+ rowActions={RowActions}
+ />
</Card.Content>
</Card.Root>
-{:else}
- <div class="flex flex-col items-center justify-center px-6 py-12 text-center">
- <HardDrive class="text-muted-foreground mb-4 size-12 opacity-40" />
- <p class="text-lg font-medium">No images found</p>
- <p class="text-muted-foreground mt-1 max-w-md text-sm">
- Pull an image using the "Pull Image" button above
- </p>
- <div class="mt-4 flex gap-3">
- <Button variant="outline" onclick={onPullDialogOpen}>
- <Download class="size-4" />
- Pull Image
- </Button>
- </div>
- </div>
-{/if}
+</div>
diff --git a/frontend/src/routes/networks/+page.svelte b/frontend/src/routes/networks/+page.svelte
index dfa471ac1..feb5f757e 100644
--- a/frontend/src/routes/networks/+page.svelte
+++ b/frontend/src/routes/networks/+page.svelte
@@ -1,12 +1,13 @@
<script lang="ts">
- import { Network, EthernetPort } from '@lucide/svelte';
+ import NetworkIcon from '@lucide/svelte/icons/network';
+ import EthernetPortIcon from '@lucide/svelte/icons/ethernet-port';
import { toast } from 'svelte-sonner';
import type { NetworkCreateOptions } from 'dockerode';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
import CreateNetworkSheet from '$lib/components/sheets/create-network-sheet.svelte';
import { environmentAPI } from '$lib/services/api';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import StatCard from '$lib/components/stat-card.svelte';
import NetworkTable from './network-table.svelte';
@@ -59,10 +60,11 @@
<p class="text-muted-foreground mt-1 text-sm">Manage your Docker networks</p>
</div>
<div class="flex items-center gap-2">
+ <ArcaneButton action="create" customLabel="Create Network" onclick={() => (isCreateDialogOpen = true)} />
<ArcaneButton
action="restart"
- onClick={refreshNetworks}
- label="Refresh"
+ onclick={refreshNetworks}
+ customLabel="Refresh"
loading={isLoading.refresh}
disabled={isLoading.refresh}
/>
@@ -73,29 +75,20 @@
<StatCard
title="Total Networks"
value={totalNetworks}
- icon={Network}
+ icon={NetworkIcon}
iconColor="text-blue-500"
class="border-l-4 border-l-blue-500"
/>
<StatCard
title="Bridge Networks"
value={bridgeNetworks}
- icon={EthernetPort}
+ icon={EthernetPortIcon}
iconColor="text-green-500"
class="border-l-4 border-l-green-500"
/>
</div>
- <NetworkTable
- bind:networks
- bind:selectedIds
- bind:requestOptions
- onCreateNetwork={() => (isCreateDialogOpen = true)}
- />
+ <NetworkTable bind:networks bind:selectedIds bind:requestOptions />
- <CreateNetworkSheet
- bind:open={isCreateDialogOpen}
- isLoading={isLoading.create}
- onSubmit={handleCreateNetworkSubmit}
- />
+ <CreateNetworkSheet bind:open={isCreateDialogOpen} isLoading={isLoading.create} onSubmit={handleCreateNetworkSubmit} />
</div>
diff --git a/frontend/src/routes/networks/[networkId]/+page.svelte b/frontend/src/routes/networks/[networkId]/+page.svelte
index 5defcc50c..adcccd6e5 100644
--- a/frontend/src/routes/networks/[networkId]/+page.svelte
+++ b/frontend/src/routes/networks/[networkId]/+page.svelte
@@ -1,27 +1,24 @@
<script lang="ts">
import type { PageData } from './$types';
import * as Card from '$lib/components/ui/card/index.js';
- import {
- AlertCircle,
- HardDrive,
- Clock,
- Tag,
- Layers,
- Hash,
- Network,
- Globe,
- Settings,
- ListTree,
- Container
- } from '@lucide/svelte';
+ import CircleAlertIcon from '@lucide/svelte/icons/alert-circle';
+ import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
+ import ClockIcon from '@lucide/svelte/icons/clock';
+ import TagIcon from '@lucide/svelte/icons/tag';
+ import LayersIcon from '@lucide/svelte/icons/layers';
+ import HashIcon from '@lucide/svelte/icons/hash';
+ import NetworkIcon from '@lucide/svelte/icons/network';
+ import GlobeIcon from '@lucide/svelte/icons/globe';
+ import SettingsIcon from '@lucide/svelte/icons/settings';
+ import ListTreeIcon from '@lucide/svelte/icons/list-tree';
+ import ContainerIcon from '@lucide/svelte/icons/container';
import * as Breadcrumb from '$lib/components/ui/breadcrumb/index.js';
import * as Alert from '$lib/components/ui/alert/index.js';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
- import { formatDate } from '$lib/utils/string.utils';
- import type { NetworkInspectInfo } from 'dockerode';
+ import { format } from 'date-fns';
import { toast } from 'svelte-sonner';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import { goto } from '$app/navigation';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
@@ -35,14 +32,10 @@
let isRemoving = $state(false);
const shortId = $derived(network?.id?.substring(0, 12) || 'N/A');
- const createdDate = $derived(network?.created ? formatDate(network.created) : 'N/A');
- const connectedContainers = $derived(
- network?.containers ? Object.values(network.containers) : []
- );
+ const createdDate = $derived(network?.created ? format(new Date(network.created), 'PP p') : 'N/A');
+ const connectedContainers = $derived(network?.containers ? Object.values(network.containers) : []);
const inUse = $derived(connectedContainers.length > 0);
- const isPredefined = $derived(
- network?.name === 'bridge' || network?.name === 'host' || network?.name === 'none'
- );
+ const isPredefined = $derived(network?.name === 'bridge' || network?.name === 'host' || network?.name === 'none');
function triggerRemove() {
if (isPredefined) {
@@ -127,10 +120,9 @@
<ArcaneButton
action="remove"
customLabel="Remove Network"
- onClick={triggerRemove}
+ onclick={triggerRemove}
loading={isRemoving}
disabled={isRemoving || isPredefined}
- label={isPredefined ? 'Cannot remove predefined networks' : 'Delete Network'}
/>
</div>
</div>
@@ -138,7 +130,7 @@
{#if errorMessage}
<Alert.Root variant="destructive">
- <AlertCircle class="mr-2 size-4" />
+ <CircleAlertIcon class="mr-2 size-4" />
<Alert.Title>Action Failed</Alert.Title>
<Alert.Description>{errorMessage}</Alert.Description>
</Alert.Root>
@@ -149,7 +141,7 @@
<Card.Root class="border shadow-sm">
<Card.Header class="pb-0">
<Card.Title class="flex items-center gap-2 text-lg">
- <Network class="text-primary size-5" />
+ <NetworkIcon class="text-primary size-5" />
Network Details
</Card.Title>
<Card.Description>Basic information about this Docker network</Card.Description>
@@ -157,10 +149,8 @@
<Card.Content class="pt-6">
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-2 lg:grid-cols-3">
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-500/10 p-2"
- >
- <Hash class="size-5 text-gray-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-500/10 p-2">
+ <HashIcon class="size-5 text-gray-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">ID</p>
@@ -169,22 +159,18 @@
</div>
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-blue-500/10 p-2"
- >
- <Network class="size-5 text-blue-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-blue-500/10 p-2">
+ <NetworkIcon class="size-5 text-blue-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">Name</p>
- <p class="mt-1 text-base font-semibold break-words">{network.name}</p>
+ <p class="mt-1 break-words text-base font-semibold">{network.name}</p>
</div>
</div>
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-orange-500/10 p-2"
- >
- <HardDrive class="size-5 text-orange-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-orange-500/10 p-2">
+ <HardDriveIcon class="size-5 text-orange-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">Driver</p>
@@ -193,10 +179,8 @@
</div>
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-purple-500/10 p-2"
- >
- <Globe class="size-5 text-purple-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-purple-500/10 p-2">
+ <GlobeIcon class="size-5 text-purple-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">Scope</p>
@@ -205,10 +189,8 @@
</div>
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-green-500/10 p-2"
- >
- <Clock class="size-5 text-green-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-green-500/10 p-2">
+ <ClockIcon class="size-5 text-green-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">Created</p>
@@ -217,52 +199,37 @@
</div>
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-yellow-500/10 p-2"
- >
- <Layers class="size-5 text-yellow-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-yellow-500/10 p-2">
+ <LayersIcon class="size-5 text-yellow-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">Attachable</p>
<p class="mt-1 text-base font-semibold">
- <StatusBadge
- variant={network.attachable ? 'green' : 'gray'}
- text={network.attachable ? 'Yes' : 'No'}
- />
+ <StatusBadge variant={network.attachable ? 'green' : 'gray'} text={network.attachable ? 'Yes' : 'No'} />
</p>
</div>
</div>
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-red-500/10 p-2"
- >
- <Settings class="size-5 text-red-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-red-500/10 p-2">
+ <SettingsIcon class="size-5 text-red-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">Internal</p>
<p class="mt-1 text-base font-semibold">
- <StatusBadge
- variant={network.internal ? 'blue' : 'gray'}
- text={network.internal ? 'Yes' : 'No'}
- />
+ <StatusBadge variant={network.internal ? 'blue' : 'gray'} text={network.internal ? 'Yes' : 'No'} />
</p>
</div>
</div>
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-indigo-500/10 p-2"
- >
- <ListTree class="size-5 text-indigo-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-indigo-500/10 p-2">
+ <ListTreeIcon class="size-5 text-indigo-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">IPv6 Enabled</p>
<p class="mt-1 text-base font-semibold">
- <StatusBadge
- variant={network.enableIPv6 ? 'indigo' : 'gray'}
- text={network.enableIPv6 ? 'Yes' : 'No'}
- />
+ <StatusBadge variant={network.enableIPv6 ? 'indigo' : 'gray'} text={network.enableIPv6 ? 'Yes' : 'No'} />
</p>
</div>
</div>
@@ -274,7 +241,7 @@
<Card.Root class="border shadow-sm">
<Card.Header class="pb-0">
<Card.Title class="flex items-center gap-2 text-lg">
- <Settings class="text-primary size-5" />
+ <SettingsIcon class="text-primary size-5" />
IPAM Configuration
</Card.Title>
<Card.Description>IP Address Management settings for this network</Card.Description>
@@ -285,9 +252,7 @@
<div class="space-y-2">
{#if config.Subnet}
<div class="flex flex-col sm:flex-row sm:items-center">
- <span class="text-muted-foreground w-full text-sm font-medium sm:w-24"
- >Subnet:</span
- >
+ <span class="text-muted-foreground w-full text-sm font-medium sm:w-24">Subnet:</span>
<code
class="bg-muted text-muted-foreground mt-1 rounded px-1.5 py-0.5 font-mono text-xs sm:mt-0 sm:text-sm"
>
@@ -298,9 +263,7 @@
{#if config.Gateway}
<div class="flex flex-col sm:flex-row sm:items-center">
- <span class="text-muted-foreground w-full text-sm font-medium sm:w-24"
- >Gateway:</span
- >
+ <span class="text-muted-foreground w-full text-sm font-medium sm:w-24">Gateway:</span>
<code
class="bg-muted text-muted-foreground mt-1 rounded px-1.5 py-0.5 font-mono text-xs sm:mt-0 sm:text-sm"
>
@@ -311,9 +274,7 @@
{#if config.IPRange}
<div class="flex flex-col sm:flex-row sm:items-center">
- <span class="text-muted-foreground w-full text-sm font-medium sm:w-24"
- >IP Range:</span
- >
+ <span class="text-muted-foreground w-full text-sm font-medium sm:w-24">IP Range:</span>
<code
class="bg-muted text-muted-foreground mt-1 rounded px-1.5 py-0.5 font-mono text-xs sm:mt-0 sm:text-sm"
>
@@ -324,16 +285,12 @@
{#if (config.AuxiliaryAddresses && Object.keys(config.AuxiliaryAddresses).length > 0) || (config.AuxAddress && Object.keys(config.AuxAddress).length > 0)}
<div class="mt-3">
- <p class="text-muted-foreground mb-1 text-sm font-medium">
- Auxiliary Addresses:
- </p>
+ <p class="text-muted-foreground mb-1 text-sm font-medium">Auxiliary Addresses:</p>
<ul class="ml-4 space-y-1">
{#each Object.entries(config.AuxiliaryAddresses ?? config.AuxAddress ?? {}) as [name, addr] (name)}
<li class="flex font-mono text-xs">
<span class="text-muted-foreground mr-2">{name}:</span>
- <code class="bg-muted text-muted-foreground rounded px-1 py-0.5"
- >{addr}</code
- >
+ <code class="bg-muted text-muted-foreground rounded px-1 py-0.5">{addr}</code>
</li>
{/each}
</ul>
@@ -371,31 +328,25 @@
<Card.Root class="border shadow-sm">
<Card.Header class="pb-0">
<Card.Title class="flex items-center gap-2 text-lg">
- <Container class="text-primary size-5" />
+ <ContainerIcon class="text-primary size-5" />
Connected Containers
</Card.Title>
<Card.Description>
- {connectedContainers.length} container{connectedContainers.length === 1 ? '' : 's'} connected
- to this network
+ {connectedContainers.length} container{connectedContainers.length === 1 ? '' : 's'} connected to this network
</Card.Description>
</Card.Header>
<Card.Content class="pt-6">
<div class="bg-card divide-y rounded-lg border">
{#each connectedContainers as container (container.Name)}
<div class="flex flex-col p-3 sm:flex-row sm:items-center">
- <div class="mb-2 w-full font-medium break-all sm:mb-0 sm:w-1/3">
- <a
- href="/containers/{container.Name}"
- class="text-primary flex items-center hover:underline"
- >
- <Container class="text-muted-foreground mr-1.5 size-3.5" />
+ <div class="mb-2 w-full break-all font-medium sm:mb-0 sm:w-1/3">
+ <a href="/containers/{container.Name}" class="text-primary flex items-center hover:underline">
+ <ContainerIcon class="text-muted-foreground mr-1.5 size-3.5" />
{container.Name}
</a>
</div>
<div class="w-full pl-0 sm:w-2/3 sm:pl-4">
- <code
- class="bg-muted text-muted-foreground rounded px-1.5 py-0.5 font-mono text-xs break-all sm:text-sm"
- >
+ <code class="bg-muted text-muted-foreground break-all rounded px-1.5 py-0.5 font-mono text-xs sm:text-sm">
{container.IPv4Address || container.IPv6Address || 'N/A'}
</code>
</div>
@@ -410,7 +361,7 @@
<Card.Root class="border shadow-sm">
<Card.Header class="pb-0">
<Card.Title class="flex items-center gap-2 text-lg">
- <Tag class="text-primary size-5" />
+ <TagIcon class="text-primary size-5" />
Labels
</Card.Title>
<Card.Description>User-defined metadata attached to this network</Card.Description>
@@ -419,14 +370,10 @@
<div class="bg-card divide-y rounded-lg border">
{#each Object.entries(network.labels) as [key, value] (key)}
<div class="flex flex-col p-3 sm:flex-row">
- <div
- class="text-muted-foreground mb-2 w-full font-medium break-all sm:mb-0 sm:w-1/3"
- >
+ <div class="text-muted-foreground mb-2 w-full break-all font-medium sm:mb-0 sm:w-1/3">
{key}
</div>
- <div
- class="bg-muted/50 w-full rounded p-2 font-mono text-xs break-all sm:w-2/3 sm:text-sm"
- >
+ <div class="bg-muted/50 w-full break-all rounded p-2 font-mono text-xs sm:w-2/3 sm:text-sm">
{value}
</div>
</div>
@@ -440,7 +387,7 @@
<Card.Root class="border shadow-sm">
<Card.Header class="pb-0">
<Card.Title class="flex items-center gap-2 text-lg">
- <Settings class="text-primary size-5" />
+ <SettingsIcon class="text-primary size-5" />
Options
</Card.Title>
<Card.Description>Network driver-specific options</Card.Description>
@@ -449,14 +396,10 @@
<div class="bg-card divide-y rounded-lg border">
{#each Object.entries(network.options) as [key, value] (key)}
<div class="flex flex-col p-3 sm:flex-row">
- <div
- class="text-muted-foreground mb-2 w-full font-medium break-all sm:mb-0 sm:w-1/3"
- >
+ <div class="text-muted-foreground mb-2 w-full break-all font-medium sm:mb-0 sm:w-1/3">
{key}
</div>
- <div
- class="bg-muted/50 w-full rounded p-2 font-mono text-xs break-all sm:w-2/3 sm:text-sm"
- >
+ <div class="bg-muted/50 w-full break-all rounded p-2 font-mono text-xs sm:w-2/3 sm:text-sm">
{value}
</div>
</div>
@@ -469,18 +412,11 @@
{:else}
<div class="flex flex-col items-center justify-center px-4 py-16 text-center">
<div class="bg-muted/30 mb-4 rounded-full p-4">
- <Network class="text-muted-foreground size-10 opacity-70" />
+ <NetworkIcon class="text-muted-foreground size-10 opacity-70" />
</div>
<h2 class="mb-2 text-xl font-medium">Network Not Found</h2>
- <p class="text-muted-foreground mb-6">
- The requested network could not be found or is no longer available.
- </p>
- <ArcaneButton
- action="cancel"
- customLabel="Back to Networks"
- onClick={() => goto('/networks')}
- size="sm"
- />
+ <p class="text-muted-foreground mb-6">The requested network could not be found or is no longer available.</p>
+ <ArcaneButton action="cancel" customLabel="Back to Networks" onclick={() => goto('/networks')} size="sm" />
</div>
{/if}
</div>
diff --git a/frontend/src/routes/networks/network-table.svelte b/frontend/src/routes/networks/network-table.svelte
index bcb3b48a2..6a500bd7f 100644
--- a/frontend/src/routes/networks/network-table.svelte
+++ b/frontend/src/routes/networks/network-table.svelte
@@ -1,8 +1,10 @@
<script lang="ts">
import type { NetworkSummaryDto } from '$lib/types/network.type';
- import ArcaneTable from '$lib/components/arcane-table.svelte';
+ import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import { Button } from '$lib/components/ui/button/index.js';
- import { ScanSearch, Trash2, Ellipsis, Network } from '@lucide/svelte';
+ import EllipsisIcon from '@lucide/svelte/icons/ellipsis';
+ import ScanSearchIcon from '@lucide/svelte/icons/scan-search';
+ import Trash2Icon from '@lucide/svelte/icons/trash-2';
import * as Card from '$lib/components/ui/card/index.js';
import { goto } from '$app/navigation';
import { toast } from 'svelte-sonner';
@@ -10,24 +12,22 @@
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
import { environmentAPI } from '$lib/services/api';
import { DEFAULT_NETWORK_NAMES } from '$lib/constants';
import type { SearchPaginationSortRequest, Paginated } from '$lib/types/pagination.type';
- import * as Table from '$lib/components/ui/table';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
+ import NetworkIcon from '@lucide/svelte/icons/network';
import { capitalizeFirstLetter } from '$lib/utils/string.utils';
+ import type { ColumnSpec } from '$lib/components/arcane-table';
let {
networks = $bindable(),
selectedIds = $bindable(),
- requestOptions = $bindable(),
- onCreateNetwork
+ requestOptions = $bindable()
}: {
networks: Paginated<NetworkSummaryDto>;
selectedIds: string[];
requestOptions: SearchPaginationSortRequest;
- onCreateNetwork: () => void;
} = $props();
let isLoading = $state({
@@ -60,32 +60,27 @@
});
}
- async function handleDeleteSelectedNetworks() {
- const selectedNetworkList = networks.data.filter((network) => selectedIds.includes(network.id));
- const defaultNetworks = selectedNetworkList.filter((network) =>
- DEFAULT_NETWORK_NAMES.has(network.name)
- );
+ async function handleDeleteSelectedNetworks(ids: string[]) {
+ const selectedNetworkList = networks.data.filter((n) => ids.includes(n.id));
+ const defaultNetworks = selectedNetworkList.filter((n) => DEFAULT_NETWORK_NAMES.has(n.name));
if (defaultNetworks.length > 0) {
- toast.error(
- `Cannot delete default networks: ${defaultNetworks.map((n) => n.name).join(', ')}`
- );
+ toast.error(`Cannot delete default networks: ${defaultNetworks.map((n) => n.name).join(', ')}`);
return;
}
openConfirmDialog({
title: 'Delete Selected Networks',
- message: `Are you sure you want to delete ${selectedIds.length} selected network(s)? This action cannot be undone.`,
+ message: `Are you sure you want to delete ${ids.length} selected network(s)? This action cannot be undone.`,
confirm: {
label: 'Delete',
destructive: true,
action: async () => {
isLoading.remove = true;
-
let successCount = 0;
let failureCount = 0;
- for (const networkId of selectedIds) {
+ for (const networkId of ids) {
const network = networks.data.find((n) => n.id === networkId);
if (!network) continue;
@@ -100,10 +95,9 @@
}
isLoading.remove = false;
+
if (successCount > 0) {
- setTimeout(async () => {
- networks = await environmentAPI.getNetworks(requestOptions);
- }, 500);
+ networks = await environmentAPI.getNetworks(requestOptions);
}
selectedIds = [];
}
@@ -111,116 +105,111 @@
});
}
- const isAnyLoading = $derived(Object.values(isLoading).some((loading) => loading));
+ const isAnyLoading = $derived(Object.values(isLoading).some((l) => l));
const hasNetworks = $derived(networks?.data?.length > 0);
- // const getConnectedContainers = (network: NetworkSummaryDto) => {
- // return network. ? Object.keys(network.Containers).length : 0;
- // };
+ const columns = [
+ {
+ accessorKey: 'name',
+ title: 'Name',
+ sortable: true,
+ cell: NameCell
+ },
+ {
+ accessorKey: 'id',
+ title: 'Network ID',
+ cell: IdCell
+ },
+ {
+ accessorKey: 'driver',
+ title: 'Driver',
+ sortable: true,
+ cell: DriverCell
+ },
+ {
+ accessorKey: 'scope',
+ title: 'Scope',
+ sortable: true,
+ cell: ScopeCell
+ }
+ ] satisfies ColumnSpec<NetworkSummaryDto>[];
</script>
+{#snippet NameCell({ item }: { item: NetworkSummaryDto })}
+ <a class="font-medium hover:underline" href="/networks/{item.id}/">{item.name}</a>
+{/snippet}
+
+{#snippet IdCell({ value }: { value: unknown })}
+ <span class="truncate font-mono text-sm">{String(value ?? '')}</span>
+{/snippet}
+
+{#snippet DriverCell({ item }: { item: NetworkSummaryDto })}
+ <StatusBadge
+ variant={item.driver === 'bridge'
+ ? 'blue'
+ : item.driver === 'overlay'
+ ? 'purple'
+ : item.driver === 'ipvlan'
+ ? 'red'
+ : item.driver === 'macvlan'
+ ? 'orange'
+ : 'gray'}
+ text={capitalizeFirstLetter(item.driver)}
+ />
+{/snippet}
+
+{#snippet ScopeCell({ item }: { item: NetworkSummaryDto })}
+ <StatusBadge variant={item.scope === 'local' ? 'green' : 'amber'} text={capitalizeFirstLetter(item.scope)} />
+{/snippet}
+
+{#snippet RowActions({ item }: { item: NetworkSummaryDto })}
+ <DropdownMenu.Root>
+ <DropdownMenu.Trigger>
+ {#snippet child({ props })}
+ <Button {...props} variant="ghost" size="icon" class="relative size-8 p-0">
+ <span class="sr-only">Open menu</span>
+ <EllipsisIcon />
+ </Button>
+ {/snippet}
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Content align="end">
+ <DropdownMenu.Group>
+ <DropdownMenu.Item onclick={() => goto(`/networks/${item.id}`)} disabled={isAnyLoading}>
+ <ScanSearchIcon class="size-4" />
+ Inspect
+ </DropdownMenu.Item>
+ {#if !DEFAULT_NETWORK_NAMES.has(item.name)}
+ <DropdownMenu.Item
+ variant="destructive"
+ onclick={() => handleDeleteNetwork(item.id, item.name)}
+ disabled={DEFAULT_NETWORK_NAMES.has(item.name) || isAnyLoading}
+ >
+ <Trash2Icon class="size-4" />
+ Remove
+ </DropdownMenu.Item>
+ {/if}
+ </DropdownMenu.Group>
+ </DropdownMenu.Content>
+ </DropdownMenu.Root>
+{/snippet}
+
{#if hasNetworks}
- <Card.Root class="border shadow-sm">
- <Card.Header class="px-6">
- <div class="flex items-center justify-between">
- <div>
- <Card.Title>Network List</Card.Title>
- </div>
- <div class="flex items-center gap-2">
- {#if selectedIds.length > 0}
- <ArcaneButton
- action="remove"
- onClick={handleDeleteSelectedNetworks}
- loading={isLoading.remove}
- disabled={isLoading.remove}
- label="Remove Selected"
- />
- {/if}
- <ArcaneButton action="create" label="Create Network" onClick={onCreateNetwork} />
- </div>
- </div>
- </Card.Header>
- <Card.Content>
+ <Card.Root>
+ <Card.Content class="py-5">
<ArcaneTable
items={networks}
bind:requestOptions
bind:selectedIds
+ onRemoveSelected={(ids) => handleDeleteSelectedNetworks(ids)}
onRefresh={async (options) => (networks = await environmentAPI.getNetworks(options))}
- columns={[
- { label: 'Name', sortColumn: 'name' },
- { label: 'Network ID' },
- { label: 'Driver', sortColumn: 'driver' },
- { label: 'Scope', sortColumn: 'scope' },
- { label: ' ' }
- ]}
- filterPlaceholder="Search networks..."
- noResultsMessage="No networks found"
- >
- {#snippet rows({ item })}
- <Table.Cell>
- <a class="font-medium hover:underline" href="/networks/{item.id}/">{item.name}</a>
- </Table.Cell>
- <Table.Cell class="truncate font-mono text-sm">{item.id}</Table.Cell>
- <Table.Cell>
- <StatusBadge
- variant={item.driver === 'bridge'
- ? 'blue'
- : item.driver === 'overlay'
- ? 'purple'
- : item.driver === 'ipvlan'
- ? 'red'
- : item.driver === 'macvlan'
- ? 'orange'
- : 'gray'}
- text={capitalizeFirstLetter(item.driver)}
- />
- </Table.Cell>
- <Table.Cell>
- <StatusBadge
- variant={item.scope === 'local' ? 'green' : 'amber'}
- text={capitalizeFirstLetter(item.scope)}
- />
- </Table.Cell>
- <Table.Cell>
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <Button {...props} variant="ghost" size="icon" class="relative size-8 p-0">
- <span class="sr-only">Open menu</span>
- <Ellipsis />
- </Button>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item
- onclick={() => goto(`/networks/${item.id}`)}
- disabled={isAnyLoading}
- >
- <ScanSearch class="size-4" />
- Inspect
- </DropdownMenu.Item>
- {#if !DEFAULT_NETWORK_NAMES.has(item.name)}
- <DropdownMenu.Item
- variant="destructive"
- onclick={() => handleDeleteNetwork(item.id, item.name)}
- disabled={DEFAULT_NETWORK_NAMES.has(item.name) || isAnyLoading}
- >
- <Trash2 class="size-4" />
- Remove
- </DropdownMenu.Item>
- {/if}
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
- </Table.Cell>
- {/snippet}
- </ArcaneTable>
+ {columns}
+ rowActions={RowActions}
+ />
</Card.Content>
</Card.Root>
{:else}
<div class="flex flex-col items-center justify-center px-6 py-12 text-center">
- <Network class="text-muted-foreground mb-4 size-12 opacity-40" />
+ <NetworkIcon class="text-muted-foreground mb-4 size-12 opacity-40" />
<p class="text-lg font-medium">No networks found</p>
<p class="text-muted-foreground mt-1 text-sm">
Create a new network using the "Create Network" button above or use the Docker CLI
diff --git a/frontend/src/routes/onboarding/+layout.svelte b/frontend/src/routes/onboarding/+layout.svelte
index de7dc9766..d852e31c1 100644
--- a/frontend/src/routes/onboarding/+layout.svelte
+++ b/frontend/src/routes/onboarding/+layout.svelte
@@ -1,17 +1,21 @@
<script lang="ts">
import '../../app.css';
- import { CheckCircle2, Key, Settings, Database, Shield, CheckCircle } from '@lucide/svelte';
+ import KeyIcon from '@lucide/svelte/icons/key';
+ import SettingsIcon from '@lucide/svelte/icons/settings';
+ import DatabaseIcon from '@lucide/svelte/icons/database';
+ import ShieldIcon from '@lucide/svelte/icons/shield';
+ import CircleCheckIcon from '@lucide/svelte/icons/check-circle';
import { page } from '$app/state';
let { children } = $props();
const steps = [
- { id: 'welcome', label: 'Welcome', path: '/onboarding/welcome', icon: CheckCircle2 },
- { id: 'password', label: 'Admin Password', path: '/onboarding/password', icon: Key },
- { id: 'docker', label: 'Docker Setup', path: '/onboarding/docker', icon: Database },
- { id: 'security', label: 'Security', path: '/onboarding/security', icon: Shield },
- { id: 'settings', label: 'Application Settings', path: '/onboarding/settings', icon: Settings },
- { id: 'complete', label: 'Complete', path: '/onboarding/complete', icon: CheckCircle }
+ { id: 'welcome', label: 'Welcome', path: '/onboarding/welcome', icon: CircleCheckIcon },
+ { id: 'password', label: 'Admin Password', path: '/onboarding/password', icon: KeyIcon },
+ { id: 'docker', label: 'Docker Setup', path: '/onboarding/docker', icon: DatabaseIcon },
+ { id: 'security', label: 'Security', path: '/onboarding/security', icon: ShieldIcon },
+ { id: 'settings', label: 'Application Settings', path: '/onboarding/settings', icon: SettingsIcon },
+ { id: 'complete', label: 'Complete', path: '/onboarding/complete', icon: CircleCheckIcon }
];
const currentStepIndex = $derived(steps.findIndex((step) => page.url.pathname === step.path));
@@ -34,10 +38,7 @@
>
<step.icon class="size-5" />
</div>
- <span
- class={`mt-2 text-sm ${i <= currentStepIndex ? 'text-foreground' : 'text-muted-foreground'}`}
- >{step.label}</span
- >
+ <span class={`mt-2 text-sm ${i <= currentStepIndex ? 'text-foreground' : 'text-muted-foreground'}`}>{step.label}</span>
</div>
{#if i < steps.length - 1}
@@ -48,7 +49,7 @@
</div>
<main class="container mx-auto flex-1 px-4 py-6">
- <div class="rounded-lg border bg-card p-8 shadow-sm">
+ <div class="bg-card rounded-lg border p-8 shadow-sm">
{@render children()}
</div>
</main>
diff --git a/frontend/src/routes/onboarding/complete/+page.svelte b/frontend/src/routes/onboarding/complete/+page.svelte
index 3fc2893dc..5c87a9089 100644
--- a/frontend/src/routes/onboarding/complete/+page.svelte
+++ b/frontend/src/routes/onboarding/complete/+page.svelte
@@ -3,7 +3,9 @@
import { settingsAPI } from '$lib/services/api';
import { toast } from 'svelte-sonner';
import { goto, invalidateAll } from '$app/navigation';
- import { Loader2, CheckCircle, ArrowRight } from '@lucide/svelte';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import CircleCheckIcon from '@lucide/svelte/icons/check-circle';
+ import ArrowRightIcon from '@lucide/svelte/icons/arrow-right';
let { data } = $props();
let currentSettings = $state(data.settings);
@@ -39,21 +41,20 @@
<div class="space-y-6 text-center">
<div class="mx-auto flex size-20 items-center justify-center rounded-full bg-green-100">
- <CheckCircle class="size-10 text-green-600" />
+ <CircleCheckIcon class="size-10 text-green-600" />
</div>
<div>
<h2 class="text-2xl font-bold">Setup Complete!</h2>
<p class="text-muted-foreground mt-2">
- Congratulations! You've successfully configured Arcane. You're ready to start managing your
- containers.
+ Congratulations! You've successfully configured Arcane. You're ready to start managing your containers.
</p>
</div>
<div class="space-y-4">
- <div class="rounded-lg border bg-muted/50 p-4">
+ <div class="bg-muted/50 rounded-lg border p-4">
<h3 class="font-semibold">What's Next?</h3>
- <ul class="mt-2 space-y-1 text-sm text-muted-foreground">
+ <ul class="text-muted-foreground mt-2 space-y-1 text-sm">
<li>• Start managing your Docker containers and images</li>
<li>• Create and deploy Docker Compose Projects</li>
<li>• Monitor system resources and performance</li>
@@ -63,11 +64,11 @@
<Button onclick={completeOnboarding} disabled={isLoading} size="lg" class="w-full">
{#if isLoading}
- <Loader2 class="mr-2 size-4 animate-spin" />
+ <LoaderCircleIcon class="mr-2 size-4 animate-spin" />
Completing Setup...
{:else}
Go to Dashboard
- <ArrowRight class="ml-2 size-4" />
+ <ArrowRightIcon class="ml-2 size-4" />
{/if}
</Button>
</div>
diff --git a/frontend/src/routes/onboarding/docker/+page.svelte b/frontend/src/routes/onboarding/docker/+page.svelte
index 53f5ef3ea..e1fe8ccf5 100644
--- a/frontend/src/routes/onboarding/docker/+page.svelte
+++ b/frontend/src/routes/onboarding/docker/+page.svelte
@@ -3,13 +3,12 @@
import * as Card from '$lib/components/ui/card';
import { Input } from '$lib/components/ui/input';
import { Label } from '$lib/components/ui/label';
- import { Textarea } from '$lib/components/ui/textarea';
import * as Select from '$lib/components/ui/select';
import { Switch } from '$lib/components/ui/switch';
import { settingsAPI } from '$lib/services/api';
import { toast } from 'svelte-sonner';
import { goto } from '$app/navigation';
- import { Loader2 } from '@lucide/svelte';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
let { data } = $props();
let currentSettings = $state(data.settings);
@@ -55,9 +54,7 @@
<div class="space-y-6">
<div class="text-center">
<h2 class="text-2xl font-bold">Docker Configuration</h2>
- <p class="text-muted-foreground mt-2">
- Configure how Arcane connects to your Docker environment
- </p>
+ <p class="text-muted-foreground mt-2">Configure how Arcane connects to your Docker environment</p>
</div>
<div class="grid gap-6 md:grid-cols-2">
@@ -69,14 +66,8 @@
<Card.Content class="space-y-4">
<div class="space-y-2">
<Label for="project-directory">Project Directory</Label>
- <Input
- id="project-directory"
- bind:value={dockerSettings.stacksDirectory}
- placeholder="data/projects"
- />
- <p class="text-xs text-muted-foreground">
- Directory where Docker Compose files will be stored
- </p>
+ <Input id="project-directory" bind:value={dockerSettings.stacksDirectory} placeholder="data/projects" />
+ <p class="text-muted-foreground text-xs">Directory where Docker Compose files will be stored</p>
</div>
</Card.Content>
</Card.Root>
@@ -90,7 +81,7 @@
<div class="flex items-center justify-between">
<div class="space-y-0.5">
<Label>Enable Polling</Label>
- <p class="text-xs text-muted-foreground">Automatically refresh container states</p>
+ <p class="text-muted-foreground text-xs">Automatically refresh container states</p>
</div>
<Switch bind:checked={dockerSettings.pollingEnabled} />
</div>
@@ -121,7 +112,7 @@
<Button variant="ghost" onclick={handleSkip}>Skip</Button>
<Button onclick={handleNext} disabled={isLoading}>
{#if isLoading}
- <Loader2 class="mr-2 size-4 animate-spin" />
+ <LoaderCircleIcon class="mr-2 size-4 animate-spin" />
{/if}
Next
</Button>
diff --git a/frontend/src/routes/onboarding/password/+page.svelte b/frontend/src/routes/onboarding/password/+page.svelte
index f7dedcb16..9f808ec82 100644
--- a/frontend/src/routes/onboarding/password/+page.svelte
+++ b/frontend/src/routes/onboarding/password/+page.svelte
@@ -3,7 +3,8 @@
import { Input } from '$lib/components/ui/input/index.js';
import { Label } from '$lib/components/ui/label/index.js';
import * as Alert from '$lib/components/ui/alert/index.js';
- import { AlertCircle, ChevronRight } from '@lucide/svelte';
+ import CircleAlertIcon from '@lucide/svelte/icons/alert-circle';
+ import ChevronRightIcon from '@lucide/svelte/icons/chevron-right';
import { preventDefault } from '$lib/utils/form.utils';
import { userAPI } from '$lib/services/api';
import { goto } from '$app/navigation';
@@ -70,14 +71,12 @@
<h1 class="mb-8 text-center text-3xl font-bold">Change Admin Password</h1>
<div class="mb-8 space-y-2">
- <p class="text-md text-center">
- For security reasons, please change the default admin password.
- </p>
+ <p class="text-md text-center">For security reasons, please change the default admin password.</p>
</div>
{#if error}
<Alert.Root class="mb-8" variant="destructive">
- <AlertCircle class="mr-2 size-5" />
+ <CircleAlertIcon class="mr-2 size-5" />
<Alert.Title>Error</Alert.Title>
<Alert.Description>{error}</Alert.Description>
</Alert.Root>
@@ -113,12 +112,10 @@
<div class="flex justify-center pt-8">
<Button type="submit" disabled={loading} class="flex h-12 w-[80%] items-center px-8">
{#if loading}
- <span
- class="inline-block size-4 animate-spin rounded-full border-2 border-white border-t-transparent"
- ></span>
+ <span class="inline-block size-4 animate-spin rounded-full border-2 border-white border-t-transparent"></span>
{/if}
Continue
- <ChevronRight class="size-4" />
+ <ChevronRightIcon class="size-4" />
</Button>
</div>
</form>
diff --git a/frontend/src/routes/onboarding/security/+page.svelte b/frontend/src/routes/onboarding/security/+page.svelte
index cce1dfdbe..68973dfa8 100644
--- a/frontend/src/routes/onboarding/security/+page.svelte
+++ b/frontend/src/routes/onboarding/security/+page.svelte
@@ -5,7 +5,11 @@
import { Input } from '$lib/components/ui/input';
import { Switch } from '$lib/components/ui/switch';
import { Label } from '$lib/components/ui/label';
- import { Loader2, Lock, Key, AlertTriangle, Info } from '@lucide/svelte';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import LockIcon from '@lucide/svelte/icons/lock';
+ import KeyIcon from '@lucide/svelte/icons/key';
+ import TriangleAlertIcon from '@lucide/svelte/icons/triangle-alert';
+ import InfoIcon from '@lucide/svelte/icons/info';
import OidcConfigDialog from '$lib/components/dialogs/oidc-config-dialog.svelte';
import { toast } from 'svelte-sonner';
import { goto } from '$app/navigation';
@@ -184,7 +188,7 @@
<Button variant="ghost" onclick={handleSkip}>Skip</Button>
<Button onclick={handleNext} disabled={isLoading.saving}>
{#if isLoading.saving}
- <Loader2 class="mr-2 size-4 animate-spin" />
+ <LoaderCircleIcon class="mr-2 size-4 animate-spin" />
{/if}
Next
</Button>
@@ -193,17 +197,15 @@
<div class="grid gap-6 md:grid-cols-2">
<!-- Authentication Methods (mirrors settings page) -->
- <Card.Root class="border shadow-sm rounded-lg">
+ <Card.Root class="rounded-lg border shadow-sm">
<Card.Header class="pb-2">
<div class="flex items-center gap-3">
<div class="rounded-md bg-indigo-500/10 p-2">
- <Lock class="size-5 text-indigo-600" />
+ <LockIcon class="size-5 text-indigo-600" />
</div>
<div>
<Card.Title class="text-lg">Authentication Methods</Card.Title>
- <Card.Description class="text-sm"
- >Configure how users sign in to Arcane</Card.Description
- >
+ <Card.Description class="text-sm">Configure how users sign in to Arcane</Card.Description>
</div>
</div>
</Card.Header>
@@ -213,15 +215,10 @@
<div class="space-y-1 pr-4">
<label for="localAuthSwitch" class="text-sm font-medium">Local Authentication</label>
<p class="text-muted-foreground text-xs">
- Username and password stored in the system. Recommended as a fallback if OIDC is
- unavailable.
+ Username and password stored in the system. Recommended as a fallback if OIDC is unavailable.
</p>
</div>
- <Switch
- id="localAuthSwitch"
- checked={localAuthEnabled}
- onCheckedChange={(checked) => (localAuthEnabled = checked)}
- />
+ <Switch id="localAuthSwitch" checked={localAuthEnabled} onCheckedChange={(checked) => (localAuthEnabled = checked)} />
</div>
<div class="bg-muted/30 flex items-start justify-between rounded-lg border p-4">
@@ -230,49 +227,30 @@
<p class="text-muted-foreground text-xs">
Use an external OIDC provider
{#if data.oidcStatus?.envForced}
- <span class="text-muted-foreground text-[11px]"
- >(Forced ON by server environment)</span
- >
+ <span class="text-muted-foreground text-[11px]">(Forced ON by server environment)</span>
{/if}
</p>
{#if data.oidcStatus?.effectivelyEnabled || data.oidcStatus?.envForced}
<div class="mt-1">
{#if data.oidcStatus.envForced && !data.oidcStatus.envConfigured}
- <Button
- variant="link"
- class="text-destructive h-auto p-0 text-xs hover:underline"
- onclick={openOidcDialog}
- >
- <AlertTriangle class="mr-1 size-3" />
- Server forces OIDC, but env vars are missing. Configure app settings or fix server
- env.
+ <Button variant="link" class="text-destructive h-auto p-0 text-xs hover:underline" onclick={openOidcDialog}>
+ <TriangleAlertIcon class="mr-1 size-3" />
+ Server forces OIDC, but env vars are missing. Configure app settings or fix server env.
</Button>
{:else if data.oidcStatus.envForced && data.oidcStatus.envConfigured}
- <Button
- variant="link"
- class="h-auto p-0 text-xs text-sky-600 hover:underline"
- onclick={openOidcDialog}
- >
- <Info class="mr-1 size-3" />
+ <Button variant="link" class="h-auto p-0 text-xs text-sky-600 hover:underline" onclick={openOidcDialog}>
+ <InfoIcon class="mr-1 size-3" />
OIDC configured & forced by server. View Status.
</Button>
{:else if !data.oidcStatus.envForced && data.oidcStatus.effectivelyEnabled && data.oidcStatus.dbConfigured}
- <Button
- variant="link"
- class="h-auto p-0 text-xs text-sky-600 hover:underline"
- onclick={openOidcDialog}
- >
- <Info class="mr-1 size-3" />
+ <Button variant="link" class="h-auto p-0 text-xs text-sky-600 hover:underline" onclick={openOidcDialog}>
+ <InfoIcon class="mr-1 size-3" />
OIDC configured via application settings. Manage.
</Button>
{:else if !data.oidcStatus.envForced && data.oidcStatus.effectivelyEnabled && !data.oidcStatus.dbConfigured}
- <Button
- variant="link"
- class="text-destructive h-auto p-0 text-xs hover:underline"
- onclick={openOidcDialog}
- >
- <AlertTriangle class="mr-1 size-3" />
+ <Button variant="link" class="text-destructive h-auto p-0 text-xs hover:underline" onclick={openOidcDialog}>
+ <TriangleAlertIcon class="mr-1 size-3" />
OIDC enabled, but app settings incomplete. Configure.
</Button>
{/if}
@@ -300,17 +278,15 @@
/>
<!-- Session Settings (mirrors settings page) -->
- <Card.Root class="border shadow-sm rounded-lg">
+ <Card.Root class="rounded-lg border shadow-sm">
<Card.Header class="pb-2">
<div class="flex items-center gap-3">
<div class="rounded-md bg-cyan-500/10 p-2">
- <Key class="size-5 text-cyan-600" />
+ <KeyIcon class="size-5 text-cyan-600" />
</div>
<div>
<Card.Title class="text-lg">Session Settings</Card.Title>
- <Card.Description class="text-sm"
- >Configure session behavior and password policies</Card.Description
- >
+ <Card.Description class="text-sm">Configure session behavior and password policies</Card.Description>
</div>
</div>
</Card.Header>
@@ -318,17 +294,8 @@
<div class="space-y-5">
<div class="space-y-2">
<Label for="sessionTimeout">Session Timeout (minutes)</Label>
- <Input
- type="number"
- id="sessionTimeout"
- name="sessionTimeout"
- bind:value={sessionTimeout}
- min="15"
- max="1440"
- />
- <p class="text-muted-foreground text-xs">
- Inactive sessions will be logged out automatically (15–1440 minutes).
- </p>
+ <Input type="number" id="sessionTimeout" name="sessionTimeout" bind:value={sessionTimeout} min="15" max="1440" />
+ <p class="text-muted-foreground text-xs">Inactive sessions will be logged out automatically (15–1440 minutes).</p>
</div>
<div class="space-y-2">
@@ -336,27 +303,21 @@
<div class="grid grid-cols-3 gap-2">
<Button
variant={passwordPolicy === 'basic' ? 'default' : 'outline'}
- class={passwordPolicy === 'basic'
- ? 'arcane-button-create w-full'
- : 'arcane-button-restart w-full'}
+ class={passwordPolicy === 'basic' ? 'arcane-button-create w-full' : 'arcane-button-restart w-full'}
onclick={() => (passwordPolicy = 'basic')}
>
Basic
</Button>
<Button
variant={passwordPolicy === 'standard' ? 'default' : 'outline'}
- class={passwordPolicy === 'standard'
- ? 'arcane-button-create w-full'
- : 'arcane-button-restart w-full'}
+ class={passwordPolicy === 'standard' ? 'arcane-button-create w-full' : 'arcane-button-restart w-full'}
onclick={() => (passwordPolicy = 'standard')}
>
Standard
</Button>
<Button
variant={passwordPolicy === 'strong' ? 'default' : 'outline'}
- class={passwordPolicy === 'strong'
- ? 'arcane-button-create w-full'
- : 'arcane-button-restart w-full'}
+ class={passwordPolicy === 'strong' ? 'arcane-button-create w-full' : 'arcane-button-restart w-full'}
onclick={() => (passwordPolicy = 'strong')}
>
Strong
diff --git a/frontend/src/routes/onboarding/settings/+page.svelte b/frontend/src/routes/onboarding/settings/+page.svelte
index d923c17f1..b9b47403d 100644
--- a/frontend/src/routes/onboarding/settings/+page.svelte
+++ b/frontend/src/routes/onboarding/settings/+page.svelte
@@ -8,7 +8,7 @@
import { settingsAPI } from '$lib/services/api';
import { toast } from 'svelte-sonner';
import { goto } from '$app/navigation';
- import { Loader2 } from '@lucide/svelte';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
let { data } = $props();
let currentSettings = $state(data.settings);
@@ -75,7 +75,7 @@
<div class="flex items-center justify-between">
<div class="space-y-0.5">
<Label>Enable Auto Update</Label>
- <p class="text-xs text-muted-foreground">Automatically check for and apply updates</p>
+ <p class="text-muted-foreground text-xs">Automatically check for and apply updates</p>
</div>
<Switch bind:checked={appSettings.autoUpdate} />
</div>
@@ -117,9 +117,7 @@
<Select.Item value="all">All Unused</Select.Item>
</Select.Content>
</Select.Root>
- <p class="text-xs text-muted-foreground">
- How aggressive to be when pruning unused resources
- </p>
+ <p class="text-muted-foreground text-xs">How aggressive to be when pruning unused resources</p>
</div>
</Card.Content>
</Card.Root>
@@ -132,12 +130,8 @@
<Card.Content class="space-y-4">
<div class="space-y-2">
<Label for="base-server-url">Base Server URL (Optional)</Label>
- <Input
- id="base-server-url"
- bind:value={appSettings.baseServerUrl}
- placeholder="https://arcane.yourdomain.com"
- />
- <p class="text-xs text-muted-foreground">
+ <Input id="base-server-url" bind:value={appSettings.baseServerUrl} placeholder="https://arcane.yourdomain.com" />
+ <p class="text-muted-foreground text-xs">
Used for generating external links and webhooks. Leave empty for auto-detection.
</p>
</div>
@@ -151,7 +145,7 @@
<Button variant="ghost" onclick={handleSkip}>Skip</Button>
<Button onclick={handleNext} disabled={isLoading}>
{#if isLoading}
- <Loader2 class="mr-2 size-4 animate-spin" />
+ <LoaderCircleIcon class="mr-2 size-4 animate-spin" />
{/if}
Complete Setup
</Button>
diff --git a/frontend/src/routes/onboarding/welcome/+page.svelte b/frontend/src/routes/onboarding/welcome/+page.svelte
index 4aaef5cd2..5593f0e13 100644
--- a/frontend/src/routes/onboarding/welcome/+page.svelte
+++ b/frontend/src/routes/onboarding/welcome/+page.svelte
@@ -1,6 +1,7 @@
<script lang="ts">
import { Button } from '$lib/components/ui/button/index.js';
- import { CheckCircle2, ChevronRight } from '@lucide/svelte';
+ import CircleCheckIcon from '@lucide/svelte/icons/check-circle';
+ import ChevronRightIcon from '@lucide/svelte/icons/chevron-right';
import { goto } from '$app/navigation';
import settingsStore from '$lib/stores/config-store';
import { settingsAPI } from '$lib/services/api';
@@ -28,9 +29,7 @@
<h1 class="mb-6 text-3xl font-bold">Welcome to Arcane</h1>
<div class="mb-8 space-y-6">
- <p class="text-xl">
- Thank you for installing Arcane! Let's get you set up with a few quick steps.
- </p>
+ <p class="text-xl">Thank you for installing Arcane! Let's get you set up with a few quick steps.</p>
<div class="space-y-4">
<p class="text-lg font-medium">This wizard will help you:</p>
@@ -38,21 +37,21 @@
<div class="space-y-3">
<div class="flex items-start gap-3">
<div class="bg-primary/10 mt-0.5 rounded-full p-1">
- <CheckCircle2 class="text-primary size-4" />
+ <CircleCheckIcon class="text-primary size-4" />
</div>
<p>Change the default admin password for security</p>
</div>
<div class="flex items-start gap-3">
<div class="bg-primary/10 mt-0.5 rounded-full p-1">
- <CheckCircle2 class="text-primary size-4" />
+ <CircleCheckIcon class="text-primary size-4" />
</div>
<p>Configure your Docker connection</p>
</div>
<div class="flex items-start gap-3">
<div class="bg-primary/10 mt-0.5 rounded-full p-1">
- <CheckCircle2 class="text-primary size-4" />
+ <CircleCheckIcon class="text-primary size-4" />
</div>
<p>Set basic application preferences</p>
</div>
@@ -63,13 +62,9 @@
</div>
<div class="flex justify-center pt-8">
- <Button
- type="button"
- onclick={() => continueToNextStep()}
- class="flex h-12 w-[80%] items-center gap-2 px-8"
- >
+ <Button type="button" onclick={() => continueToNextStep()} class="flex h-12 w-[80%] items-center gap-2 px-8">
+ <ChevronRightIcon class="size-4" />
Continue
- <ChevronRight class="size-4" />
</Button>
</div>
</div>
diff --git a/frontend/src/routes/settings/docker/+page.svelte b/frontend/src/routes/settings/docker/+page.svelte
index 1e8f4323a..03bddfda5 100644
--- a/frontend/src/routes/settings/docker/+page.svelte
+++ b/frontend/src/routes/settings/docker/+page.svelte
@@ -2,7 +2,12 @@
import * as Card from '$lib/components/ui/card/index.js';
import type { FormInput as FormInputType } from '$lib/utils/form.utils';
import { Button } from '$lib/components/ui/button/index.js';
- import { RefreshCw, ImageMinus, Save, Clock, Zap, InfoIcon } from '@lucide/svelte';
+ import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
+ import ImageMinusIcon from '@lucide/svelte/icons/image-minus';
+ import SaveIcon from '@lucide/svelte/icons/save';
+ import ClockIcon from '@lucide/svelte/icons/clock';
+ import ZapIcon from '@lucide/svelte/icons/zap';
+ import InfoIcon from '@lucide/svelte/icons/info';
import * as RadioGroup from '$lib/components/ui/radio-group/index.js';
import { Label } from '$lib/components/ui/label/index.js';
import * as Alert from '$lib/components/ui/alert/index.js';
@@ -90,13 +95,11 @@
});
let isPollingConfigValid = $derived(
- !pollingEnabledSwitch.value ||
- (pollingIntervalInput.value >= 5 && pollingIntervalInput.value <= 1440)
+ !pollingEnabledSwitch.value || (pollingIntervalInput.value >= 5 && pollingIntervalInput.value <= 1440)
);
let isAutoUpdateConfigValid = $derived(
- !autoUpdateSwitch.value ||
- (autoUpdateIntervalInput.value >= 5 && autoUpdateIntervalInput.value <= 1440)
+ !autoUpdateSwitch.value || (autoUpdateIntervalInput.value >= 5 && autoUpdateIntervalInput.value <= 1440)
);
let canSave = $derived(isPollingConfigValid && isAutoUpdateConfigValid);
@@ -120,10 +123,10 @@
class="arcane-button-save h-10 min-w-[140px]"
>
{#if isLoading.saving}
- <RefreshCw class="size-4 animate-spin" />
+ <RefreshCwIcon class="size-4 animate-spin" />
Saving...
{:else}
- <Save class="size-4" />
+ <SaveIcon class="size-4" />
Save Settings
{/if}
</Button>
@@ -134,11 +137,9 @@
{#if autoUpdateSwitch.value && pollingEnabledSwitch.value}
<div class="settings-alert">
<Alert.Root variant="warning">
- <Zap class="size-4" />
+ <ZapIcon class="size-4" />
<Alert.Title>Auto-update Enabled</Alert.Title>
- <Alert.Description
- >Automatic container updates are active with polling enabled</Alert.Description
- >
+ <Alert.Description>Automatic container updates are active with polling enabled</Alert.Description>
</Alert.Root>
</div>
{/if}
@@ -146,17 +147,15 @@
<!-- Settings Grid -->
<div class="settings-grid grid gap-6 md:grid-cols-1">
<div class="grid grid-cols-1 gap-6">
- <Card.Root class="border shadow-sm rounded-lg">
+ <Card.Root class="rounded-lg border shadow-sm">
<Card.Header class="pb-2">
<div class="flex items-center gap-3">
<div class="rounded-md bg-emerald-500/10 p-2.5">
- <Clock class="size-5 text-emerald-600" />
+ <ClockIcon class="size-5 text-emerald-600" />
</div>
<div>
<Card.Title class="text-lg">Image Automation</Card.Title>
- <Card.Description class="text-sm"
- >Control automatic image polling and updates</Card.Description
- >
+ <Card.Description class="text-sm">Control automatic image polling and updates</Card.Description>
</div>
</div>
</Card.Header>
@@ -182,12 +181,11 @@
{#if pollingIntervalInput.value < 30}
<Alert.Root variant="warning">
- <Zap class="size-4" />
+ <ZapIcon class="size-4" />
<Alert.Title>Rate Limiting Warning</Alert.Title>
<Alert.Description
- >Polling intervals below 30 minutes may trigger rate limits on Docker
- registries, potentially blocking your account temporarily. Consider using
- longer intervals for production environments.</Alert.Description
+ >Polling intervals below 30 minutes may trigger rate limits on Docker registries, potentially blocking your
+ account temporarily. Consider using longer intervals for production environments.</Alert.Description
>
</Alert.Root>
{/if}
@@ -232,17 +230,15 @@
</Card.Root>
</div>
- <Card.Root class="border shadow-sm rounded-lg">
+ <Card.Root class="rounded-lg border shadow-sm">
<Card.Header class="pb-2">
<div class="flex items-center gap-3">
<div class="rounded-md bg-purple-500/10 p-2.5">
- <ImageMinus class="size-5 text-purple-600" />
+ <ImageMinusIcon class="size-5 text-purple-600" />
</div>
<div>
<Card.Title class="text-lg">Image Pruning</Card.Title>
- <Card.Description class="text-sm"
- >Configure cleanup behavior for unused Docker images</Card.Description
- >
+ <Card.Description class="text-sm">Configure cleanup behavior for unused Docker images</Card.Description>
</div>
</div>
</Card.Header>
@@ -262,13 +258,10 @@
class="space-y-3"
id="pruneMode"
>
- <div
- class="hover:bg-muted/50 flex items-start space-x-3 rounded-lg border p-3 transition-colors"
- >
+ <div class="hover:bg-muted/50 flex items-start space-x-3 rounded-lg border p-3 transition-colors">
<RadioGroup.Item value="all" id="prune-all" class="mt-0.5" />
<div class="space-y-1">
- <Label for="prune-all" class="cursor-pointer font-medium">All Unused Images</Label
- >
+ <Label for="prune-all" class="cursor-pointer font-medium">All Unused Images</Label>
<p class="text-muted-foreground text-sm">
Remove all images not referenced by containers (equivalent to <code
class="bg-background rounded px-1 py-0.5 text-xs">docker image prune -a</code
@@ -277,17 +270,13 @@
</div>
</div>
- <div
- class="hover:bg-muted/50 flex items-start space-x-3 rounded-lg border p-3 transition-colors"
- >
+ <div class="hover:bg-muted/50 flex items-start space-x-3 rounded-lg border p-3 transition-colors">
<RadioGroup.Item value="dangling" id="prune-dangling" class="mt-0.5" />
<div class="space-y-1">
- <Label for="prune-dangling" class="cursor-pointer font-medium"
- >Dangling Images Only</Label
- >
+ <Label for="prune-dangling" class="cursor-pointer font-medium">Dangling Images Only</Label>
<p class="text-muted-foreground text-sm">
- Remove only untagged images (equivalent to <code
- class="bg-background rounded px-1 py-0.5 text-xs">docker image prune</code
+ Remove only untagged images (equivalent to <code class="bg-background rounded px-1 py-0.5 text-xs"
+ >docker image prune</code
>)
</p>
</div>
@@ -296,8 +285,7 @@
<div class="bg-muted/50 rounded-lg p-3">
<p class="text-muted-foreground text-sm">
- <strong>Note:</strong> This setting affects the "Prune Unused Images" action on the
- Images page.
+ <strong>Note:</strong> This setting affects the "Prune Unused Images" action on the Images page.
{pruneModeValue === 'all'
? 'All unused images will be removed, which frees up more space but may require re-downloading images later.'
: 'Only dangling images will be removed, which is safer but may leave some unused images behind.'}
diff --git a/frontend/src/routes/settings/general/+page.svelte b/frontend/src/routes/settings/general/+page.svelte
index 0ffb89daa..29fb2fda0 100644
--- a/frontend/src/routes/settings/general/+page.svelte
+++ b/frontend/src/routes/settings/general/+page.svelte
@@ -2,7 +2,10 @@
import * as Card from '$lib/components/ui/card/index.js';
import FormInput from '$lib/components/form/form-input.svelte';
import { Button } from '$lib/components/ui/button/index.js';
- import { Save, RefreshCw, Folder, Globe } from '@lucide/svelte';
+ import SaveIcon from '@lucide/svelte/icons/save';
+ import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
+ import FolderIcon from '@lucide/svelte/icons/folder';
+ import GlobeIcon from '@lucide/svelte/icons/globe';
import type { FormInput as FormInputType } from '$lib/utils/form.utils';
import { toast } from 'svelte-sonner';
import type { Settings } from '$lib/types/settings.type';
@@ -81,16 +84,12 @@
</p>
</div>
- <Button
- onclick={() => handleGeneralSettingUpdates()}
- disabled={isLoading.saving}
- class="h-10 min-w-[140px]"
- >
+ <Button onclick={() => handleGeneralSettingUpdates()} disabled={isLoading.saving} class="h-10 min-w-[140px]">
{#if isLoading.saving}
- <RefreshCw class="size-4 animate-spin" />
+ <RefreshCwIcon class="size-4 animate-spin" />
Saving...
{:else}
- <Save class="size-4" />
+ <SaveIcon class="size-4" />
Save Settings
{/if}
</Button>
@@ -99,17 +98,15 @@
<!-- Settings Cards -->
<div class="grid gap-6 md:grid-cols-2">
<!-- Storage Configuration -->
- <Card.Root class="border shadow-sm rounded-lg">
+ <Card.Root class="rounded-lg border shadow-sm">
<Card.Header class="pb-2">
<div class="flex items-center gap-3">
<div class="rounded-md bg-blue-500/10 p-2">
- <Folder class="size-5 text-blue-600" />
+ <FolderIcon class="size-5 text-blue-600" />
</div>
<div>
<Card.Title class="text-lg">Storage Configuration</Card.Title>
- <Card.Description class="text-sm"
- >Configure where Arcane stores stack files and data</Card.Description
- >
+ <Card.Description class="text-sm">Configure where Arcane stores stack files and data</Card.Description>
</div>
</div>
</Card.Header>
@@ -124,17 +121,15 @@
</Card.Root>
<!-- Network Configuration -->
- <Card.Root class="border shadow-sm rounded-lg">
+ <Card.Root class="rounded-lg border shadow-sm">
<Card.Header class="pb-2">
<div class="flex items-center gap-3">
<div class="rounded-md bg-green-500/10 p-2">
- <Globe class="size-5 text-green-600" />
+ <GlobeIcon class="size-5 text-green-600" />
</div>
<div>
<Card.Title class="text-lg">Network Configuration</Card.Title>
- <Card.Description class="text-sm"
- >Configure base server URL and network settings</Card.Description
- >
+ <Card.Description class="text-sm">Configure base server URL and network settings</Card.Description>
</div>
</div>
</Card.Header>
diff --git a/frontend/src/routes/settings/security/+page.svelte b/frontend/src/routes/settings/security/+page.svelte
index e625e9e07..4d90dbc0d 100644
--- a/frontend/src/routes/settings/security/+page.svelte
+++ b/frontend/src/routes/settings/security/+page.svelte
@@ -4,7 +4,12 @@
import { Button } from '$lib/components/ui/button/index.js';
import { Input } from '$lib/components/ui/input/index.js';
import { Switch } from '$lib/components/ui/switch/index.js';
- import { Lock, Key, AlertTriangle, Info, Save, RefreshCw } from '@lucide/svelte';
+ import LockIcon from '@lucide/svelte/icons/lock';
+ import KeyIcon from '@lucide/svelte/icons/key';
+ import TriangleAlertIcon from '@lucide/svelte/icons/triangle-alert';
+ import InfoIcon from '@lucide/svelte/icons/info';
+ import SaveIcon from '@lucide/svelte/icons/save';
+ import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
import settingsStore from '$lib/stores/config-store';
import OidcConfigDialog from '$lib/components/dialogs/oidc-config-dialog.svelte';
import { toast } from 'svelte-sonner';
@@ -171,16 +176,12 @@
</div>
<div>
- <Button
- onclick={() => handleSecuritySettingUpdates()}
- disabled={isLoading.saving}
- class="h-10 min-w-[140px]"
- >
+ <Button onclick={() => handleSecuritySettingUpdates()} disabled={isLoading.saving} class="h-10 min-w-[140px]">
{#if isLoading.saving}
- <RefreshCw class="size-4 animate-spin" />
+ <RefreshCwIcon class="size-4 animate-spin" />
Saving...
{:else}
- <Save class="size-4" />
+ <SaveIcon class="size-4" />
Save Settings
{/if}
</Button>
@@ -188,17 +189,15 @@
</div>
<div class="grid gap-6 md:grid-cols-2">
- <Card.Root class="settings-card border shadow-sm rounded-lg">
+ <Card.Root class="settings-card rounded-lg border shadow-sm">
<Card.Header class="settings-card-header pb-2">
<div class="settings-card-title-wrapper flex items-center gap-3">
<div class="settings-card-icon rounded-md bg-indigo-500/10 p-2">
- <Lock class="size-5 text-indigo-600" />
+ <LockIcon class="size-5 text-indigo-600" />
</div>
<div>
<Card.Title class="settings-card-title text-lg">Authentication Methods</Card.Title>
- <Card.Description class="settings-card-description text-sm">
- Configure how users sign in to Arcane
- </Card.Description>
+ <Card.Description class="settings-card-description text-sm">Configure how users sign in to Arcane</Card.Description>
</div>
</div>
</Card.Header>
@@ -206,11 +205,9 @@
<div class="space-y-4">
<div class="bg-muted/30 flex items-start justify-between rounded-lg border p-4">
<div class="space-y-1 pr-4">
- <label for="localAuthSwitch" class="text-sm font-medium">Local Authentication</label
- >
+ <label for="localAuthSwitch" class="text-sm font-medium">Local Authentication</label>
<p class="text-muted-foreground text-xs">
- Username and password stored in the system. Recommended as a fallback if OIDC is
- unavailable.
+ Username and password stored in the system. Recommended as a fallback if OIDC is unavailable.
</p>
</div>
<Switch
@@ -228,49 +225,30 @@
<p class="text-muted-foreground text-xs">
Use an external OIDC provider
{#if data.oidcStatus.envForced}
- <span class="text-muted-foreground text-[11px]"
- >(Forced ON by server environment)
- </span>
+ <span class="text-muted-foreground text-[11px]">(Forced ON by server environment) </span>
{/if}
</p>
{#if data.oidcStatus.effectivelyEnabled || data.oidcStatus.envForced}
<div class="mt-1">
{#if data.oidcStatus.envForced && !data.oidcStatus.envConfigured}
- <Button
- variant="link"
- class="text-destructive h-auto p-0 text-xs hover:underline"
- onclick={openOidcDialog}
- >
- <AlertTriangle class="mr-1 size-3" />
- Server forces OIDC, but env vars missing. Configure app settings or fix server
- env.
+ <Button variant="link" class="text-destructive h-auto p-0 text-xs hover:underline" onclick={openOidcDialog}>
+ <TriangleAlertIcon class="mr-1 size-3" />
+ Server forces OIDC, but env vars missing. Configure app settings or fix server env.
</Button>
{:else if data.oidcStatus.envForced && data.oidcStatus.envConfigured}
- <Button
- variant="link"
- class="h-auto p-0 text-xs text-sky-600 hover:underline"
- onclick={openOidcDialog}
- >
- <Info class="mr-1 size-3" />
+ <Button variant="link" class="h-auto p-0 text-xs text-sky-600 hover:underline" onclick={openOidcDialog}>
+ <InfoIcon class="mr-1 size-3" />
OIDC configured & forced by server. View Status.
</Button>
{:else if !data.oidcStatus.envForced && data.oidcStatus.effectivelyEnabled && data.oidcStatus.dbConfigured}
- <Button
- variant="link"
- class="h-auto p-0 text-xs text-sky-600 hover:underline"
- onclick={openOidcDialog}
- >
- <Info class="mr-1 size-3" />
+ <Button variant="link" class="h-auto p-0 text-xs text-sky-600 hover:underline" onclick={openOidcDialog}>
+ <InfoIcon class="mr-1 size-3" />
OIDC configured via application settings. Manage.
</Button>
{:else if !data.oidcStatus.envForced && data.oidcStatus.effectivelyEnabled && !data.oidcStatus.dbConfigured}
- <Button
- variant="link"
- class="text-destructive h-auto p-0 text-xs hover:underline"
- onclick={openOidcDialog}
- >
- <AlertTriangle class="mr-1 size-3" />
+ <Button variant="link" class="text-destructive h-auto p-0 text-xs hover:underline" onclick={openOidcDialog}>
+ <TriangleAlertIcon class="mr-1 size-3" />
OIDC enabled, but app settings incomplete. Configure.
</Button>
{/if}
@@ -296,11 +274,11 @@
onSave={handleSaveOidcConfig}
/>
- <Card.Root class="settings-card border shadow-sm rounded-lg">
+ <Card.Root class="settings-card rounded-lg border shadow-sm">
<Card.Header class="settings-card-header pb-2">
<div class="settings-card-title-wrapper flex items-center gap-3">
<div class="settings-card-icon rounded-md bg-cyan-500/10 p-2">
- <Key class="size-5 text-cyan-600" />
+ <KeyIcon class="size-5 text-cyan-600" />
</div>
<div>
<Card.Title class="settings-card-title text-lg">Session Settings</Card.Title>
@@ -313,20 +291,9 @@
<Card.Content class="pt-0">
<div class="space-y-5">
<div class="space-y-2">
- <label for="sessionTimeout" class="text-sm font-medium"
- >Session Timeout (minutes)</label
- >
- <Input
- type="number"
- id="sessionTimeout"
- name="sessionTimeout"
- bind:value={sessionTimeout}
- min="15"
- max="1440"
- />
- <p class="text-muted-foreground text-xs">
- Inactive sessions will be logged out automatically (15–1440 minutes).
- </p>
+ <label for="sessionTimeout" class="text-sm font-medium">Session Timeout (minutes)</label>
+ <Input type="number" id="sessionTimeout" name="sessionTimeout" bind:value={sessionTimeout} min="15" max="1440" />
+ <p class="text-muted-foreground text-xs">Inactive sessions will be logged out automatically (15–1440 minutes).</p>
</div>
<div class="space-y-2">
@@ -334,38 +301,27 @@
<div class="grid grid-cols-3 gap-2">
<Button
variant={passwordPolicy === 'basic' ? 'default' : 'outline'}
- class={passwordPolicy === 'basic'
- ? 'arcane-button-create w-full'
- : 'arcane-button-restart w-full'}
+ class={passwordPolicy === 'basic' ? 'arcane-button-create w-full' : 'arcane-button-restart w-full'}
onclick={() => {
passwordPolicy = 'basic';
}}>Basic</Button
>
<Button
variant={passwordPolicy === 'standard' ? 'default' : 'outline'}
- class={passwordPolicy === 'standard'
- ? 'arcane-button-create w-full'
- : 'arcane-button-restart w-full'}
+ class={passwordPolicy === 'standard' ? 'arcane-button-create w-full' : 'arcane-button-restart w-full'}
onclick={() => {
passwordPolicy = 'standard';
}}>Standard</Button
>
<Button
variant={passwordPolicy === 'strong' ? 'default' : 'outline'}
- class={passwordPolicy === 'strong'
- ? 'arcane-button-create w-full'
- : 'arcane-button-restart w-full'}
+ class={passwordPolicy === 'strong' ? 'arcane-button-create w-full' : 'arcane-button-restart w-full'}
onclick={() => {
passwordPolicy = 'strong';
}}>Strong</Button
>
</div>
- <input
- type="hidden"
- id="passwordPolicy"
- name="passwordPolicy"
- value={passwordPolicy}
- />
+ <input type="hidden" id="passwordPolicy" name="passwordPolicy" value={passwordPolicy} />
<p class="text-muted-foreground mt-1 text-xs">
{#if passwordPolicy === 'basic'}
Basic: Minimum 8 characters
diff --git a/frontend/src/routes/settings/users/+page.svelte b/frontend/src/routes/settings/users/+page.svelte
index a34fcabd8..149f39ba3 100644
--- a/frontend/src/routes/settings/users/+page.svelte
+++ b/frontend/src/routes/settings/users/+page.svelte
@@ -1,10 +1,11 @@
<script lang="ts">
- import { Users, Shield, UserCheck } from '@lucide/svelte';
- import * as Alert from '$lib/components/ui/alert/index.js';
+ import UsersIcon from '@lucide/svelte/icons/users';
+ import ShieldIcon from '@lucide/svelte/icons/shield';
+ import UserCheckIcon from '@lucide/svelte/icons/user-check';
import { toast } from 'svelte-sonner';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import { userAPI } from '$lib/services/api';
import StatCard from '$lib/components/stat-card.svelte';
import UserTable from './user-table.svelte';
@@ -15,8 +16,7 @@
let { data } = $props();
- let users = $state<User[]>(Array.isArray(data.users) ? data.users : data.users?.data || []);
- let error = $state<string | null>(null);
+ let users = $state(data.users);
let selectedIds = $state<string[]>([]);
let requestOptions = $state<SearchPaginationSortRequest>(data.userRequestOptions);
@@ -33,55 +33,9 @@
refresh: false
});
- const totalUsers = $derived(users.length);
- const adminUsers = $derived(users.filter((u) => u.roles?.includes('admin')).length);
- const regularUsers = $derived(users.filter((u) => !u.roles?.includes('admin')).length);
-
- async function loadUsers() {
- try {
- isLoading.refresh = true;
- const response = await userAPI.getUsers(
- requestOptions.pagination,
- requestOptions.sort,
- requestOptions.search,
- requestOptions.filters
- );
- users = Array.isArray(response) ? response : response.data || [];
- error = null;
- } catch (err) {
- console.error('Failed to load users:', err);
- error = err instanceof Error ? err.message : 'Failed to load users';
- users = [];
- } finally {
- isLoading.refresh = false;
- }
- }
-
- async function onRefresh(options: SearchPaginationSortRequest) {
- requestOptions = options;
- await loadUsers();
- return {
- data: users,
- pagination: {
- totalPages: Math.ceil(users.length / (requestOptions.pagination?.limit || 20)),
- totalItems: users.length,
- currentPage: requestOptions.pagination?.page || 1,
- itemsPerPage: requestOptions.pagination?.limit || 20
- }
- };
- }
-
- async function refreshUsers() {
- isLoading.refresh = true;
- try {
- await loadUsers();
- } catch (error) {
- console.error('Failed to refresh users:', error);
- toast.error('Failed to refresh users');
- } finally {
- isLoading.refresh = false;
- }
- }
+ const totalUsers = $derived(users.data.length);
+ const adminUsers = $derived(users.data.filter((u) => u.roles?.includes('admin')).length);
+ const regularUsers = $derived(users.data.filter((u) => !u.roles?.includes('admin')).length);
function openCreateDialog() {
userToEdit = null;
@@ -114,7 +68,7 @@
setLoadingState: (value) => (isLoading[loading] = value),
onSuccess: async () => {
toast.success(`User "${user.username}" updated successfully.`);
- await loadUsers();
+ users = await userAPI.getUsers(requestOptions);
isDialogOpen.edit = false;
userToEdit = null;
}
@@ -141,7 +95,7 @@
setLoadingState: (value) => (isLoading[loading] = value),
onSuccess: async () => {
toast.success(`User "${user.username}" created successfully.`);
- await loadUsers();
+ users = await userAPI.getUsers(requestOptions);
isDialogOpen.create = false;
}
});
@@ -161,58 +115,45 @@
<div class="flex items-center gap-2">
<ArcaneButton
action="create"
- label="Create User"
- onClick={openCreateDialog}
+ customLabel="Create User"
+ onclick={openCreateDialog}
loading={isLoading.creating}
disabled={isLoading.creating}
/>
- <ArcaneButton
- action="restart"
- onClick={refreshUsers}
- label="Refresh"
- loading={isLoading.refresh}
- disabled={isLoading.refresh}
- />
</div>
</div>
- {#if error}
- <Alert.Root variant="destructive">
- <Alert.Title>Error Loading Users</Alert.Title>
- <Alert.Description>{error}</Alert.Description>
- </Alert.Root>
- {/if}
-
<div class="grid grid-cols-1 gap-4 sm:grid-cols-3">
<StatCard
title="Total Users"
value={totalUsers}
- icon={Users}
+ icon={UsersIcon}
iconColor="text-blue-500"
class="border-l-4 border-l-blue-500"
/>
<StatCard
title="Administrators"
value={adminUsers}
- icon={Shield}
+ icon={ShieldIcon}
iconColor="text-red-500"
class="border-l-4 border-l-red-500"
/>
<StatCard
title="Regular Users"
value={regularUsers}
- icon={UserCheck}
+ icon={UserCheckIcon}
iconColor="text-green-500"
class="border-l-4 border-l-green-500"
/>
</div>
<UserTable
- {users}
+ bind:users
bind:selectedIds
bind:requestOptions
- {onRefresh}
- onUsersChanged={loadUsers}
+ onUsersChanged={async () => {
+ users = await userAPI.getUsers(requestOptions);
+ }}
onEditUser={openEditDialog}
/>
diff --git a/frontend/src/routes/settings/users/+page.ts b/frontend/src/routes/settings/users/+page.ts
index 15c38c007..c6a558289 100644
--- a/frontend/src/routes/settings/users/+page.ts
+++ b/frontend/src/routes/settings/users/+page.ts
@@ -1,27 +1,21 @@
import { settingsAPI, userAPI } from '$lib/services/api';
import type { SearchPaginationSortRequest } from '$lib/types/pagination.type';
-
export const load = async () => {
const settings = await settingsAPI.getSettings();
- const userRequestOptions: SearchPaginationSortRequest = {
- pagination: {
- page: 1,
- limit: 20
- },
- sort: {
- column: 'Username',
- direction: 'asc' as const
- }
- };
+ const userRequestOptions: SearchPaginationSortRequest = {
+ pagination: {
+ page: 1,
+ limit: 20
+ },
+ sort: {
+ column: 'Username',
+ direction: 'asc' as const
+ }
+ };
- const users = await userAPI.getUsers(
- userRequestOptions.pagination,
- userRequestOptions.sort,
- userRequestOptions.search,
- userRequestOptions.filters
- );
+ const users = await userAPI.getUsers(userRequestOptions);
return {
settings,
diff --git a/frontend/src/routes/settings/users/user-table.svelte b/frontend/src/routes/settings/users/user-table.svelte
index e81c4f2a4..2f9f0a080 100644
--- a/frontend/src/routes/settings/users/user-table.svelte
+++ b/frontend/src/routes/settings/users/user-table.svelte
@@ -1,33 +1,31 @@
<script lang="ts">
- import ArcaneTable from '$lib/components/arcane-table.svelte';
+ import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import { Button } from '$lib/components/ui/button/index.js';
- import { Trash2, Users, Ellipsis, Edit } from '@lucide/svelte';
+ import Trash2Icon from '@lucide/svelte/icons/trash-2';
+ import EllipsisIcon from '@lucide/svelte/icons/ellipsis';
+ import EditIcon from '@lucide/svelte/icons/edit';
import * as Card from '$lib/components/ui/card/index.js';
import { toast } from 'svelte-sonner';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
- import * as Table from '$lib/components/ui/table';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
- import { formatFriendlyDate } from '$lib/utils/date.utils';
import { userAPI } from '$lib/services/api';
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
import type { User } from '$lib/types/user.type';
+ import type { ColumnSpec } from '$lib/components/arcane-table';
let {
- users,
+ users = $bindable(),
selectedIds = $bindable(),
requestOptions = $bindable(),
- onRefresh,
onUsersChanged,
onEditUser
}: {
- users: User[];
+ users: Paginated<User>;
selectedIds: string[];
requestOptions: SearchPaginationSortRequest;
- onRefresh: (options: SearchPaginationSortRequest) => Promise<any>;
onUsersChanged: () => Promise<void>;
onEditUser: (user: User) => void;
} = $props();
@@ -36,25 +34,6 @@
removing: false
});
- type UserWithId = User & { id: string };
-
- const usersWithId = $derived(
- (users || []).map((user) => ({
- ...user,
- id: user.id
- }))
- );
-
- const paginatedUsers: Paginated<UserWithId> = $derived({
- data: usersWithId as UserWithId[],
- pagination: {
- totalPages: Math.ceil(usersWithId.length / (requestOptions.pagination?.limit || 20)),
- totalItems: usersWithId.length,
- currentPage: requestOptions.pagination?.page || 1,
- itemsPerPage: requestOptions.pagination?.limit || 20
- }
- });
-
async function handleDeleteSelected() {
if (selectedIds.length === 0) return;
@@ -88,9 +67,7 @@
isLoading.removing = false;
if (successCount > 0) {
- toast.success(
- `Successfully deleted ${successCount} user${successCount > 1 ? 's' : ''}`
- );
+ toast.success(`Successfully deleted ${successCount} user${successCount > 1 ? 's' : ''}`);
await onUsersChanged();
}
@@ -129,97 +106,77 @@
function getRoleBadgeVariant(roles: string[]) {
if (roles?.includes('admin')) return 'red';
- if (roles?.includes('moderator')) return 'amber';
return 'green';
}
function getRoleText(roles: string[]) {
if (roles?.includes('admin')) return 'Admin';
- if (roles?.includes('moderator')) return 'Moderator';
return 'User';
}
+
+ const columns = [
+ { accessorKey: 'username', title: 'Username', sortable: true, cell: UsernameCell },
+ { accessorKey: 'displayName', title: 'Display Name', sortable: true, cell: DisplayNameCell },
+ { accessorKey: 'email', title: 'Email', sortable: true, cell: EmailCell },
+ { accessorKey: 'roles', title: 'Role', sortable: true, cell: RoleCell }
+ ] satisfies ColumnSpec<User>[];
</script>
-{#if usersWithId.length > 0}
- <Card.Root class="border shadow-sm">
- <Card.Header class="px-6">
- <div class="flex items-center justify-between">
- <Card.Title>Users List</Card.Title>
- <div class="flex items-center gap-2">
- {#if selectedIds.length > 0}
- <ArcaneButton
- action="remove"
- onClick={handleDeleteSelected}
- loading={isLoading.removing}
- disabled={isLoading.removing}
- label="Remove Selected"
- />
- {/if}
- </div>
- </div>
- </Card.Header>
- <Card.Content>
- <ArcaneTable
- items={paginatedUsers}
- bind:requestOptions
- bind:selectedIds
- {onRefresh}
- columns={[
- { label: 'Username', sortColumn: 'username' },
- { label: 'Display Name', sortColumn: 'displayName' },
- { label: 'Email', sortColumn: 'email' },
- { label: 'Role', sortColumn: 'roles' },
- { label: ' ' }
- ]}
- filterPlaceholder="Search users..."
- noResultsMessage="No users found"
- >
- {#snippet rows({ item })}
- <Table.Cell>
- <span class="font-medium">{item.username}</span>
- </Table.Cell>
- <Table.Cell>{item.displayName || '-'}</Table.Cell>
- <Table.Cell>{item.email || '-'}</Table.Cell>
- <Table.Cell>
- <StatusBadge text={getRoleText(item.roles)} variant={getRoleBadgeVariant(item.roles)} />
- </Table.Cell>
- <Table.Cell>
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <Button {...props} variant="ghost" size="icon" class="relative size-8 p-0">
- <span class="sr-only">Open menu</span>
- <Ellipsis />
- </Button>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item onclick={() => onEditUser(item)}>
- <Edit class="size-4" />
- Edit
- </DropdownMenu.Item>
- <DropdownMenu.Item
- variant="destructive"
- onclick={() => handleDeleteUser(item.id, item.username)}
- >
- <Trash2 class="size-4" />
- Delete
- </DropdownMenu.Item>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
- </Table.Cell>
- {/snippet}
- </ArcaneTable>
- </Card.Content>
- </Card.Root>
-{:else}
- <div class="flex flex-col items-center justify-center px-6 py-12 text-center">
- <Users class="text-muted-foreground mb-4 size-12 opacity-40" />
- <p class="text-lg font-medium">No users found</p>
- <p class="text-muted-foreground mt-1 max-w-md text-sm">
- Create a new user using the "Create User" button above
- </p>
- </div>
-{/if}
+{#snippet UsernameCell({ item }: { item: User })}
+ <span class="font-medium">{item.username}</span>
+{/snippet}
+
+{#snippet DisplayNameCell({ value }: { value: unknown })}
+ {String(value || '-')}
+{/snippet}
+
+{#snippet EmailCell({ value }: { value: unknown })}
+ {String(value || '-')}
+{/snippet}
+
+{#snippet RoleCell({ item }: { item: User })}
+ <StatusBadge text={getRoleText(item.roles)} variant={getRoleBadgeVariant(item.roles)} />
+{/snippet}
+
+{#snippet RowActions({ item }: { item: User })}
+ <DropdownMenu.Root>
+ <DropdownMenu.Trigger>
+ {#snippet child({ props })}
+ <Button {...props} variant="ghost" size="icon" class="relative size-8 p-0">
+ <span class="sr-only">Open menu</span>
+ <EllipsisIcon />
+ </Button>
+ {/snippet}
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Content align="end">
+ <DropdownMenu.Group>
+ <DropdownMenu.Item onclick={() => onEditUser(item)}>
+ <EditIcon class="size-4" />
+ Edit
+ </DropdownMenu.Item>
+ <DropdownMenu.Item variant="destructive" onclick={() => handleDeleteUser(item.id, item.username)}>
+ <Trash2Icon class="size-4" />
+ Delete
+ </DropdownMenu.Item>
+ </DropdownMenu.Group>
+ </DropdownMenu.Content>
+ </DropdownMenu.Root>
+{/snippet}
+
+<Card.Root>
+ <Card.Content class="py-5">
+ <ArcaneTable
+ items={users}
+ bind:requestOptions
+ bind:selectedIds
+ onRemoveSelected={(ids) => handleDeleteSelected()}
+ onRefresh={async (options) => {
+ requestOptions = options;
+ await onUsersChanged();
+ return users;
+ }}
+ {columns}
+ rowActions={RowActions}
+ />
+ </Card.Content>
+</Card.Root>
diff --git a/frontend/src/routes/volumes/+page.svelte b/frontend/src/routes/volumes/+page.svelte
index c92131efd..0c296ecc2 100644
--- a/frontend/src/routes/volumes/+page.svelte
+++ b/frontend/src/routes/volumes/+page.svelte
@@ -1,11 +1,13 @@
<script lang="ts">
- import { HardDrive, ArchiveRestore, ArchiveX } from '@lucide/svelte';
+ import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
+ import ArchiveRestoreIcon from '@lucide/svelte/icons/archive-restore';
+ import ArchiveXIcon from '@lucide/svelte/icons/archive-x';
import { toast } from 'svelte-sonner';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
import CreateVolumeSheet from '$lib/components/sheets/create-volume-sheet.svelte';
import type { VolumeCreateOptions } from 'dockerode';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import { environmentAPI } from '$lib/services/api';
import StatCard from '$lib/components/stat-card.svelte';
import VolumeTable from './volume-table.svelte';
@@ -19,7 +21,8 @@
let isLoading = $state({
creating: false,
- refresh: false
+ refresh: false,
+ removingSelected: false
});
const totalVolumes = $derived(volumes.data.length);
@@ -62,15 +65,15 @@
<div class="flex items-center gap-2">
<ArcaneButton
action="create"
- label="Create Volume"
- onClick={() => (isCreateDialogOpen = true)}
+ customLabel="Create Volume"
+ onclick={() => (isCreateDialogOpen = true)}
loading={isLoading.creating}
disabled={isLoading.creating}
/>
<ArcaneButton
action="restart"
- onClick={refreshVolumes}
- label="Refresh"
+ onclick={refreshVolumes}
+ customLabel="Refresh"
loading={isLoading.refresh}
disabled={isLoading.refresh}
/>
@@ -81,21 +84,21 @@
<StatCard
title="Total Volumes"
value={totalVolumes}
- icon={HardDrive}
+ icon={HardDriveIcon}
iconColor="text-blue-500"
class="border-l-4 border-l-blue-500"
/>
<StatCard
title="Used Volumes"
value={usedVolumes}
- icon={ArchiveRestore}
+ icon={ArchiveRestoreIcon}
iconColor="text-green-500"
class="border-l-4 border-l-green-500"
/>
<StatCard
title="Unused Volumes"
value={unusedVolumes}
- icon={ArchiveX}
+ icon={ArchiveXIcon}
iconColor="text-red-500"
class="border-l-4 border-l-red-500"
/>
@@ -103,9 +106,5 @@
<VolumeTable bind:volumes bind:selectedIds bind:requestOptions />
- <CreateVolumeSheet
- bind:open={isCreateDialogOpen}
- isLoading={isLoading.creating}
- onSubmit={handleCreateVolumeSubmit}
- />
+ <CreateVolumeSheet bind:open={isCreateDialogOpen} isLoading={isLoading.creating} onSubmit={handleCreateVolumeSubmit} />
</div>
diff --git a/frontend/src/routes/volumes/[volumeName]/+page.svelte b/frontend/src/routes/volumes/[volumeName]/+page.svelte
index 808d879be..000176261 100644
--- a/frontend/src/routes/volumes/[volumeName]/+page.svelte
+++ b/frontend/src/routes/volumes/[volumeName]/+page.svelte
@@ -1,22 +1,29 @@
<script lang="ts">
import * as Card from '$lib/components/ui/card/index.js';
- import { HardDrive, Clock, Tag, Layers, Database, Globe, Info } from '@lucide/svelte';
+ import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
+ import ClockIcon from '@lucide/svelte/icons/clock';
+ import TagIcon from '@lucide/svelte/icons/tag';
+ import LayersIcon from '@lucide/svelte/icons/layers';
+ import DatabaseIcon from '@lucide/svelte/icons/database';
+ import GlobeIcon from '@lucide/svelte/icons/globe';
+ import InfoIcon from '@lucide/svelte/icons/info';
import * as Breadcrumb from '$lib/components/ui/breadcrumb/index.js';
import { goto } from '$app/navigation';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
- import { formatDate, truncateString } from '$lib/utils/string.utils';
+ import { truncateString } from '$lib/utils/string.utils';
import { openConfirmDialog } from '$lib/components/confirm-dialog/';
import { toast } from 'svelte-sonner';
import { tryCatch } from '$lib/utils/try-catch';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import { environmentAPI } from '$lib/services/api';
+ import { format } from 'date-fns';
let { data } = $props();
let volume = $state(data.volume);
let isLoading = $state({ remove: false });
- const createdDate = $derived(volume.createdAt ? formatDate(volume.createdAt) : 'N/A');
+ const createdDate = $derived(volume.createdAt ? format(new Date(volume.createdAt), 'PP p') : 'N/A');
async function handleRemoveVolumeConfirm(volumeName: string) {
let message = 'Are you sure you want to delete this volume? This action cannot be undone.';
@@ -91,7 +98,7 @@
<ArcaneButton
action="remove"
customLabel="Remove Volume"
- onClick={() => handleRemoveVolumeConfirm(volume.name)}
+ onclick={() => handleRemoveVolumeConfirm(volume.name)}
loading={isLoading.remove}
disabled={isLoading.remove}
/>
@@ -104,7 +111,7 @@
<Card.Root class="border shadow-sm">
<Card.Header class="pb-0">
<Card.Title class="flex items-center gap-2 text-lg">
- <Database class="text-primary size-5" />
+ <DatabaseIcon class="text-primary size-5" />
Volume Details
</Card.Title>
<Card.Description>Basic information about this Docker volume</Card.Description>
@@ -112,22 +119,18 @@
<Card.Content class="pt-6">
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-2 lg:grid-cols-3">
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-500/10 p-2"
- >
- <Database class="size-5 text-gray-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-500/10 p-2">
+ <DatabaseIcon class="size-5 text-gray-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">Name</p>
- <p class="mt-1 text-base font-semibold break-words">{volume.name}</p>
+ <p class="mt-1 break-words text-base font-semibold">{volume.name}</p>
</div>
</div>
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-blue-500/10 p-2"
- >
- <HardDrive class="size-5 text-blue-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-blue-500/10 p-2">
+ <HardDriveIcon class="size-5 text-blue-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">Driver</p>
@@ -136,10 +139,8 @@
</div>
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-green-500/10 p-2"
- >
- <Clock class="size-5 text-green-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-green-500/10 p-2">
+ <ClockIcon class="size-5 text-green-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">Created</p>
@@ -148,10 +149,8 @@
</div>
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-purple-500/10 p-2"
- >
- <Globe class="size-5 text-purple-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-purple-500/10 p-2">
+ <GlobeIcon class="size-5 text-purple-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">Scope</p>
@@ -160,10 +159,8 @@
</div>
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-amber-500/10 p-2"
- >
- <Info class="size-5 text-amber-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-amber-500/10 p-2">
+ <InfoIcon class="size-5 text-amber-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">Status</p>
@@ -178,15 +175,13 @@
</div>
<div class="col-span-1 flex items-start gap-3 sm:col-span-2 lg:col-span-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-teal-500/10 p-2"
- >
- <Layers class="size-5 text-teal-500" />
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-teal-500/10 p-2">
+ <LayersIcon class="size-5 text-teal-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">Mountpoint</p>
<div class="bg-muted/50 mt-2 rounded-lg border p-3">
- <code class="font-mono text-sm break-all">{volume.mountpoint}</code>
+ <code class="break-all font-mono text-sm">{volume.mountpoint}</code>
</div>
</div>
</div>
@@ -197,7 +192,7 @@
<Card.Root class="border shadow-sm">
<Card.Header class="pb-0">
<Card.Title class="flex items-center gap-2 text-lg">
- <HardDrive class="text-primary size-5" />
+ <HardDriveIcon class="text-primary size-5" />
Containers Using This Volume
</Card.Title>
<Card.Description>List of containers currently referencing this volume</Card.Description>
@@ -207,12 +202,8 @@
<div class="divide-y rounded-lg border">
{#each volume.containers as id (id)}
<div class="flex items-center justify-between gap-3 p-3">
- <code class="font-mono text-sm break-all">{truncateString(id, 48)}</code>
- <a
- href={`/containers/${id}`}
- class="text-primary hover:underline text-sm"
- title="View container details"
- >
+ <code class="break-all font-mono text-sm">{truncateString(id, 48)}</code>
+ <a href={`/containers/${id}`} class="text-primary text-sm hover:underline" title="View container details">
View
</a>
</div>
@@ -228,7 +219,7 @@
<Card.Root class="border shadow-sm">
<Card.Header class="pb-0">
<Card.Title class="flex items-center gap-2 text-lg">
- <Tag class="text-primary size-5" />
+ <TagIcon class="text-primary size-5" />
Labels
</Card.Title>
<Card.Description>User-defined metadata attached to this volume</Card.Description>
@@ -237,14 +228,10 @@
<div class="bg-card divide-y rounded-lg border">
{#each Object.entries(volume.labels) as [key, value] (key)}
<div class="flex flex-col p-3 sm:flex-row">
- <div
- class="text-muted-foreground mb-2 w-full font-medium break-all sm:mb-0 sm:w-1/3"
- >
+ <div class="text-muted-foreground mb-2 w-full break-all font-medium sm:mb-0 sm:w-1/3">
{key}
</div>
- <div
- class="bg-muted/50 w-full rounded p-2 font-mono text-xs break-all sm:w-2/3 sm:text-sm"
- >
+ <div class="bg-muted/50 w-full break-all rounded p-2 font-mono text-xs sm:w-2/3 sm:text-sm">
{value}
</div>
</div>
@@ -258,7 +245,7 @@
<Card.Root class="border shadow-sm">
<Card.Header class="pb-0">
<Card.Title class="flex items-center gap-2 text-lg">
- <HardDrive class="text-primary size-5" />
+ <HardDriveIcon class="text-primary size-5" />
Driver Options
</Card.Title>
<Card.Description>Volume driver-specific options</Card.Description>
@@ -267,14 +254,10 @@
<div class="bg-card divide-y rounded-lg border">
{#each Object.entries(volume.options) as [key, value] (key)}
<div class="flex flex-col p-3 sm:flex-row">
- <div
- class="text-muted-foreground mb-2 w-full font-medium break-all sm:mb-0 sm:w-1/3"
- >
+ <div class="text-muted-foreground mb-2 w-full break-all font-medium sm:mb-0 sm:w-1/3">
{key}
</div>
- <div
- class="bg-muted/50 w-full rounded p-2 font-mono text-xs break-all sm:w-2/3 sm:text-sm"
- >
+ <div class="bg-muted/50 w-full break-all rounded p-2 font-mono text-xs sm:w-2/3 sm:text-sm">
{value}
</div>
</div>
@@ -286,14 +269,12 @@
{#if (!volume.labels || Object.keys(volume.labels).length === 0) && (!volume.options || Object.keys(volume.options).length === 0)}
<Card.Root class="bg-muted/10 border shadow-sm">
- <Card.Content class="pt-6 pb-6 text-center">
+ <Card.Content class="pb-6 pt-6 text-center">
<div class="flex flex-col items-center justify-center">
<div class="bg-muted/30 mb-4 rounded-full p-3">
- <Tag class="text-muted-foreground size-5 opacity-50" />
+ <TagIcon class="text-muted-foreground size-5 opacity-50" />
</div>
- <p class="text-muted-foreground">
- This volume has no additional labels or driver options.
- </p>
+ <p class="text-muted-foreground">This volume has no additional labels or driver options.</p>
</div>
</Card.Content>
</Card.Root>
@@ -302,19 +283,12 @@
{:else}
<div class="flex flex-col items-center justify-center px-4 py-16 text-center">
<div class="bg-muted/30 mb-4 rounded-full p-4">
- <Database class="text-muted-foreground size-10 opacity-70" />
+ <DatabaseIcon class="text-muted-foreground size-10 opacity-70" />
</div>
<h2 class="mb-2 text-xl font-medium">Volume Not Found</h2>
- <p class="text-muted-foreground mb-6">
- The requested volume could not be found or is no longer available.
- </p>
+ <p class="text-muted-foreground mb-6">The requested volume could not be found or is no longer available.</p>
- <ArcaneButton
- action="cancel"
- customLabel="Back to Volumes"
- onClick={() => goto('/volumes')}
- size="sm"
- />
+ <ArcaneButton action="cancel" customLabel="Back to Volumes" onclick={() => goto('/volumes')} size="sm" />
</div>
{/if}
</div>
diff --git a/frontend/src/routes/volumes/volume-table.svelte b/frontend/src/routes/volumes/volume-table.svelte
index 387033c36..18aec58f8 100644
--- a/frontend/src/routes/volumes/volume-table.svelte
+++ b/frontend/src/routes/volumes/volume-table.svelte
@@ -1,23 +1,23 @@
<script lang="ts">
- import ArcaneTable from '$lib/components/arcane-table.svelte';
+ import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import { Button } from '$lib/components/ui/button/index.js';
- import { Trash2, HardDrive, Ellipsis, ScanSearch } from '@lucide/svelte';
+ import EllipsisIcon from '@lucide/svelte/icons/ellipsis';
+ import ScanSearchIcon from '@lucide/svelte/icons/scan-search';
+ import Trash2Icon from '@lucide/svelte/icons/trash-2';
import * as Card from '$lib/components/ui/card/index.js';
import { goto } from '$app/navigation';
import { toast } from 'svelte-sonner';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
- import * as Table from '$lib/components/ui/table';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
- import { formatFriendlyDate } from '$lib/utils/date.utils';
+ import { format } from 'date-fns';
import { truncateString } from '$lib/utils/string.utils';
import { environmentAPI } from '$lib/services/api';
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
- import FilterDropdown from '$lib/components/dropdowns/filter-dropdown.svelte';
import type { VolumeSummaryDto } from '$lib/types/volume.type';
+ import type { ColumnSpec } from '$lib/components/arcane-table';
let {
volumes = $bindable(),
@@ -29,73 +29,10 @@
requestOptions: SearchPaginationSortRequest;
} = $props();
- let volumeFilters = $state({
- showUsed: true,
- showUnused: true
- });
-
let isLoading = $state({
removing: false
});
- const filteredVolumes: Paginated<VolumeSummaryDto> = $derived({
- ...volumes,
- data: volumes.data.filter((vol) => {
- const showBecauseUsed = volumeFilters.showUsed && vol.inUse;
- const showBecauseUnused = volumeFilters.showUnused && !vol.inUse;
- return showBecauseUsed || showBecauseUnused;
- })
- });
-
- async function handleDeleteSelected() {
- if (selectedIds.length === 0) return;
-
- openConfirmDialog({
- title: `Remove ${selectedIds.length} Volume${selectedIds.length > 1 ? 's' : ''}`,
- message: `Are you sure you want to remove the selected volume${selectedIds.length > 1 ? 's' : ''}? This action cannot be undone and will permanently delete all data.`,
- confirm: {
- label: 'Remove',
- destructive: true,
- action: async () => {
- isLoading.removing = true;
- let successCount = 0;
- let failureCount = 0;
-
- for (const volumeName of selectedIds) {
- const result = await tryCatch(environmentAPI.deleteVolume(volumeName));
- handleApiResultWithCallbacks({
- result,
- message: `Failed to remove volume ${volumeName}`,
- setLoadingState: () => {},
- onSuccess: () => {
- successCount++;
- }
- });
-
- if (result.error) {
- failureCount++;
- }
- }
-
- isLoading.removing = false;
-
- if (successCount > 0) {
- toast.success(
- `Successfully removed ${successCount} volume${successCount > 1 ? 's' : ''}`
- );
- volumes = await environmentAPI.getVolumes(requestOptions);
- }
-
- if (failureCount > 0) {
- toast.error(`Failed to remove ${failureCount} volume${failureCount > 1 ? 's' : ''}`);
- }
-
- selectedIds = [];
- }
- }
- });
- }
-
async function handleRemoveVolumeConfirm(name: string) {
openConfirmDialog({
title: `Remove Volume`,
@@ -118,126 +55,106 @@
}
});
}
+
+ async function handleDeleteSelected(ids: string[]) {
+ if (!ids?.length) return;
+ isLoading.removing = true;
+ let successCount = 0;
+ let failureCount = 0;
+
+ const idToName = new Map(volumes.data.map((v) => [v.id, v.name] as const));
+
+ for (const id of ids) {
+ const name = idToName.get(id);
+ if (!name) continue;
+ const result = await tryCatch(environmentAPI.deleteVolume(name));
+ handleApiResultWithCallbacks({
+ result,
+ message: `Failed to remove volume ${name}`,
+ setLoadingState: () => {},
+ onSuccess: () => (successCount += 1)
+ });
+ if (result.error) failureCount += 1;
+ }
+
+ isLoading.removing = false;
+ if (successCount > 0) {
+ toast.success(`Successfully removed ${successCount} volume${successCount > 1 ? 's' : ''}`);
+ volumes = await environmentAPI.getVolumes(requestOptions);
+ }
+ if (failureCount > 0) {
+ toast.error(`Failed to remove ${failureCount} volume${failureCount > 1 ? 's' : ''}`);
+ }
+ selectedIds = [];
+ }
+
+ const columns = [
+ { accessorKey: 'id', title: 'ID', hidden: true },
+ { accessorKey: 'name', title: 'Name', sortable: true, cell: NameCell },
+ {
+ accessorKey: 'inUse',
+ title: 'Status',
+ sortable: true,
+ cell: StatusCell
+ },
+ { accessorKey: 'driver', title: 'Driver', sortable: true },
+ { accessorKey: 'createdAt', title: 'Created', sortable: true, cell: CreatedCell }
+ ] satisfies ColumnSpec<VolumeSummaryDto>[];
</script>
-{#if volumes.data.length > 0}
- <Card.Root class="border shadow-sm">
- <Card.Header class="px-6">
- <div class="flex items-center justify-between">
- <Card.Title>Volumes List</Card.Title>
- <div class="flex items-center gap-2">
- <FilterDropdown bind:filters={volumeFilters}>
- {#snippet children({ filters })}
- <DropdownMenu.Label>Volume Usage</DropdownMenu.Label>
- <DropdownMenu.CheckboxItem
- checked={filters.showUsed}
- onCheckedChange={(checked) => {
- filters.showUsed = checked;
- }}
- >
- Show Used Volumes
- </DropdownMenu.CheckboxItem>
- <DropdownMenu.CheckboxItem
- checked={filters.showUnused}
- onCheckedChange={(checked) => {
- filters.showUnused = checked;
- }}
- >
- Show Unused Volumes
- </DropdownMenu.CheckboxItem>
- {/snippet}
- </FilterDropdown>
- {#if selectedIds.length > 0}
- <ArcaneButton
- action="remove"
- onClick={handleDeleteSelected}
- loading={isLoading.removing}
- disabled={isLoading.removing}
- label="Remove Selected"
- />
- {/if}
- </div>
- </div>
- </Card.Header>
- <Card.Content>
- {#if filteredVolumes.data.length > 0}
- <ArcaneTable
- items={filteredVolumes}
- bind:requestOptions
- bind:selectedIds
- onRefresh={async (options) => (volumes = await environmentAPI.getVolumes(options))}
- columns={[
- { label: 'Name', sortColumn: 'name' },
- { label: 'Status', sortColumn: 'inUse' },
- { label: 'Driver', sortColumn: 'driver' },
- { label: 'Created', sortColumn: 'createdAt' },
- { label: ' ' }
- ]}
- filterPlaceholder="Search volumes..."
- noResultsMessage="No volumes found"
- >
- {#snippet rows({ item })}
- <Table.Cell>
- <a class="font-medium hover:underline" href="/volumes/{item.id}/" title={item.name}>
- {truncateString(item.name, 40)}
- </a>
- </Table.Cell>
- <Table.Cell>
- {#if item.inUse}
- <StatusBadge text="In Use" variant="green" />
- {:else}
- <StatusBadge text="Unused" variant="amber" />
- {/if}
- </Table.Cell>
- <Table.Cell>{item.driver}</Table.Cell>
- <Table.Cell>{formatFriendlyDate(item.createdAt)}</Table.Cell>
- <Table.Cell>
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <Button {...props} variant="ghost" size="icon" class="relative size-8 p-0">
- <span class="sr-only">Open menu</span>
- <Ellipsis />
- </Button>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item onclick={() => goto(`/volumes/${item.id}`)}>
- <ScanSearch class="size-4" />
- Inspect
- </DropdownMenu.Item>
- <DropdownMenu.Item
- variant="destructive"
- onclick={() => handleRemoveVolumeConfirm(item.name)}
- disabled={item.inUse}
- >
- <Trash2 class="size-4" />
- Remove
- </DropdownMenu.Item>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
- </Table.Cell>
- {/snippet}
- </ArcaneTable>
- {:else}
- <div class="flex flex-col items-center justify-center px-6 py-12 text-center">
- <HardDrive class="text-muted-foreground mb-4 size-12 opacity-40" />
- <p class="text-lg font-medium">No volumes match current filters</p>
- <p class="text-muted-foreground mt-1 max-w-md text-sm">
- Adjust your filters to see volumes
- </p>
- </div>
- {/if}
- </Card.Content>
- </Card.Root>
-{:else}
- <div class="flex flex-col items-center justify-center px-6 py-12 text-center">
- <HardDrive class="text-muted-foreground mb-4 size-12 opacity-40" />
- <p class="text-lg font-medium">No volumes found</p>
- <p class="text-muted-foreground mt-1 max-w-md text-sm">
- Create a new volume using the "Create Volume" button above
- </p>
- </div>
-{/if}
+{#snippet NameCell({ item }: { item: VolumeSummaryDto })}
+ <a class="font-medium hover:underline" href="/volumes/{item.id}/" title={item.name}>
+ {truncateString(item.name, 40)}
+ </a>
+{/snippet}
+
+{#snippet StatusCell({ item }: { item: VolumeSummaryDto })}
+ {#if item.inUse}
+ <StatusBadge text="In Use" variant="green" />
+ {:else}
+ <StatusBadge text="Unused" variant="amber" />
+ {/if}
+{/snippet}
+
+{#snippet CreatedCell({ value }: { value: unknown })}
+ {format(new Date(String(value)), 'PP p')}
+{/snippet}
+
+{#snippet RowActions({ item }: { item: VolumeSummaryDto })}
+ <DropdownMenu.Root>
+ <DropdownMenu.Trigger>
+ {#snippet child({ props })}
+ <Button {...props} variant="ghost" size="icon" class="relative size-8 p-0">
+ <span class="sr-only">Open menu</span>
+ <EllipsisIcon />
+ </Button>
+ {/snippet}
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Content align="end">
+ <DropdownMenu.Group>
+ <DropdownMenu.Item onclick={() => goto(`/volumes/${item.id}`)}>
+ <ScanSearchIcon class="size-4" />
+ Inspect
+ </DropdownMenu.Item>
+ <DropdownMenu.Item variant="destructive" onclick={() => handleRemoveVolumeConfirm(item.name)} disabled={item.inUse}>
+ <Trash2Icon class="size-4" />
+ Remove
+ </DropdownMenu.Item>
+ </DropdownMenu.Group>
+ </DropdownMenu.Content>
+ </DropdownMenu.Root>
+{/snippet}
+
+<Card.Root>
+ <Card.Content class="py-5">
+ <ArcaneTable
+ items={volumes}
+ bind:requestOptions
+ bind:selectedIds
+ onRemoveSelected={(ids) => handleDeleteSelected(ids)}
+ onRefresh={async (options) => (volumes = await environmentAPI.getVolumes(options))}
+ {columns}
+ rowActions={RowActions}
+ />
+ </Card.Content>
+</Card.Root>
diff --git a/package.json b/package.json
index 26664364b..025944263 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,7 @@
{
"name": "arcane-repo",
"private": true,
+ "packageManager": "[email protected]",
"workspaces": [
"frontend",
"tests"
@@ -9,7 +10,10 @@
"preinstall": "npx only-allow pnpm",
"dev": "pnpm --filter arcane-frontend dev",
"build": "pnpm --filter arcane-frontend build",
- "test": "pnpm --filter arcane-tests test",
- "format": "pnpm --filter arcane-frontend format"
+ "test:up": "docker compose -f tests/setup/compose.yaml up -d --build",
+ "test:down": "docker compose -f tests/setup/compose.yaml down",
+ "test": "pnpm test:up && pnpm --filter arcane-tests test && pnpm test:down",
+ "format": "pnpm --filter arcane-frontend format",
+ "check": "pnpm --filter arcane-frontend check"
}
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 63c33ab7d..85e6a97ec 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -69,8 +69,8 @@ importers:
specifier: ^3.8.2
version: 3.8.2
'@lucide/svelte':
- specifier: ^0.525.0
- version: 0.525.0([email protected])
+ specifier: ^0.542.0
+ version: 0.542.0([email protected])
'@sveltejs/kit':
specifier: ^2.31.0
@@ -80,6 +80,9 @@ importers:
'@tailwindcss/vite':
specifier: ^4.1.12
+ '@types/bytes':
+ specifier: ^3.1.5
+ version: 3.1.5
'@types/dockerode':
specifier: ^3.3.42
version: 3.3.42
@@ -89,6 +92,9 @@ importers:
bits-ui:
specifier: ^2.9.3
version: 2.9.3(@internationalized/[email protected])([email protected])
+ bytes:
+ specifier: ^3.1.2
+ version: 3.1.2
clsx:
specifier: ^2.1.1
version: 2.1.1
@@ -162,10 +168,10 @@ importers:
tests:
devDependencies:
'@playwright/test':
- specifier: ^1.54.1
- version: 1.54.2
+ specifier: ^1.55.0
+ version: 1.55.0
'@types/node':
- specifier: ^24.1.0
+ specifier: ^24.3.0
version: 24.3.0
packages:
@@ -518,8 +524,8 @@ packages:
resolution: {integrity: sha512-GuBLekbw9jDBDhGur82nuwkxKQ+a3W5H0GfaAthDXcAu+XdpS43VlnxA9E9hllkpSP5ellRDKjLLj7Lu9Wr6xA==}
- '@lucide/[email protected]':
- resolution: {integrity: sha512-dyUxkXzepagLUzL8jHQNdeH286nC66ClLACsg+Neu/bjkRJWPWMzkT+H0DKlE70QdkicGCfs1ZGmXCc351hmZA==}
+ '@lucide/[email protected]':
+ resolution: {integrity: sha512-NuWttxTVfMSURpOxcKiKvoCtma3JtEpcJWzF/0cO69saZfXlv6G8NYAvEEGLmk75YPl+I+ROe+F97WhddM8r2A==}
peerDependencies:
svelte: ^5
@@ -538,8 +544,8 @@ packages:
resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
engines: {node: '>= 8'}
- '@playwright/[email protected]':
- resolution: {integrity: sha512-A+znathYxPf+72riFd1r1ovOLqsIIB0jKIoPjyK2kqEIe30/6jF6BC7QNluHuwUmsD2tv1XZVugN8GqfTMOxsA==}
+ '@playwright/[email protected]':
+ resolution: {integrity: sha512-04IXzPwHrW69XusN/SIdDdKZBzMfOT9UNT/YiJit/xpy2VuAoB8NHc8Aplb96zsWDddLnbkPL3TsmrS04ZU2xQ==}
engines: {node: '>=18'}
hasBin: true
@@ -799,6 +805,9 @@ packages:
resolution: {integrity: sha512-ldZXEhOBb8Is7xLs01fR3YEc3DERiz5silj8tnGkFZytt1abEvl/GhUmCE0PMLaMPTa3Jk4HbKmRlHmu+gCftg==}
engines: {node: '>=12'}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-VgZkrJckypj85YxEsEavcMmmSOIzkUHqWmM4CCyia5dc54YwsXzJ5uT4fYxBQNEXx+oF1krlhgCbvfubXqZYsQ==}
+
resolution: {integrity: sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==}
@@ -989,6 +998,10 @@ packages:
resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
+ resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==}
+ engines: {node: '>= 0.8'}
+
resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==}
engines: {node: '>= 0.4'}
@@ -1652,13 +1665,13 @@ packages:
resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==}
engines: {node: '>=12'}
- resolution: {integrity: sha512-n5r4HFbMmWsB4twG7tJLDN9gmBUeSPcsBZiWSE4DnYz9mJMAFqr2ID7+eGC9kpEnxExJ1epttwR59LEWCk8mtA==}
+ resolution: {integrity: sha512-GvZs4vU3U5ro2nZpeiwyb0zuFaqb9sUiAJuyrWpcGouD8y9/HLgGbNRjIph7zU9D3hnPaisMl9zG9CgFi/biIg==}
engines: {node: '>=18'}
hasBin: true
- resolution: {integrity: sha512-Hu/BMoA1NAdRUuulyvQC0pEqZ4vQbGfn8f7wPXcnqQmM+zct9UliKxsIkLNmz/ku7LElUNqmaiv1TG/aL5ACsw==}
+ resolution: {integrity: sha512-sdCWStblvV1YU909Xqx0DhOjPZE4/5lJsIS84IfN9dAZfcl/CIZ5O8l3o0j7hPMjDvqoTF8ZUcc+i/GL5erstA==}
engines: {node: '>=18'}
hasBin: true
@@ -2533,7 +2546,7 @@ snapshots:
'@lezer/highlight': 1.2.1
'@lezer/lr': 1.4.2
dependencies:
svelte: 5.38.1
@@ -2551,9 +2564,9 @@ snapshots:
'@nodelib/fs.scandir': 2.1.5
fastq: 1.19.1
- '@playwright/[email protected]':
+ '@playwright/[email protected]':
dependencies:
- playwright: 1.54.2
+ playwright: 1.55.0
'@polka/[email protected]': {}
@@ -2762,6 +2775,8 @@ snapshots:
'@tanstack/[email protected]': {}
+ '@types/[email protected]': {}
+
'@types/[email protected]': {}
@@ -3005,6 +3020,8 @@ snapshots:
optional: true
+
dependencies:
es-errors: 1.3.0
@@ -3682,11 +3699,11 @@ snapshots:
dependencies:
- playwright-core: 1.54.2
+ playwright-core: 1.55.0
optionalDependencies:
fsevents: 2.3.2
diff --git a/tests/package.json b/tests/package.json
index d46d7fe83..b8d20a992 100644
--- a/tests/package.json
+++ b/tests/package.json
@@ -1,12 +1,13 @@
{
"type": "module",
"name": "arcane-tests",
+ "packageManager": "[email protected]",
"scripts": {
"preinstall": "npx only-allow pnpm",
"test": "playwright test"
},
"devDependencies": {
- "@playwright/test": "^1.54.1",
- "@types/node": "^24.1.0"
+ "@playwright/test": "^1.55.0",
+ "@types/node": "^24.3.0"
}
}
diff --git a/tests/setup/projects/test-project-1756313007787/compose.yaml b/tests/setup/projects/test-project-1756313007787/compose.yaml
deleted file mode 100644
index 66499a7b6..000000000
--- a/tests/setup/projects/test-project-1756313007787/compose.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
-services:
- nginx:
- image: nginx:alpine
- container_name: nginx_service
- env_file:
- - .env
- ports:
- - "8080:80"
- volumes:
- - nginx_data:/usr/share/nginx/html
- restart: unless-stopped
-
-volumes:
- nginx_data:
- driver: local
diff --git a/tests/setup/projects/test-project-1756313325573/compose.yaml b/tests/setup/projects/test-project-1756313325573/compose.yaml
deleted file mode 100644
index 66499a7b6..000000000
--- a/tests/setup/projects/test-project-1756313325573/compose.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
-services:
- nginx:
- image: nginx:alpine
- container_name: nginx_service
- env_file:
- - .env
- ports:
- - "8080:80"
- volumes:
- - nginx_data:/usr/share/nginx/html
- restart: unless-stopped
-
-volumes:
- nginx_data:
- driver: local
diff --git a/tests/setup/projects/test-project-1756314218578/compose.yaml b/tests/setup/projects/test-project-1756314218578/compose.yaml
deleted file mode 100644
index 66499a7b6..000000000
--- a/tests/setup/projects/test-project-1756314218578/compose.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
-services:
- nginx:
- image: nginx:alpine
- container_name: nginx_service
- env_file:
- - .env
- ports:
- - "8080:80"
- volumes:
- - nginx_data:/usr/share/nginx/html
- restart: unless-stopped
-
-volumes:
- nginx_data:
- driver: local
diff --git a/tests/setup/projects/test-project-1756314668385/compose.yaml b/tests/setup/projects/test-project-1756314668385/compose.yaml
deleted file mode 100644
index 66499a7b6..000000000
--- a/tests/setup/projects/test-project-1756314668385/compose.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
-services:
- nginx:
- image: nginx:alpine
- container_name: nginx_service
- env_file:
- - .env
- ports:
- - "8080:80"
- volumes:
- - nginx_data:/usr/share/nginx/html
- restart: unless-stopped
-
-volumes:
- nginx_data:
- driver: local
diff --git a/tests/setup/projects/test-project-1756314761673/compose.yaml b/tests/setup/projects/test-project-1756314761673/compose.yaml
deleted file mode 100644
index 66499a7b6..000000000
--- a/tests/setup/projects/test-project-1756314761673/compose.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
-services:
- nginx:
- image: nginx:alpine
- container_name: nginx_service
- env_file:
- - .env
- ports:
- - "8080:80"
- volumes:
- - nginx_data:/usr/share/nginx/html
- restart: unless-stopped
-
-volumes:
- nginx_data:
- driver: local
diff --git a/tests/spec/compose.spec.ts b/tests/spec/compose.spec.ts
index 346e4af60..1ce04df39 100644
--- a/tests/spec/compose.spec.ts
+++ b/tests/spec/compose.spec.ts
@@ -55,8 +55,7 @@ test.describe('Compose Projects Page', () => {
await expect(page.getByRole('heading', { name: 'Create New Project' })).toBeVisible();
});
- test('should display projects list when projects exist', async ({ page }) => {
- await expect(page.getByText('Projects List')).toBeVisible();
+ test('should display projects list', async ({ page }) => {
await expect(page.locator('table')).toBeVisible();
});
@@ -90,10 +89,9 @@ test.describe('Compose Projects Page', () => {
test('should allow searching/filtering projects', async ({ page }) => {
test.skip(!realProjects.length, 'No projects available for search test');
- const searchInput = page.getByPlaceholder('Search projects...');
+ const searchInput = page.getByPlaceholder('Search...');
await expect(searchInput).toBeVisible();
- // Search for the first project
const firstProject = realProjects[0];
if (firstProject?.name) {
await searchInput.fill(firstProject.name);
diff --git a/tests/spec/images.spec.ts b/tests/spec/images.spec.ts
index 8e951aa05..73f1a562f 100644
--- a/tests/spec/images.spec.ts
+++ b/tests/spec/images.spec.ts
@@ -56,26 +56,22 @@ test.describe('Images Page', () => {
await page.waitForLoadState('networkidle');
- await expect(page.getByText('Images List')).toBeVisible();
await expect(page.locator('table')).toBeVisible();
+ await expect(page.getByRole('button', { name: 'Repository' })).toBeVisible();
});
test('should open the Pull Image dialog', async ({ page }) => {
await page.goto('/images');
await page.waitForLoadState('networkidle');
await page.locator('button:has-text("Pull Image")').first().click();
- await expect(
- page.locator('div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Pull Docker Image")')
- ).toBeVisible();
+ await expect(page.locator('div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Pull Docker Image")')).toBeVisible();
});
test('should open the Prune Unused Images dialog', async ({ page }) => {
await page.goto('/images');
await page.waitForLoadState('networkidle');
await page.locator('button:has-text("Prune Unused")').click();
- await expect(
- page.locator('div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Prune Unused Images")')
- ).toBeVisible();
+ await expect(page.locator('div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Prune Unused Images")')).toBeVisible();
});
test('should navigate to image details on inspect click', async ({ page }) => {
@@ -118,9 +114,7 @@ test.describe('Images Page', () => {
await page.getByRole('menuitem', { name: 'Remove' }).click();
console.log(firstRow);
- await expect(
- page.locator('div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Remove Image")')
- ).toBeVisible();
+ await expect(page.locator('div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Remove Image")')).toBeVisible();
await page.locator('button:has-text("Remove")').click();
@@ -134,15 +128,11 @@ test.describe('Images Page', () => {
await page.locator('button:has-text("Prune Unused")').click();
- await expect(
- page.locator('div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Prune Unused Images")')
- ).toBeVisible();
+ await expect(page.locator('div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Prune Unused Images")')).toBeVisible();
await page.locator('button:has-text("Prune Images")').click();
- await expect(
- page.locator(`li[data-sonner-toast][data-type="success"] div[data-title]:has-text("pruned")`)
- ).toBeVisible({
+ await expect(page.locator(`li[data-sonner-toast][data-type="success"] div[data-title]:has-text("pruned")`)).toBeVisible({
timeout: 10000,
});
});
@@ -153,9 +143,7 @@ test.describe('Images Page', () => {
await page.waitForLoadState('networkidle');
await page.locator('button:has-text("Pull Image")').first().click();
- await expect(
- page.locator('div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Pull Docker Image")')
- ).toBeVisible();
+ await expect(page.locator('div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Pull Docker Image")')).toBeVisible();
const imageNameFull = 'ghcr.io/linuxserver/nginx:latest';
const imageName = 'ghcr.io/linuxserver/nginx';
diff --git a/tests/spec/network.spec.ts b/tests/spec/network.spec.ts
index b8889026a..a79e02ac8 100644
--- a/tests/spec/network.spec.ts
+++ b/tests/spec/network.spec.ts
@@ -49,8 +49,8 @@ test.describe('Networks Page', () => {
await page.waitForLoadState('networkidle');
if (realNetworks.length > 0) {
- await expect(page.getByText('Network List')).toBeVisible();
await expect(page.locator('table')).toBeVisible();
+ await expect(page.getByRole('button', { name: 'Name' })).toBeVisible();
} else {
await expect(page.getByText('No networks found')).toBeVisible();
}
@@ -121,7 +121,7 @@ test.describe('Networks Page', () => {
await page.goto(`/networks/${bridge.id}`);
await page.waitForLoadState('networkidle');
- const removeBtn = page.getByRole('button', { name: 'Cannot remove predefined networks' });
+ const removeBtn = page.getByRole('button', { name: 'Remove Network' });
await expect(removeBtn).toBeDisabled();
});
diff --git a/tests/spec/networks.spec.ts b/tests/spec/networks.spec.ts
deleted file mode 100644
index 7bb8b0ef3..000000000
--- a/tests/spec/networks.spec.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-import { test, expect } from '@playwright/test';
-
-test.describe('Network Management Page', () => {
- test.beforeEach(async ({ page }) => {
- await page.goto('/networks');
- await expect(page.getByRole('heading', { name: 'Networks', level: 1 })).toBeVisible();
- await expect(page.getByRole('link', { name: 'bridge' })).toBeVisible({ timeout: 10000 });
- });
-
- test('should display the main heading and description', async ({ page }) => {
- await expect(page.getByRole('heading', { name: 'Networks', level: 1 })).toBeVisible();
- await expect(page.getByText('Manage your Docker networks')).toBeVisible();
- });
-
- test('should display the "Create Network" button', async ({ page }) => {
- await expect(page.getByRole('button', { name: 'Create Network' })).toBeVisible();
- });
-
- test('should display summary cards', async ({ page }) => {
- await expect(page.getByText('Total Networks')).toBeVisible();
- await expect(page.getByText('Bridge Networks')).toBeVisible();
- });
-
- test('should display the network list card title', async ({ page }) => {
- await expect(page.getByRole('heading', { name: 'Network List' })).toBeVisible();
- });
-
- test('should open the "Create Network" dialog when button is clicked', async ({ page }) => {
- await page.waitForLoadState('networkidle');
- await page.getByRole('button', { name: 'Create Network' }).click();
- const dialogTitle = page.getByTestId('create-network-dialog-header');
- await expect(dialogTitle).toBeVisible({ timeout: 10000 });
- await expect(page.getByRole('textbox', { name: 'Name' })).toBeVisible();
- await page.getByRole('button', { name: 'Cancel' }).click();
- await expect(dialogTitle).not.toBeVisible({ timeout: 5000 });
- });
-
- test('should allow searching/filtering networks', async ({ page }) => {
- const searchInput = page.getByPlaceholder('Search networks...');
- await expect(searchInput).toBeVisible();
- await searchInput.fill('bridge');
- await expect(page.getByRole('link', { name: 'bridge' })).toBeVisible();
- await searchInput.clear();
- await expect(page.getByRole('link', { name: 'host' })).toBeVisible();
- });
-
- test('should show actions menu for a network', async ({ page }) => {
- await page.waitForLoadState('networkidle');
- const bridgeRow = page.locator('tr', { has: page.getByRole('link', { name: 'bridge' }) });
- const menuButton = bridgeRow.getByRole('button', { name: 'Open menu' });
- await expect(menuButton).toBeVisible();
- await menuButton.click();
- await expect(page.getByRole('menuitem', { name: 'Inspect' })).toBeVisible({ timeout: 5000 });
- });
-
- test('should navigate to inspect page when "Inspect" is clicked', async ({ page }) => {
- const networkLink = page.getByRole('link', { name: 'bridge' });
- const networkName = await networkLink.textContent();
- await expect(networkLink).toBeVisible();
- await networkLink.click();
- await expect(page).toHaveURL(new RegExp(`/networks/.+`), { timeout: 10000 });
- await expect(page.getByRole('heading', { name: new RegExp(`.*${networkName}`) })).toBeVisible();
- });
-
- test('should allow selecting networks via checkboxes', async ({ page }) => {
- await page.waitForLoadState('networkidle');
- const bridgeRow = page.locator('tr', { has: page.getByRole('link', { name: 'bridge' }) });
- const firstCheckbox = bridgeRow.getByRole('checkbox');
- await expect(firstCheckbox).toBeVisible();
- await firstCheckbox.click();
- await expect(firstCheckbox).toBeChecked();
- const actionsButton = page.getByRole('button', { name: /Remove Selected/i });
- await actionsButton.waitFor({ state: 'visible', timeout: 5000 });
- await expect(actionsButton).toBeVisible();
- });
-});
diff --git a/tests/spec/volumes.spec.ts b/tests/spec/volumes.spec.ts
index a33b76d69..451ea7dd6 100644
--- a/tests/spec/volumes.spec.ts
+++ b/tests/spec/volumes.spec.ts
@@ -25,36 +25,110 @@ test.beforeEach(async ({ page }) => {
realVolumes = await fetchVolumesWithRetry(page);
});
-async function setDropdownMenuItemCheckbox(page: Page, label: string, desired: boolean) {
- const menu = page.locator('[role="menu"]').last();
- await expect(menu).toBeVisible();
+function facetIds(title: string) {
+ const key = title.toLowerCase();
+ return {
+ triggerId: `facet-${key}-trigger`,
+ contentId: `facet-${key}-content`,
+ };
+}
- const desiredValue = desired ? 'true' : 'false';
+async function ensureFacetOpen(page: Page, title: string) {
+ const { triggerId, contentId } = facetIds(title);
+ const trigger = page.getByTestId(triggerId).first();
+ const content = page.getByTestId(contentId).first();
- for (let attempt = 0; attempt < 5; attempt++) {
- const item = menu.getByRole('menuitemcheckbox', { name: label });
+ if (await content.isVisible().catch(() => false)) return { trigger, content };
- await item.waitFor({ state: 'visible' });
+ if ((await trigger.getAttribute('data-state')) !== 'open') await trigger.click();
+ await content.waitFor({ state: 'visible' });
+ return { trigger, content };
+}
- const current = (await item.getAttribute('aria-checked')) === 'true';
- if (current === desired) return;
+async function ensureUsageOpen(page: Page) {
+ const trigger = page.getByTestId('facet-usage-trigger').first();
+ const used = page.getByTestId('facet-usage-option-true').first();
+ if (await used.isVisible().catch(() => false)) return;
+ if ((await trigger.getAttribute('data-state')) !== 'open') await trigger.click();
+ await used.waitFor({ state: 'visible' });
+}
- await item.focus();
- await expect(item).toBeFocused();
+async function toggleUsageValue(page: Page, value: 'true' | 'false', desired: boolean) {
+ // 'true' -> In Use, 'false' -> Unused
+ const want = desired ? 'true' : 'false';
+ const testId = `facet-usage-option-${value}`;
- await page.waitForTimeout(50);
+ for (let attempt = 0; attempt < 6; attempt++) {
+ await ensureUsageOpen(page);
+
+ const option = page.getByTestId(testId).first();
+ await option.waitFor({ state: 'visible' });
+
+ const current = (await option.getAttribute('aria-selected')) === 'true';
+ if (current === desired) return;
- await page.keyboard.press(' ');
+ // Try 1: click the label span (avoids pointer-events-none on icons)
+ const label = option.locator('span', { hasText: value === 'true' ? 'In Use' : 'Unused' }).first();
+ if (await label.isVisible().catch(() => false)) {
+ await label.click().catch(() => {});
+ try {
+ await expect(option).toHaveAttribute('aria-selected', want, { timeout: 400 });
+ return;
+ } catch {}
+ }
+ // Try 2: click the leading checkbox chip
+ const chip = option.locator('div').first();
+ await chip.click({ force: true }).catch(() => {});
try {
- await expect(item).toHaveAttribute('aria-checked', desiredValue, { timeout: 1000 });
+ await expect(option).toHaveAttribute('aria-selected', want, { timeout: 400 });
return;
- } catch {
- continue;
+ } catch {}
+
+ // Try 3: click center of the option
+ const box = await option.boundingBox();
+ if (box) {
+ await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);
+ try {
+ await expect(option).toHaveAttribute('aria-selected', want, { timeout: 400 });
+ return;
+ } catch {}
}
+
+ // Try 4: keyboard activation via the item
+ await option.focus().catch(() => {});
+ await option.press('Enter').catch(() => {});
+ try {
+ await expect(option).toHaveAttribute('aria-selected', want, { timeout: 400 });
+ return;
+ } catch {}
+
+ // Try 5: synthesize DOM events
+ await option
+ .evaluate((el) => {
+ const fire = (type: string) => el.dispatchEvent(new MouseEvent(type, { bubbles: true, cancelable: true, view: window }));
+ fire('pointerdown');
+ fire('pointerup');
+ fire('click');
+ })
+ .catch(() => {});
+ try {
+ await expect(option).toHaveAttribute('aria-selected', want, { timeout: 400 });
+ return;
+ } catch {}
+
+ await page.waitForTimeout(120);
}
- await expect(menu.getByRole('menuitemcheckbox', { name: label })).toHaveAttribute('aria-checked', desiredValue);
+ // Final check
+ await ensureUsageOpen(page);
+ await expect(page.getByTestId(testId)).toHaveAttribute('aria-selected', want);
+}
+
+async function setUsage(page: Page, showUsed: boolean, showUnused: boolean) {
+ // true -> "In Use", false -> "Unused"
+ await toggleUsageValue(page, 'true', showUsed);
+ await toggleUsageValue(page, 'false', showUnused);
}
test.describe('Volumes Page', () => {
@@ -71,18 +145,6 @@ test.describe('Volumes Page', () => {
await expect(page.locator('p:has-text("Total Volumes") + p')).toHaveText(realVolumes.length.toString());
});
- test('Tables Displays When Volumes Exist', async ({ page }) => {
- await page.goto('/volumes');
- await page.waitForLoadState('networkidle');
-
- if (realVolumes.length > 0) {
- await expect(page.getByText('Volumes List')).toBeVisible();
- await expect(page.locator('table')).toBeVisible();
- } else {
- await expect(page.getByText('No volumes found')).toBeVisible();
- }
- });
-
test('Create Volume Sheet Opens', async ({ page }) => {
await page.goto('/volumes');
await page.waitForLoadState('networkidle');
@@ -96,10 +158,9 @@ test.describe('Volumes Page', () => {
await page.goto('/volumes');
await page.waitForLoadState('networkidle');
- await page.locator('button:has-text("Filter")').click();
- await expect(page.getByText('Volume Usage')).toBeVisible();
- await expect(page.getByText('Show Used Volumes')).toBeVisible();
- await expect(page.getByText('Show Unused Volumes')).toBeVisible();
+ const { content } = await ensureFacetOpen(page, 'Usage');
+ await expect(content.getByRole('option', { name: /In Use\b/i })).toBeVisible();
+ await expect(content.getByRole('option', { name: /Unused\b/i })).toBeVisible();
});
test('Inspect Volume', async ({ page }) => {
@@ -174,26 +235,4 @@ test.describe('Volumes Page', () => {
await expect(page.locator('text="Unused"').first()).toBeVisible();
}
});
-
- test('Filter Volumes by Usage Status', async ({ page }) => {
- const usedVolumes = realVolumes.filter((v) => v.inUse);
- const unusedVolumes = realVolumes.filter((v) => !v.inUse);
-
- await page.goto('/volumes');
- await page.waitForLoadState('networkidle');
-
- // Show only Used
- await page.locator('button:has-text("Filter")').click();
- await setDropdownMenuItemCheckbox(page, 'Show Used Volumes', true);
- await setDropdownMenuItemCheckbox(page, 'Show Unused Volumes', false);
- await page.keyboard.press('Escape');
- await expect(page.locator('tbody tr')).toHaveCount(usedVolumes.length);
-
- // Show only Unused
- await page.locator('button:has-text("Filter")').click();
- await setDropdownMenuItemCheckbox(page, 'Show Used Volumes', false);
- await setDropdownMenuItemCheckbox(page, 'Show Unused Volumes', true);
- await page.keyboard.press('Escape');
- await expect(page.locator('tbody tr')).toHaveCount(unusedVolumes.length);
- });
});