Improve artifact availability UX
CI / php-store (push) Waiting to run
CI / python-components (push) Waiting to run

This commit is contained in:
2026-08-24 22:42:56 +02:00
parent 3028bf522c
commit 0440b6a48f
12 changed files with 85 additions and 23 deletions
+12 -8
View File
@@ -34,21 +34,20 @@ class LifecycleConfirmForm(forms.Form):
self.runtime = runtime
self.fields["confirmation"].widget.attrs.update({"autocomplete": "off", "placeholder": plugin.slug})
self.fields["dry_run"].initial = runtime.default_dry_run
self.has_installable_release = True
if action in {"install", "update"}:
choices = [
(release.version, release.version)
for release in plugin.releases
if (
release.supports(runtime.netbox_version, plugin)
and release.approved
and release.immutable
and bool(release.sha256)
and (runtime.execution_mode != "agent" or bool(release.approved_payload_sha256))
for release in plugin.installable_releases(
runtime.netbox_version,
require_approval_marker=runtime.execution_mode == "agent",
)
]
choices.sort(reverse=True)
self.fields["version"].choices = choices
self.fields["version"].required = True
self.has_installable_release = bool(choices)
self.fields["version"].required = self.has_installable_release
self.fields["version"].disabled = not self.has_installable_release
self.fields["version"].initial = plugin.latest_version
else:
self.fields.pop("version")
@@ -64,6 +63,11 @@ class LifecycleConfirmForm(forms.Form):
def clean(self):
cleaned = super().clean()
if self.action in {"install", "update"} and not self.has_installable_release:
raise forms.ValidationError(
"Keine freigegebene, kompatible Plugin-Version ist verfügbar. "
"Das Source-Artefakt muss zunächst im Store synchronisiert und freigegeben werden."
)
if self.runtime.execution_mode == "dry_run" and not cleaned.get("dry_run", False):
self.add_error("dry_run", "Reale Aktionen sind in execution_mode=dry_run deaktiviert.")
return cleaned