Skip to content

Introduce Workflow #65

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
83 changes: 83 additions & 0 deletions media/commitfest/css/commitfest.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,86 @@ div.form-group div.controls input.threadpick-input {
.search-bar {
display: inline-block;
}

/* Header styling */
#workflow-transitions-header {
font-size: 20px;
font-weight: bold;
margin-top: 20px;
color: #333;
border-bottom: 2px solid #ddd;
padding-bottom: 5px;
}

/* Table styling */
#workflow-transitions-table {
width: 100%;
max-width: 500px; /* Updated max-width */
border-collapse: collapse;
margin: 20px 0; /* Remove centering */
font-size: 16px;
text-align: left;
}

#workflow-transitions-table th,
#workflow-transitions-table td {
border: 1px solid #ddd;
padding: 8px;
width: 25%; /* Ensure all columns have the same width */
text-align: center; /* Center-align cell labels */
}

#workflow-transitions-table th {
background-color: #f4f4f4;
color: #333;
font-weight: bold;
text-align: center;
}

#workflow-transitions-table tr:nth-child(even) {
background-color: #f9f9f9;
}

#workflow-transitions-table tr:hover {
background-color: #f1f1f1;
}

#workflow-schedule-table {
width: 100%;
max-width: 800px;
border-collapse: collapse;
margin: 20px 0; /* Remove centering */
font-size: 16px;
text-align: left;
}

#workflow-schedule-table th,
#workflow-schedule-table td {
border: 1px solid #ddd;
padding: 8px;
text-align: center; /* Center-align cell labels */
}

#workflow-schedule-table td {
width: 15%; /* First four columns */
}

#workflow-schedule-table td:nth-child(5),
#workflow-schedule-table td:nth-child(6) {
width: 20%; /* Last two columns */
}

#workflow-schedule-table th {
background-color: #f4f4f4;
color: #333;
font-weight: bold;
text-align: center;
}

#workflow-schedule-table tr:nth-child(even) {
background-color: #f9f9f9;
}

#workflow-schedule-table tr:hover {
background-color: #f1f1f1;
}
42 changes: 42 additions & 0 deletions pgcommitfest/commitfest/apiv1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from django.http import (
HttpResponse,
)

import json
from datetime import datetime

from .models import (
Workflow,
)


def datetime_serializer(obj):
if isinstance(obj, datetime):
return obj.strftime("%Y-%m-%dT%H:%M:%S%z")
raise TypeError("Type not serializable")


def apiResponse(request, payload, status=200, content_type="application/json"):
response = HttpResponse(
json.dumps(payload, default=datetime_serializer), status=status
)
response["Content-Type"] = content_type
response["Access-Control-Allow-Origin"] = "*"
return response


def optional_as_json(obj):
if obj is None:
return None
return obj.json()


