Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e303679714 |
@@ -41,7 +41,6 @@ USER captain
|
|||||||
|
|
||||||
# Add in Django deps and generate Django's static files
|
# Add in Django deps and generate Django's static files
|
||||||
COPY manage.py manage.py
|
COPY manage.py manage.py
|
||||||
COPY server.py server.py
|
|
||||||
COPY plane plane/
|
COPY plane plane/
|
||||||
COPY templates templates/
|
COPY templates templates/
|
||||||
COPY package.json package.json
|
COPY package.json package.json
|
||||||
|
|||||||
@@ -28,4 +28,4 @@ python manage.py configure_instance
|
|||||||
# Create the default bucket
|
# Create the default bucket
|
||||||
python manage.py create_bucket
|
python manage.py create_bucket
|
||||||
|
|
||||||
python server.py
|
exec gunicorn -w $GUNICORN_WORKERS -k uvicorn.workers.UvicornWorker plane.asgi:application --bind 0.0.0.0:${PORT:-8000} --max-requests 1200 --max-requests-jitter 1000 --access-logfile -
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ class CycleAPIEndpoint(WebhookMixin, BaseAPIView):
|
|||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": "Cycle with the same external id and external source already exists",
|
"error": "Cycle with the same external id and external source already exists",
|
||||||
"id": str(cycle.id),
|
"cycle": str(cycle.id),
|
||||||
},
|
},
|
||||||
status=status.HTTP_409_CONFLICT,
|
status=status.HTTP_409_CONFLICT,
|
||||||
)
|
)
|
||||||
@@ -325,7 +325,7 @@ class CycleAPIEndpoint(WebhookMixin, BaseAPIView):
|
|||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": "Cycle with the same external id and external source already exists",
|
"error": "Cycle with the same external id and external source already exists",
|
||||||
"id": str(cycle.id),
|
"cycle_id": str(cycle.id),
|
||||||
},
|
},
|
||||||
status=status.HTTP_409_CONFLICT,
|
status=status.HTTP_409_CONFLICT,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ class IssueAPIEndpoint(WebhookMixin, BaseAPIView):
|
|||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": "Issue with the same external id and external source already exists",
|
"error": "Issue with the same external id and external source already exists",
|
||||||
"id": str(issue.id),
|
"issue_id": str(issue.id),
|
||||||
},
|
},
|
||||||
status=status.HTTP_409_CONFLICT,
|
status=status.HTTP_409_CONFLICT,
|
||||||
)
|
)
|
||||||
@@ -286,16 +286,14 @@ class IssueAPIEndpoint(WebhookMixin, BaseAPIView):
|
|||||||
and Issue.objects.filter(
|
and Issue.objects.filter(
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
workspace__slug=slug,
|
workspace__slug=slug,
|
||||||
external_source=request.data.get(
|
external_source=request.data.get("external_source", issue.external_source),
|
||||||
"external_source", issue.external_source
|
|
||||||
),
|
|
||||||
external_id=request.data.get("external_id"),
|
external_id=request.data.get("external_id"),
|
||||||
).exists()
|
).exists()
|
||||||
):
|
):
|
||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": "Issue with the same external id and external source already exists",
|
"error": "Issue with the same external id and external source already exists",
|
||||||
"id": str(issue.id),
|
"issue_id": str(issue.id),
|
||||||
},
|
},
|
||||||
status=status.HTTP_409_CONFLICT,
|
status=status.HTTP_409_CONFLICT,
|
||||||
)
|
)
|
||||||
@@ -364,30 +362,6 @@ class LabelAPIEndpoint(BaseAPIView):
|
|||||||
try:
|
try:
|
||||||
serializer = LabelSerializer(data=request.data)
|
serializer = LabelSerializer(data=request.data)
|
||||||
if serializer.is_valid():
|
if serializer.is_valid():
|
||||||
if (
|
|
||||||
request.data.get("external_id")
|
|
||||||
and request.data.get("external_source")
|
|
||||||
and Label.objects.filter(
|
|
||||||
project_id=project_id,
|
|
||||||
workspace__slug=slug,
|
|
||||||
external_source=request.data.get("external_source"),
|
|
||||||
external_id=request.data.get("external_id"),
|
|
||||||
).exists()
|
|
||||||
):
|
|
||||||
label = Label.objects.filter(
|
|
||||||
workspace__slug=slug,
|
|
||||||
project_id=project_id,
|
|
||||||
external_id=request.data.get("external_id"),
|
|
||||||
external_source=request.data.get("external_source"),
|
|
||||||
).first()
|
|
||||||
return Response(
|
|
||||||
{
|
|
||||||
"error": "Label with the same external id and external source already exists",
|
|
||||||
"id": str(label.id),
|
|
||||||
},
|
|
||||||
status=status.HTTP_409_CONFLICT,
|
|
||||||
)
|
|
||||||
|
|
||||||
serializer.save(project_id=project_id)
|
serializer.save(project_id=project_id)
|
||||||
return Response(
|
return Response(
|
||||||
serializer.data, status=status.HTTP_201_CREATED
|
serializer.data, status=status.HTTP_201_CREATED
|
||||||
@@ -396,17 +370,11 @@ class LabelAPIEndpoint(BaseAPIView):
|
|||||||
serializer.errors, status=status.HTTP_400_BAD_REQUEST
|
serializer.errors, status=status.HTTP_400_BAD_REQUEST
|
||||||
)
|
)
|
||||||
except IntegrityError:
|
except IntegrityError:
|
||||||
label = Label.objects.filter(
|
|
||||||
workspace__slug=slug,
|
|
||||||
project_id=project_id,
|
|
||||||
name=request.data.get("name"),
|
|
||||||
).first()
|
|
||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": "Label with the same name already exists in the project",
|
"error": "Label with the same name already exists in the project"
|
||||||
"id": str(label.id),
|
|
||||||
},
|
},
|
||||||
status=status.HTTP_409_CONFLICT,
|
status=status.HTTP_400_BAD_REQUEST,
|
||||||
)
|
)
|
||||||
|
|
||||||
def get(self, request, slug, project_id, pk=None):
|
def get(self, request, slug, project_id, pk=None):
|
||||||
@@ -433,25 +401,6 @@ class LabelAPIEndpoint(BaseAPIView):
|
|||||||
label = self.get_queryset().get(pk=pk)
|
label = self.get_queryset().get(pk=pk)
|
||||||
serializer = LabelSerializer(label, data=request.data, partial=True)
|
serializer = LabelSerializer(label, data=request.data, partial=True)
|
||||||
if serializer.is_valid():
|
if serializer.is_valid():
|
||||||
if (
|
|
||||||
str(request.data.get("external_id"))
|
|
||||||
and (label.external_id != str(request.data.get("external_id")))
|
|
||||||
and Issue.objects.filter(
|
|
||||||
project_id=project_id,
|
|
||||||
workspace__slug=slug,
|
|
||||||
external_source=request.data.get(
|
|
||||||
"external_source", label.external_source
|
|
||||||
),
|
|
||||||
external_id=request.data.get("external_id"),
|
|
||||||
).exists()
|
|
||||||
):
|
|
||||||
return Response(
|
|
||||||
{
|
|
||||||
"error": "Label with the same external id and external source already exists",
|
|
||||||
"id": str(label.id),
|
|
||||||
},
|
|
||||||
status=status.HTTP_409_CONFLICT,
|
|
||||||
)
|
|
||||||
serializer.save()
|
serializer.save()
|
||||||
return Response(serializer.data, status=status.HTTP_200_OK)
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
||||||
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ class ModuleAPIEndpoint(WebhookMixin, BaseAPIView):
|
|||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": "Module with the same external id and external source already exists",
|
"error": "Module with the same external id and external source already exists",
|
||||||
"id": str(module.id),
|
"module_id": str(module.id),
|
||||||
},
|
},
|
||||||
status=status.HTTP_409_CONFLICT,
|
status=status.HTTP_409_CONFLICT,
|
||||||
)
|
)
|
||||||
@@ -185,7 +185,7 @@ class ModuleAPIEndpoint(WebhookMixin, BaseAPIView):
|
|||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": "Module with the same external id and external source already exists",
|
"error": "Module with the same external id and external source already exists",
|
||||||
"id": str(module.id),
|
"module_id": str(module.id),
|
||||||
},
|
},
|
||||||
status=status.HTTP_409_CONFLICT,
|
status=status.HTTP_409_CONFLICT,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class StateAPIEndpoint(BaseAPIView):
|
|||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": "State with the same external id and external source already exists",
|
"error": "State with the same external id and external source already exists",
|
||||||
"id": str(state.id),
|
"state_id": str(state.id),
|
||||||
},
|
},
|
||||||
status=status.HTTP_409_CONFLICT,
|
status=status.HTTP_409_CONFLICT,
|
||||||
)
|
)
|
||||||
@@ -128,7 +128,7 @@ class StateAPIEndpoint(BaseAPIView):
|
|||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": "State with the same external id and external source already exists",
|
"error": "State with the same external id and external source already exists",
|
||||||
"id": str(state.id),
|
"state_id": str(state.id),
|
||||||
},
|
},
|
||||||
status=status.HTTP_409_CONFLICT,
|
status=status.HTTP_409_CONFLICT,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -242,13 +242,13 @@ class CycleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
.values("display_name", "assignee_id", "avatar")
|
.values("display_name", "assignee_id", "avatar")
|
||||||
.annotate(
|
.annotate(
|
||||||
total_issues=Count(
|
total_issues=Count(
|
||||||
"id",
|
"assignee_id",
|
||||||
filter=Q(archived_at__isnull=True, is_draft=False),
|
filter=Q(archived_at__isnull=True, is_draft=False),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
completed_issues=Count(
|
completed_issues=Count(
|
||||||
"id",
|
"assignee_id",
|
||||||
filter=Q(
|
filter=Q(
|
||||||
completed_at__isnull=False,
|
completed_at__isnull=False,
|
||||||
archived_at__isnull=True,
|
archived_at__isnull=True,
|
||||||
@@ -258,7 +258,7 @@ class CycleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
)
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
pending_issues=Count(
|
pending_issues=Count(
|
||||||
"id",
|
"assignee_id",
|
||||||
filter=Q(
|
filter=Q(
|
||||||
completed_at__isnull=True,
|
completed_at__isnull=True,
|
||||||
archived_at__isnull=True,
|
archived_at__isnull=True,
|
||||||
@@ -281,13 +281,13 @@ class CycleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
.values("label_name", "color", "label_id")
|
.values("label_name", "color", "label_id")
|
||||||
.annotate(
|
.annotate(
|
||||||
total_issues=Count(
|
total_issues=Count(
|
||||||
"id",
|
"label_id",
|
||||||
filter=Q(archived_at__isnull=True, is_draft=False),
|
filter=Q(archived_at__isnull=True, is_draft=False),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
completed_issues=Count(
|
completed_issues=Count(
|
||||||
"id",
|
"label_id",
|
||||||
filter=Q(
|
filter=Q(
|
||||||
completed_at__isnull=False,
|
completed_at__isnull=False,
|
||||||
archived_at__isnull=True,
|
archived_at__isnull=True,
|
||||||
@@ -297,7 +297,7 @@ class CycleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
)
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
pending_issues=Count(
|
pending_issues=Count(
|
||||||
"id",
|
"label_id",
|
||||||
filter=Q(
|
filter=Q(
|
||||||
completed_at__isnull=True,
|
completed_at__isnull=True,
|
||||||
archived_at__isnull=True,
|
archived_at__isnull=True,
|
||||||
@@ -419,13 +419,13 @@ class CycleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
)
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
total_issues=Count(
|
total_issues=Count(
|
||||||
"id",
|
"assignee_id",
|
||||||
filter=Q(archived_at__isnull=True, is_draft=False),
|
filter=Q(archived_at__isnull=True, is_draft=False),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
completed_issues=Count(
|
completed_issues=Count(
|
||||||
"id",
|
"assignee_id",
|
||||||
filter=Q(
|
filter=Q(
|
||||||
completed_at__isnull=False,
|
completed_at__isnull=False,
|
||||||
archived_at__isnull=True,
|
archived_at__isnull=True,
|
||||||
@@ -435,7 +435,7 @@ class CycleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
)
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
pending_issues=Count(
|
pending_issues=Count(
|
||||||
"id",
|
"assignee_id",
|
||||||
filter=Q(
|
filter=Q(
|
||||||
completed_at__isnull=True,
|
completed_at__isnull=True,
|
||||||
archived_at__isnull=True,
|
archived_at__isnull=True,
|
||||||
@@ -459,13 +459,13 @@ class CycleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
.values("label_name", "color", "label_id")
|
.values("label_name", "color", "label_id")
|
||||||
.annotate(
|
.annotate(
|
||||||
total_issues=Count(
|
total_issues=Count(
|
||||||
"id",
|
"label_id",
|
||||||
filter=Q(archived_at__isnull=True, is_draft=False),
|
filter=Q(archived_at__isnull=True, is_draft=False),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
completed_issues=Count(
|
completed_issues=Count(
|
||||||
"id",
|
"label_id",
|
||||||
filter=Q(
|
filter=Q(
|
||||||
completed_at__isnull=False,
|
completed_at__isnull=False,
|
||||||
archived_at__isnull=True,
|
archived_at__isnull=True,
|
||||||
@@ -475,7 +475,7 @@ class CycleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
)
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
pending_issues=Count(
|
pending_issues=Count(
|
||||||
"id",
|
"label_id",
|
||||||
filter=Q(
|
filter=Q(
|
||||||
completed_at__isnull=True,
|
completed_at__isnull=True,
|
||||||
archived_at__isnull=True,
|
archived_at__isnull=True,
|
||||||
|
|||||||
@@ -145,23 +145,6 @@ def dashboard_assigned_issues(self, request, slug):
|
|||||||
)
|
)
|
||||||
).order_by("priority_order")
|
).order_by("priority_order")
|
||||||
|
|
||||||
if issue_type == "pending":
|
|
||||||
pending_issues_count = assigned_issues.filter(
|
|
||||||
state__group__in=["backlog", "started", "unstarted"]
|
|
||||||
).count()
|
|
||||||
pending_issues = assigned_issues.filter(
|
|
||||||
state__group__in=["backlog", "started", "unstarted"]
|
|
||||||
)[:5]
|
|
||||||
return Response(
|
|
||||||
{
|
|
||||||
"issues": IssueSerializer(
|
|
||||||
pending_issues, many=True, expand=self.expand
|
|
||||||
).data,
|
|
||||||
"count": pending_issues_count,
|
|
||||||
},
|
|
||||||
status=status.HTTP_200_OK,
|
|
||||||
)
|
|
||||||
|
|
||||||
if issue_type == "completed":
|
if issue_type == "completed":
|
||||||
completed_issues_count = assigned_issues.filter(
|
completed_issues_count = assigned_issues.filter(
|
||||||
state__group__in=["completed"]
|
state__group__in=["completed"]
|
||||||
@@ -274,23 +257,6 @@ def dashboard_created_issues(self, request, slug):
|
|||||||
)
|
)
|
||||||
).order_by("priority_order")
|
).order_by("priority_order")
|
||||||
|
|
||||||
if issue_type == "pending":
|
|
||||||
pending_issues_count = created_issues.filter(
|
|
||||||
state__group__in=["backlog", "started", "unstarted"]
|
|
||||||
).count()
|
|
||||||
pending_issues = created_issues.filter(
|
|
||||||
state__group__in=["backlog", "started", "unstarted"]
|
|
||||||
)[:5]
|
|
||||||
return Response(
|
|
||||||
{
|
|
||||||
"issues": IssueSerializer(
|
|
||||||
pending_issues, many=True, expand=self.expand
|
|
||||||
).data,
|
|
||||||
"count": pending_issues_count,
|
|
||||||
},
|
|
||||||
status=status.HTTP_200_OK,
|
|
||||||
)
|
|
||||||
|
|
||||||
if issue_type == "completed":
|
if issue_type == "completed":
|
||||||
completed_issues_count = created_issues.filter(
|
completed_issues_count = created_issues.filter(
|
||||||
state__group__in=["completed"]
|
state__group__in=["completed"]
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ class ModuleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
)
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
total_issues=Count(
|
total_issues=Count(
|
||||||
"id",
|
"assignee_id",
|
||||||
filter=Q(
|
filter=Q(
|
||||||
archived_at__isnull=True,
|
archived_at__isnull=True,
|
||||||
is_draft=False,
|
is_draft=False,
|
||||||
@@ -206,7 +206,7 @@ class ModuleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
)
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
completed_issues=Count(
|
completed_issues=Count(
|
||||||
"id",
|
"assignee_id",
|
||||||
filter=Q(
|
filter=Q(
|
||||||
completed_at__isnull=False,
|
completed_at__isnull=False,
|
||||||
archived_at__isnull=True,
|
archived_at__isnull=True,
|
||||||
@@ -216,7 +216,7 @@ class ModuleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
)
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
pending_issues=Count(
|
pending_issues=Count(
|
||||||
"id",
|
"assignee_id",
|
||||||
filter=Q(
|
filter=Q(
|
||||||
completed_at__isnull=True,
|
completed_at__isnull=True,
|
||||||
archived_at__isnull=True,
|
archived_at__isnull=True,
|
||||||
@@ -239,7 +239,7 @@ class ModuleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
.values("label_name", "color", "label_id")
|
.values("label_name", "color", "label_id")
|
||||||
.annotate(
|
.annotate(
|
||||||
total_issues=Count(
|
total_issues=Count(
|
||||||
"id",
|
"label_id",
|
||||||
filter=Q(
|
filter=Q(
|
||||||
archived_at__isnull=True,
|
archived_at__isnull=True,
|
||||||
is_draft=False,
|
is_draft=False,
|
||||||
@@ -248,7 +248,7 @@ class ModuleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
)
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
completed_issues=Count(
|
completed_issues=Count(
|
||||||
"id",
|
"label_id",
|
||||||
filter=Q(
|
filter=Q(
|
||||||
completed_at__isnull=False,
|
completed_at__isnull=False,
|
||||||
archived_at__isnull=True,
|
archived_at__isnull=True,
|
||||||
@@ -258,7 +258,7 @@ class ModuleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
)
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
pending_issues=Count(
|
pending_issues=Count(
|
||||||
"id",
|
"label_id",
|
||||||
filter=Q(
|
filter=Q(
|
||||||
completed_at__isnull=True,
|
completed_at__isnull=True,
|
||||||
archived_at__isnull=True,
|
archived_at__isnull=True,
|
||||||
|
|||||||
@@ -353,18 +353,13 @@ def track_assignees(
|
|||||||
issue_activities,
|
issue_activities,
|
||||||
epoch,
|
epoch,
|
||||||
):
|
):
|
||||||
requested_assignees = (
|
requested_assignees = set(
|
||||||
set([str(asg) for asg in requested_data.get("assignee_ids", [])])
|
[str(asg) for asg in requested_data.get("assignee_ids", [])]
|
||||||
if requested_data is not None
|
|
||||||
else set()
|
|
||||||
)
|
)
|
||||||
current_assignees = (
|
current_assignees = set(
|
||||||
set([str(asg) for asg in current_instance.get("assignee_ids", [])])
|
[str(asg) for asg in current_instance.get("assignee_ids", [])]
|
||||||
if current_instance is not None
|
|
||||||
else set()
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
added_assignees = requested_assignees - current_assignees
|
added_assignees = requested_assignees - current_assignees
|
||||||
dropped_assginees = current_assignees - requested_assignees
|
dropped_assginees = current_assignees - requested_assignees
|
||||||
|
|
||||||
@@ -552,20 +547,6 @@ def create_issue_activity(
|
|||||||
epoch=epoch,
|
epoch=epoch,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
requested_data = (
|
|
||||||
json.loads(requested_data) if requested_data is not None else None
|
|
||||||
)
|
|
||||||
if requested_data.get("assignee_ids") is not None:
|
|
||||||
track_assignees(
|
|
||||||
requested_data,
|
|
||||||
current_instance,
|
|
||||||
issue_id,
|
|
||||||
project_id,
|
|
||||||
workspace_id,
|
|
||||||
actor_id,
|
|
||||||
issue_activities,
|
|
||||||
epoch,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def update_issue_activity(
|
def update_issue_activity(
|
||||||
|
|||||||
@@ -172,9 +172,4 @@ def create_user_notification(sender, instance, created, **kwargs):
|
|||||||
from plane.db.models import UserNotificationPreference
|
from plane.db.models import UserNotificationPreference
|
||||||
UserNotificationPreference.objects.create(
|
UserNotificationPreference.objects.create(
|
||||||
user=instance,
|
user=instance,
|
||||||
property_change=False,
|
|
||||||
state_change=False,
|
|
||||||
comment=False,
|
|
||||||
mention=False,
|
|
||||||
issue_completed=False,
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
import os
|
|
||||||
import uvicorn
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
os.environ.setdefault(
|
|
||||||
"DJANGO_SETTINGS_MODULE", "plane.settings.production"
|
|
||||||
)
|
|
||||||
uvicorn.run(
|
|
||||||
"plane.asgi:application",
|
|
||||||
host=os.environ.get("HOST", "0.0.0.0"),
|
|
||||||
port=os.environ.get("PORT", 8000),
|
|
||||||
ws="auto",
|
|
||||||
workers=int(os.environ.get("GUNICORN_WORKERS", 1)),
|
|
||||||
log_level=os.environ.get("LOG_LEVEL", "info"),
|
|
||||||
lifespan="off",
|
|
||||||
access_log="on",
|
|
||||||
)
|
|
||||||
@@ -49,7 +49,7 @@ function buildLocalImage() {
|
|||||||
cd $PLANE_TEMP_CODE_DIR
|
cd $PLANE_TEMP_CODE_DIR
|
||||||
if [ "$BRANCH" == "master" ];
|
if [ "$BRANCH" == "master" ];
|
||||||
then
|
then
|
||||||
export APP_RELEASE=latest
|
APP_RELEASE=latest
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker compose -f build.yml build --no-cache >&2
|
docker compose -f build.yml build --no-cache >&2
|
||||||
@@ -205,11 +205,6 @@ else
|
|||||||
PULL_POLICY=never
|
PULL_POLICY=never
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$BRANCH" == "master" ];
|
|
||||||
then
|
|
||||||
export APP_RELEASE=latest
|
|
||||||
fi
|
|
||||||
|
|
||||||
# REMOVE SPECIAL CHARACTERS FROM BRANCH NAME
|
# REMOVE SPECIAL CHARACTERS FROM BRANCH NAME
|
||||||
if [ "$BRANCH" != "master" ];
|
if [ "$BRANCH" != "master" ];
|
||||||
then
|
then
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { APIService } from "../api.service";
|
||||||
|
// types
|
||||||
|
import { GptApiResponse } from "@plane/types";
|
||||||
|
|
||||||
|
export class AIService extends APIService {
|
||||||
|
constructor(BASE_URL: string) {
|
||||||
|
super(BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async createGptTask(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
data: { prompt: string; task: string }
|
||||||
|
): Promise<GptApiResponse> {
|
||||||
|
return this.post(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/ai-assistant/`,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// types
|
||||||
|
import {
|
||||||
|
IAnalyticsParams,
|
||||||
|
IAnalyticsResponse,
|
||||||
|
IDefaultAnalyticsResponse,
|
||||||
|
IExportAnalyticsFormData,
|
||||||
|
ISaveAnalyticsFormData,
|
||||||
|
} from "@plane/types";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
|
||||||
|
export class AnalyticsService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getAnalytics(workspaceSlug: string, params: IAnalyticsParams): Promise<IAnalyticsResponse> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/analytics/`, {
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
project: params?.project ? params.project.toString() : null,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getDefaultAnalytics(
|
||||||
|
workspaceSlug: string,
|
||||||
|
params?: Partial<IAnalyticsParams>
|
||||||
|
): Promise<IDefaultAnalyticsResponse> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/default-analytics/`, {
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
project: params?.project ? params.project.toString() : null,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async saveAnalytics(workspaceSlug: string, data: ISaveAnalyticsFormData): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/analytic-view/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async exportAnalytics(workspaceSlug: string, data: IExportAnalyticsFormData): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/export-analytics/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
import Cookies from "js-cookie";
|
||||||
|
|
||||||
|
export abstract class APIService {
|
||||||
|
protected baseURL: string;
|
||||||
|
protected headers: any = {};
|
||||||
|
|
||||||
|
constructor(baseURL: string) {
|
||||||
|
this.baseURL = baseURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
setRefreshToken(token: string) {
|
||||||
|
Cookies.set("refreshToken", token, { expires: 30 });
|
||||||
|
}
|
||||||
|
|
||||||
|
getRefreshToken() {
|
||||||
|
return Cookies.get("refreshToken");
|
||||||
|
}
|
||||||
|
|
||||||
|
purgeRefreshToken() {
|
||||||
|
Cookies.remove("refreshToken", { path: "/" });
|
||||||
|
}
|
||||||
|
|
||||||
|
setAccessToken(token: string) {
|
||||||
|
Cookies.set("accessToken", token, { expires: 30 });
|
||||||
|
}
|
||||||
|
|
||||||
|
getAccessToken() {
|
||||||
|
return Cookies.get("accessToken");
|
||||||
|
}
|
||||||
|
|
||||||
|
purgeAccessToken() {
|
||||||
|
Cookies.remove("accessToken", { path: "/" });
|
||||||
|
}
|
||||||
|
|
||||||
|
getHeaders() {
|
||||||
|
return {
|
||||||
|
Authorization: `Bearer ${this.getAccessToken()}`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
get(url: string, config = {}): Promise<any> {
|
||||||
|
return axios({
|
||||||
|
method: "get",
|
||||||
|
url: this.baseURL + url,
|
||||||
|
headers: this.getAccessToken() ? this.getHeaders() : {},
|
||||||
|
...config,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
post(url: string, data = {}, config = {}): Promise<any> {
|
||||||
|
return axios({
|
||||||
|
method: "post",
|
||||||
|
url: this.baseURL + url,
|
||||||
|
data,
|
||||||
|
headers: this.getAccessToken() ? this.getHeaders() : {},
|
||||||
|
...config,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
put(url: string, data = {}, config = {}): Promise<any> {
|
||||||
|
return axios({
|
||||||
|
method: "put",
|
||||||
|
url: this.baseURL + url,
|
||||||
|
data,
|
||||||
|
headers: this.getAccessToken() ? this.getHeaders() : {},
|
||||||
|
...config,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
patch(url: string, data = {}, config = {}): Promise<any> {
|
||||||
|
return axios({
|
||||||
|
method: "patch",
|
||||||
|
url: this.baseURL + url,
|
||||||
|
data,
|
||||||
|
headers: this.getAccessToken() ? this.getHeaders() : {},
|
||||||
|
...config,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
delete(url: string, data?: any, config = {}): Promise<any> {
|
||||||
|
return axios({
|
||||||
|
method: "delete",
|
||||||
|
url: this.baseURL + url,
|
||||||
|
data: data,
|
||||||
|
headers: this.getAccessToken() ? this.getHeaders() : {},
|
||||||
|
...config,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
request(config = {}) {
|
||||||
|
return axios(config);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { AIService } from "./ai/ai.service";
|
||||||
|
import { WorkspaceService } from "./workspace/workspace.service";
|
||||||
|
|
||||||
|
export class Client {
|
||||||
|
ai;
|
||||||
|
workspace;
|
||||||
|
|
||||||
|
constructor(BASE_URL: string | undefined) {
|
||||||
|
this.user = new UserService(BASE_URL || "");
|
||||||
|
this.instance = new InstanceService(BASE_URL || "");
|
||||||
|
|
||||||
|
this.ai = new AIService(BASE_URL || "");
|
||||||
|
this.workspace = new WorkspaceService(BASE_URL || "");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// types
|
||||||
|
import type { CycleDateCheckData, ICycle, TIssue, TIssueMap } from "@plane/types";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
|
||||||
|
export class CycleService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async createCycle(workspaceSlug: string, projectId: string, data: any): Promise<ICycle> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getCyclesWithParams(workspaceSlug: string, projectId: string, cycleType?: "current"): Promise<ICycle[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/`, {
|
||||||
|
params: {
|
||||||
|
cycle_view: cycleType,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getCycleDetails(workspaceSlug: string, projectId: string, cycleId: string): Promise<ICycle> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/`)
|
||||||
|
.then((res) => res?.data)
|
||||||
|
.catch((err) => {
|
||||||
|
throw err?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getCycleIssues(workspaceSlug: string, projectId: string, cycleId: string): Promise<TIssue[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/cycle-issues/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getCycleIssuesWithParams(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
cycleId: string,
|
||||||
|
queries?: any
|
||||||
|
): Promise<TIssue[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/cycle-issues/`, {
|
||||||
|
params: queries,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async patchCycle(workspaceSlug: string, projectId: string, cycleId: string, data: Partial<ICycle>): Promise<any> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteCycle(workspaceSlug: string, projectId: string, cycleId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async cycleDateCheck(workspaceSlug: string, projectId: string, data: CycleDateCheckData): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/date-check/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async addCycleToFavorites(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
data: {
|
||||||
|
cycle: string;
|
||||||
|
}
|
||||||
|
): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/user-favorite-cycles/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async transferIssues(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
cycleId: string,
|
||||||
|
data: {
|
||||||
|
new_cycle_id: string;
|
||||||
|
}
|
||||||
|
): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/transfer-issues/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async removeCycleFromFavorites(workspaceSlug: string, projectId: string, cycleId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/user-favorite-cycles/${cycleId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// types
|
||||||
|
import type { TInboxIssueFilterOptions, TInboxIssueExtendedDetail, TIssue, TInboxDetailedStatus } from "@plane/types";
|
||||||
|
|
||||||
|
export class InboxIssueService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchInboxIssues(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
inboxId: string,
|
||||||
|
params?: TInboxIssueFilterOptions | {}
|
||||||
|
): Promise<TInboxIssueExtendedDetail[]> {
|
||||||
|
return this.get(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/inbox-issues/?expand=issue_inbox`,
|
||||||
|
{
|
||||||
|
params,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchInboxIssueById(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
inboxId: string,
|
||||||
|
inboxIssueId: string
|
||||||
|
): Promise<TInboxIssueExtendedDetail> {
|
||||||
|
return this.get(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/inbox-issues/${inboxIssueId}/?expand=issue_inbox`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createInboxIssue(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
inboxId: string,
|
||||||
|
data: {
|
||||||
|
source: string;
|
||||||
|
issue: Partial<TIssue>;
|
||||||
|
}
|
||||||
|
): Promise<TInboxIssueExtendedDetail> {
|
||||||
|
return this.post(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/inbox-issues/?expand=issue_inbox`,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateInboxIssue(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
inboxId: string,
|
||||||
|
inboxIssueId: string,
|
||||||
|
data: { issue: Partial<TIssue> }
|
||||||
|
): Promise<TInboxIssueExtendedDetail> {
|
||||||
|
return this.patch(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/inbox-issues/${inboxIssueId}/?expand=issue_inbox`,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async removeInboxIssue(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
inboxId: string,
|
||||||
|
inboxIssueId: string
|
||||||
|
): Promise<void> {
|
||||||
|
return this.delete(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/inbox-issues/${inboxIssueId}/`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateInboxIssueStatus(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
inboxId: string,
|
||||||
|
inboxIssueId: string,
|
||||||
|
data: TInboxDetailedStatus
|
||||||
|
): Promise<TInboxIssueExtendedDetail> {
|
||||||
|
return this.patch(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/inbox-issues/${inboxIssueId}/?expand=issue_inbox`,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// types
|
||||||
|
import type { IInboxIssue, IInbox, TInboxStatus, IInboxQueryParams } from "@plane/types";
|
||||||
|
|
||||||
|
export class InboxService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getInboxes(workspaceSlug: string, projectId: string): Promise<IInbox[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getInboxById(workspaceSlug: string, projectId: string, inboxId: string): Promise<IInbox> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async patchInbox(workspaceSlug: string, projectId: string, inboxId: string, data: Partial<IInbox>): Promise<any> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getInboxIssues(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
inboxId: string,
|
||||||
|
params?: IInboxQueryParams
|
||||||
|
): Promise<IInboxIssue[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/inbox-issues/`, {
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getInboxIssueById(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
inboxId: string,
|
||||||
|
inboxIssueId: string
|
||||||
|
): Promise<IInboxIssue> {
|
||||||
|
return this.get(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/inbox-issues/${inboxIssueId}/`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteInboxIssue(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
inboxId: string,
|
||||||
|
inboxIssueId: string
|
||||||
|
): Promise<any> {
|
||||||
|
return this.delete(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/inbox-issues/${inboxIssueId}/`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async markInboxStatus(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
inboxId: string,
|
||||||
|
inboxIssueId: string,
|
||||||
|
data: TInboxStatus
|
||||||
|
): Promise<IInboxIssue> {
|
||||||
|
return this.patch(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/inbox-issues/${inboxIssueId}/`,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async patchInboxIssue(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
inboxId: string,
|
||||||
|
inboxIssueId: string,
|
||||||
|
data: { issue: Partial<IInboxIssue> }
|
||||||
|
): Promise<any> {
|
||||||
|
return this.patch(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/inbox-issues/${inboxIssueId}/`,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createInboxIssue(workspaceSlug: string, projectId: string, inboxId: string, data: any): Promise<IInboxIssue> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/inbox-issues/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// types
|
||||||
|
import type { TInbox } from "@plane/types";
|
||||||
|
|
||||||
|
export class InboxService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchInboxes(workspaceSlug: string, projectId: string): Promise<TInbox[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchInboxById(workspaceSlug: string, projectId: string, inboxId: string): Promise<TInbox> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateInbox(workspaceSlug: string, projectId: string, inboxId: string, data: Partial<TInbox>): Promise<TInbox> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
export * from "./inbox.service";
|
||||||
|
export * from "./inbox-issue.service";
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import { APIService } from "../api.service";
|
||||||
|
import { IApiToken } from "@plane/types";
|
||||||
|
|
||||||
|
export class APITokenService extends APIService {
|
||||||
|
constructor(BASE_URL) {
|
||||||
|
super(BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getApiTokens(workspaceSlug: string): Promise<IApiToken[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/api-tokens/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async retrieveApiToken(
|
||||||
|
workspaceSlug: string,
|
||||||
|
tokenId: String
|
||||||
|
): Promise<IApiToken> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/api-tokens/${tokenId}`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createApiToken(
|
||||||
|
workspaceSlug: string,
|
||||||
|
data: Partial<IApiToken>
|
||||||
|
): Promise<IApiToken> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/api-tokens/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteApiToken(
|
||||||
|
workspaceSlug: string,
|
||||||
|
tokenId: String
|
||||||
|
): Promise<IApiToken> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/api-tokens/${tokenId}`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// helper
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// types
|
||||||
|
import { IAppConfig } from "@plane/types";
|
||||||
|
|
||||||
|
export class AppConfigService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async envConfig(): Promise<IAppConfig> {
|
||||||
|
return this.get("/api/configs/", {
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => response.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
export interface UnSplashImage {
|
||||||
|
id: string;
|
||||||
|
created_at: Date;
|
||||||
|
updated_at: Date;
|
||||||
|
promoted_at: Date;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
color: string;
|
||||||
|
blur_hash: string;
|
||||||
|
description: null;
|
||||||
|
alt_description: string;
|
||||||
|
urls: UnSplashImageUrls;
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UnSplashImageUrls {
|
||||||
|
raw: string;
|
||||||
|
full: string;
|
||||||
|
regular: string;
|
||||||
|
small: string;
|
||||||
|
thumb: string;
|
||||||
|
small_s3: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class FileService extends APIService {
|
||||||
|
private cancelSource: any;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
this.uploadFile = this.uploadFile.bind(this);
|
||||||
|
this.deleteImage = this.deleteImage.bind(this);
|
||||||
|
this.restoreImage = this.restoreImage.bind(this);
|
||||||
|
this.cancelUpload = this.cancelUpload.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
async uploadFile(workspaceSlug: string, file: FormData): Promise<any> {
|
||||||
|
this.cancelSource = axios.CancelToken.source();
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/file-assets/`, file, {
|
||||||
|
headers: {
|
||||||
|
...this.getHeaders(),
|
||||||
|
"Content-Type": "multipart/form-data",
|
||||||
|
},
|
||||||
|
cancelToken: this.cancelSource.token,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
if (axios.isCancel(error)) {
|
||||||
|
console.log(error.message);
|
||||||
|
} else {
|
||||||
|
console.log(error);
|
||||||
|
throw error?.response?.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
cancelUpload() {
|
||||||
|
this.cancelSource.cancel("Upload cancelled");
|
||||||
|
}
|
||||||
|
|
||||||
|
getUploadFileFunction(workspaceSlug: string): (file: File) => Promise<string> {
|
||||||
|
return async (file: File) => {
|
||||||
|
try {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append("asset", file);
|
||||||
|
formData.append("attributes", JSON.stringify({}));
|
||||||
|
|
||||||
|
const data = await this.uploadFile(workspaceSlug, formData);
|
||||||
|
return data.asset;
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
getDeleteImageFunction(workspaceId: string) {
|
||||||
|
return async (src: string) => {
|
||||||
|
try {
|
||||||
|
const assetUrlWithWorkspaceId = `${workspaceId}/${this.extractAssetIdFromUrl(src, workspaceId)}`;
|
||||||
|
const data = await this.deleteImage(assetUrlWithWorkspaceId);
|
||||||
|
return data;
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
getRestoreImageFunction(workspaceId: string) {
|
||||||
|
return async (src: string) => {
|
||||||
|
try {
|
||||||
|
const assetUrlWithWorkspaceId = `${workspaceId}/${this.extractAssetIdFromUrl(src, workspaceId)}`;
|
||||||
|
const data = await this.restoreImage(assetUrlWithWorkspaceId);
|
||||||
|
return data;
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
extractAssetIdFromUrl(src: string, workspaceId: string): string {
|
||||||
|
const indexWhereAssetIdStarts = src.indexOf(workspaceId) + workspaceId.length + 1;
|
||||||
|
if (indexWhereAssetIdStarts === -1) {
|
||||||
|
throw new Error("Workspace ID not found in source string");
|
||||||
|
}
|
||||||
|
const assetUrl = src.substring(indexWhereAssetIdStarts);
|
||||||
|
return assetUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteImage(assetUrlWithWorkspaceId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/file-assets/${assetUrlWithWorkspaceId}/`)
|
||||||
|
.then((response) => response?.status)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async restoreImage(assetUrlWithWorkspaceId: string): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/file-assets/${assetUrlWithWorkspaceId}/restore/`, {
|
||||||
|
headers: this.getHeaders(),
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
})
|
||||||
|
.then((response) => response?.status)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteFile(workspaceId: string, assetUrl: string): Promise<any> {
|
||||||
|
const lastIndex = assetUrl.lastIndexOf("/");
|
||||||
|
const assetId = assetUrl.substring(lastIndex + 1);
|
||||||
|
|
||||||
|
return this.delete(`/api/workspaces/file-assets/${workspaceId}/${assetId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async uploadUserFile(file: FormData): Promise<any> {
|
||||||
|
return this.post(`/api/users/file-assets/`, file, {
|
||||||
|
headers: {
|
||||||
|
...this.getHeaders(),
|
||||||
|
"Content-Type": "multipart/form-data",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteUserFile(assetUrl: string): Promise<any> {
|
||||||
|
const lastIndex = assetUrl.lastIndexOf("/");
|
||||||
|
const assetId = assetUrl.substring(lastIndex + 1);
|
||||||
|
|
||||||
|
return this.delete(`/api/users/file-assets/${assetId}`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getUnsplashImages(query?: string): Promise<UnSplashImage[]> {
|
||||||
|
return this.get(`/api/unsplash/`, {
|
||||||
|
params: {
|
||||||
|
query,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((res) => res?.data?.results ?? res?.data)
|
||||||
|
.catch((err) => {
|
||||||
|
throw err?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getProjectCoverImages(): Promise<string[]> {
|
||||||
|
return this.get(`/api/project-covers/`)
|
||||||
|
.then((res) => res?.data)
|
||||||
|
.catch((err) => {
|
||||||
|
throw err?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// types
|
||||||
|
import type { IFormattedInstanceConfiguration, IInstance, IInstanceAdmin, IInstanceConfiguration } from "@plane/types";
|
||||||
|
|
||||||
|
export class InstanceService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getInstanceInfo(): Promise<IInstance> {
|
||||||
|
return this.get("/api/instances/", { headers: {} })
|
||||||
|
.then((response) => response.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getInstanceAdmins(): Promise<IInstanceAdmin[]> {
|
||||||
|
return this.get("/api/instances/admins/")
|
||||||
|
.then((response) => response.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateInstanceInfo(data: Partial<IInstance>): Promise<IInstance> {
|
||||||
|
return this.patch("/api/instances/", data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getInstanceConfigurations() {
|
||||||
|
return this.get("/api/instances/configurations/")
|
||||||
|
.then((response) => response.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateInstanceConfigurations(
|
||||||
|
data: Partial<IFormattedInstanceConfiguration>
|
||||||
|
): Promise<IInstanceConfiguration[]> {
|
||||||
|
return this.patch("/api/instances/configurations/", data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
// api services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// types
|
||||||
|
import { IWebhook } from "@plane/types";
|
||||||
|
|
||||||
|
export class WebhookService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchWebhooksList(workspaceSlug: string): Promise<IWebhook[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/webhooks/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchWebhookDetails(workspaceSlug: string, webhookId: string): Promise<IWebhook> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/webhooks/${webhookId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createWebhook(workspaceSlug: string, data: {}): Promise<IWebhook> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/webhooks/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateWebhook(workspaceSlug: string, webhookId: string, data: {}): Promise<IWebhook> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/webhooks/${webhookId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteWebhook(workspaceSlug: string, webhookId: string): Promise<void> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/webhooks/${webhookId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async regenerateSecretKey(workspaceSlug: string, webhookId: string): Promise<IWebhook> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/webhooks/${webhookId}/regenerate/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// types
|
||||||
|
import { IGithubRepoInfo, IGithubServiceImportFormData } from "@plane/types";
|
||||||
|
|
||||||
|
const integrationServiceType: string = "github";
|
||||||
|
|
||||||
|
export class GithubIntegrationService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async listAllRepositories(workspaceSlug: string, integrationSlug: string): Promise<any> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/workspace-integrations/${integrationSlug}/github-repositories`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getGithubRepoInfo(workspaceSlug: string, params: { owner: string; repo: string }): Promise<IGithubRepoInfo> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/importers/${integrationServiceType}/`, {
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createGithubServiceImport(workspaceSlug: string, data: IGithubServiceImportFormData): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/importers/${integrationServiceType}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export * from "./github.service";
|
||||||
|
export * from "./integration.service";
|
||||||
|
export * from "./jira.service";
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// types
|
||||||
|
import { IAppIntegration, IImporterService, IWorkspaceIntegration, IExportServiceResponse } from "@plane/types";
|
||||||
|
// helper
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
|
||||||
|
export class IntegrationService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getAppIntegrationsList(): Promise<IAppIntegration[]> {
|
||||||
|
return this.get(`/api/integrations/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getWorkspaceIntegrationsList(workspaceSlug: string): Promise<IWorkspaceIntegration[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/workspace-integrations/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteWorkspaceIntegration(workspaceSlug: string, integrationId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/workspace-integrations/${integrationId}/provider/`)
|
||||||
|
.then((res) => res?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getImporterServicesList(workspaceSlug: string): Promise<IImporterService[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/importers/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async getExportsServicesList(
|
||||||
|
workspaceSlug: string,
|
||||||
|
cursor: string,
|
||||||
|
per_page: number
|
||||||
|
): Promise<IExportServiceResponse> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/export-issues`, {
|
||||||
|
params: {
|
||||||
|
per_page,
|
||||||
|
cursor,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteImporterService(workspaceSlug: string, service: string, importerId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/importers/${service}/${importerId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import { APIService } from "services/api.service";
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// types
|
||||||
|
import { IJiraMetadata, IJiraResponse, IJiraImporterForm } from "@plane/types";
|
||||||
|
|
||||||
|
export class JiraImporterService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getJiraProjectInfo(workspaceSlug: string, params: IJiraMetadata): Promise<IJiraResponse> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/importers/jira`, {
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createJiraImporter(workspaceSlug: string, data: IJiraImporterForm): Promise<IJiraResponse> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/importers/jira/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
export * from "./issue_archive.service";
|
||||||
|
export * from "./issue.service";
|
||||||
|
export * from "./issue_draft.service";
|
||||||
|
export * from "./issue_reaction.service";
|
||||||
|
export * from "./issue_label.service";
|
||||||
|
export * from "./issue_attachment.service";
|
||||||
|
export * from "./issue_activity.service";
|
||||||
|
export * from "./issue_comment.service";
|
||||||
|
export * from "./issue_relation.service";
|
||||||
@@ -0,0 +1,238 @@
|
|||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// type
|
||||||
|
import type {
|
||||||
|
TIssue,
|
||||||
|
IIssueDisplayProperties,
|
||||||
|
ILinkDetails,
|
||||||
|
TIssueLink,
|
||||||
|
TIssueSubIssues,
|
||||||
|
TIssueActivity,
|
||||||
|
} from "@plane/types";
|
||||||
|
// helper
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
|
||||||
|
export class IssueService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async createIssue(workspaceSlug: string, projectId: string, data: any): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getIssues(workspaceSlug: string, projectId: string, queries?: any): Promise<TIssue[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/`, {
|
||||||
|
params: queries,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getIssuesWithParams(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
queries?: any
|
||||||
|
): Promise<TIssue[] | { [key: string]: TIssue[] }> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/`, {
|
||||||
|
params: queries,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async retrieve(workspaceSlug: string, projectId: string, issueId: string, queries?: any): Promise<TIssue> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/`, {
|
||||||
|
params: queries,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getIssueActivities(workspaceSlug: string, projectId: string, issueId: string): Promise<TIssueActivity[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/history/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async addIssueToCycle(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
cycleId: string,
|
||||||
|
data: {
|
||||||
|
issues: string[];
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/cycle-issues/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async removeIssueFromCycle(workspaceSlug: string, projectId: string, cycleId: string, bridgeId: string) {
|
||||||
|
return this.delete(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/cycle-issues/${bridgeId}/`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createIssueRelation(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
issueId: string,
|
||||||
|
data: {
|
||||||
|
related_list: Array<{
|
||||||
|
relation_type: "duplicate" | "relates_to" | "blocked_by";
|
||||||
|
related_issue: string;
|
||||||
|
}>;
|
||||||
|
relation?: "blocking" | null;
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-relation/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteIssueRelation(workspaceSlug: string, projectId: string, issueId: string, relationId: string) {
|
||||||
|
return this.delete(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-relation/${relationId}/`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getIssueDisplayProperties(workspaceSlug: string, projectId: string): Promise<any> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-display-properties/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateIssueDisplayProperties(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
data: IIssueDisplayProperties
|
||||||
|
): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-display-properties/`, {
|
||||||
|
properties: data,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async patchIssue(workspaceSlug: string, projectId: string, issueId: string, data: Partial<TIssue>): Promise<any> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteIssue(workspaceSlug: string, projectId: string, issuesId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issuesId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async bulkDeleteIssues(workspaceSlug: string, projectId: string, data: any): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/bulk-delete-issues/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async subIssues(workspaceSlug: string, projectId: string, issueId: string): Promise<TIssueSubIssues> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/sub-issues/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async addSubIssues(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
issueId: string,
|
||||||
|
data: { sub_issue_ids: string[] }
|
||||||
|
): Promise<TIssueSubIssues> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/sub-issues/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchIssueLinks(workspaceSlug: string, projectId: string, issueId: string): Promise<TIssueLink[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-links/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createIssueLink(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
issueId: string,
|
||||||
|
data: Partial<TIssueLink>
|
||||||
|
): Promise<ILinkDetails> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-links/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateIssueLink(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
issueId: string,
|
||||||
|
linkId: string,
|
||||||
|
data: Partial<TIssueLink>
|
||||||
|
): Promise<ILinkDetails> {
|
||||||
|
return this.patch(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-links/${linkId}/`,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteIssueLink(workspaceSlug: string, projectId: string, issueId: string, linkId: string): Promise<any> {
|
||||||
|
return this.delete(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-links/${linkId}/`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// types
|
||||||
|
import { TIssueActivity } from "@plane/types";
|
||||||
|
// helper
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
|
||||||
|
export class IssueActivityService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getIssueActivities(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
issueId: string,
|
||||||
|
params:
|
||||||
|
| {
|
||||||
|
created_at__gt: string;
|
||||||
|
}
|
||||||
|
| {} = {}
|
||||||
|
): Promise<TIssueActivity[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/history/`, {
|
||||||
|
params: {
|
||||||
|
activity_type: "issue-property",
|
||||||
|
...params,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// type
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
|
||||||
|
export class IssueArchiveService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getArchivedIssues(workspaceSlug: string, projectId: string, queries?: any): Promise<any> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/archived-issues/`, {
|
||||||
|
params: { ...queries },
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async unarchiveIssue(workspaceSlug: string, projectId: string, issueId: string): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/unarchive/${issueId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async retrieveArchivedIssue(workspaceSlug: string, projectId: string, issueId: string): Promise<any> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/archived-issues/${issueId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteArchivedIssue(workspaceSlug: string, projectId: string, issuesId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/archived-issues/${issuesId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// helper
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// types
|
||||||
|
import { TIssueAttachment } from "@plane/types";
|
||||||
|
|
||||||
|
export class IssueAttachmentService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async uploadIssueAttachment(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
issueId: string,
|
||||||
|
file: FormData
|
||||||
|
): Promise<TIssueAttachment> {
|
||||||
|
return this.post(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-attachments/`,
|
||||||
|
file,
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
...this.getHeaders(),
|
||||||
|
"Content-Type": "multipart/form-data",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getIssueAttachment(workspaceSlug: string, projectId: string, issueId: string): Promise<TIssueAttachment[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-attachments/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteIssueAttachment(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
issueId: string,
|
||||||
|
assetId: string
|
||||||
|
): Promise<TIssueAttachment> {
|
||||||
|
return this.delete(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-attachments/${assetId}/`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// types
|
||||||
|
import { TIssueComment } from "@plane/types";
|
||||||
|
// helper
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
|
||||||
|
export class IssueCommentService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getIssueComments(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
issueId: string,
|
||||||
|
params:
|
||||||
|
| {
|
||||||
|
created_at__gt: string;
|
||||||
|
}
|
||||||
|
| {} = {}
|
||||||
|
): Promise<TIssueComment[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/history/`, {
|
||||||
|
params: {
|
||||||
|
activity_type: "issue-comment",
|
||||||
|
...params,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createIssueComment(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
issueId: string,
|
||||||
|
data: Partial<TIssueComment>
|
||||||
|
): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/comments/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async patchIssueComment(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
issueId: string,
|
||||||
|
commentId: string,
|
||||||
|
data: Partial<TIssueComment>
|
||||||
|
): Promise<any> {
|
||||||
|
return this.patch(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/comments/${commentId}/`,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteIssueComment(workspaceSlug: string, projectId: string, issueId: string, commentId: string): Promise<any> {
|
||||||
|
return this.delete(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/comments/${commentId}/`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
import { TIssue } from "@plane/types";
|
||||||
|
|
||||||
|
export class IssueDraftService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getDraftIssues(workspaceSlug: string, projectId: string, query?: any): Promise<TIssue[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-drafts/`, {
|
||||||
|
params: { ...query },
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createDraftIssue(workspaceSlug: string, projectId: string, data: any): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-drafts/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateDraftIssue(workspaceSlug: string, projectId: string, issueId: string, data: any): Promise<any> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-drafts/${issueId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteDraftIssue(workspaceSlug: string, projectId: string, issueId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-drafts/${issueId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getDraftIssueById(workspaceSlug: string, projectId: string, issueId: string): Promise<any> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-drafts/${issueId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// types
|
||||||
|
import type { IIssueFiltersResponse } from "@plane/types";
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
|
||||||
|
export class IssueFiltersService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// // workspace issue filters
|
||||||
|
// async fetchWorkspaceFilters(workspaceSlug: string): Promise<IIssueFiltersResponse> {
|
||||||
|
// return this.get(`/api/workspaces/${workspaceSlug}/user-properties/`)
|
||||||
|
// .then((response) => response?.data)
|
||||||
|
// .catch((error) => {
|
||||||
|
// throw error?.response?.data;
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// async patchWorkspaceFilters(
|
||||||
|
// workspaceSlug: string,
|
||||||
|
// data: Partial<IIssueFiltersResponse>
|
||||||
|
// ): Promise<IIssueFiltersResponse> {
|
||||||
|
// return this.patch(`/api/workspaces/${workspaceSlug}/user-properties/`, data)
|
||||||
|
// .then((response) => response?.data)
|
||||||
|
// .catch((error) => {
|
||||||
|
// throw error?.response?.data;
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// project issue filters
|
||||||
|
async fetchProjectIssueFilters(workspaceSlug: string, projectId: string): Promise<IIssueFiltersResponse> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/user-properties/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async patchProjectIssueFilters(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
data: Partial<IIssueFiltersResponse>
|
||||||
|
): Promise<any> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/user-properties/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// cycle issue filters
|
||||||
|
async fetchCycleIssueFilters(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
cycleId: string
|
||||||
|
): Promise<IIssueFiltersResponse> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/user-properties/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async patchCycleIssueFilters(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
cycleId: string,
|
||||||
|
data: Partial<IIssueFiltersResponse>
|
||||||
|
): Promise<any> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/user-properties/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// module issue filters
|
||||||
|
async fetchModuleIssueFilters(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
moduleId: string
|
||||||
|
): Promise<IIssueFiltersResponse> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/modules/${moduleId}/user-properties/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async patchModuleIssueFilters(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
moduleId: string,
|
||||||
|
data: Partial<IIssueFiltersResponse>
|
||||||
|
): Promise<any> {
|
||||||
|
return this.patch(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/modules/${moduleId}/user-properties/`,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// types
|
||||||
|
import { IIssueLabel } from "@plane/types";
|
||||||
|
|
||||||
|
export class IssueLabelService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getWorkspaceIssueLabels(workspaceSlug: string): Promise<IIssueLabel[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/labels/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getProjectLabels(workspaceSlug: string, projectId: string): Promise<IIssueLabel[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-labels/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createIssueLabel(workspaceSlug: string, projectId: string, data: any): Promise<IIssueLabel> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-labels/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async patchIssueLabel(workspaceSlug: string, projectId: string, labelId: string, data: any): Promise<any> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-labels/${labelId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteIssueLabel(workspaceSlug: string, projectId: string, labelId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-labels/${labelId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// types
|
||||||
|
import type { TIssueCommentReaction, TIssueReaction } from "@plane/types";
|
||||||
|
|
||||||
|
export class IssueReactionService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async createIssueReaction(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
issueId: string,
|
||||||
|
data: Partial<TIssueReaction>
|
||||||
|
): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/reactions/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async listIssueReactions(workspaceSlug: string, projectId: string, issueId: string): Promise<TIssueReaction[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/reactions/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteIssueReaction(workspaceSlug: string, projectId: string, issueId: string, reaction: string): Promise<any> {
|
||||||
|
return this.delete(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/reactions/${reaction}/`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createIssueCommentReaction(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
commentId: string,
|
||||||
|
data: Partial<TIssueCommentReaction>
|
||||||
|
): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/comments/${commentId}/reactions/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async listIssueCommentReactions(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
commentId: string
|
||||||
|
): Promise<TIssueCommentReaction[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/comments/${commentId}/reactions/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteIssueCommentReaction(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
commentId: string,
|
||||||
|
reaction: string
|
||||||
|
): Promise<any> {
|
||||||
|
return this.delete(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/comments/${commentId}/reactions/${reaction}/`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// types
|
||||||
|
import type { TIssueRelation, TIssue, TIssueRelationTypes } from "@plane/types";
|
||||||
|
|
||||||
|
export class IssueRelationService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async listIssueRelations(workspaceSlug: string, projectId: string, issueId: string): Promise<TIssueRelation> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-relation/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createIssueRelations(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
issueId: string,
|
||||||
|
data: { relation_type: TIssueRelationTypes; issues: string[] }
|
||||||
|
): Promise<TIssue[]> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-relation/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteIssueRelation(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
issueId: string,
|
||||||
|
data: { relation_type: TIssueRelationTypes; related_issue: string }
|
||||||
|
): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/remove-relation/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,213 @@
|
|||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// types
|
||||||
|
import type { IModule, TIssue, ILinkDetails, ModuleLink } from "@plane/types";
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
|
||||||
|
export class ModuleService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getModules(workspaceSlug: string, projectId: string): Promise<IModule[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/modules/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createModule(workspaceSlug: string, projectId: string, data: any): Promise<IModule> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/modules/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateModule(workspaceSlug: string, projectId: string, moduleId: string, data: any): Promise<any> {
|
||||||
|
return this.put(`/api/workspaces/${workspaceSlug}/projects/${projectId}/modules/${moduleId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getModuleDetails(workspaceSlug: string, projectId: string, moduleId: string): Promise<IModule> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/modules/${moduleId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async patchModule(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
moduleId: string,
|
||||||
|
data: Partial<IModule>
|
||||||
|
): Promise<IModule> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/modules/${moduleId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteModule(workspaceSlug: string, projectId: string, moduleId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/modules/${moduleId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getModuleIssues(workspaceSlug: string, projectId: string, moduleId: string, queries?: any): Promise<TIssue[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/modules/${moduleId}/issues/`, {
|
||||||
|
params: queries,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async addIssuesToModule(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
moduleId: string,
|
||||||
|
data: { issues: string[] }
|
||||||
|
): Promise<void> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/modules/${moduleId}/issues/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async addModulesToIssue(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
issueId: string,
|
||||||
|
data: { modules: string[] }
|
||||||
|
): Promise<void> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/modules/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async removeIssueFromModule(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
moduleId: string,
|
||||||
|
issueId: string
|
||||||
|
): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/modules/${moduleId}/issues/${issueId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async removeIssuesFromModuleBulk(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
moduleId: string,
|
||||||
|
issueIds: string[]
|
||||||
|
): Promise<any> {
|
||||||
|
const promiseDataUrls: any = [];
|
||||||
|
issueIds.forEach((issueId) => {
|
||||||
|
promiseDataUrls.push(
|
||||||
|
this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/modules/${moduleId}/issues/${issueId}/`)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
return await Promise.all(promiseDataUrls)
|
||||||
|
.then((response) => response)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async removeModulesFromIssueBulk(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
issueId: string,
|
||||||
|
moduleIds: string[]
|
||||||
|
): Promise<any> {
|
||||||
|
const promiseDataUrls: any = [];
|
||||||
|
moduleIds.forEach((moduleId) => {
|
||||||
|
promiseDataUrls.push(
|
||||||
|
this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/modules/${moduleId}/issues/${issueId}/`)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
return await Promise.all(promiseDataUrls)
|
||||||
|
.then((response) => response)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createModuleLink(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
moduleId: string,
|
||||||
|
data: Partial<ModuleLink>
|
||||||
|
): Promise<ILinkDetails> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/modules/${moduleId}/module-links/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateModuleLink(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
moduleId: string,
|
||||||
|
linkId: string,
|
||||||
|
data: Partial<ModuleLink>
|
||||||
|
): Promise<ILinkDetails> {
|
||||||
|
return this.patch(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/modules/${moduleId}/module-links/${linkId}/`,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteModuleLink(workspaceSlug: string, projectId: string, moduleId: string, linkId: string): Promise<any> {
|
||||||
|
return this.delete(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/modules/${moduleId}/module-links/${linkId}/`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async addModuleToFavorites(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
data: {
|
||||||
|
module: string;
|
||||||
|
}
|
||||||
|
): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/user-favorite-modules/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async removeModuleFromFavorites(workspaceSlug: string, projectId: string, moduleId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/user-favorite-modules/${moduleId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,203 @@
|
|||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// types
|
||||||
|
import { IPage, IPageBlock, TIssue } from "@plane/types";
|
||||||
|
|
||||||
|
export class PageService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async createPage(workspaceSlug: string, projectId: string, data: Partial<IPage>): Promise<IPage> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async patchPage(workspaceSlug: string, projectId: string, pageId: string, data: Partial<IPage>): Promise<IPage> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/${pageId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
console.error("error", error?.response?.data);
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deletePage(workspaceSlug: string, projectId: string, pageId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/${pageId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async addPageToFavorites(workspaceSlug: string, projectId: string, pageId: string): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/user-favorite-pages/`, { page: pageId })
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async removePageFromFavorites(workspaceSlug: string, projectId: string, pageId: string) {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/user-favorite-pages/${pageId}`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getProjectPages(workspaceSlug: string, projectId: string): Promise<IPage[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getPagesWithParams(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
pageType: "all" | "favorite" | "private" | "shared"
|
||||||
|
): Promise<IPage[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/`, {
|
||||||
|
params: {
|
||||||
|
page_view: pageType,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getPageDetails(workspaceSlug: string, projectId: string, pageId: string): Promise<IPage> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/${pageId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createPageBlock(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
pageId: string,
|
||||||
|
data: Partial<IPageBlock>
|
||||||
|
): Promise<IPageBlock> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/${pageId}/page-blocks/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getPageBlock(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
pageId: string,
|
||||||
|
pageBlockId: string
|
||||||
|
): Promise<IPageBlock[]> {
|
||||||
|
return this.get(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/${pageId}/page-blocks/${pageBlockId}/`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async patchPageBlock(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
pageId: string,
|
||||||
|
pageBlockId: string,
|
||||||
|
data: Partial<IPageBlock>
|
||||||
|
): Promise<IPage> {
|
||||||
|
return this.patch(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/${pageId}/page-blocks/${pageBlockId}/`,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deletePageBlock(workspaceSlug: string, projectId: string, pageId: string, pageBlockId: string): Promise<any> {
|
||||||
|
return this.delete(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/${pageId}/page-blocks/${pageBlockId}/`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async listPageBlocks(workspaceSlug: string, projectId: string, pageId: string): Promise<IPageBlock[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/${pageId}/page-blocks/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async convertPageBlockToIssue(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
pageId: string,
|
||||||
|
blockId: string
|
||||||
|
): Promise<TIssue> {
|
||||||
|
return this.post(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/${pageId}/page-blocks/${blockId}/issues/`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// =============== Archiving & Unarchiving Pages =================
|
||||||
|
async archivePage(workspaceSlug: string, projectId: string, pageId: string): Promise<void> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/${pageId}/archive/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async restorePage(workspaceSlug: string, projectId: string, pageId: string): Promise<void> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/${pageId}/unarchive/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getArchivedPages(workspaceSlug: string, projectId: string): Promise<IPage[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/archived-pages/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// ==================== Pages Locking Services ==========================
|
||||||
|
async lockPage(workspaceSlug: string, projectId: string, pageId: string): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/${pageId}/lock/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async unlockPage(workspaceSlug: string, projectId: string, pageId: string): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/${pageId}/unlock/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
export * from "./project.service";
|
||||||
|
export * from "./project-estimate.service";
|
||||||
|
export * from "./project-export.service";
|
||||||
|
export * from "./project-member.service";
|
||||||
|
export * from "./project-state.service";
|
||||||
|
export * from "./project-publish.service";
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// types
|
||||||
|
import type { IEstimate, IEstimateFormData, IEstimatePoint } from "@plane/types";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
|
||||||
|
export class ProjectEstimateService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async createEstimate(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
data: IEstimateFormData
|
||||||
|
): Promise<{
|
||||||
|
estimate: IEstimate;
|
||||||
|
estimate_points: IEstimatePoint[];
|
||||||
|
}> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/estimates/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async patchEstimate(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
estimateId: string,
|
||||||
|
data: IEstimateFormData
|
||||||
|
): Promise<any> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/estimates/${estimateId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getEstimateDetails(workspaceSlug: string, projectId: string, estimateId: string): Promise<IEstimate> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/estimates/${estimateId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getEstimatesList(workspaceSlug: string, projectId: string): Promise<IEstimate[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/estimates/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteEstimate(workspaceSlug: string, projectId: string, estimateId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/estimates/${estimateId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getWorkspaceEstimatesList(workspaceSlug: string): Promise<IEstimate[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/estimates/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
|
||||||
|
export class ProjectExportService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async csvExport(
|
||||||
|
workspaceSlug: string,
|
||||||
|
data: {
|
||||||
|
provider: string;
|
||||||
|
project: string[];
|
||||||
|
}
|
||||||
|
): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/export-issues/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// types
|
||||||
|
import type { IProjectBulkAddFormData, IProjectMember, IProjectMembership } from "@plane/types";
|
||||||
|
|
||||||
|
export class ProjectMemberService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchProjectMembers(workspaceSlug: string, projectId: string): Promise<IProjectMembership[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/members/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async bulkAddMembersToProject(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
data: IProjectBulkAddFormData
|
||||||
|
): Promise<IProjectMembership[]> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/members/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async projectMemberMe(workspaceSlug: string, projectId: string): Promise<IProjectMember> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/project-members/me/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getProjectMember(workspaceSlug: string, projectId: string, memberId: string): Promise<IProjectMember> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/members/${memberId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateProjectMember(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
memberId: string,
|
||||||
|
data: Partial<IProjectMember>
|
||||||
|
): Promise<IProjectMember> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/members/${memberId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteProjectMember(workspaceSlug: string, projectId: string, memberId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/members/${memberId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// types
|
||||||
|
import { IProjectPublishSettings } from "store/project/project-publish.store";
|
||||||
|
|
||||||
|
export class ProjectPublishService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getProjectSettingsAsync(workspace_slug: string, project_slug: string): Promise<any> {
|
||||||
|
return this.get(`/api/workspaces/${workspace_slug}/projects/${project_slug}/project-deploy-boards/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createProjectSettingsAsync(
|
||||||
|
workspace_slug: string,
|
||||||
|
project_slug: string,
|
||||||
|
data: IProjectPublishSettings
|
||||||
|
): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspace_slug}/projects/${project_slug}/project-deploy-boards/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateProjectSettingsAsync(
|
||||||
|
workspace_slug: string,
|
||||||
|
project_slug: string,
|
||||||
|
project_publish_id: string,
|
||||||
|
data: IProjectPublishSettings
|
||||||
|
): Promise<any> {
|
||||||
|
return this.patch(
|
||||||
|
`/api/workspaces/${workspace_slug}/projects/${project_slug}/project-deploy-boards/${project_publish_id}/`,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteProjectSettingsAsync(
|
||||||
|
workspace_slug: string,
|
||||||
|
project_slug: string,
|
||||||
|
project_publish_id: string
|
||||||
|
): Promise<any> {
|
||||||
|
return this.delete(
|
||||||
|
`/api/workspaces/${workspace_slug}/projects/${project_slug}/project-deploy-boards/${project_publish_id}/`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// types
|
||||||
|
import type { IState } from "@plane/types";
|
||||||
|
|
||||||
|
export class ProjectStateService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async createState(workspaceSlug: string, projectId: string, data: any): Promise<IState> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/states/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async markDefault(workspaceSlug: string, projectId: string, stateId: string): Promise<void> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/states/${stateId}/mark-default/`, {})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getStates(workspaceSlug: string, projectId: string): Promise<IState[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/states/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getState(workspaceSlug: string, projectId: string, stateId: string): Promise<any> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/states/${stateId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateState(workspaceSlug: string, projectId: string, stateId: string, data: IState): Promise<any> {
|
||||||
|
return this.put(`/api/workspaces/${workspaceSlug}/projects/${projectId}/states/${stateId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async patchState(workspaceSlug: string, projectId: string, stateId: string, data: Partial<IState>): Promise<any> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/states/${stateId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteState(workspaceSlug: string, projectId: string, stateId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/states/${stateId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getWorkspaceStates(workspaceSlug: string): Promise<IState[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/states/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,168 @@
|
|||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// types
|
||||||
|
import type {
|
||||||
|
GithubRepositoriesResponse,
|
||||||
|
IProject,
|
||||||
|
ISearchIssueResponse,
|
||||||
|
ProjectPreferences,
|
||||||
|
IProjectViewProps,
|
||||||
|
TProjectIssuesSearchParams,
|
||||||
|
} from "@plane/types";
|
||||||
|
|
||||||
|
export class ProjectService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async createProject(workspaceSlug: string, data: Partial<IProject>): Promise<IProject> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async checkProjectIdentifierAvailability(workspaceSlug: string, data: string): Promise<any> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/project-identifiers`, {
|
||||||
|
params: {
|
||||||
|
name: data,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getProjects(workspaceSlug: string): Promise<IProject[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getProject(workspaceSlug: string, projectId: string): Promise<IProject> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateProject(workspaceSlug: string, projectId: string, data: Partial<IProject>): Promise<IProject> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteProject(workspaceSlug: string, projectId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async setProjectView(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
data: {
|
||||||
|
view_props?: IProjectViewProps;
|
||||||
|
default_props?: IProjectViewProps;
|
||||||
|
preferences?: ProjectPreferences;
|
||||||
|
sort_order?: number;
|
||||||
|
}
|
||||||
|
): Promise<any> {
|
||||||
|
await this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/project-views/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getGithubRepositories(url: string): Promise<GithubRepositoriesResponse> {
|
||||||
|
return this.request({
|
||||||
|
method: "get",
|
||||||
|
url,
|
||||||
|
headers: this.getAccessToken() ? this.getHeaders() : {},
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async syncGithubRepository(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
workspaceIntegrationId: string,
|
||||||
|
data: {
|
||||||
|
name: string;
|
||||||
|
owner: string;
|
||||||
|
repository_id: string;
|
||||||
|
url: string;
|
||||||
|
}
|
||||||
|
): Promise<any> {
|
||||||
|
return this.post(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/workspace-integrations/${workspaceIntegrationId}/github-repository-sync/`,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getProjectGithubRepository(workspaceSlug: string, projectId: string, integrationId: string): Promise<any> {
|
||||||
|
return this.get(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/workspace-integrations/${integrationId}/github-repository-sync/`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getUserProjectFavorites(workspaceSlug: string): Promise<any[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/user-favorite-projects/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async addProjectToFavorites(workspaceSlug: string, project: string): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/user-favorite-projects/`, { project })
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async removeProjectFromFavorites(workspaceSlug: string, projectId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/user-favorite-projects/${projectId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async projectIssuesSearch(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
params: TProjectIssuesSearchParams
|
||||||
|
): Promise<ISearchIssueResponse[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/search-issues/`, {
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// types
|
||||||
|
import {
|
||||||
|
IEmailCheckData,
|
||||||
|
IEmailCheckResponse,
|
||||||
|
ILoginTokenResponse,
|
||||||
|
IMagicSignInData,
|
||||||
|
IPasswordSignInData,
|
||||||
|
} from "@plane/types";
|
||||||
|
|
||||||
|
export class AuthService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async emailCheck(data: IEmailCheckData): Promise<IEmailCheckResponse> {
|
||||||
|
return this.post("/api/email-check/", data, { headers: {} })
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async passwordSignIn(data: IPasswordSignInData): Promise<ILoginTokenResponse> {
|
||||||
|
return this.post("/api/sign-in/", data, { headers: {} })
|
||||||
|
.then((response) => {
|
||||||
|
this.setAccessToken(response?.data?.access_token);
|
||||||
|
this.setRefreshToken(response?.data?.refresh_token);
|
||||||
|
return response?.data;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async sendResetPasswordLink(data: { email: string }): Promise<any> {
|
||||||
|
return this.post(`/api/forgot-password/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async setPassword(data: { password: string }): Promise<any> {
|
||||||
|
return this.post(`/api/users/me/set-password/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async resetPassword(
|
||||||
|
uidb64: string,
|
||||||
|
token: string,
|
||||||
|
data: {
|
||||||
|
new_password: string;
|
||||||
|
}
|
||||||
|
): Promise<ILoginTokenResponse> {
|
||||||
|
return this.post(`/api/reset-password/${uidb64}/${token}/`, data, { headers: {} })
|
||||||
|
.then((response) => {
|
||||||
|
if (response?.status === 200) {
|
||||||
|
this.setAccessToken(response?.data?.access_token);
|
||||||
|
this.setRefreshToken(response?.data?.refresh_token);
|
||||||
|
return response?.data;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async emailSignUp(data: { email: string; password: string }): Promise<ILoginTokenResponse> {
|
||||||
|
return this.post("/api/sign-up/", data, { headers: {} })
|
||||||
|
.then((response) => {
|
||||||
|
this.setAccessToken(response?.data?.access_token);
|
||||||
|
this.setRefreshToken(response?.data?.refresh_token);
|
||||||
|
return response?.data;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async socialAuth(data: any): Promise<ILoginTokenResponse> {
|
||||||
|
return this.post("/api/social-auth/", data, { headers: {} })
|
||||||
|
.then((response) => {
|
||||||
|
this.setAccessToken(response?.data?.access_token);
|
||||||
|
this.setRefreshToken(response?.data?.refresh_token);
|
||||||
|
return response?.data;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async generateUniqueCode(data: { email: string }): Promise<any> {
|
||||||
|
return this.post("/api/magic-generate/", data, { headers: {} })
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async magicSignIn(data: IMagicSignInData): Promise<any> {
|
||||||
|
return await this.post("/api/magic-sign-in/", data, { headers: {} })
|
||||||
|
.then((response) => {
|
||||||
|
if (response?.status === 200) {
|
||||||
|
this.setAccessToken(response?.data?.access_token);
|
||||||
|
this.setRefreshToken(response?.data?.refresh_token);
|
||||||
|
return response?.data;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async instanceAdminSignIn(data: IPasswordSignInData): Promise<ILoginTokenResponse> {
|
||||||
|
return await this.post("/api/instances/admins/sign-in/", data, { headers: {} })
|
||||||
|
.then((response) => {
|
||||||
|
if (response?.status === 200) {
|
||||||
|
this.setAccessToken(response?.data?.access_token);
|
||||||
|
this.setRefreshToken(response?.data?.refresh_token);
|
||||||
|
return response?.data;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async signOut(): Promise<any> {
|
||||||
|
return this.post("/api/sign-out/", { refresh_token: this.getRefreshToken() })
|
||||||
|
.then((response) => {
|
||||||
|
this.purgeAccessToken();
|
||||||
|
this.purgeRefreshToken();
|
||||||
|
return response?.data;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.purgeAccessToken();
|
||||||
|
this.purgeRefreshToken();
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// types
|
||||||
|
import type {
|
||||||
|
IUserNotification,
|
||||||
|
INotificationParams,
|
||||||
|
NotificationCount,
|
||||||
|
PaginatedUserNotification,
|
||||||
|
IMarkAllAsReadPayload,
|
||||||
|
} from "@plane/types";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
|
||||||
|
export class NotificationService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getUserNotifications(workspaceSlug: string, params: INotificationParams): Promise<IUserNotification[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/users/notifications`, {
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getUserNotificationDetailById(workspaceSlug: string, notificationId: string): Promise<IUserNotification> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/users/notifications/${notificationId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async markUserNotificationAsRead(workspaceSlug: string, notificationId: string): Promise<IUserNotification> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/users/notifications/${notificationId}/read/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async markUserNotificationAsUnread(workspaceSlug: string, notificationId: string): Promise<IUserNotification> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/users/notifications/${notificationId}/read/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async markUserNotificationAsArchived(workspaceSlug: string, notificationId: string): Promise<IUserNotification> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/users/notifications/${notificationId}/archive/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async markUserNotificationAsUnarchived(workspaceSlug: string, notificationId: string): Promise<IUserNotification> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/users/notifications/${notificationId}/archive/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async patchUserNotification(
|
||||||
|
workspaceSlug: string,
|
||||||
|
notificationId: string,
|
||||||
|
data: Partial<IUserNotification>
|
||||||
|
): Promise<IUserNotification> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/users/notifications/${notificationId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteUserNotification(workspaceSlug: string, notificationId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/users/notifications/${notificationId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async subscribeToIssueNotifications(workspaceSlug: string, projectId: string, issueId: string): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/subscribe/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getIssueNotificationSubscriptionStatus(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
issueId: string
|
||||||
|
): Promise<{
|
||||||
|
subscribed: boolean;
|
||||||
|
}> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/subscribe/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async unsubscribeFromIssueNotifications(workspaceSlug: string, projectId: string, issueId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/subscribe/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getUnreadNotificationsCount(workspaceSlug: string): Promise<NotificationCount> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/users/notifications/unread/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getNotifications(url: string): Promise<PaginatedUserNotification> {
|
||||||
|
return this.get(url)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async markAllNotificationsAsRead(workspaceSlug: string, payload: IMarkAllAsReadPayload): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/users/notifications/mark-all-read/`, {
|
||||||
|
...payload,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,212 @@
|
|||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// types
|
||||||
|
import type {
|
||||||
|
TIssue,
|
||||||
|
IUser,
|
||||||
|
IUserActivityResponse,
|
||||||
|
IInstanceAdminStatus,
|
||||||
|
IUserProfileData,
|
||||||
|
IUserProfileProjectSegregation,
|
||||||
|
IUserSettings,
|
||||||
|
IUserWorkspaceDashboard,
|
||||||
|
IUserEmailNotificationSettings,
|
||||||
|
} from "@plane/types";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
|
||||||
|
export class UserService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
currentUserConfig() {
|
||||||
|
return {
|
||||||
|
url: `${this.baseURL}/api/users/me/`,
|
||||||
|
headers: this.getHeaders(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async userIssues(
|
||||||
|
workspaceSlug: string,
|
||||||
|
params: any
|
||||||
|
): Promise<
|
||||||
|
| {
|
||||||
|
[key: string]: TIssue[];
|
||||||
|
}
|
||||||
|
| TIssue[]
|
||||||
|
> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/my-issues/`, {
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async currentUser(): Promise<IUser> {
|
||||||
|
return this.get("/api/users/me/")
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async currentUserInstanceAdminStatus(): Promise<IInstanceAdminStatus> {
|
||||||
|
return this.get("/api/users/me/instance-admin/")
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async currentUserSettings(): Promise<IUserSettings> {
|
||||||
|
return this.get("/api/users/me/settings/")
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async currentUserEmailNotificationSettings(): Promise<IUserEmailNotificationSettings> {
|
||||||
|
return this.get("/api/users/me/notification-preferences/")
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateUser(data: Partial<IUser>): Promise<any> {
|
||||||
|
return this.patch("/api/users/me/", data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateUserOnBoard(): Promise<any> {
|
||||||
|
return this.patch("/api/users/me/onboard/", {
|
||||||
|
is_onboarded: true,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateUserTourCompleted(): Promise<any> {
|
||||||
|
return this.patch("/api/users/me/tour-completed/", {
|
||||||
|
is_tour_completed: true,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateCurrentUserEmailNotificationSettings(data: Partial<IUserEmailNotificationSettings>): Promise<any> {
|
||||||
|
return this.patch("/api/users/me/notification-preferences/", data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getUserActivity(): Promise<IUserActivityResponse> {
|
||||||
|
return this.get(`/api/users/me/activities/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async userWorkspaceDashboard(workspaceSlug: string, month: number): Promise<IUserWorkspaceDashboard> {
|
||||||
|
return this.get(`/api/users/me/workspaces/${workspaceSlug}/dashboard/`, {
|
||||||
|
params: {
|
||||||
|
month: month,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async changePassword(data: { old_password: string; new_password: string; confirm_password: string }): Promise<any> {
|
||||||
|
return this.post(`/api/users/me/change-password/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getUserProfileData(workspaceSlug: string, userId: string): Promise<IUserProfileData> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/user-stats/${userId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getUserProfileProjectsSegregation(
|
||||||
|
workspaceSlug: string,
|
||||||
|
userId: string
|
||||||
|
): Promise<IUserProfileProjectSegregation> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/user-profile/${userId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getUserProfileActivity(workspaceSlug: string, userId: string): Promise<IUserActivityResponse> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/user-activity/${userId}/?per_page=15`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getUserProfileIssues(workspaceSlug: string, userId: string, params: any): Promise<TIssue[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/user-issues/${userId}/`, {
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deactivateAccount() {
|
||||||
|
return this.delete(`/api/users/me/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async leaveWorkspace(workspaceSlug: string) {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/members/leave/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async joinProject(workspaceSlug: string, project_ids: string[]): Promise<any> {
|
||||||
|
return this.post(`/api/users/me/workspaces/${workspaceSlug}/projects/invitations/`, { project_ids })
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async leaveProject(workspaceSlug: string, projectId: string) {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/members/leave/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// types
|
||||||
|
import { IProjectView } from "@plane/types";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
|
||||||
|
export class ViewService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async createView(workspaceSlug: string, projectId: string, data: Partial<IProjectView>): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/views/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async patchView(workspaceSlug: string, projectId: string, viewId: string, data: Partial<IProjectView>): Promise<any> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/views/${viewId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteView(workspaceSlug: string, projectId: string, viewId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/views/${viewId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getViews(workspaceSlug: string, projectId: string): Promise<IProjectView[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/views/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getViewDetails(workspaceSlug: string, projectId: string, viewId: string): Promise<IProjectView> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/views/${viewId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getViewIssues(workspaceSlug: string, projectId: string, viewId: string): Promise<any> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/views/${viewId}/issues/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async addViewToFavorites(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
data: {
|
||||||
|
view: string;
|
||||||
|
}
|
||||||
|
): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/user-favorite-views/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async removeViewFromFavorites(workspaceSlug: string, projectId: string, viewId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/user-favorite-views/${viewId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
// services
|
||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
|
||||||
|
export class AppInstallationService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async addInstallationApp(workspaceSlug: string, provider: string, data: any): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/workspace-integrations/${provider}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async addSlackChannel(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
integrationId: string | null | undefined,
|
||||||
|
data: any
|
||||||
|
): Promise<any> {
|
||||||
|
return this.post(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/workspace-integrations/${integrationId}/project-slack-sync/`,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getSlackChannelDetail(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
integrationId: string | null | undefined
|
||||||
|
): Promise<any> {
|
||||||
|
return this.get(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/workspace-integrations/${integrationId}/project-slack-sync/`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async removeSlackChannel(
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
integrationId: string | null | undefined,
|
||||||
|
slackSyncId: string | undefined
|
||||||
|
): Promise<any> {
|
||||||
|
return this.delete(
|
||||||
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/workspace-integrations/${integrationId}/project-slack-sync/${slackSyncId}`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import { APIService } from "services/api.service";
|
||||||
|
// helpers
|
||||||
|
import { API_BASE_URL } from "helpers/common.helper";
|
||||||
|
// types
|
||||||
|
import { THomeDashboardResponse, TWidget, TWidgetStatsResponse, TWidgetStatsRequestParams } from "@plane/types";
|
||||||
|
|
||||||
|
export class DashboardService extends APIService {
|
||||||
|
constructor() {
|
||||||
|
super(API_BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getHomeDashboardWidgets(workspaceSlug: string): Promise<THomeDashboardResponse> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/dashboard/`, {
|
||||||
|
params: {
|
||||||
|
dashboard_type: "home",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getWidgetStats(
|
||||||
|
workspaceSlug: string,
|
||||||
|
dashboardId: string,
|
||||||
|
params: TWidgetStatsRequestParams
|
||||||
|
): Promise<TWidgetStatsResponse> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/dashboard/${dashboardId}/`, {
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getDashboardDetails(dashboardId: string): Promise<TWidgetStatsResponse> {
|
||||||
|
return this.get(`/api/dashboard/${dashboardId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateDashboardWidget(dashboardId: string, widgetId: string, data: Partial<TWidget>): Promise<TWidget> {
|
||||||
|
return this.patch(`/api/dashboard/${dashboardId}/widgets/${widgetId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,397 @@
|
|||||||
|
// services
|
||||||
|
import { APIService } from "../api.service";
|
||||||
|
// types
|
||||||
|
import {
|
||||||
|
IWorkspace,
|
||||||
|
IWorkspaceMemberMe,
|
||||||
|
IWorkspaceMember,
|
||||||
|
IWorkspaceMemberInvitation,
|
||||||
|
ILastActiveWorkspaceDetails,
|
||||||
|
IWorkspaceSearchResults,
|
||||||
|
IProductUpdateResponse,
|
||||||
|
IWorkspaceBulkInviteFormData,
|
||||||
|
IWorkspaceViewProps,
|
||||||
|
IUserProjectsRole,
|
||||||
|
TIssue,
|
||||||
|
IWorkspaceView,
|
||||||
|
} from "@plane/types";
|
||||||
|
|
||||||
|
export interface IWorkspaceService {
|
||||||
|
list(): Promise<IWorkspace[]>;
|
||||||
|
retrieve(workspaceSlug: string): Promise<IWorkspace>;
|
||||||
|
create(data: Partial<IWorkspace>): Promise<IWorkspace>;
|
||||||
|
update(workspaceSlug: string, data: Partial<IWorkspace>): Promise<IWorkspace>;
|
||||||
|
delete(workspaceSlug: string): Promise<undefined>;
|
||||||
|
invite(
|
||||||
|
workspaceSlug: string,
|
||||||
|
data: IWorkspaceBulkInviteFormData
|
||||||
|
): Promise<any>;
|
||||||
|
join(workspaceSlug: string, invitationId: string, data: any): Promise<any>;
|
||||||
|
joinMany(data: any): Promise<any>;
|
||||||
|
getLastActiveWorkspaceAndProjects(): Promise<ILastActiveWorkspaceDetails>;
|
||||||
|
userWorkspaceInvitations(): Promise<IWorkspaceMemberInvitation[]>;
|
||||||
|
workspaceMemberMe(workspaceSlug: string): Promise<IWorkspaceMemberMe>;
|
||||||
|
updateWorkspaceView(
|
||||||
|
workspaceSlug: string,
|
||||||
|
data: { view_props: IWorkspaceViewProps }
|
||||||
|
): Promise<any>;
|
||||||
|
fetchWorkspaceMembers(workspaceSlug: string): Promise<IWorkspaceMember[]>;
|
||||||
|
updateWorkspaceMember(
|
||||||
|
workspaceSlug: string,
|
||||||
|
memberId: string,
|
||||||
|
data: Partial<IWorkspaceMember>
|
||||||
|
): Promise<IWorkspaceMember>;
|
||||||
|
deleteWorkspaceMember(workspaceSlug: string, memberId: string): Promise<any>;
|
||||||
|
workspaceInvitations(
|
||||||
|
workspaceSlug: string
|
||||||
|
): Promise<IWorkspaceMemberInvitation[]>;
|
||||||
|
getWorkspaceInvitation(
|
||||||
|
workspaceSlug: string,
|
||||||
|
invitationId: string
|
||||||
|
): Promise<IWorkspaceMemberInvitation>;
|
||||||
|
updateWorkspaceInvitation(
|
||||||
|
workspaceSlug: string,
|
||||||
|
invitationId: string,
|
||||||
|
data: Partial<IWorkspaceMember>
|
||||||
|
): Promise<any>;
|
||||||
|
deleteWorkspaceInvitations(
|
||||||
|
workspaceSlug: string,
|
||||||
|
invitationId: string
|
||||||
|
): Promise<any>;
|
||||||
|
workspaceSlugCheck(slug: string): Promise<any>;
|
||||||
|
searchWorkspace(
|
||||||
|
workspaceSlug: string,
|
||||||
|
params: { project_id?: string; search: string; workspace_search: boolean }
|
||||||
|
): Promise<IWorkspaceSearchResults>;
|
||||||
|
getProductUpdates(): Promise<IProductUpdateResponse[]>;
|
||||||
|
createView(
|
||||||
|
workspaceSlug: string,
|
||||||
|
data: Partial<IWorkspaceView>
|
||||||
|
): Promise<IWorkspaceView>;
|
||||||
|
updateView(
|
||||||
|
workspaceSlug: string,
|
||||||
|
viewId: string,
|
||||||
|
data: Partial<IWorkspaceView>
|
||||||
|
): Promise<IWorkspaceView>;
|
||||||
|
deleteView(workspaceSlug: string, viewId: string): Promise<any>;
|
||||||
|
getAllViews(workspaceSlug: string): Promise<IWorkspaceView[]>;
|
||||||
|
getViewDetails(
|
||||||
|
workspaceSlug: string,
|
||||||
|
viewId: string
|
||||||
|
): Promise<IWorkspaceView>;
|
||||||
|
getViewIssues(workspaceSlug: string, params: any): Promise<TIssue[]>;
|
||||||
|
getWorkspaceUserProjectsRole(
|
||||||
|
workspaceSlug: string
|
||||||
|
): Promise<IUserProjectsRole>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class WorkspaceService extends APIService implements IWorkspaceService {
|
||||||
|
constructor(BASE_URL: string) {
|
||||||
|
super(BASE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
async list(): Promise<IWorkspace[]> {
|
||||||
|
return this.get("/api/users/me/workspaces/")
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async retrieve(workspaceSlug: string): Promise<IWorkspace> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async create(data: Partial<IWorkspace>): Promise<IWorkspace> {
|
||||||
|
return this.post("/api/workspaces/", data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async update(
|
||||||
|
workspaceSlug: string,
|
||||||
|
data: Partial<IWorkspace>
|
||||||
|
): Promise<IWorkspace> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async delete(workspaceSlug: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async invite(
|
||||||
|
workspaceSlug: string,
|
||||||
|
data: IWorkspaceBulkInviteFormData
|
||||||
|
): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/invitations/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async join(
|
||||||
|
workspaceSlug: string,
|
||||||
|
invitationId: string,
|
||||||
|
data: any
|
||||||
|
): Promise<any> {
|
||||||
|
return this.post(
|
||||||
|
`/api/workspaces/${workspaceSlug}/invitations/${invitationId}/join/`,
|
||||||
|
data,
|
||||||
|
{
|
||||||
|
headers: {},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async joinMany(data: any): Promise<any> {
|
||||||
|
return this.post("/api/users/me/workspaces/invitations/", data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getLastActiveWorkspaceAndProjects(): Promise<ILastActiveWorkspaceDetails> {
|
||||||
|
return this.get("/api/users/last-visited-workspace/")
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async userWorkspaceInvitations(): Promise<IWorkspaceMemberInvitation[]> {
|
||||||
|
return this.get("/api/users/me/workspaces/invitations/")
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async workspaceMemberMe(workspaceSlug: string): Promise<IWorkspaceMemberMe> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/workspace-members/me/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateWorkspaceView(
|
||||||
|
workspaceSlug: string,
|
||||||
|
data: { view_props: IWorkspaceViewProps }
|
||||||
|
): Promise<any> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/workspace-views/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchWorkspaceMembers(
|
||||||
|
workspaceSlug: string
|
||||||
|
): Promise<IWorkspaceMember[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/members/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateWorkspaceMember(
|
||||||
|
workspaceSlug: string,
|
||||||
|
memberId: string,
|
||||||
|
data: Partial<IWorkspaceMember>
|
||||||
|
): Promise<IWorkspaceMember> {
|
||||||
|
return this.patch(
|
||||||
|
`/api/workspaces/${workspaceSlug}/members/${memberId}/`,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteWorkspaceMember(
|
||||||
|
workspaceSlug: string,
|
||||||
|
memberId: string
|
||||||
|
): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/members/${memberId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async workspaceInvitations(
|
||||||
|
workspaceSlug: string
|
||||||
|
): Promise<IWorkspaceMemberInvitation[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/invitations/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getWorkspaceInvitation(
|
||||||
|
workspaceSlug: string,
|
||||||
|
invitationId: string
|
||||||
|
): Promise<IWorkspaceMemberInvitation> {
|
||||||
|
return this.get(
|
||||||
|
`/api/workspaces/${workspaceSlug}/invitations/${invitationId}/join/`,
|
||||||
|
{ headers: {} }
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateWorkspaceInvitation(
|
||||||
|
workspaceSlug: string,
|
||||||
|
invitationId: string,
|
||||||
|
data: Partial<IWorkspaceMember>
|
||||||
|
): Promise<any> {
|
||||||
|
return this.patch(
|
||||||
|
`/api/workspaces/${workspaceSlug}/invitations/${invitationId}/`,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteWorkspaceInvitations(
|
||||||
|
workspaceSlug: string,
|
||||||
|
invitationId: string
|
||||||
|
): Promise<any> {
|
||||||
|
return this.delete(
|
||||||
|
`/api/workspaces/${workspaceSlug}/invitations/${invitationId}/`
|
||||||
|
)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async workspaceSlugCheck(slug: string): Promise<any> {
|
||||||
|
return this.get(`/api/workspace-slug-check/?slug=${slug}`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async searchWorkspace(
|
||||||
|
workspaceSlug: string,
|
||||||
|
params: {
|
||||||
|
project_id?: string;
|
||||||
|
search: string;
|
||||||
|
workspace_search: boolean;
|
||||||
|
}
|
||||||
|
): Promise<IWorkspaceSearchResults> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/search/`, {
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
.then((res) => res?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async getProductUpdates(): Promise<IProductUpdateResponse[]> {
|
||||||
|
return this.get("/api/release-notes/")
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createView(
|
||||||
|
workspaceSlug: string,
|
||||||
|
data: Partial<IWorkspaceView>
|
||||||
|
): Promise<IWorkspaceView> {
|
||||||
|
return this.post(`/api/workspaces/${workspaceSlug}/views/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateView(
|
||||||
|
workspaceSlug: string,
|
||||||
|
viewId: string,
|
||||||
|
data: Partial<IWorkspaceView>
|
||||||
|
): Promise<IWorkspaceView> {
|
||||||
|
return this.patch(`/api/workspaces/${workspaceSlug}/views/${viewId}/`, data)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteView(workspaceSlug: string, viewId: string): Promise<any> {
|
||||||
|
return this.delete(`/api/workspaces/${workspaceSlug}/views/${viewId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getAllViews(workspaceSlug: string): Promise<IWorkspaceView[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/views/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getViewDetails(
|
||||||
|
workspaceSlug: string,
|
||||||
|
viewId: string
|
||||||
|
): Promise<IWorkspaceView> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/views/${viewId}/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getViewIssues(workspaceSlug: string, params: any): Promise<TIssue[]> {
|
||||||
|
return this.get(`/api/workspaces/${workspaceSlug}/issues/`, {
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getWorkspaceUserProjectsRole(
|
||||||
|
workspaceSlug: string
|
||||||
|
): Promise<IUserProjectsRole> {
|
||||||
|
return this.get(`/api/users/me/workspaces/${workspaceSlug}/project-roles/`)
|
||||||
|
.then((response) => response?.data)
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
import { IProjectLite, IWorkspaceLite } from "@plane/types";
|
import { IProjectLite, IWorkspaceLite } from "@plane/types";
|
||||||
|
|
||||||
export interface IGptResponse {
|
export type GptApiResponse = {
|
||||||
response: string;
|
response: string;
|
||||||
response_html: string;
|
response_html: string;
|
||||||
count: number;
|
count: number;
|
||||||
project_detail: IProjectLite;
|
project_detail: IProjectLite;
|
||||||
workspace_detail: IWorkspaceLite;
|
workspace_detail: IWorkspaceLite;
|
||||||
}
|
};
|
||||||
|
|||||||
Vendored
+1
-2
@@ -13,10 +13,9 @@ export type TWidgetKeys =
|
|||||||
| "recent_projects"
|
| "recent_projects"
|
||||||
| "recent_collaborators";
|
| "recent_collaborators";
|
||||||
|
|
||||||
export type TIssuesListTypes = "pending" | "upcoming" | "overdue" | "completed";
|
export type TIssuesListTypes = "upcoming" | "overdue" | "completed";
|
||||||
|
|
||||||
export type TDurationFilterOptions =
|
export type TDurationFilterOptions =
|
||||||
| "none"
|
|
||||||
| "today"
|
| "today"
|
||||||
| "this_week"
|
| "this_week"
|
||||||
| "this_month"
|
| "this_month"
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ export const PriorityIcon: React.FC<IPriorityIcon> = (props) => {
|
|||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
size={size}
|
size={size}
|
||||||
|
viewBox="0 0 23.5 24"
|
||||||
className={cn(
|
className={cn(
|
||||||
{
|
{
|
||||||
"text-white": priority === "urgent",
|
"text-white": priority === "urgent",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Command } from "cmdk";
|
import { Command } from "cmdk";
|
||||||
import { ContrastIcon, FileText } from "lucide-react";
|
import { ContrastIcon, FileText } from "lucide-react";
|
||||||
// hooks
|
// hooks
|
||||||
import { useApplication, useEventTracker } from "hooks/store";
|
import { useApplication } from "hooks/store";
|
||||||
// ui
|
// ui
|
||||||
import { DiceIcon, PhotoFilterIcon } from "@plane/ui";
|
import { DiceIcon, PhotoFilterIcon } from "@plane/ui";
|
||||||
|
|
||||||
@@ -14,8 +14,8 @@ export const CommandPaletteProjectActions: React.FC<Props> = (props) => {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
commandPalette: { toggleCreateCycleModal, toggleCreateModuleModal, toggleCreatePageModal, toggleCreateViewModal },
|
commandPalette: { toggleCreateCycleModal, toggleCreateModuleModal, toggleCreatePageModal, toggleCreateViewModal },
|
||||||
|
eventTracker: { setTrackElement },
|
||||||
} = useApplication();
|
} = useApplication();
|
||||||
const { setTrackElement } = useEventTracker();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -23,7 +23,7 @@ export const CommandPaletteProjectActions: React.FC<Props> = (props) => {
|
|||||||
<Command.Item
|
<Command.Item
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
closePalette();
|
closePalette();
|
||||||
setTrackElement("Command palette");
|
setTrackElement("COMMAND_PALETTE");
|
||||||
toggleCreateCycleModal(true);
|
toggleCreateCycleModal(true);
|
||||||
}}
|
}}
|
||||||
className="focus:outline-none"
|
className="focus:outline-none"
|
||||||
@@ -39,7 +39,6 @@ export const CommandPaletteProjectActions: React.FC<Props> = (props) => {
|
|||||||
<Command.Item
|
<Command.Item
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
closePalette();
|
closePalette();
|
||||||
setTrackElement("Command palette");
|
|
||||||
toggleCreateModuleModal(true);
|
toggleCreateModuleModal(true);
|
||||||
}}
|
}}
|
||||||
className="focus:outline-none"
|
className="focus:outline-none"
|
||||||
@@ -55,7 +54,6 @@ export const CommandPaletteProjectActions: React.FC<Props> = (props) => {
|
|||||||
<Command.Item
|
<Command.Item
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
closePalette();
|
closePalette();
|
||||||
setTrackElement("Command palette");
|
|
||||||
toggleCreateViewModal(true);
|
toggleCreateViewModal(true);
|
||||||
}}
|
}}
|
||||||
className="focus:outline-none"
|
className="focus:outline-none"
|
||||||
@@ -71,7 +69,6 @@ export const CommandPaletteProjectActions: React.FC<Props> = (props) => {
|
|||||||
<Command.Item
|
<Command.Item
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
closePalette();
|
closePalette();
|
||||||
setTrackElement("Command palette");
|
|
||||||
toggleCreatePageModal(true);
|
toggleCreatePageModal(true);
|
||||||
}}
|
}}
|
||||||
className="focus:outline-none"
|
className="focus:outline-none"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Dialog, Transition } from "@headlessui/react";
|
|||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { FolderPlus, Search, Settings } from "lucide-react";
|
import { FolderPlus, Search, Settings } from "lucide-react";
|
||||||
// hooks
|
// hooks
|
||||||
import { useApplication, useEventTracker, useProject } from "hooks/store";
|
import { useApplication, useProject } from "hooks/store";
|
||||||
// services
|
// services
|
||||||
import { WorkspaceService } from "services/workspace.service";
|
import { WorkspaceService } from "services/workspace.service";
|
||||||
import { IssueService } from "services/issue";
|
import { IssueService } from "services/issue";
|
||||||
@@ -64,8 +64,8 @@ export const CommandModal: React.FC = observer(() => {
|
|||||||
toggleCreateIssueModal,
|
toggleCreateIssueModal,
|
||||||
toggleCreateProjectModal,
|
toggleCreateProjectModal,
|
||||||
},
|
},
|
||||||
|
eventTracker: { setTrackElement },
|
||||||
} = useApplication();
|
} = useApplication();
|
||||||
const { setTrackElement } = useEventTracker();
|
|
||||||
|
|
||||||
// router
|
// router
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -278,7 +278,7 @@ export const CommandModal: React.FC = observer(() => {
|
|||||||
<Command.Item
|
<Command.Item
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
closePalette();
|
closePalette();
|
||||||
setTrackElement("Command Palette");
|
setTrackElement("COMMAND_PALETTE");
|
||||||
toggleCreateIssueModal(true);
|
toggleCreateIssueModal(true);
|
||||||
}}
|
}}
|
||||||
className="focus:bg-custom-background-80"
|
className="focus:bg-custom-background-80"
|
||||||
@@ -296,7 +296,7 @@ export const CommandModal: React.FC = observer(() => {
|
|||||||
<Command.Item
|
<Command.Item
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
closePalette();
|
closePalette();
|
||||||
setTrackElement("Command palette");
|
setTrackElement("COMMAND_PALETTE");
|
||||||
toggleCreateProjectModal(true);
|
toggleCreateProjectModal(true);
|
||||||
}}
|
}}
|
||||||
className="focus:outline-none"
|
className="focus:outline-none"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useRouter } from "next/router";
|
|||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
// hooks
|
// hooks
|
||||||
import { useApplication, useEventTracker, useIssues, useUser } from "hooks/store";
|
import { useApplication, useIssues, useUser } from "hooks/store";
|
||||||
import useToast from "hooks/use-toast";
|
import useToast from "hooks/use-toast";
|
||||||
// components
|
// components
|
||||||
import { CommandModal, ShortcutsModal } from "components/command-palette";
|
import { CommandModal, ShortcutsModal } from "components/command-palette";
|
||||||
@@ -32,8 +32,8 @@ export const CommandPalette: FC = observer(() => {
|
|||||||
const {
|
const {
|
||||||
commandPalette,
|
commandPalette,
|
||||||
theme: { toggleSidebar },
|
theme: { toggleSidebar },
|
||||||
|
eventTracker: { setTrackElement },
|
||||||
} = useApplication();
|
} = useApplication();
|
||||||
const { setTrackElement } = useEventTracker();
|
|
||||||
const { currentUser } = useUser();
|
const { currentUser } = useUser();
|
||||||
const {
|
const {
|
||||||
issues: { removeIssue },
|
issues: { removeIssue },
|
||||||
@@ -118,10 +118,11 @@ export const CommandPalette: FC = observer(() => {
|
|||||||
toggleSidebar();
|
toggleSidebar();
|
||||||
}
|
}
|
||||||
} else if (!isAnyModalOpen) {
|
} else if (!isAnyModalOpen) {
|
||||||
setTrackElement("Shortcut key");
|
|
||||||
if (keyPressed === "c") {
|
if (keyPressed === "c") {
|
||||||
|
setTrackElement("SHORTCUT_KEY");
|
||||||
toggleCreateIssueModal(true);
|
toggleCreateIssueModal(true);
|
||||||
} else if (keyPressed === "p") {
|
} else if (keyPressed === "p") {
|
||||||
|
setTrackElement("SHORTCUT_KEY");
|
||||||
toggleCreateProjectModal(true);
|
toggleCreateProjectModal(true);
|
||||||
} else if (keyPressed === "h") {
|
} else if (keyPressed === "h") {
|
||||||
toggleShortcutModal(true);
|
toggleShortcutModal(true);
|
||||||
|
|||||||
@@ -86,15 +86,12 @@ const ProgressChart: React.FC<Props> = ({ distribution, startDate, endDate, tota
|
|||||||
{
|
{
|
||||||
id: "pending",
|
id: "pending",
|
||||||
color: "#3F76FF",
|
color: "#3F76FF",
|
||||||
data:
|
data: chartData.map((item, index) => ({
|
||||||
chartData.length > 0
|
index,
|
||||||
? chartData.map((item, index) => ({
|
x: item.currentDate,
|
||||||
index,
|
y: item.pending,
|
||||||
x: item.currentDate,
|
color: "#3F76FF",
|
||||||
y: item.pending,
|
})),
|
||||||
color: "#3F76FF",
|
|
||||||
}))
|
|
||||||
: [],
|
|
||||||
enableArea: true,
|
enableArea: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -124,9 +121,7 @@ const ProgressChart: React.FC<Props> = ({ distribution, startDate, endDate, tota
|
|||||||
enableArea
|
enableArea
|
||||||
colors={(datum) => datum.color ?? "#3F76FF"}
|
colors={(datum) => datum.color ?? "#3F76FF"}
|
||||||
customYAxisTickValues={[0, totalIssues]}
|
customYAxisTickValues={[0, totalIssues]}
|
||||||
gridXValues={
|
gridXValues={chartData.map((item, index) => (index % 2 === 0 ? item.currentDate : ""))}
|
||||||
chartData.length > 0 ? chartData.map((item, index) => (index % 2 === 0 ? item.currentDate : "")) : undefined
|
|
||||||
}
|
|
||||||
enableSlices="x"
|
enableSlices="x"
|
||||||
sliceTooltip={(datum) => (
|
sliceTooltip={(datum) => (
|
||||||
<div className="rounded-md border border-custom-border-200 bg-custom-background-80 p-2 text-xs">
|
<div className="rounded-md border border-custom-border-200 bg-custom-background-80 p-2 text-xs">
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ export const SidebarProgressStats: React.FC<Props> = ({
|
|||||||
</Tab>
|
</Tab>
|
||||||
</Tab.List>
|
</Tab.List>
|
||||||
<Tab.Panels className="flex w-full items-center justify-between text-custom-text-200">
|
<Tab.Panels className="flex w-full items-center justify-between text-custom-text-200">
|
||||||
<Tab.Panel as="div" className="flex min-h-44 w-full flex-col gap-1.5 overflow-y-auto pt-3.5">
|
<Tab.Panel as="div" className="flex h-44 w-full flex-col gap-1.5 overflow-y-auto pt-3.5">
|
||||||
{distribution?.assignees.length > 0 ? (
|
{distribution?.assignees.length > 0 ? (
|
||||||
distribution.assignees.map((assignee, index) => {
|
distribution.assignees.map((assignee, index) => {
|
||||||
if (assignee.assignee_id)
|
if (assignee.assignee_id)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { FC, MouseEvent, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
// hooks
|
// hooks
|
||||||
import { useEventTracker, useCycle, useUser } from "hooks/store";
|
import { useApplication, useCycle, useUser } from "hooks/store";
|
||||||
import useToast from "hooks/use-toast";
|
import useToast from "hooks/use-toast";
|
||||||
// components
|
// components
|
||||||
import { CycleCreateUpdateModal, CycleDeleteModal } from "components/cycles";
|
import { CycleCreateUpdateModal, CycleDeleteModal } from "components/cycles";
|
||||||
@@ -33,7 +33,9 @@ export const CyclesBoardCard: FC<ICyclesBoardCard> = (props) => {
|
|||||||
// router
|
// router
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
// store
|
// store
|
||||||
const { setTrackElement } = useEventTracker();
|
const {
|
||||||
|
eventTracker: { setTrackElement },
|
||||||
|
} = useApplication();
|
||||||
const {
|
const {
|
||||||
membership: { currentProjectRole },
|
membership: { currentProjectRole },
|
||||||
} = useUser();
|
} = useUser();
|
||||||
@@ -115,15 +117,14 @@ export const CyclesBoardCard: FC<ICyclesBoardCard> = (props) => {
|
|||||||
const handleEditCycle = (e: MouseEvent<HTMLButtonElement>) => {
|
const handleEditCycle = (e: MouseEvent<HTMLButtonElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
setTrackElement("Cycles page board layout");
|
|
||||||
setUpdateModal(true);
|
setUpdateModal(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDeleteCycle = (e: MouseEvent<HTMLButtonElement>) => {
|
const handleDeleteCycle = (e: MouseEvent<HTMLButtonElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
setTrackElement("Cycles page board layout");
|
|
||||||
setDeleteModal(true);
|
setDeleteModal(true);
|
||||||
|
setTrackElement("CYCLE_PAGE_BOARD_LAYOUT");
|
||||||
};
|
};
|
||||||
|
|
||||||
const openCycleOverview = (e: MouseEvent<HTMLButtonElement>) => {
|
const openCycleOverview = (e: MouseEvent<HTMLButtonElement>) => {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { FC, MouseEvent, useState } from "react";
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
// hooks
|
// hooks
|
||||||
import { useEventTracker, useCycle, useUser } from "hooks/store";
|
import { useApplication, useCycle, useUser } from "hooks/store";
|
||||||
import useToast from "hooks/use-toast";
|
import useToast from "hooks/use-toast";
|
||||||
// components
|
// components
|
||||||
import { CycleCreateUpdateModal, CycleDeleteModal } from "components/cycles";
|
import { CycleCreateUpdateModal, CycleDeleteModal } from "components/cycles";
|
||||||
@@ -37,7 +37,9 @@ export const CyclesListItem: FC<TCyclesListItem> = (props) => {
|
|||||||
// router
|
// router
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
// store hooks
|
// store hooks
|
||||||
const { setTrackElement } = useEventTracker();
|
const {
|
||||||
|
eventTracker: { setTrackElement },
|
||||||
|
} = useApplication();
|
||||||
const {
|
const {
|
||||||
membership: { currentProjectRole },
|
membership: { currentProjectRole },
|
||||||
} = useUser();
|
} = useUser();
|
||||||
@@ -88,15 +90,14 @@ export const CyclesListItem: FC<TCyclesListItem> = (props) => {
|
|||||||
const handleEditCycle = (e: MouseEvent<HTMLButtonElement>) => {
|
const handleEditCycle = (e: MouseEvent<HTMLButtonElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
setTrackElement("Cycles page list layout");
|
|
||||||
setUpdateModal(true);
|
setUpdateModal(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDeleteCycle = (e: MouseEvent<HTMLButtonElement>) => {
|
const handleDeleteCycle = (e: MouseEvent<HTMLButtonElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
setTrackElement("Cycles page list layout");
|
|
||||||
setDeleteModal(true);
|
setDeleteModal(true);
|
||||||
|
setTrackElement("CYCLE_PAGE_LIST_LAYOUT");
|
||||||
};
|
};
|
||||||
|
|
||||||
const openCycleOverview = (e: MouseEvent<HTMLButtonElement>) => {
|
const openCycleOverview = (e: MouseEvent<HTMLButtonElement>) => {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { Dialog, Transition } from "@headlessui/react";
|
|||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { AlertTriangle } from "lucide-react";
|
import { AlertTriangle } from "lucide-react";
|
||||||
// hooks
|
// hooks
|
||||||
import { useEventTracker, useCycle } from "hooks/store";
|
import { useApplication, useCycle } from "hooks/store";
|
||||||
import useToast from "hooks/use-toast";
|
import useToast from "hooks/use-toast";
|
||||||
// components
|
// components
|
||||||
import { Button } from "@plane/ui";
|
import { Button } from "@plane/ui";
|
||||||
@@ -27,7 +27,9 @@ export const CycleDeleteModal: React.FC<ICycleDelete> = observer((props) => {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { cycleId, peekCycle } = router.query;
|
const { cycleId, peekCycle } = router.query;
|
||||||
// store hooks
|
// store hooks
|
||||||
const { captureCycleEvent } = useEventTracker();
|
const {
|
||||||
|
eventTracker: { postHogEventTracker },
|
||||||
|
} = useApplication();
|
||||||
const { deleteCycle } = useCycle();
|
const { deleteCycle } = useCycle();
|
||||||
// toast alert
|
// toast alert
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
@@ -44,15 +46,13 @@ export const CycleDeleteModal: React.FC<ICycleDelete> = observer((props) => {
|
|||||||
title: "Success!",
|
title: "Success!",
|
||||||
message: "Cycle deleted successfully.",
|
message: "Cycle deleted successfully.",
|
||||||
});
|
});
|
||||||
captureCycleEvent({
|
postHogEventTracker("CYCLE_DELETE", {
|
||||||
eventName: "Cycle deleted",
|
state: "SUCCESS",
|
||||||
payload: { ...cycle, state: "SUCCESS" },
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
captureCycleEvent({
|
postHogEventTracker("CYCLE_DELETE", {
|
||||||
eventName: "Cycle deleted",
|
state: "FAILED",
|
||||||
payload: { ...cycle, state: "FAILED" },
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Dialog, Transition } from "@headlessui/react";
|
|||||||
// services
|
// services
|
||||||
import { CycleService } from "services/cycle.service";
|
import { CycleService } from "services/cycle.service";
|
||||||
// hooks
|
// hooks
|
||||||
import { useEventTracker, useCycle, useProject } from "hooks/store";
|
import { useApplication, useCycle, useProject } from "hooks/store";
|
||||||
import useToast from "hooks/use-toast";
|
import useToast from "hooks/use-toast";
|
||||||
import useLocalStorage from "hooks/use-local-storage";
|
import useLocalStorage from "hooks/use-local-storage";
|
||||||
// components
|
// components
|
||||||
@@ -27,7 +27,9 @@ export const CycleCreateUpdateModal: React.FC<CycleModalProps> = (props) => {
|
|||||||
// states
|
// states
|
||||||
const [activeProject, setActiveProject] = useState<string | null>(null);
|
const [activeProject, setActiveProject] = useState<string | null>(null);
|
||||||
// store hooks
|
// store hooks
|
||||||
const { captureCycleEvent } = useEventTracker();
|
const {
|
||||||
|
eventTracker: { postHogEventTracker },
|
||||||
|
} = useApplication();
|
||||||
const { workspaceProjectIds } = useProject();
|
const { workspaceProjectIds } = useProject();
|
||||||
const { createCycle, updateCycleDetails } = useCycle();
|
const { createCycle, updateCycleDetails } = useCycle();
|
||||||
// toast alert
|
// toast alert
|
||||||
@@ -46,9 +48,9 @@ export const CycleCreateUpdateModal: React.FC<CycleModalProps> = (props) => {
|
|||||||
title: "Success!",
|
title: "Success!",
|
||||||
message: "Cycle created successfully.",
|
message: "Cycle created successfully.",
|
||||||
});
|
});
|
||||||
captureCycleEvent({
|
postHogEventTracker("CYCLE_CREATE", {
|
||||||
eventName: "Cycle created",
|
...res,
|
||||||
payload: { ...res, state: "SUCCESS" },
|
state: "SUCCESS",
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
@@ -57,9 +59,8 @@ export const CycleCreateUpdateModal: React.FC<CycleModalProps> = (props) => {
|
|||||||
title: "Error!",
|
title: "Error!",
|
||||||
message: err.detail ?? "Error in creating cycle. Please try again.",
|
message: err.detail ?? "Error in creating cycle. Please try again.",
|
||||||
});
|
});
|
||||||
captureCycleEvent({
|
postHogEventTracker("CYCLE_CREATE", {
|
||||||
eventName: "Cycle created",
|
state: "FAILED",
|
||||||
payload: { ...payload, state: "FAILED" },
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Disclosure, Popover, Transition } from "@headlessui/react";
|
|||||||
// services
|
// services
|
||||||
import { CycleService } from "services/cycle.service";
|
import { CycleService } from "services/cycle.service";
|
||||||
// hooks
|
// hooks
|
||||||
import { useEventTracker, useCycle, useUser, useMember } from "hooks/store";
|
import { useApplication, useCycle, useMember, useUser } from "hooks/store";
|
||||||
import useToast from "hooks/use-toast";
|
import useToast from "hooks/use-toast";
|
||||||
// components
|
// components
|
||||||
import { SidebarProgressStats } from "components/core";
|
import { SidebarProgressStats } from "components/core";
|
||||||
@@ -66,7 +66,9 @@ export const CycleDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug, projectId, peekCycle } = router.query;
|
const { workspaceSlug, projectId, peekCycle } = router.query;
|
||||||
// store hooks
|
// store hooks
|
||||||
const { setTrackElement } = useEventTracker();
|
const {
|
||||||
|
eventTracker: { setTrackElement },
|
||||||
|
} = useApplication();
|
||||||
const {
|
const {
|
||||||
membership: { currentProjectRole },
|
membership: { currentProjectRole },
|
||||||
} = useUser();
|
} = useUser();
|
||||||
@@ -317,7 +319,13 @@ export const CycleDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||||||
const currentCycle = CYCLE_STATUS.find((status) => status.value === cycleStatus);
|
const currentCycle = CYCLE_STATUS.find((status) => status.value === cycleStatus);
|
||||||
|
|
||||||
const issueCount =
|
const issueCount =
|
||||||
cycleDetails.total_issues === 0 ? "0 Issue" : `${cycleDetails.completed_issues}/${cycleDetails.total_issues}`;
|
cycleDetails.total_issues === 0
|
||||||
|
? "0 Issue"
|
||||||
|
: cycleDetails.total_issues === cycleDetails.completed_issues
|
||||||
|
? cycleDetails.total_issues > 1
|
||||||
|
? `${cycleDetails.total_issues}`
|
||||||
|
: `${cycleDetails.total_issues}`
|
||||||
|
: `${cycleDetails.completed_issues}/${cycleDetails.total_issues}`;
|
||||||
|
|
||||||
const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserWorkspaceRoles.MEMBER;
|
const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserWorkspaceRoles.MEMBER;
|
||||||
|
|
||||||
@@ -567,9 +575,7 @@ export const CycleDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||||||
<Transition show={open}>
|
<Transition show={open}>
|
||||||
<Disclosure.Panel>
|
<Disclosure.Panel>
|
||||||
<div className="flex flex-col gap-3">
|
<div className="flex flex-col gap-3">
|
||||||
{cycleDetails.distribution?.completion_chart &&
|
{isStartValid && isEndValid ? (
|
||||||
cycleDetails.start_date &&
|
|
||||||
cycleDetails.end_date ? (
|
|
||||||
<div className="h-full w-full pt-4">
|
<div className="h-full w-full pt-4">
|
||||||
<div className="flex items-start gap-4 py-2 text-xs">
|
<div className="flex items-start gap-4 py-2 text-xs">
|
||||||
<div className="flex items-center gap-3 text-custom-text-100">
|
<div className="flex items-center gap-3 text-custom-text-100">
|
||||||
@@ -583,14 +589,16 @@ export const CycleDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="relative h-40 w-80">
|
{cycleDetails && cycleDetails.distribution && (
|
||||||
<ProgressChart
|
<div className="relative h-40 w-80">
|
||||||
distribution={cycleDetails.distribution?.completion_chart}
|
<ProgressChart
|
||||||
startDate={cycleDetails.start_date}
|
distribution={cycleDetails.distribution?.completion_chart ?? {}}
|
||||||
endDate={cycleDetails.end_date}
|
startDate={cycleDetails.start_date ?? ""}
|
||||||
totalIssues={cycleDetails.total_issues}
|
endDate={cycleDetails.end_date ?? ""}
|
||||||
/>
|
totalIssues={cycleDetails.total_issues}
|
||||||
</div>
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
// hooks
|
// hooks
|
||||||
import { useApplication, useEventTracker, useUser } from "hooks/store";
|
import { useApplication, useUser } from "hooks/store";
|
||||||
// ui
|
// ui
|
||||||
import { Button } from "@plane/ui";
|
import { Button } from "@plane/ui";
|
||||||
// assets
|
// assets
|
||||||
@@ -14,7 +14,6 @@ export const DashboardProjectEmptyState = observer(() => {
|
|||||||
const {
|
const {
|
||||||
commandPalette: { toggleCreateProjectModal },
|
commandPalette: { toggleCreateProjectModal },
|
||||||
} = useApplication();
|
} = useApplication();
|
||||||
const { setTrackElement } = useEventTracker();
|
|
||||||
const {
|
const {
|
||||||
membership: { currentWorkspaceRole },
|
membership: { currentWorkspaceRole },
|
||||||
} = useUser();
|
} = useUser();
|
||||||
@@ -32,13 +31,7 @@ export const DashboardProjectEmptyState = observer(() => {
|
|||||||
<Image src={ProjectEmptyStateImage} className="w-full" alt="Project empty state" />
|
<Image src={ProjectEmptyStateImage} className="w-full" alt="Project empty state" />
|
||||||
{canCreateProject && (
|
{canCreateProject && (
|
||||||
<div className="flex justify-center">
|
<div className="flex justify-center">
|
||||||
<Button
|
<Button variant="primary" onClick={() => toggleCreateProjectModal(true)}>
|
||||||
variant="primary"
|
|
||||||
onClick={() => {
|
|
||||||
setTrackElement("Project empty state");
|
|
||||||
toggleCreateProjectModal(true);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Build your first project
|
Build your first project
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import { getCustomDates, getRedirectionFilters } from "helpers/dashboard.helper"
|
|||||||
// types
|
// types
|
||||||
import { TAssignedIssuesWidgetFilters, TAssignedIssuesWidgetResponse } from "@plane/types";
|
import { TAssignedIssuesWidgetFilters, TAssignedIssuesWidgetResponse } from "@plane/types";
|
||||||
// constants
|
// constants
|
||||||
import { FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard";
|
import { ISSUES_TABS_LIST } from "constants/dashboard";
|
||||||
|
|
||||||
const WIDGET_KEY = "assigned_issues";
|
const WIDGET_KEY = "assigned_issues";
|
||||||
|
|
||||||
@@ -30,8 +30,6 @@ export const AssignedIssuesWidget: React.FC<WidgetProps> = observer((props) => {
|
|||||||
// derived values
|
// derived values
|
||||||
const widgetDetails = getWidgetDetails(workspaceSlug, dashboardId, WIDGET_KEY);
|
const widgetDetails = getWidgetDetails(workspaceSlug, dashboardId, WIDGET_KEY);
|
||||||
const widgetStats = getWidgetStats<TAssignedIssuesWidgetResponse>(workspaceSlug, dashboardId, WIDGET_KEY);
|
const widgetStats = getWidgetStats<TAssignedIssuesWidgetResponse>(workspaceSlug, dashboardId, WIDGET_KEY);
|
||||||
const selectedTab = widgetDetails?.widget_filters.tab ?? "pending";
|
|
||||||
const selectedDurationFilter = widgetDetails?.widget_filters.target_date ?? "none";
|
|
||||||
|
|
||||||
const handleUpdateFilters = async (filters: Partial<TAssignedIssuesWidgetFilters>) => {
|
const handleUpdateFilters = async (filters: Partial<TAssignedIssuesWidgetFilters>) => {
|
||||||
if (!widgetDetails) return;
|
if (!widgetDetails) return;
|
||||||
@@ -43,79 +41,68 @@ export const AssignedIssuesWidget: React.FC<WidgetProps> = observer((props) => {
|
|||||||
filters,
|
filters,
|
||||||
});
|
});
|
||||||
|
|
||||||
const filterDates = getCustomDates(filters.target_date ?? selectedDurationFilter);
|
|
||||||
fetchWidgetStats(workspaceSlug, dashboardId, {
|
fetchWidgetStats(workspaceSlug, dashboardId, {
|
||||||
widget_key: WIDGET_KEY,
|
widget_key: WIDGET_KEY,
|
||||||
issue_type: filters.tab ?? selectedTab,
|
issue_type: filters.tab ?? widgetDetails.widget_filters.tab ?? "upcoming",
|
||||||
...(filterDates.trim() !== "" ? { target_date: filterDates } : {}),
|
target_date: getCustomDates(filters.target_date ?? widgetDetails.widget_filters.target_date ?? "this_week"),
|
||||||
expand: "issue_relation",
|
expand: "issue_relation",
|
||||||
}).finally(() => setFetching(false));
|
}).finally(() => setFetching(false));
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const filterDates = getCustomDates(selectedDurationFilter);
|
const filterDates = getCustomDates(widgetDetails?.widget_filters.target_date ?? "this_week");
|
||||||
|
|
||||||
fetchWidgetStats(workspaceSlug, dashboardId, {
|
fetchWidgetStats(workspaceSlug, dashboardId, {
|
||||||
widget_key: WIDGET_KEY,
|
widget_key: WIDGET_KEY,
|
||||||
issue_type: selectedTab,
|
issue_type: widgetDetails?.widget_filters.tab ?? "upcoming",
|
||||||
...(filterDates.trim() !== "" ? { target_date: filterDates } : {}),
|
target_date: filterDates,
|
||||||
expand: "issue_relation",
|
expand: "issue_relation",
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const filterParams = getRedirectionFilters(selectedTab);
|
const filterParams = getRedirectionFilters(widgetDetails?.widget_filters.tab ?? "upcoming");
|
||||||
const tabsList = selectedDurationFilter === "none" ? UNFILTERED_ISSUES_TABS_LIST : FILTERED_ISSUES_TABS_LIST;
|
|
||||||
|
|
||||||
if (!widgetDetails || !widgetStats) return <WidgetLoader widgetKey={WIDGET_KEY} />;
|
if (!widgetDetails || !widgetStats) return <WidgetLoader widgetKey={WIDGET_KEY} />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-custom-background-100 rounded-xl border-[0.5px] border-custom-border-200 w-full hover:shadow-custom-shadow-4xl duration-300 flex flex-col min-h-96">
|
<div className="bg-custom-background-100 rounded-xl border-[0.5px] border-custom-border-200 w-full hover:shadow-custom-shadow-4xl duration-300 flex flex-col min-h-96">
|
||||||
<div className="flex items-center justify-between gap-2 p-6 pl-7">
|
<div className="flex items-start justify-between gap-2 p-6 pl-7">
|
||||||
<Link
|
<div>
|
||||||
href={`/${workspaceSlug}/workspace-views/assigned/${filterParams}`}
|
<Link
|
||||||
className="text-lg font-semibold text-custom-text-300 hover:underline"
|
href={`/${workspaceSlug}/workspace-views/assigned/${filterParams}`}
|
||||||
>
|
className="text-lg font-semibold text-custom-text-300 hover:underline"
|
||||||
Assigned to you
|
>
|
||||||
</Link>
|
Assigned to you
|
||||||
|
</Link>
|
||||||
|
<p className="mt-3 text-xs font-medium text-custom-text-300">
|
||||||
|
Filtered by{" "}
|
||||||
|
<span className="border-[0.5px] border-custom-border-300 rounded py-1 px-2 ml-0.5">Due date</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<DurationFilterDropdown
|
<DurationFilterDropdown
|
||||||
value={selectedDurationFilter}
|
value={widgetDetails.widget_filters.target_date ?? "this_week"}
|
||||||
onChange={(val) => {
|
onChange={(val) =>
|
||||||
if (val === selectedDurationFilter) return;
|
handleUpdateFilters({
|
||||||
|
target_date: val,
|
||||||
// switch to pending tab if target date is changed to none
|
})
|
||||||
if (val === "none" && selectedTab !== "completed") {
|
}
|
||||||
handleUpdateFilters({ target_date: val, tab: "pending" });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// switch to upcoming tab if target date is changed to other than none
|
|
||||||
if (val !== "none" && selectedDurationFilter === "none" && selectedTab !== "completed") {
|
|
||||||
handleUpdateFilters({
|
|
||||||
target_date: val,
|
|
||||||
tab: "upcoming",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleUpdateFilters({ target_date: val });
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Tab.Group
|
<Tab.Group
|
||||||
as="div"
|
as="div"
|
||||||
selectedIndex={tabsList.findIndex((tab) => tab.key === selectedTab)}
|
defaultIndex={ISSUES_TABS_LIST.findIndex((t) => t.key === widgetDetails.widget_filters.tab ?? "upcoming")}
|
||||||
onChange={(i) => {
|
onChange={(i) => {
|
||||||
const selectedTab = tabsList[i];
|
const selectedTab = ISSUES_TABS_LIST[i];
|
||||||
handleUpdateFilters({ tab: selectedTab?.key ?? "pending" });
|
handleUpdateFilters({ tab: selectedTab.key ?? "upcoming" });
|
||||||
}}
|
}}
|
||||||
className="h-full flex flex-col"
|
className="h-full flex flex-col"
|
||||||
>
|
>
|
||||||
<div className="px-6">
|
<div className="px-6">
|
||||||
<TabsList durationFilter={selectedDurationFilter} selectedTab={selectedTab} />
|
<TabsList />
|
||||||
</div>
|
</div>
|
||||||
<Tab.Panels as="div" className="h-full">
|
<Tab.Panels as="div" className="h-full">
|
||||||
{tabsList.map((tab) => (
|
{ISSUES_TABS_LIST.map((tab) => (
|
||||||
<Tab.Panel key={tab.key} as="div" className="h-full flex flex-col">
|
<Tab.Panel key={tab.key} as="div" className="h-full flex flex-col">
|
||||||
<WidgetIssuesList
|
<WidgetIssuesList
|
||||||
issues={widgetStats.issues}
|
issues={widgetStats.issues}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import { getCustomDates, getRedirectionFilters } from "helpers/dashboard.helper"
|
|||||||
// types
|
// types
|
||||||
import { TCreatedIssuesWidgetFilters, TCreatedIssuesWidgetResponse } from "@plane/types";
|
import { TCreatedIssuesWidgetFilters, TCreatedIssuesWidgetResponse } from "@plane/types";
|
||||||
// constants
|
// constants
|
||||||
import { FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard";
|
import { ISSUES_TABS_LIST } from "constants/dashboard";
|
||||||
|
|
||||||
const WIDGET_KEY = "created_issues";
|
const WIDGET_KEY = "created_issues";
|
||||||
|
|
||||||
@@ -30,8 +30,6 @@ export const CreatedIssuesWidget: React.FC<WidgetProps> = observer((props) => {
|
|||||||
// derived values
|
// derived values
|
||||||
const widgetDetails = getWidgetDetails(workspaceSlug, dashboardId, WIDGET_KEY);
|
const widgetDetails = getWidgetDetails(workspaceSlug, dashboardId, WIDGET_KEY);
|
||||||
const widgetStats = getWidgetStats<TCreatedIssuesWidgetResponse>(workspaceSlug, dashboardId, WIDGET_KEY);
|
const widgetStats = getWidgetStats<TCreatedIssuesWidgetResponse>(workspaceSlug, dashboardId, WIDGET_KEY);
|
||||||
const selectedTab = widgetDetails?.widget_filters.tab ?? "pending";
|
|
||||||
const selectedDurationFilter = widgetDetails?.widget_filters.target_date ?? "none";
|
|
||||||
|
|
||||||
const handleUpdateFilters = async (filters: Partial<TCreatedIssuesWidgetFilters>) => {
|
const handleUpdateFilters = async (filters: Partial<TCreatedIssuesWidgetFilters>) => {
|
||||||
if (!widgetDetails) return;
|
if (!widgetDetails) return;
|
||||||
@@ -43,76 +41,64 @@ export const CreatedIssuesWidget: React.FC<WidgetProps> = observer((props) => {
|
|||||||
filters,
|
filters,
|
||||||
});
|
});
|
||||||
|
|
||||||
const filterDates = getCustomDates(filters.target_date ?? selectedDurationFilter);
|
|
||||||
fetchWidgetStats(workspaceSlug, dashboardId, {
|
fetchWidgetStats(workspaceSlug, dashboardId, {
|
||||||
widget_key: WIDGET_KEY,
|
widget_key: WIDGET_KEY,
|
||||||
issue_type: filters.tab ?? selectedTab,
|
issue_type: filters.tab ?? widgetDetails.widget_filters.tab ?? "upcoming",
|
||||||
...(filterDates.trim() !== "" ? { target_date: filterDates } : {}),
|
target_date: getCustomDates(filters.target_date ?? widgetDetails.widget_filters.target_date ?? "this_week"),
|
||||||
}).finally(() => setFetching(false));
|
}).finally(() => setFetching(false));
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const filterDates = getCustomDates(selectedDurationFilter);
|
|
||||||
|
|
||||||
fetchWidgetStats(workspaceSlug, dashboardId, {
|
fetchWidgetStats(workspaceSlug, dashboardId, {
|
||||||
widget_key: WIDGET_KEY,
|
widget_key: WIDGET_KEY,
|
||||||
issue_type: selectedTab,
|
issue_type: widgetDetails?.widget_filters.tab ?? "upcoming",
|
||||||
...(filterDates.trim() !== "" ? { target_date: filterDates } : {}),
|
target_date: getCustomDates(widgetDetails?.widget_filters.target_date ?? "this_week"),
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const filterParams = getRedirectionFilters(selectedTab);
|
const filterParams = getRedirectionFilters(widgetDetails?.widget_filters.tab ?? "upcoming");
|
||||||
const tabsList = selectedDurationFilter === "none" ? UNFILTERED_ISSUES_TABS_LIST : FILTERED_ISSUES_TABS_LIST;
|
|
||||||
|
|
||||||
if (!widgetDetails || !widgetStats) return <WidgetLoader widgetKey={WIDGET_KEY} />;
|
if (!widgetDetails || !widgetStats) return <WidgetLoader widgetKey={WIDGET_KEY} />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-custom-background-100 rounded-xl border-[0.5px] border-custom-border-200 w-full hover:shadow-custom-shadow-4xl duration-300 flex flex-col min-h-96">
|
<div className="bg-custom-background-100 rounded-xl border-[0.5px] border-custom-border-200 w-full hover:shadow-custom-shadow-4xl duration-300 flex flex-col min-h-96">
|
||||||
<div className="flex items-center justify-between gap-2 p-6 pl-7">
|
<div className="flex items-start justify-between gap-2 p-6 pl-7">
|
||||||
<Link
|
<div>
|
||||||
href={`/${workspaceSlug}/workspace-views/created/${filterParams}`}
|
<Link
|
||||||
className="text-lg font-semibold text-custom-text-300 hover:underline"
|
href={`/${workspaceSlug}/workspace-views/created/${filterParams}`}
|
||||||
>
|
className="text-lg font-semibold text-custom-text-300 hover:underline"
|
||||||
Created by you
|
>
|
||||||
</Link>
|
Created by you
|
||||||
|
</Link>
|
||||||
|
<p className="mt-3 text-xs font-medium text-custom-text-300">
|
||||||
|
Filtered by{" "}
|
||||||
|
<span className="border-[0.5px] border-custom-border-300 rounded py-1 px-2 ml-0.5">Due date</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<DurationFilterDropdown
|
<DurationFilterDropdown
|
||||||
value={selectedDurationFilter}
|
value={widgetDetails.widget_filters.target_date ?? "this_week"}
|
||||||
onChange={(val) => {
|
onChange={(val) =>
|
||||||
if (val === selectedDurationFilter) return;
|
handleUpdateFilters({
|
||||||
|
target_date: val,
|
||||||
// switch to pending tab if target date is changed to none
|
})
|
||||||
if (val === "none" && selectedTab !== "completed") {
|
}
|
||||||
handleUpdateFilters({ target_date: val, tab: "pending" });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// switch to upcoming tab if target date is changed to other than none
|
|
||||||
if (val !== "none" && selectedDurationFilter === "none" && selectedTab !== "completed") {
|
|
||||||
handleUpdateFilters({
|
|
||||||
target_date: val,
|
|
||||||
tab: "upcoming",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleUpdateFilters({ target_date: val });
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Tab.Group
|
<Tab.Group
|
||||||
as="div"
|
as="div"
|
||||||
selectedIndex={tabsList.findIndex((tab) => tab.key === selectedTab)}
|
defaultIndex={ISSUES_TABS_LIST.findIndex((t) => t.key === widgetDetails.widget_filters.tab ?? "upcoming")}
|
||||||
onChange={(i) => {
|
onChange={(i) => {
|
||||||
const selectedTab = tabsList[i];
|
const selectedTab = ISSUES_TABS_LIST[i];
|
||||||
handleUpdateFilters({ tab: selectedTab.key ?? "pending" });
|
handleUpdateFilters({ tab: selectedTab.key ?? "upcoming" });
|
||||||
}}
|
}}
|
||||||
className="h-full flex flex-col"
|
className="h-full flex flex-col"
|
||||||
>
|
>
|
||||||
<div className="px-6">
|
<div className="px-6">
|
||||||
<TabsList durationFilter={selectedDurationFilter} selectedTab={selectedTab} />
|
<TabsList />
|
||||||
</div>
|
</div>
|
||||||
<Tab.Panels as="div" className="h-full">
|
<Tab.Panels as="div" className="h-full">
|
||||||
{tabsList.map((tab) => (
|
{ISSUES_TABS_LIST.map((tab) => (
|
||||||
<Tab.Panel key={tab.key} as="div" className="h-full flex flex-col">
|
<Tab.Panel key={tab.key} as="div" className="h-full flex flex-col">
|
||||||
<WidgetIssuesList
|
<WidgetIssuesList
|
||||||
issues={widgetStats.issues}
|
issues={widgetStats.issues}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
IssueListItemProps,
|
IssueListItemProps,
|
||||||
} from "components/dashboard/widgets";
|
} from "components/dashboard/widgets";
|
||||||
// ui
|
// ui
|
||||||
import { getButtonStyling } from "@plane/ui";
|
import { Loader, getButtonStyling } from "@plane/ui";
|
||||||
// helpers
|
// helpers
|
||||||
import { cn } from "helpers/common.helper";
|
import { cn } from "helpers/common.helper";
|
||||||
import { getRedirectionFilters } from "helpers/dashboard.helper";
|
import { getRedirectionFilters } from "helpers/dashboard.helper";
|
||||||
@@ -41,18 +41,16 @@ export const WidgetIssuesList: React.FC<WidgetIssuesListProps> = (props) => {
|
|||||||
const filterParams = getRedirectionFilters(tab);
|
const filterParams = getRedirectionFilters(tab);
|
||||||
|
|
||||||
const ISSUE_LIST_ITEM: {
|
const ISSUE_LIST_ITEM: {
|
||||||
[key: string]: {
|
[key in string]: {
|
||||||
[key in TIssuesListTypes]: React.FC<IssueListItemProps>;
|
[key in TIssuesListTypes]: React.FC<IssueListItemProps>;
|
||||||
};
|
};
|
||||||
} = {
|
} = {
|
||||||
assigned: {
|
assigned: {
|
||||||
pending: AssignedUpcomingIssueListItem,
|
|
||||||
upcoming: AssignedUpcomingIssueListItem,
|
upcoming: AssignedUpcomingIssueListItem,
|
||||||
overdue: AssignedOverdueIssueListItem,
|
overdue: AssignedOverdueIssueListItem,
|
||||||
completed: AssignedCompletedIssueListItem,
|
completed: AssignedCompletedIssueListItem,
|
||||||
},
|
},
|
||||||
created: {
|
created: {
|
||||||
pending: CreatedUpcomingIssueListItem,
|
|
||||||
upcoming: CreatedUpcomingIssueListItem,
|
upcoming: CreatedUpcomingIssueListItem,
|
||||||
overdue: CreatedOverdueIssueListItem,
|
overdue: CreatedOverdueIssueListItem,
|
||||||
completed: CreatedCompletedIssueListItem,
|
completed: CreatedCompletedIssueListItem,
|
||||||
@@ -63,7 +61,12 @@ export const WidgetIssuesList: React.FC<WidgetIssuesListProps> = (props) => {
|
|||||||
<>
|
<>
|
||||||
<div className="h-full">
|
<div className="h-full">
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<></>
|
<Loader className="mt-7 mx-6 space-y-4">
|
||||||
|
<Loader.Item height="25px" />
|
||||||
|
<Loader.Item height="25px" />
|
||||||
|
<Loader.Item height="25px" />
|
||||||
|
<Loader.Item height="25px" />
|
||||||
|
</Loader>
|
||||||
) : issues.length > 0 ? (
|
) : issues.length > 0 ? (
|
||||||
<>
|
<>
|
||||||
<div className="mt-7 mx-6 border-b-[0.5px] border-custom-border-200 grid grid-cols-6 gap-1 text-xs text-custom-text-300 pb-1">
|
<div className="mt-7 mx-6 border-b-[0.5px] border-custom-border-200 grid grid-cols-6 gap-1 text-xs text-custom-text-300 pb-1">
|
||||||
@@ -78,7 +81,7 @@ export const WidgetIssuesList: React.FC<WidgetIssuesListProps> = (props) => {
|
|||||||
{totalIssues}
|
{totalIssues}
|
||||||
</span>
|
</span>
|
||||||
</h6>
|
</h6>
|
||||||
{["upcoming", "pending"].includes(tab) && <h6 className="text-center">Due date</h6>}
|
{tab === "upcoming" && <h6 className="text-center">Due date</h6>}
|
||||||
{tab === "overdue" && <h6 className="text-center">Due by</h6>}
|
{tab === "overdue" && <h6 className="text-center">Due by</h6>}
|
||||||
{type === "assigned" && tab !== "completed" && <h6 className="text-center">Blocked by</h6>}
|
{type === "assigned" && tab !== "completed" && <h6 className="text-center">Blocked by</h6>}
|
||||||
{type === "created" && <h6 className="text-center">Assigned to</h6>}
|
{type === "created" && <h6 className="text-center">Assigned to</h6>}
|
||||||
|
|||||||
@@ -1,63 +1,26 @@
|
|||||||
import { observer } from "mobx-react";
|
|
||||||
import { Tab } from "@headlessui/react";
|
import { Tab } from "@headlessui/react";
|
||||||
// helpers
|
// helpers
|
||||||
import { cn } from "helpers/common.helper";
|
import { cn } from "helpers/common.helper";
|
||||||
// types
|
|
||||||
import { TDurationFilterOptions, TIssuesListTypes } from "@plane/types";
|
|
||||||
// constants
|
// constants
|
||||||
import { FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard";
|
import { ISSUES_TABS_LIST } from "constants/dashboard";
|
||||||
|
|
||||||
type Props = {
|
export const TabsList = () => (
|
||||||
durationFilter: TDurationFilterOptions;
|
<Tab.List
|
||||||
selectedTab: TIssuesListTypes;
|
as="div"
|
||||||
};
|
className="border-[0.5px] border-custom-border-200 rounded grid grid-cols-3 bg-custom-background-80"
|
||||||
|
>
|
||||||
export const TabsList: React.FC<Props> = observer((props) => {
|
{ISSUES_TABS_LIST.map((tab) => (
|
||||||
const { durationFilter, selectedTab } = props;
|
<Tab
|
||||||
|
key={tab.key}
|
||||||
const tabsList = durationFilter === "none" ? UNFILTERED_ISSUES_TABS_LIST : FILTERED_ISSUES_TABS_LIST;
|
className={({ selected }) =>
|
||||||
const selectedTabIndex = tabsList.findIndex((tab) => tab.key === (selectedTab ?? "pending"));
|
cn("font-semibold text-xs rounded py-1.5 focus:outline-none", {
|
||||||
|
"bg-custom-background-100 text-custom-text-300 shadow-[2px_0_8px_rgba(167,169,174,0.15)]": selected,
|
||||||
return (
|
"text-custom-text-400": !selected,
|
||||||
<Tab.List
|
})
|
||||||
as="div"
|
}
|
||||||
className="relative border-[0.5px] border-custom-border-200 rounded bg-custom-background-80 grid"
|
>
|
||||||
style={{
|
{tab.label}
|
||||||
gridTemplateColumns: `repeat(${tabsList.length}, 1fr)`,
|
</Tab>
|
||||||
}}
|
))}
|
||||||
>
|
</Tab.List>
|
||||||
<div
|
);
|
||||||
className={cn("absolute bg-custom-background-100 rounded transition-all duration-500 ease-in-out", {
|
|
||||||
// right shadow
|
|
||||||
"shadow-[2px_0_8px_rgba(167,169,174,0.15)]": selectedTabIndex !== tabsList.length - 1,
|
|
||||||
// left shadow
|
|
||||||
"shadow-[-2px_0_8px_rgba(167,169,174,0.15)]": selectedTabIndex !== 0,
|
|
||||||
})}
|
|
||||||
style={{
|
|
||||||
height: "calc(100% - 1px)",
|
|
||||||
width: `${100 / tabsList.length}%`,
|
|
||||||
transform: `translateX(${selectedTabIndex * 100}%)`,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
{tabsList.map((tab) => (
|
|
||||||
<Tab
|
|
||||||
key={tab.key}
|
|
||||||
className={cn(
|
|
||||||
"relative z-[1] font-semibold text-xs rounded py-1.5 text-custom-text-400 focus:outline-none",
|
|
||||||
"transition duration-500",
|
|
||||||
{
|
|
||||||
"text-custom-text-100 bg-custom-background-100": selectedTab === tab.key,
|
|
||||||
"hover:text-custom-text-300": selectedTab !== tab.key,
|
|
||||||
// // right shadow
|
|
||||||
// "shadow-[2px_0_8px_rgba(167,169,174,0.15)]": selectedTabIndex !== tabsList.length - 1,
|
|
||||||
// // left shadow
|
|
||||||
// "shadow-[-2px_0_8px_rgba(167,169,174,0.15)]": selectedTabIndex !== 0,
|
|
||||||
}
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<span className="scale-110">{tab.label}</span>
|
|
||||||
</Tab>
|
|
||||||
))}
|
|
||||||
</Tab.List>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -84,18 +84,16 @@ export const IssuesByPriorityWidget: React.FC<WidgetProps> = observer((props) =>
|
|||||||
filters,
|
filters,
|
||||||
});
|
});
|
||||||
|
|
||||||
const filterDates = getCustomDates(filters.target_date ?? widgetDetails.widget_filters.target_date ?? "none");
|
|
||||||
fetchWidgetStats(workspaceSlug, dashboardId, {
|
fetchWidgetStats(workspaceSlug, dashboardId, {
|
||||||
widget_key: WIDGET_KEY,
|
widget_key: WIDGET_KEY,
|
||||||
...(filterDates.trim() !== "" ? { target_date: filterDates } : {}),
|
target_date: getCustomDates(filters.target_date ?? widgetDetails.widget_filters.target_date ?? "this_week"),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const filterDates = getCustomDates(widgetDetails?.widget_filters.target_date ?? "none");
|
|
||||||
fetchWidgetStats(workspaceSlug, dashboardId, {
|
fetchWidgetStats(workspaceSlug, dashboardId, {
|
||||||
widget_key: WIDGET_KEY,
|
widget_key: WIDGET_KEY,
|
||||||
...(filterDates.trim() !== "" ? { target_date: filterDates } : {}),
|
target_date: getCustomDates(widgetDetails?.widget_filters.target_date ?? "this_week"),
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
@@ -131,15 +129,21 @@ export const IssuesByPriorityWidget: React.FC<WidgetProps> = observer((props) =>
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-custom-background-100 rounded-xl border-[0.5px] border-custom-border-200 w-full py-6 hover:shadow-custom-shadow-4xl duration-300 overflow-hidden min-h-96 flex flex-col">
|
<div className="bg-custom-background-100 rounded-xl border-[0.5px] border-custom-border-200 w-full py-6 hover:shadow-custom-shadow-4xl duration-300 overflow-hidden min-h-96 flex flex-col">
|
||||||
<div className="flex items-center justify-between gap-2 pl-7 pr-6">
|
<div className="flex items-start justify-between gap-2 pl-7 pr-6">
|
||||||
<Link
|
<div>
|
||||||
href={`/${workspaceSlug}/workspace-views/assigned`}
|
<Link
|
||||||
className="text-lg font-semibold text-custom-text-300 hover:underline"
|
href={`/${workspaceSlug}/workspace-views/assigned`}
|
||||||
>
|
className="text-lg font-semibold text-custom-text-300 hover:underline"
|
||||||
Assigned by priority
|
>
|
||||||
</Link>
|
Assigned by priority
|
||||||
|
</Link>
|
||||||
|
<p className="mt-3 text-xs font-medium text-custom-text-300">
|
||||||
|
Filtered by{" "}
|
||||||
|
<span className="border-[0.5px] border-custom-border-300 rounded py-1 px-2 ml-0.5">Due date</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<DurationFilterDropdown
|
<DurationFilterDropdown
|
||||||
value={widgetDetails.widget_filters.target_date ?? "none"}
|
value={widgetDetails.widget_filters.target_date ?? "this_week"}
|
||||||
onChange={(val) =>
|
onChange={(val) =>
|
||||||
handleUpdateFilters({
|
handleUpdateFilters({
|
||||||
target_date: val,
|
target_date: val,
|
||||||
|
|||||||
@@ -43,19 +43,17 @@ export const IssuesByStateGroupWidget: React.FC<WidgetProps> = observer((props)
|
|||||||
filters,
|
filters,
|
||||||
});
|
});
|
||||||
|
|
||||||
const filterDates = getCustomDates(filters.target_date ?? widgetDetails.widget_filters.target_date ?? "none");
|
|
||||||
fetchWidgetStats(workspaceSlug, dashboardId, {
|
fetchWidgetStats(workspaceSlug, dashboardId, {
|
||||||
widget_key: WIDGET_KEY,
|
widget_key: WIDGET_KEY,
|
||||||
...(filterDates.trim() !== "" ? { target_date: filterDates } : {}),
|
target_date: getCustomDates(filters.target_date ?? widgetDetails.widget_filters.target_date ?? "this_week"),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// fetch widget stats
|
// fetch widget stats
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const filterDates = getCustomDates(widgetDetails?.widget_filters.target_date ?? "none");
|
|
||||||
fetchWidgetStats(workspaceSlug, dashboardId, {
|
fetchWidgetStats(workspaceSlug, dashboardId, {
|
||||||
widget_key: WIDGET_KEY,
|
widget_key: WIDGET_KEY,
|
||||||
...(filterDates.trim() !== "" ? { target_date: filterDates } : {}),
|
target_date: getCustomDates(widgetDetails?.widget_filters.target_date ?? "this_week"),
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
@@ -74,14 +72,14 @@ export const IssuesByStateGroupWidget: React.FC<WidgetProps> = observer((props)
|
|||||||
startedCount > 0
|
startedCount > 0
|
||||||
? "started"
|
? "started"
|
||||||
: unStartedCount > 0
|
: unStartedCount > 0
|
||||||
? "unstarted"
|
? "unstarted"
|
||||||
: backlogCount > 0
|
: backlogCount > 0
|
||||||
? "backlog"
|
? "backlog"
|
||||||
: completedCount > 0
|
: completedCount > 0
|
||||||
? "completed"
|
? "completed"
|
||||||
: canceledCount > 0
|
: canceledCount > 0
|
||||||
? "cancelled"
|
? "cancelled"
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
setActiveStateGroup(stateGroup);
|
setActiveStateGroup(stateGroup);
|
||||||
setDefaultStateGroup(stateGroup);
|
setDefaultStateGroup(stateGroup);
|
||||||
@@ -130,15 +128,21 @@ export const IssuesByStateGroupWidget: React.FC<WidgetProps> = observer((props)
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-custom-background-100 rounded-xl border-[0.5px] border-custom-border-200 w-full py-6 hover:shadow-custom-shadow-4xl duration-300 overflow-hidden min-h-96 flex flex-col">
|
<div className="bg-custom-background-100 rounded-xl border-[0.5px] border-custom-border-200 w-full py-6 hover:shadow-custom-shadow-4xl duration-300 overflow-hidden min-h-96 flex flex-col">
|
||||||
<div className="flex items-center justify-between gap-2 pl-7 pr-6">
|
<div className="flex items-start justify-between gap-2 pl-7 pr-6">
|
||||||
<Link
|
<div>
|
||||||
href={`/${workspaceSlug}/workspace-views/assigned`}
|
<Link
|
||||||
className="text-lg font-semibold text-custom-text-300 hover:underline"
|
href={`/${workspaceSlug}/workspace-views/assigned`}
|
||||||
>
|
className="text-lg font-semibold text-custom-text-300 hover:underline"
|
||||||
Assigned by state
|
>
|
||||||
</Link>
|
Assigned by state
|
||||||
|
</Link>
|
||||||
|
<p className="mt-3 text-xs font-medium text-custom-text-300">
|
||||||
|
Filtered by{" "}
|
||||||
|
<span className="border-[0.5px] border-custom-border-300 rounded py-1 px-2 ml-0.5">Due date</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<DurationFilterDropdown
|
<DurationFilterDropdown
|
||||||
value={widgetDetails.widget_filters.target_date ?? "none"}
|
value={widgetDetails.widget_filters.target_date ?? "this_week"}
|
||||||
onChange={(val) =>
|
onChange={(val) =>
|
||||||
handleUpdateFilters({
|
handleUpdateFilters({
|
||||||
target_date: val,
|
target_date: val,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import Link from "next/link";
|
|||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { Plus } from "lucide-react";
|
import { Plus } from "lucide-react";
|
||||||
// hooks
|
// hooks
|
||||||
import { useApplication, useEventTracker, useDashboard, useProject, useUser } from "hooks/store";
|
import { useApplication, useDashboard, useProject, useUser } from "hooks/store";
|
||||||
// components
|
// components
|
||||||
import { WidgetLoader, WidgetProps } from "components/dashboard/widgets";
|
import { WidgetLoader, WidgetProps } from "components/dashboard/widgets";
|
||||||
// ui
|
// ui
|
||||||
@@ -72,7 +72,6 @@ export const RecentProjectsWidget: React.FC<WidgetProps> = observer((props) => {
|
|||||||
const {
|
const {
|
||||||
commandPalette: { toggleCreateProjectModal },
|
commandPalette: { toggleCreateProjectModal },
|
||||||
} = useApplication();
|
} = useApplication();
|
||||||
const { setTrackElement } = useEventTracker();
|
|
||||||
const {
|
const {
|
||||||
membership: { currentWorkspaceRole },
|
membership: { currentWorkspaceRole },
|
||||||
} = useUser();
|
} = useUser();
|
||||||
@@ -106,7 +105,6 @@ export const RecentProjectsWidget: React.FC<WidgetProps> = observer((props) => {
|
|||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
setTrackElement("Sidebar");
|
|
||||||
toggleCreateProjectModal(true);
|
toggleCreateProjectModal(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ export const DateDropdown: React.FC<Props> = (props) => {
|
|||||||
tabIndex={tabIndex}
|
tabIndex={tabIndex}
|
||||||
className={cn("h-full", className)}
|
className={cn("h-full", className)}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
disabled={disabled}
|
|
||||||
>
|
>
|
||||||
<Combobox.Button as={React.Fragment}>
|
<Combobox.Button as={React.Fragment}>
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import Link from "next/link";
|
|||||||
// hooks
|
// hooks
|
||||||
import {
|
import {
|
||||||
useApplication,
|
useApplication,
|
||||||
useEventTracker,
|
|
||||||
useCycle,
|
useCycle,
|
||||||
useLabel,
|
useLabel,
|
||||||
useMember,
|
useMember,
|
||||||
@@ -71,8 +70,8 @@ export const CycleIssuesHeader: React.FC = observer(() => {
|
|||||||
const { currentProjectCycleIds, getCycleById } = useCycle();
|
const { currentProjectCycleIds, getCycleById } = useCycle();
|
||||||
const {
|
const {
|
||||||
commandPalette: { toggleCreateIssueModal },
|
commandPalette: { toggleCreateIssueModal },
|
||||||
|
eventTracker: { setTrackElement },
|
||||||
} = useApplication();
|
} = useApplication();
|
||||||
const { setTrackElement } = useEventTracker();
|
|
||||||
const {
|
const {
|
||||||
membership: { currentProjectRole },
|
membership: { currentProjectRole },
|
||||||
} = useUser();
|
} = useUser();
|
||||||
@@ -239,7 +238,7 @@ export const CycleIssuesHeader: React.FC = observer(() => {
|
|||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setTrackElement("Cycle issues page");
|
setTrackElement("CYCLE_PAGE_HEADER");
|
||||||
toggleCreateIssueModal(true, EIssuesStoreType.CYCLE);
|
toggleCreateIssueModal(true, EIssuesStoreType.CYCLE);
|
||||||
}}
|
}}
|
||||||
size="sm"
|
size="sm"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useRouter } from "next/router";
|
|||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { Plus } from "lucide-react";
|
import { Plus } from "lucide-react";
|
||||||
// hooks
|
// hooks
|
||||||
import { useApplication, useEventTracker, useProject, useUser } from "hooks/store";
|
import { useApplication, useProject, useUser } from "hooks/store";
|
||||||
// ui
|
// ui
|
||||||
import { Breadcrumbs, Button, ContrastIcon } from "@plane/ui";
|
import { Breadcrumbs, Button, ContrastIcon } from "@plane/ui";
|
||||||
// helpers
|
// helpers
|
||||||
@@ -20,8 +20,8 @@ export const CyclesHeader: FC = observer(() => {
|
|||||||
// store hooks
|
// store hooks
|
||||||
const {
|
const {
|
||||||
commandPalette: { toggleCreateCycleModal },
|
commandPalette: { toggleCreateCycleModal },
|
||||||
|
eventTracker: { setTrackElement },
|
||||||
} = useApplication();
|
} = useApplication();
|
||||||
const { setTrackElement } = useEventTracker();
|
|
||||||
const {
|
const {
|
||||||
membership: { currentProjectRole },
|
membership: { currentProjectRole },
|
||||||
} = useUser();
|
} = useUser();
|
||||||
@@ -70,7 +70,7 @@ export const CyclesHeader: FC = observer(() => {
|
|||||||
size="sm"
|
size="sm"
|
||||||
prependIcon={<Plus />}
|
prependIcon={<Plus />}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setTrackElement("Cycles page");
|
setTrackElement("CYCLES_PAGE_HEADER");
|
||||||
toggleCreateCycleModal(true);
|
toggleCreateCycleModal(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import Link from "next/link";
|
|||||||
// hooks
|
// hooks
|
||||||
import {
|
import {
|
||||||
useApplication,
|
useApplication,
|
||||||
useEventTracker,
|
|
||||||
useLabel,
|
useLabel,
|
||||||
useMember,
|
useMember,
|
||||||
useModule,
|
useModule,
|
||||||
@@ -74,8 +73,8 @@ export const ModuleIssuesHeader: React.FC = observer(() => {
|
|||||||
const { projectModuleIds, getModuleById } = useModule();
|
const { projectModuleIds, getModuleById } = useModule();
|
||||||
const {
|
const {
|
||||||
commandPalette: { toggleCreateIssueModal },
|
commandPalette: { toggleCreateIssueModal },
|
||||||
|
eventTracker: { setTrackElement },
|
||||||
} = useApplication();
|
} = useApplication();
|
||||||
const { setTrackElement } = useEventTracker();
|
|
||||||
const {
|
const {
|
||||||
membership: { currentProjectRole },
|
membership: { currentProjectRole },
|
||||||
} = useUser();
|
} = useUser();
|
||||||
@@ -242,7 +241,7 @@ export const ModuleIssuesHeader: React.FC = observer(() => {
|
|||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setTrackElement("Module issues page");
|
setTrackElement("MODULE_PAGE_HEADER");
|
||||||
toggleCreateIssueModal(true, EIssuesStoreType.MODULE);
|
toggleCreateIssueModal(true, EIssuesStoreType.MODULE);
|
||||||
}}
|
}}
|
||||||
size="sm"
|
size="sm"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useRouter } from "next/router";
|
|||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { Plus } from "lucide-react";
|
import { Plus } from "lucide-react";
|
||||||
// hooks
|
// hooks
|
||||||
import { useApplication, useEventTracker, useProject, useUser } from "hooks/store";
|
import { useApplication, useProject, useUser } from "hooks/store";
|
||||||
import useLocalStorage from "hooks/use-local-storage";
|
import useLocalStorage from "hooks/use-local-storage";
|
||||||
// ui
|
// ui
|
||||||
import { Breadcrumbs, Button, Tooltip, DiceIcon } from "@plane/ui";
|
import { Breadcrumbs, Button, Tooltip, DiceIcon } from "@plane/ui";
|
||||||
@@ -21,7 +21,6 @@ export const ModulesListHeader: React.FC = observer(() => {
|
|||||||
const { workspaceSlug } = router.query;
|
const { workspaceSlug } = router.query;
|
||||||
// store hooks
|
// store hooks
|
||||||
const { commandPalette: commandPaletteStore } = useApplication();
|
const { commandPalette: commandPaletteStore } = useApplication();
|
||||||
const { setTrackElement } = useEventTracker();
|
|
||||||
const {
|
const {
|
||||||
membership: { currentProjectRole },
|
membership: { currentProjectRole },
|
||||||
} = useUser();
|
} = useUser();
|
||||||
@@ -91,10 +90,7 @@ export const ModulesListHeader: React.FC = observer(() => {
|
|||||||
variant="primary"
|
variant="primary"
|
||||||
size="sm"
|
size="sm"
|
||||||
prependIcon={<Plus />}
|
prependIcon={<Plus />}
|
||||||
onClick={() => {
|
onClick={() => commandPaletteStore.toggleCreateModuleModal(true)}
|
||||||
setTrackElement("Modules page");
|
|
||||||
commandPaletteStore.toggleCreateModuleModal(true);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
Add Module
|
Add Module
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -4,16 +4,7 @@ import { useRouter } from "next/router";
|
|||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { ArrowLeft, Briefcase, Circle, ExternalLink, Plus } from "lucide-react";
|
import { ArrowLeft, Briefcase, Circle, ExternalLink, Plus } from "lucide-react";
|
||||||
// hooks
|
// hooks
|
||||||
import {
|
import { useApplication, useLabel, useProject, useProjectState, useUser, useInbox, useMember } from "hooks/store";
|
||||||
useApplication,
|
|
||||||
useEventTracker,
|
|
||||||
useLabel,
|
|
||||||
useProject,
|
|
||||||
useProjectState,
|
|
||||||
useUser,
|
|
||||||
useInbox,
|
|
||||||
useMember,
|
|
||||||
} from "hooks/store";
|
|
||||||
// components
|
// components
|
||||||
import { DisplayFiltersSelection, FiltersDropdown, FilterSelection, LayoutSelection } from "components/issues";
|
import { DisplayFiltersSelection, FiltersDropdown, FilterSelection, LayoutSelection } from "components/issues";
|
||||||
import { ProjectAnalyticsModal } from "components/analytics";
|
import { ProjectAnalyticsModal } from "components/analytics";
|
||||||
@@ -45,8 +36,8 @@ export const ProjectIssuesHeader: React.FC = observer(() => {
|
|||||||
} = useIssues(EIssuesStoreType.PROJECT);
|
} = useIssues(EIssuesStoreType.PROJECT);
|
||||||
const {
|
const {
|
||||||
commandPalette: { toggleCreateIssueModal },
|
commandPalette: { toggleCreateIssueModal },
|
||||||
|
eventTracker: { setTrackElement },
|
||||||
} = useApplication();
|
} = useApplication();
|
||||||
const { setTrackElement } = useEventTracker();
|
|
||||||
const {
|
const {
|
||||||
membership: { currentProjectRole },
|
membership: { currentProjectRole },
|
||||||
} = useUser();
|
} = useUser();
|
||||||
@@ -230,7 +221,7 @@ export const ProjectIssuesHeader: React.FC = observer(() => {
|
|||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setTrackElement("Project issues page");
|
setTrackElement("PROJECT_PAGE_HEADER");
|
||||||
toggleCreateIssueModal(true, EIssuesStoreType.PROJECT);
|
toggleCreateIssueModal(true, EIssuesStoreType.PROJECT);
|
||||||
}}
|
}}
|
||||||
size="sm"
|
size="sm"
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import Link from "next/link";
|
|||||||
// hooks
|
// hooks
|
||||||
import {
|
import {
|
||||||
useApplication,
|
useApplication,
|
||||||
useEventTracker,
|
|
||||||
useIssues,
|
useIssues,
|
||||||
useLabel,
|
useLabel,
|
||||||
useMember,
|
useMember,
|
||||||
@@ -42,9 +41,9 @@ export const ProjectViewIssuesHeader: React.FC = observer(() => {
|
|||||||
const {
|
const {
|
||||||
issuesFilter: { issueFilters, updateFilters },
|
issuesFilter: { issueFilters, updateFilters },
|
||||||
} = useIssues(EIssuesStoreType.PROJECT_VIEW);
|
} = useIssues(EIssuesStoreType.PROJECT_VIEW);
|
||||||
const { setTrackElement } = useEventTracker();
|
|
||||||
const {
|
const {
|
||||||
commandPalette: { toggleCreateIssueModal },
|
commandPalette: { toggleCreateIssueModal },
|
||||||
|
eventTracker: { setTrackElement },
|
||||||
} = useApplication();
|
} = useApplication();
|
||||||
const {
|
const {
|
||||||
membership: { currentProjectRole },
|
membership: { currentProjectRole },
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { Search, Plus, Briefcase } from "lucide-react";
|
import { Search, Plus, Briefcase } from "lucide-react";
|
||||||
// hooks
|
// hooks
|
||||||
import { useApplication, useEventTracker, useProject, useUser } from "hooks/store";
|
import { useApplication, useProject, useUser } from "hooks/store";
|
||||||
// ui
|
// ui
|
||||||
import { Breadcrumbs, Button } from "@plane/ui";
|
import { Breadcrumbs, Button } from "@plane/ui";
|
||||||
// constants
|
// constants
|
||||||
@@ -12,8 +12,10 @@ import { BreadcrumbLink } from "components/common";
|
|||||||
|
|
||||||
export const ProjectsHeader = observer(() => {
|
export const ProjectsHeader = observer(() => {
|
||||||
// store hooks
|
// store hooks
|
||||||
const { commandPalette: commandPaletteStore } = useApplication();
|
const {
|
||||||
const { setTrackElement } = useEventTracker();
|
commandPalette: commandPaletteStore,
|
||||||
|
eventTracker: { setTrackElement },
|
||||||
|
} = useApplication();
|
||||||
const {
|
const {
|
||||||
membership: { currentWorkspaceRole },
|
membership: { currentWorkspaceRole },
|
||||||
} = useUser();
|
} = useUser();
|
||||||
@@ -51,7 +53,7 @@ export const ProjectsHeader = observer(() => {
|
|||||||
prependIcon={<Plus />}
|
prependIcon={<Plus />}
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setTrackElement("Projects page");
|
setTrackElement("PROJECTS_PAGE_HEADER");
|
||||||
commandPaletteStore.toggleCreateProjectModal(true);
|
commandPaletteStore.toggleCreateProjectModal(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { observer } from "mobx-react-lite";
|
|||||||
import DatePicker from "react-datepicker";
|
import DatePicker from "react-datepicker";
|
||||||
import { Popover } from "@headlessui/react";
|
import { Popover } from "@headlessui/react";
|
||||||
// hooks
|
// hooks
|
||||||
import { useUser, useInboxIssues, useIssueDetail, useWorkspace, useEventTracker } from "hooks/store";
|
import { useApplication, useUser, useInboxIssues, useIssueDetail, useWorkspace } from "hooks/store";
|
||||||
import useToast from "hooks/use-toast";
|
import useToast from "hooks/use-toast";
|
||||||
// components
|
// components
|
||||||
import {
|
import {
|
||||||
@@ -38,7 +38,9 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
|
|||||||
// router
|
// router
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
// hooks
|
// hooks
|
||||||
const { captureIssueEvent } = useEventTracker();
|
const {
|
||||||
|
eventTracker: { postHogEventTracker },
|
||||||
|
} = useApplication();
|
||||||
const { currentWorkspace } = useWorkspace();
|
const { currentWorkspace } = useWorkspace();
|
||||||
const {
|
const {
|
||||||
issues: { getInboxIssuesByInboxId, getInboxIssueByIssueId, updateInboxIssueStatus, removeInboxIssue },
|
issues: { getInboxIssuesByInboxId, getInboxIssueByIssueId, updateInboxIssueStatus, removeInboxIssue },
|
||||||
@@ -85,19 +87,17 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
|
|||||||
if (!workspaceSlug || !projectId || !inboxId || !inboxIssueId || !currentWorkspace)
|
if (!workspaceSlug || !projectId || !inboxId || !inboxIssueId || !currentWorkspace)
|
||||||
throw new Error("Missing required parameters");
|
throw new Error("Missing required parameters");
|
||||||
await removeInboxIssue(workspaceSlug, projectId, inboxId, inboxIssueId);
|
await removeInboxIssue(workspaceSlug, projectId, inboxId, inboxIssueId);
|
||||||
captureIssueEvent({
|
postHogEventTracker(
|
||||||
eventName: "Issue deleted",
|
"ISSUE_DELETED",
|
||||||
payload: {
|
{
|
||||||
id: inboxIssueId,
|
|
||||||
state: "SUCCESS",
|
state: "SUCCESS",
|
||||||
element: "Inbox page",
|
|
||||||
},
|
},
|
||||||
group: {
|
{
|
||||||
isGrouping: true,
|
isGrouping: true,
|
||||||
groupType: "Workspace_metrics",
|
groupType: "Workspace_metrics",
|
||||||
groupId: currentWorkspace?.id!,
|
groupId: currentWorkspace?.id!,
|
||||||
},
|
}
|
||||||
});
|
);
|
||||||
router.push({
|
router.push({
|
||||||
pathname: `/${workspaceSlug}/projects/${projectId}/inbox/${inboxId}`,
|
pathname: `/${workspaceSlug}/projects/${projectId}/inbox/${inboxId}`,
|
||||||
});
|
});
|
||||||
@@ -107,19 +107,17 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
|
|||||||
title: "Error!",
|
title: "Error!",
|
||||||
message: "Something went wrong while deleting inbox issue. Please try again.",
|
message: "Something went wrong while deleting inbox issue. Please try again.",
|
||||||
});
|
});
|
||||||
captureIssueEvent({
|
postHogEventTracker(
|
||||||
eventName: "Issue deleted",
|
"ISSUE_DELETED",
|
||||||
payload: {
|
{
|
||||||
id: inboxIssueId,
|
|
||||||
state: "FAILED",
|
state: "FAILED",
|
||||||
element: "Inbox page",
|
|
||||||
},
|
},
|
||||||
group: {
|
{
|
||||||
isGrouping: true,
|
isGrouping: true,
|
||||||
groupType: "Workspace_metrics",
|
groupType: "Workspace_metrics",
|
||||||
groupId: currentWorkspace?.id!,
|
groupId: currentWorkspace?.id!,
|
||||||
},
|
}
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
@@ -132,7 +130,7 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
|
|||||||
updateInboxIssueStatus,
|
updateInboxIssueStatus,
|
||||||
removeInboxIssue,
|
removeInboxIssue,
|
||||||
setToastAlert,
|
setToastAlert,
|
||||||
captureIssueEvent,
|
postHogEventTracker,
|
||||||
router,
|
router,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Controller, useForm } from "react-hook-form";
|
|||||||
import { RichTextEditorWithRef } from "@plane/rich-text-editor";
|
import { RichTextEditorWithRef } from "@plane/rich-text-editor";
|
||||||
import { Sparkle } from "lucide-react";
|
import { Sparkle } from "lucide-react";
|
||||||
// hooks
|
// hooks
|
||||||
import { useApplication, useEventTracker, useWorkspace, useInboxIssues, useMention } from "hooks/store";
|
import { useApplication, useWorkspace, useInboxIssues, useMention } from "hooks/store";
|
||||||
import useToast from "hooks/use-toast";
|
import useToast from "hooks/use-toast";
|
||||||
// services
|
// services
|
||||||
import { FileService } from "services/file.service";
|
import { FileService } from "services/file.service";
|
||||||
@@ -63,8 +63,8 @@ export const CreateInboxIssueModal: React.FC<Props> = observer((props) => {
|
|||||||
} = useInboxIssues();
|
} = useInboxIssues();
|
||||||
const {
|
const {
|
||||||
config: { envConfig },
|
config: { envConfig },
|
||||||
|
eventTracker: { postHogEventTracker },
|
||||||
} = useApplication();
|
} = useApplication();
|
||||||
const { captureIssueEvent } = useEventTracker();
|
|
||||||
const { currentWorkspace } = useWorkspace();
|
const { currentWorkspace } = useWorkspace();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -93,37 +93,32 @@ export const CreateInboxIssueModal: React.FC<Props> = observer((props) => {
|
|||||||
router.push(`/${workspaceSlug}/projects/${projectId}/inbox/${inboxId}?inboxIssueId=${res.id}`);
|
router.push(`/${workspaceSlug}/projects/${projectId}/inbox/${inboxId}?inboxIssueId=${res.id}`);
|
||||||
handleClose();
|
handleClose();
|
||||||
} else reset(defaultValues);
|
} else reset(defaultValues);
|
||||||
captureIssueEvent({
|
postHogEventTracker(
|
||||||
eventName: "Issue created",
|
"ISSUE_CREATED",
|
||||||
payload: {
|
{
|
||||||
...formData,
|
...res,
|
||||||
state: "SUCCESS",
|
state: "SUCCESS",
|
||||||
element: "Inbox page",
|
|
||||||
},
|
},
|
||||||
group: {
|
{
|
||||||
isGrouping: true,
|
isGrouping: true,
|
||||||
groupType: "Workspace_metrics",
|
groupType: "Workspace_metrics",
|
||||||
groupId: currentWorkspace?.id!,
|
groupId: currentWorkspace?.id!,
|
||||||
},
|
}
|
||||||
path: router.pathname,
|
);
|
||||||
});
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
captureIssueEvent({
|
postHogEventTracker(
|
||||||
eventName: "Issue created",
|
"ISSUE_CREATED",
|
||||||
payload: {
|
{
|
||||||
...formData,
|
|
||||||
state: "FAILED",
|
state: "FAILED",
|
||||||
element: "Inbox page",
|
|
||||||
},
|
},
|
||||||
group: {
|
{
|
||||||
isGrouping: true,
|
isGrouping: true,
|
||||||
groupType: "Workspace_metrics",
|
groupType: "Workspace_metrics",
|
||||||
groupId: currentWorkspace?.id!,
|
groupId: currentWorkspace?.id!,
|
||||||
},
|
}
|
||||||
path: router.pathname,
|
);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { observer } from "mobx-react-lite";
|
|||||||
import { useFormContext, Controller } from "react-hook-form";
|
import { useFormContext, Controller } from "react-hook-form";
|
||||||
import { Plus } from "lucide-react";
|
import { Plus } from "lucide-react";
|
||||||
// hooks
|
// hooks
|
||||||
import { useApplication, useEventTracker, useProject } from "hooks/store";
|
import { useApplication, useProject } from "hooks/store";
|
||||||
// components
|
// components
|
||||||
import { CustomSelect, Input } from "@plane/ui";
|
import { CustomSelect, Input } from "@plane/ui";
|
||||||
// helpers
|
// helpers
|
||||||
@@ -14,8 +14,10 @@ import { IJiraImporterForm } from "@plane/types";
|
|||||||
|
|
||||||
export const JiraGetImportDetail: React.FC = observer(() => {
|
export const JiraGetImportDetail: React.FC = observer(() => {
|
||||||
// store hooks
|
// store hooks
|
||||||
const { commandPalette: commandPaletteStore } = useApplication();
|
const {
|
||||||
const { setTrackElement } = useEventTracker();
|
commandPalette: commandPaletteStore,
|
||||||
|
eventTracker: { setTrackElement },
|
||||||
|
} = useApplication();
|
||||||
const { workspaceProjectIds, getProjectById } = useProject();
|
const { workspaceProjectIds, getProjectById } = useProject();
|
||||||
// form info
|
// form info
|
||||||
const {
|
const {
|
||||||
@@ -200,7 +202,7 @@ export const JiraGetImportDetail: React.FC = observer(() => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setTrackElement("Jira import detail page");
|
setTrackElement("JIRA_IMPORT_DETAIL");
|
||||||
commandPaletteStore.toggleCreateProjectModal(true);
|
commandPaletteStore.toggleCreateProjectModal(true);
|
||||||
}}
|
}}
|
||||||
className="flex cursor-pointer select-none items-center space-x-2 truncate rounded px-1 py-1.5 text-custom-text-200"
|
className="flex cursor-pointer select-none items-center space-x-2 truncate rounded px-1 py-1.5 text-custom-text-200"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { FC, useMemo } from "react";
|
import { FC, useMemo } from "react";
|
||||||
// hooks
|
// hooks
|
||||||
import { useEventTracker, useIssueDetail } from "hooks/store";
|
import { useIssueDetail } from "hooks/store";
|
||||||
import useToast from "hooks/use-toast";
|
import useToast from "hooks/use-toast";
|
||||||
// components
|
// components
|
||||||
import { IssueAttachmentUpload } from "./attachment-upload";
|
import { IssueAttachmentUpload } from "./attachment-upload";
|
||||||
@@ -23,7 +23,6 @@ export const IssueAttachmentRoot: FC<TIssueAttachmentRoot> = (props) => {
|
|||||||
const { workspaceSlug, projectId, issueId, disabled = false } = props;
|
const { workspaceSlug, projectId, issueId, disabled = false } = props;
|
||||||
// hooks
|
// hooks
|
||||||
const { createAttachment, removeAttachment } = useIssueDetail();
|
const { createAttachment, removeAttachment } = useIssueDetail();
|
||||||
const { captureIssueEvent } = useEventTracker();
|
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
|
|
||||||
const handleAttachmentOperations: TAttachmentOperations = useMemo(
|
const handleAttachmentOperations: TAttachmentOperations = useMemo(
|
||||||
@@ -31,25 +30,13 @@ export const IssueAttachmentRoot: FC<TIssueAttachmentRoot> = (props) => {
|
|||||||
create: async (data: FormData) => {
|
create: async (data: FormData) => {
|
||||||
try {
|
try {
|
||||||
if (!workspaceSlug || !projectId || !issueId) throw new Error("Missing required fields");
|
if (!workspaceSlug || !projectId || !issueId) throw new Error("Missing required fields");
|
||||||
const res = await createAttachment(workspaceSlug, projectId, issueId, data);
|
await createAttachment(workspaceSlug, projectId, issueId, data);
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
message: "The attachment has been successfully uploaded",
|
message: "The attachment has been successfully uploaded",
|
||||||
type: "success",
|
type: "success",
|
||||||
title: "Attachment uploaded",
|
title: "Attachment uploaded",
|
||||||
});
|
});
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Issue updated",
|
|
||||||
payload: { id: issueId, state: "SUCCESS", element: "Issue detail page" },
|
|
||||||
updates: {
|
|
||||||
changed_property: "attachment",
|
|
||||||
change_details: res.id,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Issue updated",
|
|
||||||
payload: { id: issueId, state: "FAILED", element: "Issue detail page" },
|
|
||||||
});
|
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
message: "The attachment could not be uploaded",
|
message: "The attachment could not be uploaded",
|
||||||
type: "error",
|
type: "error",
|
||||||
@@ -66,23 +53,7 @@ export const IssueAttachmentRoot: FC<TIssueAttachmentRoot> = (props) => {
|
|||||||
type: "success",
|
type: "success",
|
||||||
title: "Attachment removed",
|
title: "Attachment removed",
|
||||||
});
|
});
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Issue updated",
|
|
||||||
payload: { id: issueId, state: "SUCCESS", element: "Issue detail page" },
|
|
||||||
updates: {
|
|
||||||
changed_property: "attachment",
|
|
||||||
change_details: "",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Issue updated",
|
|
||||||
payload: { id: issueId, state: "FAILED", element: "Issue detail page" },
|
|
||||||
updates: {
|
|
||||||
changed_property: "attachment",
|
|
||||||
change_details: "",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
message: "The Attachment could not be removed",
|
message: "The Attachment could not be removed",
|
||||||
type: "error",
|
type: "error",
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import { FC, useMemo } from "react";
|
import { FC, useMemo } from "react";
|
||||||
import { useRouter } from "next/router";
|
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
// components
|
// components
|
||||||
import { InboxIssueMainContent } from "./main-content";
|
import { InboxIssueMainContent } from "./main-content";
|
||||||
import { InboxIssueDetailsSidebar } from "./sidebar";
|
import { InboxIssueDetailsSidebar } from "./sidebar";
|
||||||
// hooks
|
// hooks
|
||||||
import { useEventTracker, useInboxIssues, useIssueDetail, useUser } from "hooks/store";
|
import { useInboxIssues, useIssueDetail, useUser } from "hooks/store";
|
||||||
import useToast from "hooks/use-toast";
|
import useToast from "hooks/use-toast";
|
||||||
// types
|
// types
|
||||||
import { TIssue } from "@plane/types";
|
import { TIssue } from "@plane/types";
|
||||||
@@ -22,8 +21,6 @@ export type TInboxIssueDetailRoot = {
|
|||||||
|
|
||||||
export const InboxIssueDetailRoot: FC<TInboxIssueDetailRoot> = (props) => {
|
export const InboxIssueDetailRoot: FC<TInboxIssueDetailRoot> = (props) => {
|
||||||
const { workspaceSlug, projectId, inboxId, issueId } = props;
|
const { workspaceSlug, projectId, inboxId, issueId } = props;
|
||||||
// router
|
|
||||||
const router = useRouter();
|
|
||||||
// hooks
|
// hooks
|
||||||
const {
|
const {
|
||||||
issues: { fetchInboxIssueById, updateInboxIssue, removeInboxIssue },
|
issues: { fetchInboxIssueById, updateInboxIssue, removeInboxIssue },
|
||||||
@@ -31,7 +28,6 @@ export const InboxIssueDetailRoot: FC<TInboxIssueDetailRoot> = (props) => {
|
|||||||
const {
|
const {
|
||||||
issue: { getIssueById },
|
issue: { getIssueById },
|
||||||
} = useIssueDetail();
|
} = useIssueDetail();
|
||||||
const { captureIssueEvent } = useEventTracker();
|
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
const {
|
const {
|
||||||
membership: { currentProjectRole },
|
membership: { currentProjectRole },
|
||||||
@@ -54,7 +50,7 @@ export const InboxIssueDetailRoot: FC<TInboxIssueDetailRoot> = (props) => {
|
|||||||
showToast: boolean = true
|
showToast: boolean = true
|
||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
const response = await updateInboxIssue(workspaceSlug, projectId, inboxId, issueId, data);
|
await updateInboxIssue(workspaceSlug, projectId, inboxId, issueId, data);
|
||||||
if (showToast) {
|
if (showToast) {
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Issue updated successfully",
|
title: "Issue updated successfully",
|
||||||
@@ -62,30 +58,12 @@ export const InboxIssueDetailRoot: FC<TInboxIssueDetailRoot> = (props) => {
|
|||||||
message: "Issue updated successfully",
|
message: "Issue updated successfully",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Inbox issue updated",
|
|
||||||
payload: { ...response, state: "SUCCESS", element: "Inbox" },
|
|
||||||
updates: {
|
|
||||||
changed_property: Object.keys(data).join(","),
|
|
||||||
change_details: Object.values(data).join(","),
|
|
||||||
},
|
|
||||||
path: router.asPath,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Issue update failed",
|
title: "Issue update failed",
|
||||||
type: "error",
|
type: "error",
|
||||||
message: "Issue update failed",
|
message: "Issue update failed",
|
||||||
});
|
});
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Inbox issue updated",
|
|
||||||
payload: { state: "SUCCESS", element: "Inbox" },
|
|
||||||
updates: {
|
|
||||||
changed_property: Object.keys(data).join(","),
|
|
||||||
change_details: Object.values(data).join(","),
|
|
||||||
},
|
|
||||||
path: router.asPath,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
remove: async (workspaceSlug: string, projectId: string, issueId: string) => {
|
remove: async (workspaceSlug: string, projectId: string, issueId: string) => {
|
||||||
@@ -96,17 +74,7 @@ export const InboxIssueDetailRoot: FC<TInboxIssueDetailRoot> = (props) => {
|
|||||||
type: "success",
|
type: "success",
|
||||||
message: "Issue deleted successfully",
|
message: "Issue deleted successfully",
|
||||||
});
|
});
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Inbox issue deleted",
|
|
||||||
payload: { id: issueId, state: "SUCCESS", element: "Inbox" },
|
|
||||||
path: router.asPath,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Inbox issue deleted",
|
|
||||||
payload: { id: issueId, state: "FAILED", element: "Inbox" },
|
|
||||||
path: router.asPath,
|
|
||||||
});
|
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Issue delete failed",
|
title: "Issue delete failed",
|
||||||
type: "error",
|
type: "error",
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { EmptyState } from "components/common";
|
|||||||
// images
|
// images
|
||||||
import emptyIssue from "public/empty-state/issue.svg";
|
import emptyIssue from "public/empty-state/issue.svg";
|
||||||
// hooks
|
// hooks
|
||||||
import { useEventTracker, useIssueDetail, useIssues, useUser } from "hooks/store";
|
import { useIssueDetail, useIssues, useUser } from "hooks/store";
|
||||||
import useToast from "hooks/use-toast";
|
import useToast from "hooks/use-toast";
|
||||||
// types
|
// types
|
||||||
import { TIssue } from "@plane/types";
|
import { TIssue } from "@plane/types";
|
||||||
@@ -70,7 +70,6 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = (props) => {
|
|||||||
const {
|
const {
|
||||||
issues: { removeIssue: removeArchivedIssue },
|
issues: { removeIssue: removeArchivedIssue },
|
||||||
} = useIssues(EIssuesStoreType.ARCHIVED);
|
} = useIssues(EIssuesStoreType.ARCHIVED);
|
||||||
const { captureIssueEvent } = useEventTracker();
|
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
const {
|
const {
|
||||||
membership: { currentProjectRole },
|
membership: { currentProjectRole },
|
||||||
@@ -93,7 +92,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = (props) => {
|
|||||||
showToast: boolean = true
|
showToast: boolean = true
|
||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
const response = await updateIssue(workspaceSlug, projectId, issueId, data);
|
await updateIssue(workspaceSlug, projectId, issueId, data);
|
||||||
if (showToast) {
|
if (showToast) {
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Issue updated successfully",
|
title: "Issue updated successfully",
|
||||||
@@ -101,25 +100,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = (props) => {
|
|||||||
message: "Issue updated successfully",
|
message: "Issue updated successfully",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Issue updated",
|
|
||||||
payload: { ...response, state: "SUCCESS", element: "Issue detail page" },
|
|
||||||
updates: {
|
|
||||||
changed_property: Object.keys(data).join(","),
|
|
||||||
change_details: Object.values(data).join(","),
|
|
||||||
},
|
|
||||||
path: router.asPath,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Issue updated",
|
|
||||||
payload: { state: "FAILED", element: "Issue detail page" },
|
|
||||||
updates: {
|
|
||||||
changed_property: Object.keys(data).join(","),
|
|
||||||
change_details: Object.values(data).join(","),
|
|
||||||
},
|
|
||||||
path: router.asPath,
|
|
||||||
});
|
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Issue update failed",
|
title: "Issue update failed",
|
||||||
type: "error",
|
type: "error",
|
||||||
@@ -129,59 +110,30 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = (props) => {
|
|||||||
},
|
},
|
||||||
remove: async (workspaceSlug: string, projectId: string, issueId: string) => {
|
remove: async (workspaceSlug: string, projectId: string, issueId: string) => {
|
||||||
try {
|
try {
|
||||||
let response;
|
if (is_archived) await removeArchivedIssue(workspaceSlug, projectId, issueId);
|
||||||
if (is_archived) response = await removeArchivedIssue(workspaceSlug, projectId, issueId);
|
else await removeIssue(workspaceSlug, projectId, issueId);
|
||||||
else response = await removeIssue(workspaceSlug, projectId, issueId);
|
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Issue deleted successfully",
|
title: "Issue deleted successfully",
|
||||||
type: "success",
|
type: "success",
|
||||||
message: "Issue deleted successfully",
|
message: "Issue deleted successfully",
|
||||||
});
|
});
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Issue deleted",
|
|
||||||
payload: { id: issueId, state: "SUCCESS", element: "Issue detail page" },
|
|
||||||
path: router.asPath,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Issue delete failed",
|
title: "Issue delete failed",
|
||||||
type: "error",
|
type: "error",
|
||||||
message: "Issue delete failed",
|
message: "Issue delete failed",
|
||||||
});
|
});
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Issue deleted",
|
|
||||||
payload: { id: issueId, state: "FAILED", element: "Issue detail page" },
|
|
||||||
path: router.asPath,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addIssueToCycle: async (workspaceSlug: string, projectId: string, cycleId: string, issueIds: string[]) => {
|
addIssueToCycle: async (workspaceSlug: string, projectId: string, cycleId: string, issueIds: string[]) => {
|
||||||
try {
|
try {
|
||||||
const response = await addIssueToCycle(workspaceSlug, projectId, cycleId, issueIds);
|
await addIssueToCycle(workspaceSlug, projectId, cycleId, issueIds);
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Cycle added to issue successfully",
|
title: "Cycle added to issue successfully",
|
||||||
type: "success",
|
type: "success",
|
||||||
message: "Issue added to issue successfully",
|
message: "Issue added to issue successfully",
|
||||||
});
|
});
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Issue updated",
|
|
||||||
payload: { ...response, state: "SUCCESS", element: "Issue detail page" },
|
|
||||||
updates: {
|
|
||||||
changed_property: "cycle_id",
|
|
||||||
change_details: cycleId,
|
|
||||||
},
|
|
||||||
path: router.asPath,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Issue updated",
|
|
||||||
payload: { state: "FAILED", element: "Issue detail page" },
|
|
||||||
updates: {
|
|
||||||
changed_property: "cycle_id",
|
|
||||||
change_details: cycleId,
|
|
||||||
},
|
|
||||||
path: router.asPath,
|
|
||||||
});
|
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Cycle add to issue failed",
|
title: "Cycle add to issue failed",
|
||||||
type: "error",
|
type: "error",
|
||||||
@@ -191,31 +143,13 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = (props) => {
|
|||||||
},
|
},
|
||||||
removeIssueFromCycle: async (workspaceSlug: string, projectId: string, cycleId: string, issueId: string) => {
|
removeIssueFromCycle: async (workspaceSlug: string, projectId: string, cycleId: string, issueId: string) => {
|
||||||
try {
|
try {
|
||||||
const response = await removeIssueFromCycle(workspaceSlug, projectId, cycleId, issueId);
|
await removeIssueFromCycle(workspaceSlug, projectId, cycleId, issueId);
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Cycle removed from issue successfully",
|
title: "Cycle removed from issue successfully",
|
||||||
type: "success",
|
type: "success",
|
||||||
message: "Cycle removed from issue successfully",
|
message: "Cycle removed from issue successfully",
|
||||||
});
|
});
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Issue updated",
|
|
||||||
payload: { ...response, state: "SUCCESS", element: "Issue detail page" },
|
|
||||||
updates: {
|
|
||||||
changed_property: "cycle_id",
|
|
||||||
change_details: "",
|
|
||||||
},
|
|
||||||
path: router.asPath,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Issue updated",
|
|
||||||
payload: { state: "FAILED", element: "Issue detail page" },
|
|
||||||
updates: {
|
|
||||||
changed_property: "cycle_id",
|
|
||||||
change_details: "",
|
|
||||||
},
|
|
||||||
path: router.asPath,
|
|
||||||
});
|
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Cycle remove from issue failed",
|
title: "Cycle remove from issue failed",
|
||||||
type: "error",
|
type: "error",
|
||||||
@@ -225,31 +159,13 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = (props) => {
|
|||||||
},
|
},
|
||||||
addModulesToIssue: async (workspaceSlug: string, projectId: string, issueId: string, moduleIds: string[]) => {
|
addModulesToIssue: async (workspaceSlug: string, projectId: string, issueId: string, moduleIds: string[]) => {
|
||||||
try {
|
try {
|
||||||
const response = await addModulesToIssue(workspaceSlug, projectId, issueId, moduleIds);
|
await addModulesToIssue(workspaceSlug, projectId, issueId, moduleIds);
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Module added to issue successfully",
|
title: "Module added to issue successfully",
|
||||||
type: "success",
|
type: "success",
|
||||||
message: "Module added to issue successfully",
|
message: "Module added to issue successfully",
|
||||||
});
|
});
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Issue updated",
|
|
||||||
payload: { ...response, state: "SUCCESS", element: "Issue detail page" },
|
|
||||||
updates: {
|
|
||||||
changed_property: "module_id",
|
|
||||||
change_details: moduleIds,
|
|
||||||
},
|
|
||||||
path: router.asPath,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Issue updated",
|
|
||||||
payload: { id: issueId, state: "FAILED", element: "Issue detail page" },
|
|
||||||
updates: {
|
|
||||||
changed_property: "module_id",
|
|
||||||
change_details: moduleIds,
|
|
||||||
},
|
|
||||||
path: router.asPath,
|
|
||||||
});
|
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Module add to issue failed",
|
title: "Module add to issue failed",
|
||||||
type: "error",
|
type: "error",
|
||||||
@@ -265,25 +181,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = (props) => {
|
|||||||
type: "success",
|
type: "success",
|
||||||
message: "Module removed from issue successfully",
|
message: "Module removed from issue successfully",
|
||||||
});
|
});
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Issue updated",
|
|
||||||
payload: { id: issueId, state: "SUCCESS", element: "Issue detail page" },
|
|
||||||
updates: {
|
|
||||||
changed_property: "module_id",
|
|
||||||
change_details: "",
|
|
||||||
},
|
|
||||||
path: router.asPath,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Issue updated",
|
|
||||||
payload: { id: issueId, state: "FAILED", element: "Issue detail page" },
|
|
||||||
updates: {
|
|
||||||
changed_property: "module_id",
|
|
||||||
change_details: "",
|
|
||||||
},
|
|
||||||
path: router.asPath,
|
|
||||||
});
|
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Module remove from issue failed",
|
title: "Module remove from issue failed",
|
||||||
type: "error",
|
type: "error",
|
||||||
|
|||||||
@@ -11,12 +11,11 @@ import { TGroupedIssues, TIssue } from "@plane/types";
|
|||||||
import { IQuickActionProps } from "../list/list-view-types";
|
import { IQuickActionProps } from "../list/list-view-types";
|
||||||
import { EIssueActions } from "../types";
|
import { EIssueActions } from "../types";
|
||||||
import { handleDragDrop } from "./utils";
|
import { handleDragDrop } from "./utils";
|
||||||
import { useIssues, useUser } from "hooks/store";
|
import { useIssues } from "hooks/store";
|
||||||
import { ICycleIssues, ICycleIssuesFilter } from "store/issue/cycle";
|
import { ICycleIssues, ICycleIssuesFilter } from "store/issue/cycle";
|
||||||
import { IModuleIssues, IModuleIssuesFilter } from "store/issue/module";
|
import { IModuleIssues, IModuleIssuesFilter } from "store/issue/module";
|
||||||
import { IProjectIssues, IProjectIssuesFilter } from "store/issue/project";
|
import { IProjectIssues, IProjectIssuesFilter } from "store/issue/project";
|
||||||
import { IProjectViewIssues, IProjectViewIssuesFilter } from "store/issue/project-views";
|
import { IProjectViewIssues, IProjectViewIssuesFilter } from "store/issue/project-views";
|
||||||
import { EUserProjectRoles } from "constants/project";
|
|
||||||
|
|
||||||
interface IBaseCalendarRoot {
|
interface IBaseCalendarRoot {
|
||||||
issueStore: IProjectIssues | IModuleIssues | ICycleIssues | IProjectViewIssues;
|
issueStore: IProjectIssues | IModuleIssues | ICycleIssues | IProjectViewIssues;
|
||||||
@@ -28,11 +27,10 @@ interface IBaseCalendarRoot {
|
|||||||
[EIssueActions.REMOVE]?: (issue: TIssue) => Promise<void>;
|
[EIssueActions.REMOVE]?: (issue: TIssue) => Promise<void>;
|
||||||
};
|
};
|
||||||
viewId?: string;
|
viewId?: string;
|
||||||
isCompletedCycle?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const BaseCalendarRoot = observer((props: IBaseCalendarRoot) => {
|
export const BaseCalendarRoot = observer((props: IBaseCalendarRoot) => {
|
||||||
const { issueStore, issuesFilterStore, QuickActions, issueActions, viewId, isCompletedCycle = false } = props;
|
const { issueStore, issuesFilterStore, QuickActions, issueActions, viewId } = props;
|
||||||
|
|
||||||
// router
|
// router
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -41,11 +39,6 @@ export const BaseCalendarRoot = observer((props: IBaseCalendarRoot) => {
|
|||||||
// hooks
|
// hooks
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
const { issueMap } = useIssues();
|
const { issueMap } = useIssues();
|
||||||
const {
|
|
||||||
membership: { currentProjectRole },
|
|
||||||
} = useUser();
|
|
||||||
|
|
||||||
const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER;
|
|
||||||
|
|
||||||
const displayFilters = issuesFilterStore.issueFilters?.displayFilters;
|
const displayFilters = issuesFilterStore.issueFilters?.displayFilters;
|
||||||
|
|
||||||
@@ -114,12 +107,10 @@ export const BaseCalendarRoot = observer((props: IBaseCalendarRoot) => {
|
|||||||
? async () => handleIssues(issue.target_date ?? "", issue, EIssueActions.REMOVE)
|
? async () => handleIssues(issue.target_date ?? "", issue, EIssueActions.REMOVE)
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
readOnly={!isEditingAllowed || isCompletedCycle}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
quickAddCallback={issueStore.quickAddIssue}
|
quickAddCallback={issueStore.quickAddIssue}
|
||||||
viewId={viewId}
|
viewId={viewId}
|
||||||
readOnly={!isEditingAllowed || isCompletedCycle}
|
|
||||||
/>
|
/>
|
||||||
</DragDropContext>
|
</DragDropContext>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -31,21 +31,11 @@ type Props = {
|
|||||||
viewId?: string
|
viewId?: string
|
||||||
) => Promise<TIssue | undefined>;
|
) => Promise<TIssue | undefined>;
|
||||||
viewId?: string;
|
viewId?: string;
|
||||||
readOnly?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CalendarChart: React.FC<Props> = observer((props) => {
|
export const CalendarChart: React.FC<Props> = observer((props) => {
|
||||||
const {
|
const { issuesFilterStore, issues, groupedIssueIds, layout, showWeekends, quickActions, quickAddCallback, viewId } =
|
||||||
issuesFilterStore,
|
props;
|
||||||
issues,
|
|
||||||
groupedIssueIds,
|
|
||||||
layout,
|
|
||||||
showWeekends,
|
|
||||||
quickActions,
|
|
||||||
quickAddCallback,
|
|
||||||
viewId,
|
|
||||||
readOnly = false,
|
|
||||||
} = props;
|
|
||||||
// store hooks
|
// store hooks
|
||||||
const {
|
const {
|
||||||
issues: { viewFlags },
|
issues: { viewFlags },
|
||||||
@@ -90,7 +80,6 @@ export const CalendarChart: React.FC<Props> = observer((props) => {
|
|||||||
quickActions={quickActions}
|
quickActions={quickActions}
|
||||||
quickAddCallback={quickAddCallback}
|
quickAddCallback={quickAddCallback}
|
||||||
viewId={viewId}
|
viewId={viewId}
|
||||||
readOnly={readOnly}
|
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -106,7 +95,6 @@ export const CalendarChart: React.FC<Props> = observer((props) => {
|
|||||||
quickActions={quickActions}
|
quickActions={quickActions}
|
||||||
quickAddCallback={quickAddCallback}
|
quickAddCallback={quickAddCallback}
|
||||||
viewId={viewId}
|
viewId={viewId}
|
||||||
readOnly={readOnly}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ type Props = {
|
|||||||
viewId?: string
|
viewId?: string
|
||||||
) => Promise<TIssue | undefined>;
|
) => Promise<TIssue | undefined>;
|
||||||
viewId?: string;
|
viewId?: string;
|
||||||
readOnly?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CalendarDayTile: React.FC<Props> = observer((props) => {
|
export const CalendarDayTile: React.FC<Props> = observer((props) => {
|
||||||
@@ -42,7 +41,6 @@ export const CalendarDayTile: React.FC<Props> = observer((props) => {
|
|||||||
disableIssueCreation,
|
disableIssueCreation,
|
||||||
quickAddCallback,
|
quickAddCallback,
|
||||||
viewId,
|
viewId,
|
||||||
readOnly = false,
|
|
||||||
} = props;
|
} = props;
|
||||||
const [showAllIssues, setShowAllIssues] = useState(false);
|
const [showAllIssues, setShowAllIssues] = useState(false);
|
||||||
const calendarLayout = issuesFilterStore?.issueFilters?.displayFilters?.calendar?.layout ?? "month";
|
const calendarLayout = issuesFilterStore?.issueFilters?.displayFilters?.calendar?.layout ?? "month";
|
||||||
@@ -75,7 +73,7 @@ export const CalendarDayTile: React.FC<Props> = observer((props) => {
|
|||||||
|
|
||||||
{/* content */}
|
{/* content */}
|
||||||
<div className="h-full w-full">
|
<div className="h-full w-full">
|
||||||
<Droppable droppableId={formattedDatePayload} isDropDisabled={readOnly}>
|
<Droppable droppableId={formattedDatePayload} isDropDisabled={false}>
|
||||||
{(provided, snapshot) => (
|
{(provided, snapshot) => (
|
||||||
<div
|
<div
|
||||||
className={`h-full w-full select-none overflow-y-auto ${
|
className={`h-full w-full select-none overflow-y-auto ${
|
||||||
@@ -91,10 +89,9 @@ export const CalendarDayTile: React.FC<Props> = observer((props) => {
|
|||||||
issueIdList={issueIdList}
|
issueIdList={issueIdList}
|
||||||
quickActions={quickActions}
|
quickActions={quickActions}
|
||||||
showAllIssues={showAllIssues}
|
showAllIssues={showAllIssues}
|
||||||
isDragDisabled={readOnly}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{enableQuickIssueCreate && !disableIssueCreation && !readOnly && (
|
{enableQuickIssueCreate && !disableIssueCreation && (
|
||||||
<div className="px-2 py-1">
|
<div className="px-2 py-1">
|
||||||
<CalendarQuickAddIssueForm
|
<CalendarQuickAddIssueForm
|
||||||
formKey="target_date"
|
formKey="target_date"
|
||||||
|
|||||||
@@ -17,11 +17,10 @@ type Props = {
|
|||||||
issueIdList: string[] | null;
|
issueIdList: string[] | null;
|
||||||
quickActions: (issue: TIssue, customActionButton?: React.ReactElement) => React.ReactNode;
|
quickActions: (issue: TIssue, customActionButton?: React.ReactElement) => React.ReactNode;
|
||||||
showAllIssues?: boolean;
|
showAllIssues?: boolean;
|
||||||
isDragDisabled?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CalendarIssueBlocks: React.FC<Props> = observer((props) => {
|
export const CalendarIssueBlocks: React.FC<Props> = observer((props) => {
|
||||||
const { issues, issueIdList, quickActions, showAllIssues = false, isDragDisabled = false } = props;
|
const { issues, issueIdList, quickActions, showAllIssues = false } = props;
|
||||||
// hooks
|
// hooks
|
||||||
const {
|
const {
|
||||||
router: { workspaceSlug, projectId },
|
router: { workspaceSlug, projectId },
|
||||||
@@ -66,7 +65,7 @@ export const CalendarIssueBlocks: React.FC<Props> = observer((props) => {
|
|||||||
getProjectStates(issue?.project_id)?.find((state) => state?.id == issue?.state_id)?.color || "";
|
getProjectStates(issue?.project_id)?.find((state) => state?.id == issue?.state_id)?.color || "";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Draggable key={issue.id} draggableId={issue.id} index={index} isDragDisabled={isDragDisabled}>
|
<Draggable key={issue.id} draggableId={issue.id} index={index}>
|
||||||
{(provided, snapshot) => (
|
{(provided, snapshot) => (
|
||||||
<div
|
<div
|
||||||
className="relative cursor-pointer p-1 px-2"
|
className="relative cursor-pointer p-1 px-2"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useRouter } from "next/router";
|
|||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
// hooks
|
// hooks
|
||||||
import { useEventTracker, useProject } from "hooks/store";
|
import { useProject } from "hooks/store";
|
||||||
import useToast from "hooks/use-toast";
|
import useToast from "hooks/use-toast";
|
||||||
import useKeypress from "hooks/use-keypress";
|
import useKeypress from "hooks/use-keypress";
|
||||||
import useOutsideClickDetector from "hooks/use-outside-click-detector";
|
import useOutsideClickDetector from "hooks/use-outside-click-detector";
|
||||||
@@ -64,7 +64,6 @@ export const CalendarQuickAddIssueForm: React.FC<Props> = observer((props) => {
|
|||||||
const { workspaceSlug, projectId } = router.query;
|
const { workspaceSlug, projectId } = router.query;
|
||||||
// store hooks
|
// store hooks
|
||||||
const { getProjectById } = useProject();
|
const { getProjectById } = useProject();
|
||||||
const { captureIssueEvent } = useEventTracker();
|
|
||||||
// refs
|
// refs
|
||||||
const ref = useRef<HTMLDivElement>(null);
|
const ref = useRef<HTMLDivElement>(null);
|
||||||
// states
|
// states
|
||||||
@@ -127,13 +126,7 @@ export const CalendarQuickAddIssueForm: React.FC<Props> = observer((props) => {
|
|||||||
...payload,
|
...payload,
|
||||||
},
|
},
|
||||||
viewId
|
viewId
|
||||||
).then((res) => {
|
));
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Issue created",
|
|
||||||
payload: { ...res, state: "SUCCESS", element: "Calendar quick add" },
|
|
||||||
path: router.asPath,
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "success",
|
type: "success",
|
||||||
title: "Success!",
|
title: "Success!",
|
||||||
@@ -141,11 +134,6 @@ export const CalendarQuickAddIssueForm: React.FC<Props> = observer((props) => {
|
|||||||
});
|
});
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
captureIssueEvent({
|
|
||||||
eventName: "Issue created",
|
|
||||||
payload: { ...payload, state: "FAILED", element: "Calendar quick add" },
|
|
||||||
path: router.asPath,
|
|
||||||
});
|
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "error",
|
type: "error",
|
||||||
title: "Error!",
|
title: "Error!",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
//hooks
|
//hooks
|
||||||
import { useCycle, useIssues } from "hooks/store";
|
import { useIssues } from "hooks/store";
|
||||||
// components
|
// components
|
||||||
import { CycleIssueQuickActions } from "components/issues";
|
import { CycleIssueQuickActions } from "components/issues";
|
||||||
// types
|
// types
|
||||||
@@ -13,7 +13,6 @@ import { useMemo } from "react";
|
|||||||
|
|
||||||
export const CycleCalendarLayout: React.FC = observer(() => {
|
export const CycleCalendarLayout: React.FC = observer(() => {
|
||||||
const { issues, issuesFilter } = useIssues(EIssuesStoreType.CYCLE);
|
const { issues, issuesFilter } = useIssues(EIssuesStoreType.CYCLE);
|
||||||
const { currentProjectCompletedCycleIds } = useCycle();
|
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug, projectId, cycleId } = router.query;
|
const { workspaceSlug, projectId, cycleId } = router.query;
|
||||||
@@ -39,9 +38,6 @@ export const CycleCalendarLayout: React.FC = observer(() => {
|
|||||||
|
|
||||||
if (!cycleId) return null;
|
if (!cycleId) return null;
|
||||||
|
|
||||||
const isCompletedCycle =
|
|
||||||
cycleId && currentProjectCompletedCycleIds ? currentProjectCompletedCycleIds.includes(cycleId.toString()) : false;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BaseCalendarRoot
|
<BaseCalendarRoot
|
||||||
issueStore={issues}
|
issueStore={issues}
|
||||||
@@ -49,7 +45,6 @@ export const CycleCalendarLayout: React.FC = observer(() => {
|
|||||||
QuickActions={CycleIssueQuickActions}
|
QuickActions={CycleIssueQuickActions}
|
||||||
issueActions={issueActions}
|
issueActions={issueActions}
|
||||||
viewId={cycleId.toString()}
|
viewId={cycleId.toString()}
|
||||||
isCompletedCycle={isCompletedCycle}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ type Props = {
|
|||||||
viewId?: string
|
viewId?: string
|
||||||
) => Promise<TIssue | undefined>;
|
) => Promise<TIssue | undefined>;
|
||||||
viewId?: string;
|
viewId?: string;
|
||||||
readOnly?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CalendarWeekDays: React.FC<Props> = observer((props) => {
|
export const CalendarWeekDays: React.FC<Props> = observer((props) => {
|
||||||
@@ -40,7 +39,6 @@ export const CalendarWeekDays: React.FC<Props> = observer((props) => {
|
|||||||
disableIssueCreation,
|
disableIssueCreation,
|
||||||
quickAddCallback,
|
quickAddCallback,
|
||||||
viewId,
|
viewId,
|
||||||
readOnly = false,
|
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const calendarLayout = issuesFilterStore?.issueFilters?.displayFilters?.calendar?.layout ?? "month";
|
const calendarLayout = issuesFilterStore?.issueFilters?.displayFilters?.calendar?.layout ?? "month";
|
||||||
@@ -69,7 +67,6 @@ export const CalendarWeekDays: React.FC<Props> = observer((props) => {
|
|||||||
disableIssueCreation={disableIssueCreation}
|
disableIssueCreation={disableIssueCreation}
|
||||||
quickAddCallback={quickAddCallback}
|
quickAddCallback={quickAddCallback}
|
||||||
viewId={viewId}
|
viewId={viewId}
|
||||||
readOnly={readOnly}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user