Commit graph

31 commits

Author SHA1 Message Date
Tim Abell
9545538106
Add docker-compose profile support
Implements the design captured in docs/adr/0001-docker-compose-profile-support.md
(jesseduffield/lazydocker#423). Profiles render as pseudo-projects in the
project panel; selecting one filters the services and containers panels to
the services that activate with that profile, and Up/Down/Restart on the
selection use docker compose --profile X invocations.

Key choices:

- Profile is a flag on Project (IsProfile bool), not a new type. Avoids a
  generic-type split across the SideListPanel and CommandObject.

- Reuse existing command templates (Up, Down, DownWithVolumes, Restart,
  AllLogs, DockerComposeConfig). NewCommandObject appends --profile X when
  a profile context is set, so no separate UpProfile/DownProfile/... family
  is needed. Adds a new Restart template (master had no project-level
  restart at all).

- Discovery via 'docker compose config --profiles' and
  'docker compose --profile X config --services', cached on DockerCommand
  for the session. Soft-fails on error (logs once, caches empty) so the UI
  degrades to "no profile rows" rather than popping an error.

- Per-profile service filtering uses the local project and the profile's
  service set (default services + profile-X services, per docker semantics).

- No new keybinding for project/profile restart in this PR; handler exists
  for follow-up discussion.

- New unit tests cover NewCommandObject --profile injection, GetProfiles
  caching, GetProfileServices caching, and the soft-fail path.

fixes: https://github.com/jesseduffield/lazydocker/issues/423

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 14:48:50 +01:00
Jesse Duffield
f5ff116af9 Use IsProjectScoped at remaining call sites + add test
Addresses Copilot review comments on PR #797:
- Containers panel title, initial focus selection, and the local-project
  inclusion in getDiscoveredProjects all switched from
  InDockerComposeProject to IsProjectScoped, so they stay consistent
  when -p is given outside a compose dir.
- Adds TestIsProjectScoped table test covering all four combinations.

InDockerComposeProject is still used at the call sites that genuinely
require a compose dir (renderDockerComposeConfig, GetServices).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 12:47:30 +10:00
Jesse Duffield
3974f6fec1 Support -p flag and DRY up code 2026-04-19 12:16:55 +10:00
copilot-swe-agent[bot]
e3c1c8630a Hide project/services panels when not in a docker-compose project
Co-authored-by: jesseduffield <8456633+jesseduffield@users.noreply.github.com>
2026-03-15 22:26:03 +00:00
Jesse Duffield
26ce871368 Improve projects support 2026-03-15 14:53:48 +11:00
Tony Soloveyv
2a9ed70896
Allow to render container stats and configs both in json and yaml (#444) 2023-05-21 14:06:56 +10:00
Jesse Duffield
b0241c79db use context instead of struct channel 2022-11-10 19:38:49 +11:00
Jesse Duffield
52040d1d99 better way of rendering to the main view 2022-11-10 19:14:12 +11:00
Jesse Duffield
5ffbeae3e8 preparing to refactor main render functions 2022-11-09 21:21:36 +11:00
Jesse Duffield
7324254414 better name: GetTableCells 2022-11-09 21:21:36 +11:00
Jesse Duffield
d6ad538426 refactor side list panel some more 2022-11-09 21:21:36 +11:00
Jesse Duffield
a87b698761 move things into presentation package 2022-11-09 21:21:36 +11:00
Jesse Duffield
fc592b5806 more refactoring of list panels 2022-11-09 21:21:36 +11:00
Jesse Duffield
5d498c796a move context stuff into its own struct 2022-11-09 21:21:36 +11:00
Jesse Duffield
b453ce8940 cleaning things up 2022-11-09 21:21:36 +11:00
Jesse Duffield
9b58b8188a remove redundant function 2022-11-09 21:21:35 +11:00
Jesse Duffield
f7beb6e83f stop support menu filtering for simplicity 2022-11-09 21:21:35 +11:00
Jesse Duffield
e6d4a97545 better search logic 2022-11-09 21:21:35 +11:00
Jesse Duffield
60df208924 convert menu panel to use new struct 2022-11-09 21:21:35 +11:00
Jesse Duffield
158ef68372 convert project panel to use new struct 2022-11-09 21:21:35 +11:00
Jesse Duffield
79a58c8d48 convert services panel to use new struct 2022-11-09 21:21:35 +11:00
Jesse Duffield
e46b908006 support filtered list panel without dependency on gui package 2022-11-09 21:21:35 +11:00
Jesse Duffield
33df6ff3b0 update sponsor link 2022-10-10 18:40:49 -07:00
Jesse Duffield
46de6b365d clean up some things
remove redundant g argument
2022-10-09 18:36:42 -07:00
Jesse Duffield
fb7b28243b improve subprocess approach 2022-10-09 18:03:46 -07:00
Jesse Duffield
a100caa0d9 use sdk to inspect containers 2022-05-11 18:22:14 +10:00
Jesse Duffield
6bc57b7628 appease linter 2022-05-09 21:31:24 +10:00
Jesse Duffield
2fe7505ebc use event channel to reduce CPU usage by a LOT 2022-05-09 20:31:16 +10:00
Pieter van de Bruggen
b3422c87f4 Pull the project name from docker-compose labels, when available 2019-07-03 16:58:42 -07:00
Pieter van de Bruggen
86dfebdeaf Replace Project panel content with the project directory.
In the future, it may be worth trying to compute this from ComposeFiles.
2019-07-03 10:59:45 -07:00
Pieter van de Bruggen
12f3cfab55 Rename StatusPanel to ProjectPanel 2019-07-03 10:48:55 -07:00
Renamed from pkg/gui/status_panel.go (Browse further)