Skip to content
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
136e807
Fixed a permissions issue
evildmp Sep 11, 2025
1a90957
Bumped version
evildmp Sep 11, 2025
8dd5060
Add more reload delays, fix another permissions bug
evildmp Sep 11, 2025
92c3c06
Fixed status algorithm (again)
evildmp Sep 11, 2025
cfc961b
Added date picker for last review date
evildmp Sep 11, 2025
e664637
Added URL field, improved basic view
evildmp Sep 11, 2025
a627455
Added back tests for logged-in user
evildmp Sep 11, 2025
6475a35
Updated CSS for candidate/na statuses
evildmp Sep 11, 2025
5ff906d
Reformatted with Black
evildmp Sep 10, 2025
ce256fb
Added basic permission testing
evildmp Sep 10, 2025
c4ce0be
Removed unnecessary formset from template
evildmp Sep 11, 2025
7a7e846
Bumped version
evildmp Sep 11, 2025
69415f3
merge upstream/main to resolve version number conflicts
dwilding Sep 12, 2025
0b3c352
install playright before running tests
dwilding Sep 12, 2025
86862e4
add CI for running tests
dwilding Sep 12, 2025
1582127
fix testing deps
dwilding Sep 12, 2025
6e07e9d
merge upstream/main to get updated workflows
dwilding Sep 12, 2025
e6ec7d0
Improved frontend tests
evildmp Sep 12, 2025
b3157ca
Update dashboard/projects/templates/projects/partial_project_basics.html
evildmp Sep 12, 2025
be206c5
Merge branch 'more-frontend-fixes' of github.com:evildmp/dashboard in…
evildmp Sep 12, 2025
449f379
Merge branch 'main' of github.com:canonical/dashboard into more-front…
evildmp Sep 12, 2025
93bbfcb
Updated initial_data.yaml
evildmp Sep 12, 2025
f84d6e3
Removed project objective inlines from project admin
evildmp Sep 12, 2025
81c9ca7
Added log in/out and other URLs to project page
evildmp Sep 12, 2025
1580bae
Bumped version
evildmp Sep 15, 2025
ca54915
add delays in more places (temporary workaround)
dwilding Sep 15, 2025
aeb3e95
try very long delays (for debugging
dwilding Sep 15, 2025
6df08a9
compromise on 5-second delays
dwilding Sep 15, 2025
191fbf0
match settings.py update in rock version
dwilding Sep 15, 2025
c509c8c
match login form layout with project form
dwilding Sep 16, 2025
b972a19
send users back to the project page on logout
dwilding Sep 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ The application will run in a Kubernetes cluster, so we need a container image f
Creating the container image might take several minutes, so this is a good point to take a break. When you return, you should see the following output:

> ```
> Packed dashboard_0.24_amd64.rock
> Packed dashboard_0.25_amd64.rock
> ```

### Create a charm
Expand All @@ -109,10 +109,10 @@ Creating the charm might take several minutes, so this is another good point to
``` { name=deploy-dashboard }
cd ~/dashboard
rockcraft.skopeo --insecure-policy copy --dest-tls-verify=false \
oci-archive:dashboard_0.24_amd64.rock \
docker://localhost:32000/dashboard:0.24
oci-archive:dashboard_0.25_amd64.rock \
docker://localhost:32000/dashboard:0.25
juju deploy ./charm/dashboard_ubuntu-22.04-amd64.charm \
--resource django-app-image=localhost:32000/dashboard:0.24
--resource django-app-image=localhost:32000/dashboard:0.25
```

The `rockcraft.skopeo` command makes the container image available to Juju.
Expand Down
3 changes: 3 additions & 0 deletions dashboard/dashboard/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,6 @@
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

LOGIN_REDIRECT_URL = "projects:project_list"
LOGOUT_REDIRECT_URL = "projects:project_list"
Comment on lines +135 to +136
Copy link
Collaborator

Choose a reason for hiding this comment

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

I just pushed a commit to add these to dashboard_rock_patch/dashboard/settings.py too.

12 changes: 12 additions & 0 deletions dashboard/dashboard/templates/registration/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% extends "base.html" %}

{% block content %}

<h2>Log in</h2>
<form method="post">
{% csrf_token %}
{{ form }}
<button type="submit">Log In</button>
</form>

{% endblock %}
1 change: 1 addition & 0 deletions dashboard/dashboard/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
urlpatterns = [
path("admin/doc/", include("django.contrib.admindocs.urls")),
path("admin/", admin.site.urls),
path("accounts/", include("django.contrib.auth.urls")),
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does this do? I tried opening http://localhost:8000/accounts but I got a page not found error - so I must be misunderstanding something.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I did some research into this. I understand the purpose now. It's so that we can use user authorisation URLs that don't need to go via the admin interface. This makes sense, now that we support live editing on the project pages.

path("__reload__/", include("django_browser_reload.urls")),
path("", include("projects.urls")),
]
4 changes: 2 additions & 2 deletions dashboard/initial_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@
pk: 1
fields:
name: Nuclear
url: ''
url: https://nuclear.org
group: 1
owner: A. Scientist
driver: A. Technician
Expand All @@ -489,7 +489,7 @@
pk: 2
fields:
name: Chemistry
url: https://nuclear.nut
url: https://chemistry.org
group: 1
owner: A. Chemist
driver: null
Expand Down
19 changes: 1 addition & 18 deletions dashboard/projects/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,6 @@ def has_delete_permission(self, request, obj):
return False


