Skip to content

Commit f5a079b

Browse files
authored
Consolidates status views (#52)
* Tidied up some styles * Consolidated status fields into single report * Bumped version to 0.19
1 parent 196aff3 commit f5a079b

15 files changed

+97
-77
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.18_amd64.rock
89+
> Packed dashboard_0.19_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.18_amd64.rock \
113-
docker://localhost:32000/dashboard:0.18
112+
oci-archive:dashboard_0.19_amd64.rock \
113+
docker://localhost:32000/dashboard:0.19
114114
juju deploy ./charm/dashboard_ubuntu-22.04-amd64.charm \
115-
--resource django-app-image=localhost:32000/dashboard:0.18
115+
--resource django-app-image=localhost:32000/dashboard:0.19
116116
```
117117
118118
The `rockcraft.skopeo` command makes the container image available to Juju.

dashboard/dashboard/static/admin.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ table.objectives td p, th p {margin: .2rem 0}
99
table.objectives select {height: 1.2rem;}
1010
table.objectives select {height: 1.2rem; padding: 0px 6px;} /* padding is required for Chrome for some reason */
1111

12-
table.objectives td.workcycle {color: white; background: #6AA84F;}
1312
table.objectives td.field-committed {color: white; background: #93C47D;}
1413
table.objectives td.commitment-blank {color: white; background: #D9EAD3;}
1514

dashboard/dashboard/static/base-styles.css

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,17 @@ th.projectobjectivegroup {
1818
padding-top: 10px; padding-bottom: 10px; margin-top: 10px;
1919
}
2020

21-
22-
21+
td.workcycle {color: white; background: #6AA84F;}
2322
td.workcycle.current {color: black; font-weight: bold;}
2423
td.objective.description {font-style: italic;}
2524

2625
/* work statuses */
2726

28-
td.na {color: black; background: #CCCCCC}
27+
td.not-applicable {color: black; background: #CCCCCC}
2928
td.paused {color: black; background: #FCE5CD}
3029
td.planned {color: black; background: #FFF2CC}
3130
td.deferred {color: black; background: #FCE5CD}
32-
td.blocked, td.inactive {color: black; background: #EAD1DC}
31+
td.blocked, td.inactive {color: black; background: #EAD1DC;}
3332

3433
/* result statuses */
3534

@@ -44,4 +43,4 @@ td.mature-results, td.done, td.all-ok {color: white; background: #38761D}
4443

4544
tr.condition.candidate .attributes .condition.candidate {color: black;}
4645
tr.condition.not-applicable .condition.not-applicable {color: black;}
47-
tr.condition.not-applicable .condition.name {color: #bbb; text-decoration: line-through;;}
46+
tr.condition.not-applicable .condition.name {color: #bbb; text-decoration: line-through;}

dashboard/initial_data.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,7 +1817,7 @@
18171817
project: 1
18181818
objective: 1
18191819
condition: 2
1820-
done: false
1820+
done: true
18211821
not_applicable: false
18221822
candidate: false
18231823
- model: projects.projectobjectivecondition
@@ -2609,7 +2609,7 @@
26092609
project: 1
26102610
objective: 7
26112611
condition: 24
2612-
done: false
2612+
done: true
26132613
not_applicable: false
26142614
candidate: false
26152615
- model: projects.projectobjectivecondition
@@ -2681,7 +2681,7 @@
26812681
project: 1
26822682
objective: 7
26832683
condition: 26
2684-
done: true
2684+
done: false
26852685
not_applicable: false
26862686
candidate: false
26872687
- model: projects.projectobjectivecondition

dashboard/projects/models.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ def achieved_level(self):
129129
objective=self.objective,
130130
condition__level=level,
131131
)
132-
if results.exists() and not results.filter(done=False, not_applicable=False).exists():
132+
if (
133+
results.exists()
134+
and not results.filter(done=False, not_applicable=False).exists()
135+
):
133136
return level
134137

135138
def status(self):
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<td
2+
id="projectobjective_status_{{ projectobjective.instance.id }}"
3+
class="{{ projectobjective.instance.status|lower|slugify }}"
4+
data-testid="projectobjective_status_{{ projectobjective.instance.id }}"
5+
hx-trigger="
6+
change from:select delay:.5s,
7+
change from:input[type='checkbox'] delay:.5s,
8+
click from:div.attributes delay:.5s"
9+
hx-get="{% url 'projects:status_projectobjective' projectobjective.instance.id %}"
10+
hx-swap-oob="true">
11+
{{ projectobjective.instance.status|default:"No activity" }}
12+
</td>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<td colspan="2">
2+
{{ projectobjective.unstarted_reason }}
3+
</td>

dashboard/projects/templates/projects/newpartial_projectobjectives.html

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,31 @@
1919

2020
{% for projectobjective in projectobjectives %}
2121

22-
{% with projectobjective=projectobjective.instance %}
22+
<tr id="projectobjective-{{ projectobjective.instance.id }}" class="objective">
23+
<td colspan="{{ workcycle_count|add:'2' }}" class="objective name">
24+
{{ projectobjective.instance.objective }}
25+
</td>
26+
</tr>
27+
28+
<tr class="">
29+
<td colspan="2" class="">{{ projectobjective.instance.objective.description|default:"" }}</td>
30+
<td colspan="{{ workcycle_count }}" class="commitment-blank"></td>
31+
</tr>
32+
33+
<tr class="">
34+
{% include "projects/newpartial_objectivestatus.html" %}
35+
<td></td>
36+
<td colspan="{{ workcycle_count }}" class="commitment-blank"></td>
37+
</tr>
38+
39+
<tr class="">
40+
{% include "projects/newpartial_objectiveunstarted.html" %}
41+
{% for work_cycle in work_cycles %}
42+
<td class="workcycle {% if work_cycle.is_current %}current{% endif %}">{{ work_cycle }}</td>
43+
{% endfor %}
44+
</tr>
2345

24-
<tr id="projectobjective-{{ projectobjective.id }}" class="objective">
25-
<td colspan="{{ workcycle_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="{{ workcycle_count }}" class="commitment-blank"></td>
33-
</tr>
34-
35-
<tr class="">
36-
{% include "projects/partial_objectivestatus.html" %}
37-
<td></td>
38-
<td colspan="{{ workcycle_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>
46+
{% with projectobjective=projectobjective.instance %}
4747

4848
{% regroup projectobjective.projectobjectiveconditions by level as levels %}
4949
{% regroup projectobjective.levelcommitments by level as commitments %}
Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,33 @@
11
<td
22
id="projectobjective_status_{{ projectobjective.id }}"
3-
class="{{ projectobjective.status|lower|slugify }}"
3+
class="{{ projectobjective.achieved_level|lower|slugify }}"
44
data-testid="projectobjective_status_{{ projectobjective.id }}"
55
hx-trigger="
6-
change from:select delay:.5s,
7-
change from:input[type='checkbox'] delay:.5s,
6+
change from:input[type='checkbox'] delay:.5s,
87
click from:div.attributes delay:.5s"
98
hx-get="{% url 'projects:status_projectobjective' projectobjective.id %}"
109
hx-swap-oob="true">
11-
{{ projectobjective.status|default:"No activity" }}
10+
{% if projectobjective.achieved_level %}
11+
12+
{{ projectobjective.status }}
13+
14+
{% else %}
15+
<select
16+
name="ifnotstarted"
17+
id="projectobjective_ifnotstarted_{{ projectobjective.id }}"
18+
data-testid="projectobjective_ifnotstarted_{{ projectobjective.id }}"
19+
hx-put="{% url 'projects:action_select_reason' projectobjective.id %}"
20+
hx-swap="none"
21+
>
22+
<option value></option>
23+
{% for reason in unstarted_reasons %}
24+
<option value="{{ reason.id }}"
25+
{% if reason.id == projectobjective.unstarted_reason.id %}selected{% endif %}
26+
>
27+
{{ reason }}
28+
</option>
29+
{% endfor %}
30+
</select>
31+
32+
{% endif %}
1233
</td>

dashboard/projects/templates/projects/partial_objectiveunstarted.html

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)