Progress Indicator #259

Merged
lois merged 14 commits from lois/Fediversity:ProgressIndicator into main 2025-03-26 10:14:07 +01:00
Owner

closes #74
Show progress indicator to track deployment

  • Disable deploy button when deployment is in progress.
closes #74 Show progress indicator to track deployment - Disable deploy button when deployment is in progress.
kevin self-assigned this 2025-03-19 15:43:31 +01:00
kevin changed title from WIP: Progress Indicator to Progress Indicator 2025-03-19 15:43:55 +01:00
@ -6,1 +6,4 @@
{{ form.as_p }}
<button id="deploy-button" class="button"
hx-post="{% url 'configuration_form' %}"
hx-trigger="click"
Owner

do they not use click as a default trigger for buttons? (i haven't checked)

do they not use click as a default trigger for buttons? (i haven't checked)
Owner

even if default wouldn't be better to still specify things like this so its clear to other people working on this code what it triggers on since we lack comments through the whole code

even if default wouldn't be better to still specify things like this so its clear to other people working on this code what it triggers on since we lack comments through the whole code
kevin marked this conversation as resolved
kiara requested changes 2025-03-19 16:00:32 +01:00
Dismissed
kiara left a comment

please clean the diffs to ensure this isn't reverting stuff, otherwise lgtm

please clean the diffs to ensure this isn't reverting stuff, otherwise lgtm
@ -7,0 +8,4 @@
hx-post="{% url 'configuration_form' %}"
hx-trigger="click"
hx-indicator="#spinner-container"
hx-vals='{"deploy": ""}'
Owner

i wonder if there's a more elegant way to handle button identity here, but i'm no htmx expert and i guess this matches with what django wanted now 🤷‍♀️

i wonder if there's a more elegant way to handle button identity here, but i'm no htmx expert and i guess this matches with what django wanted now 🤷‍♀️
kevin marked this conversation as resolved
@ -8,7 +10,10 @@ from django.contrib.auth.models import User
from django.views.generic import TemplateView, DetailView
from django.views.generic.edit import FormView
from panel import models, settings
Owner

this now reverts some of the logic from Fediversity/Fediversity#253/files 😿, please check your diffs to ensure any proposed change matches your intention

this now reverts some of the logic from https://git.fediversity.eu/Fediversity/Fediversity/pulls/253/files#diff-de06c10854bd6e90e4d3acc5f00f0c1fdbb89a00 😿, please check your diffs to ensure any proposed change matches your intention
lois marked this conversation as resolved
Owner

@kiara i cleaned up somethings in the file to improve the diff

@kiara i cleaned up somethings in the file to improve the diff
@ -128,0 +125,4 @@
cwd=settings.repo_dir,
env=env,
)
Owner

maybe factor this block into a separate function, maybe located just under where this block had been to reduce merge conflicts for now - otherwise i'm satisfied 😅

maybe factor this block into a separate function, maybe located just under where this block had been to reduce merge conflicts for now - otherwise i'm satisfied 😅
lois marked this conversation as resolved
@ -7,0 +10,4 @@
hx-indicator="#spinner-container"
hx-disabled-elt="this"
hx-swap="none"
name="deploy"
Owner

hm, def a nitpick, but it feels unfortunate forgejo highlighting breaks on these lines.
i think name was highlighted when it was up still.
could it be it breaks for everything starting from the line containing the percentage symbols, and if so would reordering help? tho it could also dislike newlines between attributes or attribute names with dashes... could we find a nice middle ground here?

hm, def a nitpick, but it feels unfortunate forgejo highlighting breaks on these lines. i think `name` was highlighted when it was up still. could it be it breaks for everything starting from the line containing the percentage symbols, and if so would reordering help? tho it could also dislike newlines between attributes or attribute names with dashes... could we find a nice middle ground here?
kevin marked this conversation as resolved
@ -129,0 +105,4 @@
return obj
def convert_enums_to_names(self, data_dict):
Owner

this looks like a lot of extra code for a spinner

this looks like a lot of extra code for a spinner
lois marked this conversation as resolved
lois requested review from kiara 2025-03-25 13:37:30 +01:00
@ -5,6 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://unpkg.com/htmx.org@2.0.4" integrity="sha384-HGfztofotfshcF7+8n44JQL2oJmowVChPTg48S+jvZoztPfvwD79OC/LTtG6dMp+" crossorigin="anonymous"></script>

Please use our local one here

Please use our local one here
lois marked this conversation as resolved
@ -129,0 +92,4 @@
class DeploymentStatus(ConfigurationForm):
def form_valid(self, form):
obj = self.get_object()
obj.value = form.to_python().model_dump_json()

Why are we reading and then immediately writing the object here? This was done in the form to store the user input. I would have expected the deployment button to load the stored config from the DB and run nixops with the values.

Why are we reading and then immediately writing the object here? This was done in the form to store the user input. I would have expected the deployment button to load the stored config from the DB and run nixops with the values.
kevin marked this conversation as resolved
lois force-pushed ProgressIndicator from fba4ab090c
All checks were successful
/ check-pre-commit (pull_request) Successful in 27s
/ check-website (pull_request) Successful in 10s
/ check-peertube (pull_request) Successful in 23s
to 772901085b
Some checks failed
/ check-pre-commit (pull_request) Successful in 25s
/ check-website (pull_request) Successful in 10s
/ check-peertube (pull_request) Successful in 21s
/ check-panel (pull_request) Failing after 1m27s
2025-03-25 15:19:33 +01:00
Compare
Remove overwriting the obj
Some checks failed
/ check-pre-commit (pull_request) Successful in 26s
/ check-website (pull_request) Successful in 11s
/ check-peertube (pull_request) Successful in 22s
/ check-panel (pull_request) Failing after 1m24s
550d08cad6
Fix merge issue
All checks were successful
/ check-pre-commit (pull_request) Successful in 25s
/ check-website (pull_request) Successful in 11s
/ check-peertube (pull_request) Successful in 21s
/ check-panel (pull_request) Successful in 1m29s
df5edbc1cc
Merge branch 'main' into ProgressIndicator
All checks were successful
/ check-pre-commit (pull_request) Successful in 25s
/ check-website (pull_request) Successful in 9s
/ check-peertube (pull_request) Successful in 21s
/ check-panel (pull_request) Successful in 1m23s
617c362f0e
@ -129,0 +121,4 @@
}
cmd = [
"nix",
"develop",
Owner

as per diffchecker, the main branch had a comment in here:
# workaround to pass in info to nixops4 thru env vars, tho impure :(

as per diffchecker, the main branch had a comment in here: `# workaround to pass in info to nixops4 thru env vars, tho impure :(`
kiara approved these changes 2025-03-26 08:40:02 +01:00
@ -37,3 +37,3 @@
mastodon_enable=True,
)
print(form_data)

please remove all print statements. if you want debug logging, use python's logging infrastructure

please remove all print statements. if you want debug logging, use python's logging infrastructure
lois merged commit b4fbc457a6 into main 2025-03-26 10:14:07 +01:00
lois deleted branch ProgressIndicator 2025-03-26 10:14:08 +01:00
lois referenced this pull request from a commit 2025-03-26 10:14:10 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
fediversity/fediversity!259
No description provided.