class ProjectObjectiveInline(admin.TabularInline):
model = ProjectObjective
max_num = 0
can_delete = False
fields = ("name", "unstarted_reason")
readonly_fields = ["name"]
exclude = ["objective", "description", "status"]

def has_add_permission(self, request, obj):
return False

def has_delete_permission(self, request, obj):
return False


@admin.register(ProjectObjective)
class ProjectObjectiveAdmin(admin.ModelAdmin):
readonly_fields = ["project", "objective", "status"]
Expand Down Expand Up @@ -95,9 +80,7 @@ def change_view(self, request, object_id, form_url="", extra_context=None):

@admin.register(Project)
class ProjectAdmin(admin.ModelAdmin):
inlines = [
ProjectObjectiveInline,
]

list_display = [
"name",
"owner",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<div id="basic_information">

{% if not user.is_authenticated %}
<div class="auth"><a href="{% url 'admin:index' %}">Log in to edit</a></div>
{% endif %}

<div id="basic_form" class="submit-row">
<form
hx-post="{% url 'projects:project_basic_form_save' project.id %}"
Expand Down
48 changes: 34 additions & 14 deletions dashboard/projects/templates/projects/project.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,47 @@

{% block content %}

<h1>{{ project }}</h1>
<div id="container">

<div id="container">
<div class="main" id="main">
<main id="content-start" class="content">
<div id="content" class="colM">
<div id="content-main">
<nav class="navigation">
<ul>
<li><a href="/">Dashboard</a></li>
{% if user.is_authenticated %}
<li><a href="{% url 'admin:index' %}">Admin</a></li>
<li>Logged in as {{ user.username }}</li>
<li>
<form action="{% url 'logout' %}" method="post">
{% csrf_token %}
<button type="submit">Log out</button>
</form>
</li>
{% else %}
<li><a href="{% url 'login' %}?next={{ request.path }}">Log in</a></li>
{% endif %}
</ul>
</nav>

<div>{% include "projects/partial_project_basics.html" %}</div>
<h1>{{ project }}</h1>

<hr>
<div class="main" id="main">
<main id="content-start" class="content">
<div id="content" class="colM">
<div id="content-main">

<div>{% include "projects/partial_project_commitments.html" %}</div>
<div>{% include "projects/partial_project_basics.html" %}</div>

<hr>
<hr>

{% include "projects/partial_projectobjectives.html" %}
<div>{% include "projects/partial_project_commitments.html" %}</div>

<hr>

{% include "projects/partial_projectobjectives.html" %}

</div>
</div>
</div>
</main>
</main>
</div>
</div>
</div>

{% endblock content %}
6 changes: 4 additions & 2 deletions dashboard/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_toggling_conditions(live_server, page):
# after toggling, the new conditions should be saved in the database
page.get_by_test_id("toggle_condition_94").uncheck()
page.get_by_test_id("toggle_condition_102").check()
time.sleep(0.5) # Temporary workaround. Find a better solution.
time.sleep(5) # Temporary workaround. Find a better solution.

assert ProjectObjectiveCondition.objects.get(id=94).done == False
assert ProjectObjectiveCondition.objects.get(id=102).done == True
Expand All @@ -70,7 +70,7 @@ def test_toggling_conditions(live_server, page):

page.get_by_test_id("toggle_commitment_705").check()
page.get_by_test_id("toggle_commitment_474").uncheck()
time.sleep(0.5) # Temporary workaround. Find a better solution.
time.sleep(5) # Temporary workaround. Find a better solution.

assert Commitment.objects.get(id=705).committed == True
assert Commitment.objects.get(id=474).committed == False
Expand All @@ -88,13 +88,15 @@ def test_toggling_conditions(live_server, page):

# check the remaining box to get to Started
page.get_by_test_id("toggle_condition_10").check()
time.sleep(5) # Temporary workaround. Find a better solution.
assert ProjectObjectiveCondition.objects.get(
id=10
).projectobjective().status() == Level.objects.get(id=1)
expect(page.get_by_test_id("projectobjective_status_1")).to_contain_text("Started")

# check one more to get to First results
page.get_by_test_id("toggle_condition_14").check()
time.sleep(5) # Temporary workaround. Find a better solution.
assert ProjectObjectiveCondition.objects.get(
id=14
).projectobjective().status() == Level.objects.get(id=1)
Expand Down
3 changes: 3 additions & 0 deletions dashboard_rock_patch/dashboard/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,6 @@
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

LOGIN_REDIRECT_URL = "projects:project_list"
LOGOUT_REDIRECT_URL = "projects:project_list"
2 changes: 1 addition & 1 deletion rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: dashboard
# see https://documentation.ubuntu.com/rockcraft/en/1.8.0/explanation/bases/
# for more information about bases and using 'bare' bases for chiselled rocks
base: ubuntu@22.04 # the base environment for this Django application
version: "0.24" # just for humans. Semantic versioning is recommended
version: "0.25" # just for humans. Semantic versioning is recommended
summary: A summary of your Django application # 79 char long summary
description: |
Dashboard is a Django application to track quality and progress of multiple
Expand Down