Skip to content
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

Merged
merged 18 commits into from
Sep 19, 2024

Conversation

stephherbers
Copy link
Contributor

@stephherbers stephherbers commented Sep 9, 2024

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

Peek 2024-09-19 10-47

Docs

@@ -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"),
Copy link
Contributor Author

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

Base automatically changed from smh/exp-versioning-ui-versions-tab to main September 10, 2024 05:51
Details
</button>

<dialog id="modal-{{ record.id }}" class="modal">
Copy link
Collaborator

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.

@@ -167,6 +167,9 @@ class ExperimentVersionsTable(tables.Table):
{% endif %}""",
verbose_name="Default Version",
)
details = columns.TemplateColumn(
Copy link
Collaborator

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-commenter
Copy link

codecov-commenter commented Sep 18, 2024

Codecov Report

Attention: Patch coverage is 51.85185% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
apps/experiments/views/experiment.py 50.00% 8 Missing ⚠️
apps/experiments/models.py 50.00% 5 Missing ⚠️
Additional details and impacted files

📢 Thoughts on this report? Let us know!

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
Copy link
Contributor Author

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?

Copy link
Collaborator

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

@stephherbers
Copy link
Contributor Author

@SmittieC to-do with this branch:
fix routing after setting as default to land on the version table (url error causing templating issue)
demo (duh!!)

@stephherbers stephherbers marked this pull request as ready for review September 18, 2024 19:04
snopoke
snopoke previously approved these changes Sep 19, 2024
Copy link
Collaborator

@snopoke snopoke left a comment

Choose a reason for hiding this comment

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

No blocking comments.

"git_status": true
},
"format_on_save": "off"
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: remote this file

@@ -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]:
Copy link
Collaborator

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

Copy link
Collaborator

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">
Copy link
Collaborator

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?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@SmittieC SmittieC merged commit e90138f into main Sep 19, 2024
4 checks passed
@SmittieC SmittieC deleted the smh/versioning-details-view branch September 19, 2024 12:06
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.

4 participants