Skip to content

Commit cc41fb5

Browse files
authored
New frontend (#50)
* Updated initial data * Improved project view Detail view: added internal links List view: tidied links from dashboard * Added status agreement field * Reverted a flag in initial_data * Updated version * Removed alphabetical ordering of project objectives * Implemented form editing in detail view * Moved some styles * Implemented htmx updates of multiple elements * project commitment summary * project objective status ... from multiple triggers. Tidied up CSS. * Bumped version
1 parent 7d42cc5 commit cc41fb5

26 files changed

+471
-313
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ The application will run in a Kubernetes cluster, so we need a container image f
8686
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:
8787

8888
> ```
89-
> Packed dashboard_0.17_amd64.rock
89+
> Packed dashboard_0.18_amd64.rock
9090
> ```
9191
9292
### Create a charm
@@ -109,10 +109,10 @@ Creating the charm might take several minutes, so this is another good point to
109109
``` { name=deploy-dashboard }
110110
cd ~/dashboard
111111
rockcraft.skopeo --insecure-policy copy --dest-tls-verify=false \
112-
oci-archive:dashboard_0.17_amd64.rock \
113-
docker://localhost:32000/dashboard:0.17
112+
oci-archive:dashboard_0.18_amd64.rock \
113+
docker://localhost:32000/dashboard:0.18
114114
juju deploy ./charm/dashboard_ubuntu-22.04-amd64.charm \
115-
--resource django-app-image=localhost:32000/dashboard:0.17
115+
--resource django-app-image=localhost:32000/dashboard:0.18
116116
```
117117
118118
The `rockcraft.skopeo` command makes the container image available to Juju.

dashboard/dashboard/static/admin.css

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
table.objectives td {border-bottom: none;}
2-
table.objectives tr {background: var(--body-bg)}
31
table.objectives tr.objective td.name {background-color: #205067; color: white; font-weight: bold;}
42
table.objectives tr.level {background-color: #f0f0f0; font-weight: bold;}
53

@@ -16,9 +14,4 @@ table.objectives td.field-committed {color: white; background: #93C47D;}
1614
table.objectives td.commitment-blank {color: white; background: #D9EAD3;}
1715

1816
table.objectives td.no-activity {outline: 1px solid black;}
19-
table.objectives td.planned {color: black; background: #FFF2CC}
20-
table.objectives td.deferred {color: black; background: #FCE5CD}
21-
table.objectives td.blocked, td.inactive {color: black; background: #EAD1DC}
22-
table.objectives td.started {color: black; background: #B6D7A8}
23-
table.objectives td.first-results {color: black; background: #6AA84F}
24-
table.objectives td.mature-results, td.done, td.all-ok {color: white; background: #38761D}
17+
Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
11
body {font-family: Helvetica, sans-serif; font-size: 12px;}
22

3-
table.objectives.detail {width: 100%;}
4-
table.objectives.detail .projectobjectivegroup {background: #D9EAD3; color: black; font-weight: bold; padding-top: 10px; padding-bottom: 10px; margin-top: 10px;}
5-
table.objectives.detail td.workcycle.current {color: black; font-weight: bold;}
3+
/* general table styles */
64

5+
table.objectives.detail {
6+
width: 100%;
7+
border-collapse: collapse;
8+
}
9+
table.objectives tr {background: var(--body-bg)}
10+
table.objectives td {border-bottom: none;}
11+
12+
13+
th.projectobjectivegroup {
14+
background: #D9EAD3;
15+
color: black; font-weight: bold;
16+
padding-top: 10px; padding-bottom: 10px; margin-top: 10px;
17+
text-align: left;
18+
}
19+
20+
21+
22+
td.workcycle.current {color: black; font-weight: bold;}
23+
td.objective.description {font-style: italic;}
24+
25+
/* work statuses */
26+
27+
td.na {color: black; background: #CCCCCC}
28+
td.paused {color: black; background: #FCE5CD}
29+
td.planned {color: black; background: #FFF2CC}
30+
td.deferred {color: black; background: #FCE5CD}
31+
td.blocked, td.inactive {color: black; background: #EAD1DC}
32+
33+
/* result statuses */
34+
35+
td.started {color: black; background: #B6D7A8}
36+
td.first-results {color: black; background: #6AA84F}
37+
td.mature-results, td.done, td.all-ok {color: white; background: #38761D}

dashboard/dashboard/static/dashboard.css

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,9 @@ th.project-name {font-weight: normal; text-align: left;}
3131

3232
table a, table a:visited {color: inherit; text-decoration: none}
3333

34-
td.na {color: black; background: #CCCCCC}
35-
td.paused {color: black; background: #FCE5CD}
36-
td.planned {color: black; background: #FFF2CC}
37-
td.deferred {color: black; background: #FCE5CD}
38-
td.blocked, td.inactive {color: black; background: #EAD1DC}
3934
td.needs-work {color: black; background: #E66439}
4035
td.needs-review {color: black; background: #E69138}
4136
td.mostly-met {color: black; background: #E69138}
42-
td.started {color: black; background: #B6D7A8}
43-
td.first-results {color: black; background: #6AA84F}
44-
td.mature-results, td.done, td.all-ok {color: white; background: #38761D}
4537

4638
td.new {color: white; background: #38761D}
4739
td.acceptable {color: white; background: #B5D7A8}

dashboard/dashboard/urls.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from django.contrib import admin
22
from django.urls import include, path
3-
from projects.views import ProjectDetailView, ProjectListView, action_toggle_commitment
43

54
urlpatterns = [
65
path("admin/doc/", include("django.contrib.admindocs.urls")),

dashboard/framework/models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ class Meta:
8080
ordering = ["timestamp"]
8181

8282

83-
8483
class ObjectiveGroup(models.Model):
8584
name = models.CharField(max_length=100)
8685

@@ -127,7 +126,7 @@ def save(self, **kwargs):
127126
)
128127

129128
class Meta:
130-
ordering = ["group", "name"]
129+
ordering = ["group"]
131130

132131

133132
class Condition(models.Model):

dashboard/projects/admin.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,14 @@ class ProjectAdmin(admin.ModelAdmin):
9898
inlines = [
9999
ProjectObjectiveInline,
100100
]
101-
list_display = ["name", "owner", "driver", "last_review", "agreement_status", "last_review_status"]
101+
list_display = [
102+
"name",
103+
"owner",
104+
"driver",
105+
"last_review",
106+
"agreement_status",
107+
"last_review_status",
108+
]
102109
save_on_top = True
103110

104111
fieldsets = (

dashboard/projects/forms.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from . import models
22
from django.forms import ModelForm
3+
from django.forms import inlineformset_factory
34

45

56
class ProjectDetailForm(ModelForm):
@@ -13,3 +14,23 @@ class Meta:
1314
"last_review",
1415
"last_review_status",
1516
]
17+
18+
19+
class ProjectObjectiveForm(ModelForm):
20+
class Meta:
21+
model = models.ProjectObjective
22+
fields = ["unstarted_reason"]
23+
labels = {"unstarted_reason": ""}
24+
help_texts = {"unstarted_reason": ""}
25+
26+
27+
class ProjectObjectiveConditionForm(ModelForm):
28+
class Meta:
29+
model = models.ProjectObjectiveCondition
30+
fields = ["done"]
31+
32+
33+
class LevelCommitmentForm(ModelForm):
34+
class Meta:
35+
model = models.LevelCommitment
36+
fields = ["committed"]

dashboard/projects/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def save(self, **kwargs):
7575
)
7676

7777
def get_absolute_url(self):
78-
return reverse("projects:project_detail", kwargs={"pk": self.pk})
78+
return reverse("projects:project", kwargs={"pk": self.pk})
7979

8080
def quality_indicator(self):
8181
x = 0
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{% load project_tags %}
2+
3+
<div class="inline-group">
4+
<div class="tabular inline-related">
5+
6+
{% regroup projectobjectives_formset by instance.objective.group as projectobjectivegroups %}
7+
8+
<table class="objectives detail">
9+
<tbody>
10+
11+
<form method="post">
12+
{{ projectobjectives_formset.management_form }}
13+
14+
{% for projectobjectivegroup, projectobjectives in projectobjectivegroups %}
15+
16+
<tr><th class="projectobjectivegroup" colspan="{{ work_cycle_count|add:'2' }}">
17+
{{ projectobjectivegroup }}
18+
</th></tr>
19+
20+
{% for projectobjective in projectobjectives %}
21+
22+
{% with projectobjective=projectobjective.instance %}
23+
24+
<tr id="projectobjective-{{ projectobjective.id }}" class="objective">
25+
<td colspan="{{ work_cycle_count|add:'2' }}" class="objective name">
26+
{{ projectobjective.objective }}
27+
</td>
28+
</tr>
29+
30+
<tr class="">
31+
<td colspan="2" class="">{{ projectobjective.objective.description|default:"" }}</td>
32+
<td colspan="{{ work_cycle_count }}" class="commitment-blank"></td>
33+
</tr>
34+
35+
<tr class="">
36+
{% include "projects/partial_objectivestatus.html" %}
37+
<td></td>
38+
<td colspan="{{ work_cycle_count }}" class="commitment-blank"></td>
39+
</tr>
40+
41+
<tr class="">
42+
{% include "projects/partial_objectiveunstarted.html" %}
43+
{% for work_cycle in work_cycles %}
44+
<td class="workcycle {% if work_cycle.is_current %}current{% endif %}">{{ work_cycle }}</td>
45+
{% endfor %}
46+
</tr>
47+
48+
{% regroup projectobjective.projectobjectiveconditions by level as levels %}
49+
{% regroup projectobjective.levelcommitments by level as commitments %}
50+
{% pack levels commitments as level_collections %}
51+
52+
{% for condition, commitment in level_collections %}
53+
54+
<tr id="" class="level">
55+
<td colspan="2" class="">{{ condition.grouper }}</td>
56+
57+
{% for commitment in commitment.list %}
58+
{% include "projects/partial_levelcommitment.html" %}
59+
{% endfor %}
60+
61+
</tr>
62+
63+
{% for condition in condition.list %}
64+
{% include "projects/partial_condition.html" %}
65+
{% endfor %}
66+
67+
{% endfor %}
68+
{% endwith %}
69+
{% endfor %}
70+
{% endfor %}
71+
</form>
72+
</tbody>
73+
</table>
74+
75+
</div>
76+
</div>

0 commit comments

Comments
 (0)