Skip to content

Commit

Permalink
Merge pull request #170 from makeplane/preview
Browse files Browse the repository at this point in the history
release: v0.18.4
  • Loading branch information
sriramveeraghanta authored Apr 17, 2024
2 parents 6787377 + b33c47f commit a73ca1e
Show file tree
Hide file tree
Showing 358 changed files with 11,813 additions and 6,981 deletions.
11 changes: 9 additions & 2 deletions .github/ISSUE_TEMPLATE/--bug-report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,19 @@ body:
- Safari
- Other
- type: dropdown
id: version
id: variant
attributes:
label: Version
label: Variant
options:
- Cloud
- Self-hosted
- Local
validations:
required: true
- type: input
id: version
attributes:
label: Version
placeholder: v0.17.0-dev
validations:
required: true
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: "CodeQL"
on:
workflow_dispatch:
push:
branches: ["develop", "preview", "master"]
branches: ["preview", "master"]
pull_request:
branches: ["develop", "preview", "master"]
schedule:
Expand Down
2 changes: 1 addition & 1 deletion apiserver/plane/api/urls/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
name="transfer-issues",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/cycles/<uuid:pk>/archive/",
"workspaces/<str:slug>/projects/<uuid:project_id>/cycles/<uuid:cycle_id>/archive/",
CycleArchiveUnarchiveAPIEndpoint.as_view(),
name="cycle-archive-unarchive",
),
Expand Down
19 changes: 11 additions & 8 deletions apiserver/plane/api/views/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ def get(self, request, slug, project_id, pk=None):
data,
status=status.HTTP_200_OK,
)
queryset = (
self.get_queryset().filter(archived_at__isnull=True)
)
queryset = self.get_queryset().filter(archived_at__isnull=True)
cycle_view = request.GET.get("cycle_view", "all")

# Current Cycle
Expand Down Expand Up @@ -495,17 +493,22 @@ def get(self, request, slug, project_id):
).data,
)

def post(self, request, slug, project_id, pk):
def post(self, request, slug, project_id, cycle_id):
cycle = Cycle.objects.get(
pk=pk, project_id=project_id, workspace__slug=slug
pk=cycle_id, project_id=project_id, workspace__slug=slug
)
if cycle.end_date >= timezone.now().date():
return Response(
{"error": "Only completed cycles can be archived"},
status=status.HTTP_400_BAD_REQUEST,
)
cycle.archived_at = timezone.now()
cycle.save()
return Response(status=status.HTTP_204_NO_CONTENT)

def delete(self, request, slug, project_id, pk):
def delete(self, request, slug, project_id, cycle_id):
cycle = Cycle.objects.get(
pk=pk, project_id=project_id, workspace__slug=slug
pk=cycle_id, project_id=project_id, workspace__slug=slug
)
cycle.archived_at = None
cycle.save()
Expand Down Expand Up @@ -743,7 +746,7 @@ def delete(self, request, slug, project_id, cycle_id, issue_id):

class TransferCycleIssueAPIEndpoint(BaseAPIView):
"""
This viewset provides `create` actions for transfering the issues into a particular cycle.
This viewset provides `create` actions for transferring the issues into a particular cycle.
"""

Expand Down
9 changes: 8 additions & 1 deletion apiserver/plane/api/views/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def get_queryset(self):
.order_by(self.kwargs.get("order_by", "-created_at"))
)

def get(self, request, slug, project_id):
def get(self, request, slug, project_id, pk):
return self.paginate(
request=request,
queryset=(self.get_queryset()),
Expand All @@ -570,6 +570,13 @@ def post(self, request, slug, project_id, pk):
module = Module.objects.get(
pk=pk, project_id=project_id, workspace__slug=slug
)
if module.status not in ["completed", "cancelled"]:
return Response(
{
"error": "Only completed or cancelled modules can be archived"
},
status=status.HTTP_400_BAD_REQUEST,
)
module.archived_at = timezone.now()
module.save()
return Response(status=status.HTTP_204_NO_CONTENT)
Expand Down
1 change: 1 addition & 0 deletions apiserver/plane/app/serializers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
PageSerializer,
PageLogSerializer,
SubPageSerializer,
PageDetailSerializer,
PageFavoriteSerializer,
)

Expand Down
43 changes: 31 additions & 12 deletions apiserver/plane/app/serializers/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

