Skip to content

feat(dockerMan): add Save button to save template without recreating container or requiring authoring mode#2589

Open
wandercone wants to merge 1 commit intounraid:masterfrom
wandercone:allow-save-without-authoring-mode
Open

feat(dockerMan): add Save button to save template without recreating container or requiring authoring mode#2589
wandercone wants to merge 1 commit intounraid:masterfrom
wandercone:allow-save-without-authoring-mode

Conversation

@wandercone
Copy link
Copy Markdown
Contributor

@wandercone wandercone commented Mar 25, 2026

Adds a Save button (visible to all users) that writes the template XML to disk and navigates back, skipping image pull and container recreate/restart. The existing authoring-mode button is renamed from Save to Dry Run to reflect its actual behavior.

Summary by CodeRabbit

  • New Features
    • Docker container creation interface now includes an unconditional "Save" button, enabling users to save configurations without executing full creation (previously only available in authoring mode)
    • New save-only mode provides streamlined configuration management alongside the existing dry-run functionality

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 25, 2026

Walkthrough

Added a new saveOnly POST flag to the Docker container creation handler. Modified the control flow to disable path creation when either dryRun or saveOnly is set. Refactored log output handling to conditionally emit a completion script when saveOnly is true. Updated UI buttons to make "Save" unconditional.

Changes

Cohort / File(s) Summary
Docker Container Creation Handler
emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php
Added saveOnly POST flag support; modified xmlToCommand() to disable path creation when either dryRun or saveOnly is set; refactored log output to conditionally emit <script>done();</script> and skip log reading when saveOnly is true; updated UI buttons to make "Save" unconditional (sends saveOnly=true) and keep "Dry Run" button in authoring mode (sends dryRun=true).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A container saved, not yet born,
With flags that guide both night and morn—
saveOnly whispers, "hold your ground,"
While buttons dance without a sound,
Configuration safe, tucked away tight! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a Save button to the Docker manager that saves templates without requiring authoring mode or container recreation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

🔧 PR Test Plugin Available

A test plugin has been generated for this PR that includes the modified files.

Version: 2026.03.25.1211
Build: View Workflow Run

📥 Installation Instructions:

Install via Unraid Web UI:

  1. Go to Plugins → Install Plugin
  2. Copy and paste this URL:
https://preview.dl.unraid.net/pr-plugins/pr-2589/webgui-pr-2589.plg
  1. Click Install

Alternative: Direct Download

⚠️ Important Notes:

  • Testing only: This plugin is for testing PR changes
  • Backup included: Original files are automatically backed up
  • Easy removal: Files are restored when plugin is removed
  • Conflicts: Remove this plugin before installing production updates

📝 Modified Files:

Click to expand file list
emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php

🔄 To Remove:

Navigate to Plugins → Installed Plugins and remove webgui-pr-2589, or run:

plugin remove webgui-pr-2589

🤖 This comment is automatically generated and will be updated with each new push to this PR.

@wandercone wandercone changed the title feat dockerMan: add Save button to save template without recreating container or requiring authoring mode feat(dockerMan): add Save button to save template without recreating container or requiring authoring mode Mar 25, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php (1)

95-101: Minor UX consideration: no visual confirmation of save success.

The implementation is functionally correct—the template is written before this block, and done() navigates back. However, unlike the normal apply flow (which shows log output) or dry run (which shows XML/command), the save-only flow provides no feedback that the save succeeded.

Consider whether a brief success toast or visual confirmation would improve user confidence. This is optional and doesn't block the feature.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php` around lines
95 - 101, When $save_only is true the current branch just echoes
"<script>done();</script>" and immediately exits so users get no visual
confirmation; modify the $save_only branch (referencing the $save_only variable
and the done() call) to render a brief success confirmation before navigating
back—e.g., output a small toast or a short HTML message (or include the existing
log.htm content via readfile(".../log.htm") with a "Save successful" line) then
call done(); ensure the UX is non-blocking and visually shows success prior to
the existing navigation flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php`:
- Around line 95-101: When $save_only is true the current branch just echoes
"<script>done();</script>" and immediately exits so users get no visual
confirmation; modify the $save_only branch (referencing the $save_only variable
and the done() call) to render a brief success confirmation before navigating
back—e.g., output a small toast or a short HTML message (or include the existing
log.htm content via readfile(".../log.htm") with a "Save successful" line) then
call done(); ensure the UX is non-blocking and visually shows success prior to
the existing navigation flow.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f83510ec-eced-4fab-8876-86c03cf53b1d

📥 Commits

Reviewing files that changed from the base of the PR and between 685ce26 and 71435fc.

📒 Files selected for processing (1)
  • emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php

@Squidly271
Copy link
Copy Markdown
Contributor

@wandercone

Curious why you want this. If anything, I'd switch the existing functionality save to actually save the template instead of just displaying it.

The "dry run" was to simplify the creation of default templates for CA template repositories.

@wandercone
Copy link
Copy Markdown
Contributor Author

wandercone commented Mar 25, 2026

@wandercone

Curious why you want this. If anything, I'd switch the existing functionality save to actually save the template instead of just displaying it.

The "dry run" was to simplify the creation of default templates for CA template repositories.

@Squidly271 ,

As I understand authoring mode's primary intention is the creation of a new template and not modification to an existing one. That is really just a dry-run, add values and make sure they all work type of flow.

Take my current situation; Seafile. The migration from v12 to v13 requires changes to a bunch of variables across a myriad of templates. Regardless of container state pre-edit, the apply button brings up the container. Well a service like Seafile needs to be brought up in a specific order as to not break dependencies. With the save button I can edit the templates as required and then manually bring up the services in the proper order ensuring an issue free upgrade of Seafile.

@Squidly271
Copy link
Copy Markdown
Contributor

Squidly271 commented Mar 25, 2026

@wandercone

I can get some minor template values to take effect on the drop down menu by just hitting save. They're minor ones though -> notably shell.

I think that this should only show in authoring mode. An additional button that would display by default regardless of the authoring configured for specific use cases I think could lead to some confusion for users if they inadvertently hit save instead of Apply.

But, this is a great addition and should've been done years ago. Thanks.

@wandercone
Copy link
Copy Markdown
Contributor Author

With that, why is the Authoring Mode not only hidden behind Advanced View but also only visible when docker is stopped?

@Squidly271
Copy link
Copy Markdown
Contributor

With Authoring View enabled, you're in Advanced view by default whenever you edit a container.

Why the setting can only be changed with the service stopped? My best answer is that I didn't write that code as there's no reason why the service needs to be stopped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants