Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: frontend #483

Draft
wants to merge 46 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
e166450
fixup analysis
c0rydoras Oct 4, 2024
9fb69f7
fix(backend): improve comment search performance
c0rydoras Sep 17, 2024
100d8df
chore(deps-dev): bump ruff from 0.6.5 to 0.6.6 in /backend (#474)
dependabot[bot] Sep 20, 2024
e59dbc8
fix(backend/mail-templates): use 'd F Y' instead of m/d/Y
c0rydoras Sep 25, 2024
a34352a
feat(frontend/durationpicker-day): auto format time
c0rydoras Sep 25, 2024
47409b1
chore(deps-dev): bump ruff from 0.6.6 to 0.6.8 in /backend
dependabot[bot] Sep 27, 2024
d13dce4
chore(deps): bump psycopg from 3.2.2 to 3.2.3 in /backend
dependabot[bot] Sep 30, 2024
23942e3
chore(frontend): use ember-apply to bootstrap tailwind
c0rydoras Sep 30, 2024
6fa88af
chore(frontend): use postcss for tailwind
c0rydoras Oct 1, 2024
b075502
chore(frontend): delete scss styles
c0rydoras Oct 1, 2024
0eebacc
chore(frontend): setup styles (structure) and add base styles
c0rydoras Oct 2, 2024
80cc280
fix(frontend): style slider
c0rydoras Oct 2, 2024
f369c7d
fix(frontend): style timed-clock
c0rydoras Oct 2, 2024
23f2c2e
fix(frontend): style topnav
c0rydoras Oct 2, 2024
b4d98bd
fix(frontend): style power-select and basic-dropdown
c0rydoras Oct 1, 2024
554f164
fix(frontend): style tracking bar
c0rydoras Oct 1, 2024
4264a35
fix(frontend): style buttons
c0rydoras Oct 2, 2024
d154bf6
fix(frontend): style optimized-power-select
c0rydoras Oct 2, 2024
afb1e92
chore(frontend/styles): add striped utility
c0rydoras Oct 2, 2024
0ebea36
fix(frontend): added toggle component
c0rydoras Oct 2, 2024
2d0b4d5
fix(frontend): added checkbox component
c0rydoras Oct 2, 2024
289c6d1
fix(frontend): style weekly-overview
c0rydoras Oct 2, 2024
9f72c2e
fix(frontend): style report-row
c0rydoras Oct 2, 2024
1572980
fix(frontend): added Empty component
c0rydoras Oct 2, 2024
9d5c7e8
fix(frontend): style date-navigation
c0rydoras Oct 2, 2024
251d0ad
fix(frontend): add nav-tabs components
c0rydoras Oct 2, 2024
bc26167
fix(frontend): style /reports
c0rydoras Oct 2, 2024
9aa14dc
fix(frontend): style /login
c0rydoras Oct 2, 2024
c66d1fc
fix(frontend): style projects
c0rydoras Oct 2, 2024
b3347f0
fix(frontend): style index/template.hbs
c0rydoras Oct 2, 2024
64c9554
fix(frontend): style /attendances
c0rydoras Oct 2, 2024
59e3820
fix(frontend): style /activities (still buggy)
c0rydoras Oct 2, 2024
642611c
fix(frontend): style /analysis
c0rydoras Oct 2, 2024
55a30e5
fix(frontend): style task selection
c0rydoras Oct 2, 2024
66b5e2f
fix(frontend): style magic-link-modal
c0rydoras Oct 2, 2024
e3fd213
fix(frontend): style time and durationpicker
c0rydoras Oct 2, 2024
b51e87c
fix(frontend): style alerts
c0rydoras Oct 2, 2024
8d273e9
chore(frontend): update ember-validated-form to v7
c0rydoras Oct 3, 2024
30530f9
fix(frontend): style scroll-container
c0rydoras Oct 3, 2024
316c768
fix(frontend): style filter-sidebar
c0rydoras Oct 3, 2024
38bed9d
fix(frontend): style remaining-effort input
c0rydoras Oct 3, 2024
c4990f2
chore(frontend): add pointer-events-all utility class
c0rydoras Oct 3, 2024
264473d
fix(frontend): style sort-header
c0rydoras Oct 3, 2024
c4812a0
fix(frontend): style loading-icon
c0rydoras Oct 3, 2024
7a689a7
fix(frontend): style user-selection
c0rydoras Oct 4, 2024
37abeff
fix(frontend): style /statistics (not finished)
c0rydoras Oct 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 91 additions & 91 deletions backend/poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ sentry-sdk = "^2.14.0"
whitenoise = "^6.7.0"
django-hurricane = "^1.6.0"
openpyxl = "3.0.10" # TODO: dependency of `pyexcel-xlsx` Remove as soon as https://github.com/pyexcel/pyexcel-xlsx/issues/52 is resolved.
psycopg = {extras = ["binary"], version = "^3.2.2"}
psycopg = {extras = ["binary"], version = "^3.2.3"}

[tool.poetry.group.dev.dependencies]
ruff = "^0.6.5"
ruff = "^0.6.8"
coverage = "7.6.1"
django-extensions = "3.2.3"
factory-boy = "3.3.1"
Expand Down
8 changes: 7 additions & 1 deletion backend/timed/tracking/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from functools import wraps
from typing import TYPE_CHECKING

from django.contrib.postgres.search import SearchQuery
from django.db.models import Q
from django_filters.constants import EMPTY_VALUES
from django_filters.rest_framework import (
Expand Down Expand Up @@ -113,7 +114,7 @@ class ReportFilterSet(FilterSet):
user = NumberFilter(field_name="user_id")
cost_center = NumberFilter(method="filter_cost_center")
rejected = NumberFilter(field_name="rejected")
comment = CharFilter(field_name="comment", lookup_expr="search")
comment = CharFilter(method="filter_comment")

def filter_has_reviewer(
self, queryset: QuerySet[models.Report], _name: str, value: int
Expand Down Expand Up @@ -231,6 +232,11 @@ def filter_cost_center(
| Q(task__project__cost_center=value) & Q(task__cost_center__isnull=True)
)

def filter_comment(
self, queryset: QuerySet[models.Report], _name: str, value: str
) -> QuerySet[models.Report]:
return queryset.filter(search_vector=SearchQuery(value, config="english"))

class Meta:
"""Meta information for the report filter set."""

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 4.2.16 on 2024-09-17 08:50

import django.contrib.postgres.indexes
import django.contrib.postgres.search
from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('tracking', '0018_report_search_vector_idx'),
]

operations = [
migrations.RemoveIndex(
model_name='report',
name='search_vector_idx',
),
migrations.AddField(
model_name='report',
name='search_vector',
field=django.contrib.postgres.search.SearchVectorField(null=True),
),
migrations.AddIndex(
model_name='report',
index=django.contrib.postgres.indexes.GinIndex(fields=['search_vector'], name='tracking_re_search__35ab7c_gin'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from django.contrib.postgres.search import SearchVector
from django.db import migrations


def compute_search_vector(apps, schema_editor):
Report = apps.get_model("tracking", "Report")
Report.objects.update(search_vector=SearchVector("comment"))


class Migration(migrations.Migration):
dependencies = [
(
"tracking",
"0019_remove_report_search_vector_idx_report_search_vector_and_more",
),
]

operations = [
migrations.RunPython(
compute_search_vector, reverse_code=migrations.RunPython.noop
),
]
9 changes: 4 additions & 5 deletions backend/timed/tracking/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from django.conf import settings
from django.contrib.postgres.indexes import GinIndex
from django.contrib.postgres.search import SearchVector
from django.contrib.postgres.search import SearchVectorField
from django.db import models

from timed.utils import round_timedelta
Expand Down Expand Up @@ -100,15 +100,14 @@ class Report(models.Model):
rejected = models.BooleanField(default=False)
remaining_effort = models.DurationField(default=timedelta(0), null=True)

search_vector = SearchVectorField(null=True)

class Meta:
"""Meta information for the report model."""

indexes = (
models.Index(fields=["date"]),
GinIndex(
SearchVector("comment", config="english"),
name="search_vector_idx",
),
GinIndex(fields=["search_vector"]),
)

def __str__(self) -> str:
Expand Down
9 changes: 8 additions & 1 deletion backend/timed/tracking/signals.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.db.models import Sum
from django.contrib.postgres.search import SearchVector
from django.db.models import Sum, Value
from django.db.models.signals import pre_save
from django.dispatch import receiver

Expand All @@ -15,6 +16,12 @@ def update_rejected_on_reports(sender, instance, **kwargs): # noqa: ARG001
instance.rejected = False


@receiver(pre_save, sender=Report)
def update_search_vector(sender, instance, **kwargs): # noqa: ARG001
"""Update comment search vector."""
instance.search_vector = SearchVector(Value(instance.comment), config="english")


@receiver(pre_save, sender=Report)
def update_most_recent_remaining_effort(sender, instance, **kwargs): # noqa: ARG001
"""Update remaining effort on task, if remaining effort tracking is active.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Some of your reports have been changed.
Reviewer: {{reviewer.first_name }} {{ reviewer.last_name }}
{% for changeset in user_changes %}

Date: {{ changeset.report.date|date:"SHORT_DATE_FORMAT" }}
Date: {{ changeset.report.date|date:"d F Y" }}
Duration: {{ changeset.report.duration|duration }}
{% if "task" not in changeset.changes %}Task: {{ changeset.report.task }}{% endif %}
{% if "comment" not in changeset.changes %}Comment: {{ changeset.report.comment }}{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ the reports to the correct project / task.
Reviewer: {{reviewer.first_name }} {{ reviewer.last_name }}
{% for changeset in user_changes %}

Date: {{ changeset.report.date|date:"SHORT_DATE_FORMAT" }}
Date: {{ changeset.report.date|date:"d F Y" }}
Duration: {{ changeset.report.duration|duration }}
Task: {{ changeset.report.task }}
Comment: {{ changeset.report.comment }}
Expand Down
8 changes: 4 additions & 4 deletions backend/timed/tracking/tests/__snapshots__/test_report.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Reviewer: Test User


Date: 10/03/1998
Date: 03 October 1998
Duration: 3:15 (h:mm)


Expand All @@ -22,7 +22,7 @@

---

Date: 05/27/2000
Date: 27 May 2000
Duration: 2:30 (h:mm)

Comment: some other comment
Expand All @@ -33,7 +33,7 @@

---

Date: 04/20/2005
Date: 20 April 2005
Duration: 0:15 (h:mm)
Task: Allen Inc > Cross-platform content-based synergy > LLC
Comment: some other comment
Expand All @@ -44,7 +44,7 @@

---

Date: 03/23/2016
Date: 23 March 2016
Duration: 1:00 (h:mm)
Task: Allen Inc > Cross-platform content-based synergy > LLC

Expand Down
Loading
Loading