def active_commitfests(request):
payload = {
"workflow": {
"open": optional_as_json(Workflow.open_cf()),
"inprogress": optional_as_json(Workflow.inprogress_cf()),
"parked": optional_as_json(Workflow.parked_cf()),
},
}
return apiResponse(request, payload)
36 changes: 36 additions & 0 deletions pgcommitfest/commitfest/fixtures/auth_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,41 @@
"groups": [],
"user_permissions": []
}
},
{
"model": "auth.user",
"pk": 6,
"fields": {
"password": "",
"last_login": null,
"is_superuser": false,
"username": "prolific-author",
"first_name": "Prolific",
"last_name": "Author",
"email": "",
"is_staff": false,
"is_active": true,
"date_joined": "2025-01-01T00:00:00",
"groups": [],
"user_permissions": []
}
},
{
"model": "auth.user",
"pk": 7,
"fields": {
"password": "",
"last_login": null,
"is_superuser": false,
"username": "prolific-reviewer",
"first_name": "Prolific",
"last_name": "Reviewer",
"email": "",
"is_staff": false,
"is_active": true,
"date_joined": "2025-01-01T00:00:00",
"groups": [],
"user_permissions": []
}
}
]
67 changes: 67 additions & 0 deletions pgcommitfest/commitfest/fixtures/commitfest_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@
"enddate": "2025-05-31"
}
},
{
"model": "commitfest.commitfest",
"pk": 5,
"fields": {
"name": "Drafts PG19",
"status": 5,
"startdate": "2024-09-01",
"enddate": "2025-08-31"
}
},
{
"model": "commitfest.topic",
"pk": 1,
Expand Down Expand Up @@ -237,6 +247,25 @@
]
}
},
{
"model": "commitfest.patch",
"pk": 8,
"fields": {
"name": "Test DGJ Multi-Author and Reviewer",
"topic": 3,
"wikilink": "",
"gitlink": "",
"targetversion": 1,
"committer": 4,
"created": "2025-02-01T00:00",
"modified": "2025-02-01T00:00",
"lastmail": "2025-02-01T00:00",
"authors": [6,3],
"reviewers": [7,1],
"subscribers": [],
"mailthread_set": [8]
}
},
{
"model": "commitfest.patchoncommitfest",
"pk": 1,
Expand Down Expand Up @@ -325,6 +354,17 @@
"status": 1
}
},
{
"model": "commitfest.patchoncommitfest",
"pk": 9,
"fields": {
"patch": 8,
"commitfest": 5,
"enterdate": "2025-02-01T00:00:00",
"leavedate": null,
"status": 1
}
},
{
"model": "commitfest.patchhistory",
"pk": 1,
Expand Down Expand Up @@ -632,6 +672,33 @@
"latestmsgid": "example@message-31"
}
},
{
"model": "commitfest.mailthread",
"pk": 8,
"fields": {
"messageid": "dgj-example@message-08",
"subject": "Test DGJ Multi-Author and Reviewer",
"firstmessage": "2025-02-01T00:00",
"firstauthor": "[email protected]",
"latestmessage": "2025-02-01T00:00",
"latestauthor": "[email protected]",
"latestsubject": "Test DGJ Multi-Author and Reviewer",
"latestmsgid": "dgj-example@message-08"
}
},
{
"model": "commitfest.mailthreadattachment",
"pk": 8,
"fields": {
"messageid": "dgj-example@message-08",
"attachmentid": 1,
"filename": "v1-0001-content.patch",
"date": "2025-02-01T00:00",
"author": "[email protected]",
"ispatch": true,
"mailthread_id": 8
}
},
{
"model": "commitfest.patchstatus",
"pk": 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("commitfest", "0010_add_failing_since_column"),
]
operations = [
migrations.RunSQL(
"""
CREATE UNIQUE INDEX cf_enforce_maxoneopen_idx
ON commitfest_commitfest (status)
WHERE status not in (1,4);
""",
reverse_sql="""
DROP INDEX IF EXISTS cf_enforce_maxoneopen_idx;
""",
),
migrations.RunSQL(
"""
CREATE UNIQUE INDEX poc_enforce_maxoneoutcome_idx
ON commitfest_patchoncommitfest (patch_id)
WHERE status not in (5);
""",
reverse_sql="""
DROP INDEX IF EXISTS poc_enforce_maxoneoutcome_idx;
""",
),
migrations.RunSQL(
"""
ALTER TABLE commitfest_patchoncommitfest
ADD CONSTRAINT status_and_leavedate_correlation
CHECK ((status IN (4,5,6,7,8)) = (leavedate IS NOT NULL));
""",
reverse_sql="""
ALTER TABLE commitfest_patchoncommitfest
DROP CONSTRAINT IF EXISTS status_and_leavedate_correlation;
""",
),
migrations.RunSQL(
"""
COMMENT ON COLUMN commitfest_patchoncommitfest.leavedate IS
$$A leave date is recorded in two situations, both of which
means this particular patch-cf combination became inactive
on the corresponding date. For status 5 the patch was moved
to some other cf. For 4,6,7, and 8, this was the final cf.
$$
""",
reverse_sql="""
COMMENT ON COLUMN commitfest_patchoncommitfest.leavedate IS NULL;
""",
),
migrations.RunSQL(
"""
COMMENT ON TABLE commitfest_patchoncommitfest IS
$$This is a re-entrant table: patches may become associated
with a given cf multiple times, resetting the entrydate and clearing
the leavedate each time. Non-final statuses never have a leavedate
while final statuses always do. The final status of 5 (moved) is
special in that all but one of the rows a patch has in this table
must have it as the status.
$$
""",
reverse_sql="""
COMMENT ON TABLE commitfest_patchoncommitfest IS NULL;
""",
),
]
23 changes: 23 additions & 0 deletions pgcommitfest/commitfest/migrations/0012_add_parked_cf_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("commitfest", "0011_add_status_related_constraints"),
]
operations = [
migrations.AlterField(
model_name="commitfest",
name="status",
field=models.IntegerField(
choices=[
(1, "Future"),
(2, "Open"),
(3, "In Progress"),
(4, "Closed"),
(5, "Parked"),
],
default=1,
),
)
]
Loading