# Module imports
from .base import BaseSerializer
from .issue import LabelLiteSerializer
from .workspace import WorkspaceLiteSerializer
from .project import ProjectLiteSerializer
from plane.db.models import (
Page,
PageLog,
Expand All @@ -17,22 +14,33 @@

class PageSerializer(BaseSerializer):
is_favorite = serializers.BooleanField(read_only=True)
label_details = LabelLiteSerializer(
read_only=True, source="labels", many=True
)
labels = serializers.ListField(
child=serializers.PrimaryKeyRelatedField(queryset=Label.objects.all()),
write_only=True,
required=False,
)
project_detail = ProjectLiteSerializer(source="project", read_only=True)
workspace_detail = WorkspaceLiteSerializer(
source="workspace", read_only=True
)

class Meta:
model = Page
fields = "__all__"
fields = [
"id",
"name",
"owned_by",
"access",
"color",
"labels",
"parent",
"is_favorite",
"is_locked",
"archived_at",
"workspace",
"project",
"created_at",
"updated_at",
"created_by",
"updated_by",
"view_props",
]
read_only_fields = [
"workspace",
"project",
Expand All @@ -48,8 +56,12 @@ def create(self, validated_data):
labels = validated_data.pop("labels", None)
project_id = self.context["project_id"]
owned_by_id = self.context["owned_by_id"]
description_html = self.context["description_html"]
page = Page.objects.create(
**validated_data, project_id=project_id, owned_by_id=owned_by_id
**validated_data,
description_html=description_html,
project_id=project_id,
owned_by_id=owned_by_id,
)

if labels is not None:
Expand Down Expand Up @@ -91,6 +103,13 @@ def update(self, instance, validated_data):
return super().update(instance, validated_data)


class PageDetailSerializer(PageSerializer):
description_html = serializers.CharField()

class Meta(PageSerializer.Meta):
fields = PageSerializer.Meta.fields + ["description_html"]


class SubPageSerializer(BaseSerializer):
entity_details = serializers.SerializerMethodField()

Expand Down
5 changes: 5 additions & 0 deletions apiserver/plane/app/urls/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,9 @@
CycleArchiveUnarchiveEndpoint.as_view(),
name="cycle-archive-unarchive",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/archived-cycles/<uuid:pk>/",
CycleArchiveUnarchiveEndpoint.as_view(),
name="cycle-archive-unarchive",
),
]
5 changes: 5 additions & 0 deletions apiserver/plane/app/urls/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,9 @@
ModuleArchiveUnarchiveEndpoint.as_view(),
name="module-archive-unarchive",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/archived-modules/<uuid:pk>/",
ModuleArchiveUnarchiveEndpoint.as_view(),
name="module-archive-unarchive",
),
]
77 changes: 13 additions & 64 deletions apiserver/plane/app/urls/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,102 +31,51 @@
),
name="project-pages",
),
# favorite pages
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/user-favorite-pages/",
"workspaces/<str:slug>/projects/<uuid:project_id>/favorite-pages/<uuid:pk>/",
PageFavoriteViewSet.as_view(
{
"get": "list",
"post": "create",
}
),
name="user-favorite-pages",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/user-favorite-pages/<uuid:page_id>/",
PageFavoriteViewSet.as_view(
{
"delete": "destroy",
}
),
name="user-favorite-pages",
),
# archived pages
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/pages/",
PageViewSet.as_view(
{
"get": "list",
"post": "create",
}
),
name="project-pages",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/pages/<uuid:pk>/",
PageViewSet.as_view(
{
"get": "retrieve",
"patch": "partial_update",
"delete": "destroy",
}
),
name="project-pages",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/pages/<uuid:page_id>/archive/",
"workspaces/<str:slug>/projects/<uuid:project_id>/pages/<uuid:pk>/archive/",
PageViewSet.as_view(
{
"post": "archive",
"delete": "unarchive",
}
),
name="project-page-archive",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/pages/<uuid:page_id>/unarchive/",
PageViewSet.as_view(
{
"post": "unarchive",
}
),
name="project-page-unarchive",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/archived-pages/",
PageViewSet.as_view(
{
"get": "archive_list",
}
),
name="project-pages",
name="project-page-archive-unarchive",
),
# lock and unlock
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/pages/<uuid:page_id>/lock/",
"workspaces/<str:slug>/projects/<uuid:project_id>/pages/<uuid:pk>/lock/",
PageViewSet.as_view(
{
"post": "lock",
"delete": "unlock",
}
),
name="project-pages",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/pages/<uuid:page_id>/unlock/",
PageViewSet.as_view(
{
"post": "unlock",
}
),
name="project-pages-lock-unlock",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/pages/<uuid:page_id>/transactions/",
"workspaces/<str:slug>/projects/<uuid:project_id>/pages/<uuid:pk>/transactions/",
PageLogEndpoint.as_view(),
name="page-transactions",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/pages/<uuid:page_id>/transactions/<uuid:transaction>/",
"workspaces/<str:slug>/projects/<uuid:project_id>/pages/<uuid:pk>/transactions/<uuid:transaction>/",
PageLogEndpoint.as_view(),
name="page-transactions",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/pages/<uuid:page_id>/sub-pages/",
"workspaces/<str:slug>/projects/<uuid:project_id>/pages/<uuid:pk>/sub-pages/",
SubPagesEndpoint.as_view(),
name="sub-page",
),
Expand Down
Loading

0 comments on commit a73ca1e

Please sign in to comment.