-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Experiment versioning UI: version details view #675
Conversation
apps/experiments/urls.py
Outdated
@@ -44,6 +44,7 @@ | |||
path("e/<int:experiment_id>/", views.single_experiment_home, name="single_experiment_home"), | |||
path("e/<int:experiment_id>/sessions-table/", views.ExperimentSessionsTableView.as_view(), name="sessions-list"), | |||
path("e/<int:experiment_id>/versions/", views.ExperimentVersionsTableView.as_view(), name="versions-list"), | |||
path("e/<int:pk>/versions/set_default", views.set_default_experiment, name="set-default-experiment"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not working at the moment-- tried what seems like all possibilities
Details | ||
</button> | ||
|
||
<dialog id="modal-{{ record.id }}" class="modal"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about using HTMX to fetch the modal content rather than including it all in the main page (https://htmx.org/examples/modal-bootstrap/)
The benefit is a smaller page load for the main page which should be quicker to load and render. We also don't then need to prefetch all the related objects for each version on the main page.
templates/experiments/components/experiment_version_details_button.html
Outdated
Show resolved
Hide resolved
@@ -167,6 +167,9 @@ class ExperimentVersionsTable(tables.Table): | |||
{% endif %}""", | |||
verbose_name="Default Version", | |||
) | |||
details = columns.TemplateColumn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super nit : Thoughts on calling it something like "view" rather? I can't articulate exactly why, but if I were to click on a button that says "details" and see some actions where I can for instance archive the version of the experiment, my brain stop and asks "wait, what just happened". If this is not the case with you, fine to leave it as-is 😄
Co-authored-by: Simon Kelly <skelly@dimagi.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files📢 Thoughts on this report? Let us know! |
apps/experiments/views/experiment.py
Outdated
def set_default_experiment(request, team_slug: str, experiment_id: int, pk: int): | ||
experiment = get_object_or_404(Experiment, working_version_id=experiment_id, version_number=pk, team=request.team) | ||
Experiment.objects.exclude(version_number=pk).filter(team__slug=team_slug, working_version_id=experiment_id).update( | ||
is_default_version=False, audit_action=AuditAction.AUDIT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@snopoke got the auditing error without adding the "audit_action" but that feels bizarre for this instance to me-- is there a work around?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is expected. Since the .update method doesn't call .save, we need to manually mark this as being audited
@SmittieC to-do with this branch: |
…e default version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No blocking comments.
.zed/settings.json
Outdated
"git_status": true | ||
}, | ||
"format_on_save": "off" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remote this file
apps/experiments/models.py
Outdated
@@ -691,6 +691,42 @@ def is_public(self) -> bool: | |||
def is_participant_allowed(self, identifier: str): | |||
return identifier in self.participant_allowlist or self.team.members.filter(email=identifier).exists() | |||
|
|||
def version_details_for_display(self) -> list[dict]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this is a good place to use a TypedDict or a dataclass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea: a585408
View Details | ||
</button> | ||
|
||
<dialog id="details_modal" class="modal"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be removed form here and we use the one in experiment_version_table.html
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
Adds detail button view to the versions table to display the details of the experiment version and set that version as the defualt
User Impact
None at this time, this feature is behind a pre-release FF for testing purposes
Demo
Docs