Skip to content

Modern Docker Management, Designed for Everyone

fix: hide internal volumes for backups and volume browser (#1755)

Kyle Mendell03e62f5044a2
diff --git a/backend/internal/bootstrap/bootstrap.go b/backend/internal/bootstrap/bootstrap.go
index f32301d0b..c78710864 100644
--- a/backend/internal/bootstrap/bootstrap.go
+++ b/backend/internal/bootstrap/bootstrap.go
@@ -65,6 +65,12 @@ func Bootstrap(ctx context.Context) error {
}
}(appCtx)
+ if appServices.Volume != nil {
+ if err := appServices.Volume.CleanupOrphanedVolumeHelpers(appCtx); err != nil {
+ slog.WarnContext(appCtx, "Failed to cleanup orphaned volume helpers on startup", "error", err)
+ }
+ }
+
utils.LoadAgentToken(appCtx, cfg, appServices.Settings.GetStringSetting)
utils.EnsureEncryptionKey(appCtx, cfg, appServices.Settings.EnsureEncryptionKey)
crypto.InitEncryption(cfg)
diff --git a/backend/internal/huma/handlers/volumes.go b/backend/internal/huma/handlers/volumes.go
index 6bc4127b7..7b1d090f0 100644
--- a/backend/internal/huma/handlers/volumes.go
+++ b/backend/internal/huma/handlers/volumes.go
@@ -43,13 +43,14 @@ type VolumePaginatedResponse struct {
}
type ListVolumesInput struct {
- EnvironmentID string `path:"id" doc:"Environment ID"`
- Search string `query:"search" doc:"Search query"`
- Sort string `query:"sort" doc:"Column to sort by"`
- Order string `query:"order" default:"asc" doc:"Sort direction (asc or desc)"`
- Start int `query:"start" default:"0" doc:"Start index for pagination"`
- Limit int `query:"limit" default:"20" doc:"Number of items per page"`
- InUse string `query:"inUse" doc:"Filter by in-use status (true/false)"`
+ EnvironmentID string `path:"id" doc:"Environment ID"`
+ Search string `query:"search" doc:"Search query"`
+ Sort string `query:"sort" doc:"Column to sort by"`
+ Order string `query:"order" default:"asc" doc:"Sort direction (asc or desc)"`
+ Start int `query:"start" default:"0" doc:"Start index for pagination"`
+ Limit int `query:"limit" default:"20" doc:"Number of items per page"`
+ InUse string `query:"inUse" doc:"Filter by in-use status (true/false)"`
+ IncludeInternal bool `query:"includeInternal" default:"false" doc:"Include internal volumes"`
}
type ListVolumesOutput struct {
@@ -115,7 +116,8 @@ type GetVolumeUsageOutput struct {
}
type GetVolumeUsageCountsInput struct {
- EnvironmentID string `path:"id" doc:"Environment ID"`
+ EnvironmentID string `path:"id" doc:"Environment ID"`
+ IncludeInternal bool `query:"includeInternal" default:"false" doc:"Include internal volumes"`
}
type GetVolumeUsageCountsOutput struct {
@@ -664,7 +666,7 @@ func (h *VolumeHandler) ListVolumes(ctx context.Context, input *ListVolumesInput
params.Limit = 20
}
- volumes, paginationResp, counts, err := h.volumeService.ListVolumesPaginated(ctx, params)
+ volumes, paginationResp, counts, err := h.volumeService.ListVolumesPaginated(ctx, params, input.IncludeInternal)
if err != nil {
return nil, huma.Error500InternalServerError((&common.VolumeListError{Err: err}).Error())
}
@@ -814,11 +816,11 @@ func (h *VolumeHandler) GetVolumeUsage(ctx context.Context, input *GetVolumeUsag
// GetVolumeUsageCounts returns counts of volumes by usage status.
func (h *VolumeHandler) GetVolumeUsageCounts(ctx context.Context, input *GetVolumeUsageCountsInput) (*GetVolumeUsageCountsOutput, error) {
- if h.dockerService == nil {
+ if h.volumeService == nil {
return nil, huma.Error500InternalServerError("service not available")
}
- _, inuse, unused, total, err := h.dockerService.GetAllVolumes(ctx)
+ _, _, counts, err := h.volumeService.ListVolumesPaginated(ctx, pagination.QueryParams{}, input.IncludeInternal)
if err != nil {
return nil, huma.Error500InternalServerError((&common.VolumeCountsError{Err: err}).Error())
}
@@ -827,9 +829,9 @@ func (h *VolumeHandler) GetVolumeUsageCounts(ctx context.Context, input *GetVolu
Body: base.ApiResponse[VolumeUsageCountsData]{
Success: true,
Data: VolumeUsageCountsData{
- Inuse: inuse,
- Unused: unused,
- Total: total,
+ Inuse: counts.Inuse,
+ Unused: counts.Unused,
+ Total: counts.Total,
},
},
}, nil
diff --git a/backend/internal/services/volume_service.go b/backend/internal/services/volume_service.go
index 023e44f63..665d1e3fe 100644
--- a/backend/internal/services/volume_service.go
+++ b/backend/internal/services/volume_service.go
@@ -11,6 +11,7 @@ import (
"net/http"
"os"
"path"
+ "runtime"
"strconv"
"strings"
"sync"
@@ -44,6 +45,8 @@ type VolumeService struct {
helperByVolume map[string]string
}
+const volumeHelperImage = "busybox:stable-musl"
+
func NewVolumeService(db *database.DB, dockerService *DockerClientService, eventService *EventService, settingsService *SettingsService, containerService *ContainerService, imageService *ImageService, backupVolumeName string) *VolumeService {
slog.Debug("volume service: new")
if strings.TrimSpace(backupVolumeName) == "" {
@@ -378,38 +381,48 @@ func (s *VolumeService) getHelperImageInternal(ctx context.Context) (string, err
return "", fmt.Errorf("failed to get docker client: %w", err)
}
- // 1. Try to find Arcane container's image (the most prune-proof)
- // Check hostname first (ID of container if in Docker)
- hostname, _ := os.Hostname()
- if hostname != "" {
- if inspect, err := dockerClient.ContainerInspect(ctx, hostname); err == nil {
- return inspect.Config.Image, nil
- }
+ if _, err := dockerClient.ImageInspect(ctx, volumeHelperImage); err == nil {
+ slog.InfoContext(ctx, "volume service: helper image strategy selected", "strategy", "busybox-local", "image", volumeHelperImage)
+ return volumeHelperImage, nil
}
- // 2. Search for any container with Arcane label
- filter := filters.NewArgs()
- filter.Add("label", "com.getarcaneapp.arcane=true")
- if containers, err := dockerClient.ContainerList(ctx, container.ListOptions{Filters: filter, All: true}); err == nil && len(containers) > 0 {
- return containers[0].Image, nil
+ var pullErr error
+ if s.imageService != nil {
+ pullImageErr := s.imageService.PullImage(ctx, volumeHelperImage, io.Discard, systemUser, nil)
+ if pullImageErr == nil {
+ slog.InfoContext(ctx, "volume service: helper image strategy selected", "strategy", "busybox-pulled", "image", volumeHelperImage)
+ return volumeHelperImage, nil
+ }
+ pullErr = pullImageErr
+ slog.WarnContext(ctx, "volume service: failed to pull busybox helper image, attempting arcane fallback", "error", pullImageErr.Error())
+ } else {
+ pullErr = fmt.Errorf("image service unavailable")
+ slog.WarnContext(ctx, "volume service: image service unavailable, attempting arcane fallback")
}
- // 3. Try busybox:stable-musl
- const helperImage = "busybox:stable-musl"
- if _, err := dockerClient.ImageInspect(ctx, helperImage); err == nil {
- return helperImage, nil
+ if fallbackImage, source, ok := s.resolveArcaneHelperImageInternal(ctx, dockerClient); ok {
+ slog.InfoContext(ctx, "volume service: helper image strategy selected", "strategy", "arcane-fallback", "source", source, "image", fallbackImage)
+ return fallbackImage, nil
}
- // 4. Default to pulling busybox
- slog.InfoContext(ctx, "no suitable internal image found, pulling busybox:stable-musl")
- if s.imageService == nil {
- return "", fmt.Errorf("helper image %s missing and image service unavailable", helperImage)
+ return "", fmt.Errorf("failed to resolve helper image: busybox unavailable and arcane fallback not found (pull error: %w)", pullErr)
+}
+
+func (s *VolumeService) resolveArcaneHelperImageInternal(ctx context.Context, dockerClient *client.Client) (string, string, bool) {
+ hostname, _ := os.Hostname()
+ if hostname != "" {
+ if inspect, err := dockerClient.ContainerInspect(ctx, hostname); err == nil && inspect.Config != nil && strings.TrimSpace(inspect.Config.Image) != "" {
+ return inspect.Config.Image, "hostname", true
+ }
}
- if err := s.imageService.PullImage(ctx, helperImage, io.Discard, systemUser, nil); err != nil {
- return "", fmt.Errorf("failed to pull helper image %s: %w", helperImage, err)
+
+ filter := filters.NewArgs()
+ filter.Add("label", "com.getarcaneapp.arcane=true")
+ if containers, err := dockerClient.ContainerList(ctx, container.ListOptions{Filters: filter, All: true}); err == nil && len(containers) > 0 && strings.TrimSpace(containers[0].Image) != "" {
+ return containers[0].Image, "arcane-label", true
}
- return helperImage, nil
+ return "", "", false
}
func (s *VolumeService) BackupMountWarning(ctx context.Context) string {
@@ -476,6 +489,58 @@ type cleanupReadCloser struct {
cleanup func()
}
+func buildVolumeHelperLabelsInternal() map[string]string {
+ return map[string]string{
+ libarcane.InternalResourceLabel: "true",
+ }
+}
+
+func volumeHelperRemoveOptionsInternal() container.RemoveOptions {
+ return container.RemoveOptions{Force: true, RemoveVolumes: true}
+}
+
+func isLegacyVolumeHelperContainerInternal(c container.Summary) bool {
+ if !libarcane.IsInternalContainer(c.Labels) {
+ return false
+ }
+
+ command := strings.ToLower(c.Command)
+ if !strings.Contains(command, "sleep") || !strings.Contains(command, "infinity") {
+ return false
+ }
+
+ for _, m := range c.Mounts {
+ if m.Destination == "/volume" {
+ return true
+ }
+ }
+
+ return false
+}
+
+func isVolumeHelperContainerInternal(c container.Summary) bool {
+ return isLegacyVolumeHelperContainerInternal(c)
+}
+
+func (s *VolumeService) isArcaneFallbackHelperImageInternal(helperImage string) bool {
+ return !strings.EqualFold(strings.TrimSpace(helperImage), volumeHelperImage)
+}
+
+func (s *VolumeService) buildHelperHostConfigInternal(helperImage string, binds []string) *container.HostConfig {
+ hostConfig := &container.HostConfig{
+ Binds: binds,
+ AutoRemove: true,
+ }
+
+ if runtime.GOOS == "linux" && s.isArcaneFallbackHelperImageInternal(helperImage) {
+ hostConfig.Tmpfs = map[string]string{
+ "/app/data": "rw,noexec,nosuid,nodev",
+ }
+ }
+
+ return hostConfig
+}
+
func (c *cleanupReadCloser) Close() error {
err := c.Closer.Close()
c.cleanup()
@@ -504,22 +569,17 @@ func (s *VolumeService) createTempContainerInternal(ctx context.Context, volumeN
Image: helperImage,
Cmd: []string{"sleep", "infinity"},
NetworkDisabled: true,
- Labels: map[string]string{
- libarcane.InternalContainerLabel: "true",
- },
+ Labels: buildVolumeHelperLabelsInternal(),
}
- hostConfig := &container.HostConfig{
- Binds: []string{
- fmt.Sprintf("%s:/volume%s", volumeName, func() string {
- if readOnly {
- return ":ro"
- }
- return ""
- }()),
- },
- AutoRemove: true,
- }
+ hostConfig := s.buildHelperHostConfigInternal(helperImage, []string{
+ fmt.Sprintf("%s:/volume%s", volumeName, func() string {
+ if readOnly {
+ return ":ro"
+ }
+ return ""
+ }()),
+ })
resp, err := dockerClient.ContainerCreate(ctx, config, hostConfig, nil, nil, "")
if err != nil {
@@ -527,12 +587,12 @@ func (s *VolumeService) createTempContainerInternal(ctx context.Context, volumeN
}
if err := dockerClient.ContainerStart(ctx, resp.ID, container.StartOptions{}); err != nil {
- _ = dockerClient.ContainerRemove(ctx, resp.ID, container.RemoveOptions{Force: true})
+ _ = dockerClient.ContainerRemove(ctx, resp.ID, volumeHelperRemoveOptionsInternal())
return "", nil, fmt.Errorf("failed to start temp container: %w", err)
}
cleanup := func() {
- _ = dockerClient.ContainerRemove(ctx, resp.ID, container.RemoveOptions{Force: true})
+ _ = dockerClient.ContainerRemove(ctx, resp.ID, volumeHelperRemoveOptionsInternal())
}
if readOnly {
@@ -582,12 +642,41 @@ func (s *VolumeService) CleanupHelperContainers(ctx context.Context) {
s.helperMu.Unlock()
for _, containerID := range helperIDs {
- if err := dockerClient.ContainerRemove(ctx, containerID, container.RemoveOptions{Force: true}); err != nil {
+ if err := dockerClient.ContainerRemove(ctx, containerID, volumeHelperRemoveOptionsInternal()); err != nil {
slog.WarnContext(ctx, "failed to remove helper container", "container_id", containerID, "error", err.Error())
}
}
}
+func (s *VolumeService) CleanupOrphanedVolumeHelpers(ctx context.Context) error {
+ dockerClient, err := s.dockerService.GetClient()
+ if err != nil {
+ return fmt.Errorf("failed to get docker client for orphan helper cleanup: %w", err)
+ }
+
+ containers, err := dockerClient.ContainerList(ctx, container.ListOptions{All: true})
+ if err != nil {
+ return fmt.Errorf("failed to list containers for orphan helper cleanup: %w", err)
+ }
+
+ removedCount := 0
+ for _, c := range containers {
+ if !isVolumeHelperContainerInternal(c) {
+ continue
+ }
+
+ if err := dockerClient.ContainerRemove(ctx, c.ID, volumeHelperRemoveOptionsInternal()); err != nil {
+ slog.WarnContext(ctx, "failed to remove orphaned volume helper container", "container_id", c.ID, "error", err.Error())
+ continue
+ }
+
+ removedCount++
+ }
+
+ slog.InfoContext(ctx, "volume service: orphan helper cleanup completed", "removed_count", removedCount)
+ return nil
+}
+
func (s *VolumeService) removeHelperEntry(volumeName string) {
if strings.TrimSpace(volumeName) == "" {
return
@@ -812,20 +901,15 @@ func (s *VolumeService) CreateBackup(ctx context.Context, volumeName string, use
}
config := &container.Config{
- Image: helperImage,
- Cmd: []string{"sh", "-c", fmt.Sprintf("tar -czf /backups/%s -C /volume .", filename)},
- Labels: map[string]string{
- libarcane.InternalContainerLabel: "true",
- },
+ Image: helperImage,
+ Cmd: []string{"sh", "-c", fmt.Sprintf("tar -czf /backups/%s -C /volume .", filename)},
+ Labels: buildVolumeHelperLabelsInternal(),
}
- hostConfig := &container.HostConfig{
- Binds: []string{
- fmt.Sprintf("%s:/volume:ro", volumeName),
- fmt.Sprintf("%s:/backups", s.backupVolumeName),
- },
- AutoRemove: true,
- }
+ hostConfig := s.buildHelperHostConfigInternal(helperImage, []string{
+ fmt.Sprintf("%s:/volume:ro", volumeName),
+ fmt.Sprintf("%s:/backups", s.backupVolumeName),
+ })
resp, err := dockerClient.ContainerCreate(ctx, config, hostConfig, nil, nil, "")
if err != nil {
@@ -833,6 +917,7 @@ func (s *VolumeService) CreateBackup(ctx context.Context, volumeName string, use
}
if err := dockerClient.ContainerStart(ctx, resp.ID, container.StartOptions{}); err != nil {
+ _ = dockerClient.ContainerRemove(ctx, resp.ID, volumeHelperRemoveOptionsInternal())
return nil, fmt.Errorf("failed to start backup container: %w", err)
}
@@ -1049,18 +1134,13 @@ func (s *VolumeService) RestoreBackup(ctx context.Context, volumeName, backupID
"-c",
fmt.Sprintf("set -e; tmp=$(mktemp -d /volume/.restore_tmp.XXXXXX); tar -tzf /backups/%s >/dev/null; tar -xzf /backups/%s -C \"$tmp\"; find /volume -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +; find \"$tmp\" -mindepth 1 -maxdepth 1 -exec mv -- {} /volume/ \\;; rmdir \"$tmp\"", filename, filename),
},
- Labels: map[string]string{
- libarcane.InternalContainerLabel: "true",
- },
+ Labels: buildVolumeHelperLabelsInternal(),
}
- hostConfig := &container.HostConfig{
- Binds: []string{
- fmt.Sprintf("%s:/volume", volumeName),
- fmt.Sprintf("%s:/backups:ro", s.backupVolumeName),
- },
- AutoRemove: true,
- }
+ hostConfig := s.buildHelperHostConfigInternal(helperImage, []string{
+ fmt.Sprintf("%s:/volume", volumeName),
+ fmt.Sprintf("%s:/backups:ro", s.backupVolumeName),
+ })
resp, err := dockerClient.ContainerCreate(ctx, config, hostConfig, nil, nil, "")
if err != nil {
@@ -1068,6 +1148,7 @@ func (s *VolumeService) RestoreBackup(ctx context.Context, volumeName, backupID
}
if err := dockerClient.ContainerStart(ctx, resp.ID, container.StartOptions{}); err != nil {
+ _ = dockerClient.ContainerRemove(ctx, resp.ID, volumeHelperRemoveOptionsInternal())
return fmt.Errorf("failed to start restore container: %w", err)
}
@@ -1282,18 +1363,13 @@ func (s *VolumeService) RestoreBackupFiles(ctx context.Context, volumeName, back
Image: helperImage,
Cmd: []string{"sleep", "infinity"},
NetworkDisabled: true,
- Labels: map[string]string{
- libarcane.InternalContainerLabel: "true",
- },
+ Labels: buildVolumeHelperLabelsInternal(),
}
- hostConfig := &container.HostConfig{
- Binds: []string{
- fmt.Sprintf("%s:/volume", volumeName),
- fmt.Sprintf("%s:/backups:ro", s.backupVolumeName),
- },
- AutoRemove: true,
- }
+ hostConfig := s.buildHelperHostConfigInternal(helperImage, []string{
+ fmt.Sprintf("%s:/volume", volumeName),
+ fmt.Sprintf("%s:/backups:ro", s.backupVolumeName),
+ })
resp, err := dockerClient.ContainerCreate(ctx, config, hostConfig, nil, nil, "")
if err != nil {
@@ -1301,12 +1377,12 @@ func (s *VolumeService) RestoreBackupFiles(ctx context.Context, volumeName, back
}
if err := dockerClient.ContainerStart(ctx, resp.ID, container.StartOptions{}); err != nil {
- _ = dockerClient.ContainerRemove(ctx, resp.ID, container.RemoveOptions{Force: true})
+ _ = dockerClient.ContainerRemove(ctx, resp.ID, volumeHelperRemoveOptionsInternal())
return fmt.Errorf("failed to start restore container: %w", err)
}
cleanup := func() {
- _ = dockerClient.ContainerRemove(ctx, resp.ID, container.RemoveOptions{Force: true})
+ _ = dockerClient.ContainerRemove(ctx, resp.ID, volumeHelperRemoveOptionsInternal())
}
defer cleanup()
@@ -1701,8 +1777,16 @@ func (s *VolumeService) calculateVolumeUsageCountsInternal(items []volumetypes.V
return counts
}
-func (s *VolumeService) ListVolumesPaginated(ctx context.Context, params pagination.QueryParams) ([]volumetypes.Volume, pagination.Response, volumetypes.UsageCounts, error) {
- slog.DebugContext(ctx, "volume service: list volumes paginated", "search", params.Search, "sort", params.Sort, "order", params.Order, "start", params.Start, "limit", params.Limit)
+func (s *VolumeService) isInternalVolumeInternal(v volumetypes.Volume) bool {
+ if strings.EqualFold(strings.TrimSpace(v.Name), strings.TrimSpace(s.backupVolumeName)) {
+ return true
+ }
+
+ return libarcane.IsInternalContainer(v.Labels)
+}
+
+func (s *VolumeService) ListVolumesPaginated(ctx context.Context, params pagination.QueryParams, includeInternal bool) ([]volumetypes.Volume, pagination.Response, volumetypes.UsageCounts, error) {
+ slog.DebugContext(ctx, "volume service: list volumes paginated", "search", params.Search, "sort", params.Sort, "order", params.Order, "start", params.Start, "limit", params.Limit, "include_internal", includeInternal)
dockerClient, err := s.dockerService.GetClient()
if err != nil {
return nil, pagination.Response{}, volumetypes.UsageCounts{}, fmt.Errorf("failed to connect to Docker: %w", err)
@@ -1763,6 +1847,9 @@ func (s *VolumeService) ListVolumesPaginated(ctx context.Context, params paginat
items := make([]volumetypes.Volume, 0, len(volumes))
for _, v := range volumes {
volDto := volumetypes.NewSummary(v)
+ if !includeInternal && s.isInternalVolumeInternal(volDto) {
+ continue
+ }
if containerIDs, ok := volumeContainerMap[v.Name]; ok {
volDto.Containers = containerIDs
if len(containerIDs) > 0 {
diff --git a/backend/internal/services/volume_service_test.go b/backend/internal/services/volume_service_test.go
new file mode 100644
index 000000000..72cad7e8d
--- /dev/null
+++ b/backend/internal/services/volume_service_test.go
@@ -0,0 +1,57 @@
+package services
+
+import (
+ "testing"
+
+ "github.com/docker/docker/api/types/container"
+ "github.com/getarcaneapp/arcane/backend/pkg/libarcane"
+ "github.com/stretchr/testify/require"
+)
+
+func TestIsLegacyVolumeHelperContainerInternal(t *testing.T) {
+ tests := []struct {
+ name string
+ summary container.Summary
+ want bool
+ }{
+ {
+ name: "legacy helper signature matches",
+ summary: container.Summary{
+ Labels: map[string]string{
+ libarcane.InternalResourceLabel: "true",
+ },
+ Command: "sleep infinity",
+ Mounts: []container.MountPoint{
+ {Destination: "/volume"},
+ },
+ },
+ want: true,
+ },
+ {
+ name: "internal trivy-like helper is not treated as legacy volume helper",
+ summary: container.Summary{
+ Labels: map[string]string{
+ libarcane.InternalResourceLabel: "true",
+ },
+ Command: "trivy image --quiet alpine:latest",
+ Mounts: []container.MountPoint{
+ {Destination: "/var/run/docker.sock"},
+ },
+ },
+ want: false,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ require.Equal(t, tt.want, isLegacyVolumeHelperContainerInternal(tt.summary))
+ })
+ }
+}
+
+func TestBuildVolumeHelperLabelsInternal(t *testing.T) {
+ labels := buildVolumeHelperLabelsInternal()
+
+ require.Equal(t, "true", labels[libarcane.InternalResourceLabel])
+ require.Len(t, labels, 1)
+}
diff --git a/backend/internal/services/vulnerability_service.go b/backend/internal/services/vulnerability_service.go
index cd9c96bf2..cc8df274d 100644
--- a/backend/internal/services/vulnerability_service.go
+++ b/backend/internal/services/vulnerability_service.go
@@ -870,7 +870,7 @@ func (s *VulnerabilityService) createBatchTrivyContainer(ctx context.Context, tr
Image: trivyImage,
Entrypoint: []string{"sh", "-c", "trap 'exit 0' TERM; while :; do sleep 1; done"},
Labels: map[string]string{
- libarcane.InternalContainerLabel: "true",
+ libarcane.InternalResourceLabel: "true",
},
}
@@ -1073,7 +1073,7 @@ func (s *VulnerabilityService) GetTrivyVersion(ctx context.Context) string {
Image: trivyImage,
Cmd: []string{"--version"},
Labels: map[string]string{
- libarcane.InternalContainerLabel: "true",
+ libarcane.InternalResourceLabel: "true",
},
}
@@ -1223,7 +1223,7 @@ func (s *VulnerabilityService) ensureTrivyCacheVolumeInternal(ctx context.Contex
_, err = dockerClient.VolumeCreate(ctx, volumetypes.CreateOptions{
Name: trivyCacheVolumeName,
Labels: map[string]string{
- libarcane.InternalContainerLabel: "true",
+ libarcane.InternalResourceLabel: "true",
},
})
if err != nil {
@@ -1320,7 +1320,7 @@ func buildTrivyContainerConfig(trivyImage string, cmdArgs []string) *containerty
Image: trivyImage,
Cmd: cmdArgs,
Labels: map[string]string{
- libarcane.InternalContainerLabel: "true",
+ libarcane.InternalResourceLabel: "true",
},
}
}
diff --git a/backend/pkg/libarcane/internal_container.go b/backend/pkg/libarcane/internal_resource.go
similarity index 57%
rename from backend/pkg/libarcane/internal_container.go
rename to backend/pkg/libarcane/internal_resource.go
index 673200fa3..e4aeb519c 100644
--- a/backend/pkg/libarcane/internal_container.go
+++ b/backend/pkg/libarcane/internal_resource.go
@@ -3,14 +3,18 @@ package libarcane
import "strings"
// Internal containers indicate containers used for arcanes utilties, ie: temp containers used for viewing files for volumes etc
-const InternalContainerLabel = "com.getarcaneapp.internal.container"
+const (
+ InternalResourceLabel = "com.getarcaneapp.internal.resource"
+ // Deprecated - Legacy label. Use InternalResourceLabel instead.
+ legacyInternalContainerLabel = "com.getarcaneapp.internal.container"
+)
func IsInternalContainer(labels map[string]string) bool {
if labels == nil {
return false
}
for k, v := range labels {
- if strings.EqualFold(k, InternalContainerLabel) {
+ if strings.EqualFold(k, InternalResourceLabel) || strings.EqualFold(k, legacyInternalContainerLabel) {
switch strings.TrimSpace(strings.ToLower(v)) {
case "true", "1", "yes", "on":
return true
diff --git a/frontend/src/lib/components/arcane-table/arcane-table-toolbar.svelte b/frontend/src/lib/components/arcane-table/arcane-table-toolbar.svelte
index b965f6f2b..7c8f42cf5 100644
--- a/frontend/src/lib/components/arcane-table/arcane-table-toolbar.svelte
+++ b/frontend/src/lib/components/arcane-table/arcane-table-toolbar.svelte
@@ -216,10 +216,6 @@
{@render customToolbarActions()}
{/if}
- {#if customToolbarActions}
- {@render customToolbarActions()}
- {/if}
-
<div class="hidden md:block">
<DataTableViewOptions {table} {customViewOptions} />
</div>
diff --git a/frontend/src/routes/(app)/volumes/volume-table.svelte b/frontend/src/routes/(app)/volumes/volume-table.svelte
index b1e39f7e6..98eda887a 100644
--- a/frontend/src/routes/(app)/volumes/volume-table.svelte
+++ b/frontend/src/routes/(app)/volumes/volume-table.svelte
@@ -20,6 +20,7 @@
import { TrashIcon, InspectIcon, VolumesIcon, CalendarIcon, EllipsisIcon } from '$lib/icons';
import { Spinner } from '$lib/components/ui/spinner';
import settingsStore from '$lib/stores/config-store';
+ import { onMount } from 'svelte';
let {
volumes = $bindable(),
@@ -36,6 +37,10 @@
let isLoading = $state({
removing: false
});
+ let customSettings = $state<Record<string, unknown>>({});
+ let showInternal = $derived.by(() => {
+ return (customSettings.showInternalVolumes as boolean) ?? false;
+ });
async function refreshVolumes(options: SearchPaginationSortRequest = requestOptions) {
if (onRefreshData) {
@@ -45,6 +50,25 @@
volumes = await volumeService.getVolumes(options);
}
+ function getCurrentLimit() {
+ return requestOptions?.pagination?.limit ?? volumes?.pagination?.itemsPerPage ?? 20;
+ }
+
+ function setShowInternal(value: boolean) {
+ const currentSetting = (customSettings.showInternalVolumes as boolean) ?? false;
+ const currentRequest = requestOptions?.includeInternal ?? false;
+ if (value === currentSetting && value === currentRequest) return;
+
+ customSettings = { ...customSettings, showInternalVolumes: value };
+ const nextOptions: SearchPaginationSortRequest = {
+ ...requestOptions,
+ includeInternal: value,
+ pagination: { page: 1, limit: getCurrentLimit() }
+ };
+ requestOptions = nextOptions;
+ refreshVolumes(nextOptions);
+ }
+
const backupVolumeName = $derived.by(() => $settingsStore?.backupVolumeName || 'arcane-backups');
const isBackupVolumeName = (name?: string) => (name ?? '') === backupVolumeName;
const isBackupVolume = (item: VolumeSummaryDto) => isBackupVolumeName(item.name);
@@ -177,6 +201,14 @@
]);
let mobileFieldVisibility = $state<Record<string, boolean>>({});
+
+ onMount(() => {
+ const persistedInternal = (customSettings.showInternalVolumes as boolean) ?? false;
+ const currentInternal = requestOptions?.includeInternal ?? false;
+ if (persistedInternal !== currentInternal) {
+ setShowInternal(persistedInternal);
+ }
+ });
</script>
{#snippet NameCell({ item }: { item: VolumeSummaryDto })}
@@ -312,6 +344,7 @@
bind:requestOptions
bind:selectedIds
bind:mobileFieldVisibility
+ bind:customSettings
{bulkActions}
onRefresh={async (options) => {
requestOptions = options;
@@ -322,4 +355,11 @@
{mobileFields}
rowActions={RowActions}
mobileCard={VolumeMobileCardSnippet}
+ customViewOptions={CustomViewOptions}
/>
+
+{#snippet CustomViewOptions()}
+ <DropdownMenu.CheckboxItem bind:checked={() => showInternal, (v) => setShowInternal(!!v)}>
+ {`${m.common_show()} ${m.internal()} ${m.volumes_title()}`}
+ </DropdownMenu.CheckboxItem>
+{/snippet}