feat: dashboard widgets (#3362)
* fix: created dashboard, widgets and dashboard widget model * fix: new user home dashboard * chore: recent projects list * chore: recent collaborators * chore: priority order change * chore: payload changes * chore: collaborator's active issue count * chore: all dashboard widgets added with services and typs * chore: centered metric for pie chart * chore: widget filters * chore: created issue filter * fix: created and assigned issues payload change * chore: created issue payload change * fix: date filter change * chore: implement filters * fix: added expansion fields * fix: changed issue structure with relation * chore: new issues response * fix: project member fix * chore: updated issue_relation structure * chore: code cleanup * chore: update issues response and added empty states * fix: button text wrap * chore: update empty state messages * fix: filters * chore: update dark mode empty states * build-error: Type check in the issue relation service * fix: issues redirection * fix: project empty state * chore: project member active check * chore: project member check in state and priority * chore: remove console logs and replace harcoded values with constants * fix: code refactoring * fix: key name changed * refactor: mapping through similar components using an array * fix: build errors --------- Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com> Co-authored-by: gurusainath <gurusainath007@gmail.com>
This commit is contained in:
parent
f347c1cd69
commit
c9337d4a41
122 changed files with 6790 additions and 849 deletions
97
apiserver/plane/db/migrations/0055_auto_20240108_0648.py
Normal file
97
apiserver/plane/db/migrations/0055_auto_20240108_0648.py
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
# Generated by Django 4.2.7 on 2024-01-08 06:48
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def create_widgets(apps, schema_editor):
|
||||
Widget = apps.get_model("db", "Widget")
|
||||
widgets_list = [
|
||||
{"key": "overview_stats", "filters": {}},
|
||||
{
|
||||
"key": "assigned_issues",
|
||||
"filters": {
|
||||
"duration": "this_week",
|
||||
"tab": "upcoming",
|
||||
},
|
||||
},
|
||||
{
|
||||
"key": "created_issues",
|
||||
"filters": {
|
||||
"duration": "this_week",
|
||||
"tab": "upcoming",
|
||||
},
|
||||
},
|
||||
{
|
||||
"key": "issues_by_state_groups",
|
||||
"filters": {
|
||||
"duration": "this_week",
|
||||
},
|
||||
},
|
||||
{
|
||||
"key": "issues_by_priority",
|
||||
"filters": {
|
||||
"duration": "this_week",
|
||||
},
|
||||
},
|
||||
{"key": "recent_activity", "filters": {}},
|
||||
{"key": "recent_projects", "filters": {}},
|
||||
{"key": "recent_collaborators", "filters": {}},
|
||||
]
|
||||
Widget.objects.bulk_create(
|
||||
[
|
||||
Widget(
|
||||
key=widget["key"],
|
||||
filters=widget["filters"],
|
||||
)
|
||||
for widget in widgets_list
|
||||
],
|
||||
batch_size=10,
|
||||
)
|
||||
|
||||
|
||||
def create_dashboards(apps, schema_editor):
|
||||
Dashboard = apps.get_model("db", "Dashboard")
|
||||
User = apps.get_model("db", "User")
|
||||
Dashboard.objects.bulk_create(
|
||||
[
|
||||
Dashboard(
|
||||
name="Home dashboard",
|
||||
description_html="<p></p>",
|
||||
identifier=None,
|
||||
owned_by_id=user_id,
|
||||
type_identifier="home",
|
||||
is_default=True,
|
||||
)
|
||||
for user_id in User.objects.values_list('id', flat=True)
|
||||
],
|
||||
batch_size=2000,
|
||||
)
|
||||
|
||||
|
||||
def create_dashboard_widgets(apps, schema_editor):
|
||||
Widget = apps.get_model("db", "Widget")
|
||||
Dashboard = apps.get_model("db", "Dashboard")
|
||||
DashboardWidget = apps.get_model("db", "DashboardWidget")
|
||||
|
||||
updated_dashboard_widget = [
|
||||
DashboardWidget(
|
||||
widget_id=widget_id,
|
||||
dashboard_id=dashboard_id,
|
||||
)
|
||||
for widget_id in Widget.objects.values_list('id', flat=True)
|
||||
for dashboard_id in Dashboard.objects.values_list('id', flat=True)
|
||||
]
|
||||
|
||||
DashboardWidget.objects.bulk_create(updated_dashboard_widget, batch_size=2000)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("db", "0054_dashboard_widget_dashboardwidget"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(create_widgets),
|
||||
migrations.RunPython(create_dashboards),
|
||||
migrations.RunPython(create_dashboard_widgets),
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue