-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from SmartReports/dev
Dev
- Loading branch information
Showing
20 changed files
with
606 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
{ | ||
"cSpell.words": [ | ||
"smartreport" | ||
] | ||
"kpis", | ||
"smartreport", | ||
"uids" | ||
], | ||
"editor.inlineSuggest.showToolbar": "always" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
from django.contrib import admin | ||
from .models import ( | ||
Kpi, | ||
ReportTemplate, | ||
ReportTemplatePage, | ||
ReportTemplateImage, | ||
KpiReportElement, | ||
Alarm, | ||
DashboardLayout | ||
) | ||
|
||
|
||
class KpiReportElementInline(admin.TabularInline): | ||
model = KpiReportElement | ||
extra = 1 | ||
|
||
|
||
class ReportTemplatePageInline(admin.TabularInline): | ||
model = ReportTemplatePage | ||
extra = 1 | ||
show_change_link = True | ||
inlines = [KpiReportElementInline] | ||
|
||
@admin.register(Kpi) | ||
class KpiAdmin(admin.ModelAdmin): | ||
list_display = ("kb_name",) | ||
search_fields = ("kb_name",) | ||
|
||
|
||
@admin.register(ReportTemplate) | ||
class ReportTemplateAdmin(admin.ModelAdmin): | ||
list_display = ("id", "name", "frequency") | ||
list_filter = ("frequency",) | ||
inlines = [ReportTemplatePageInline] | ||
|
||
|
||
@admin.register(ReportTemplatePage) | ||
class ReportTemplatePageAdmin(admin.ModelAdmin): | ||
list_display = ("report_template", "layout") | ||
list_filter = ("layout",) | ||
inlines = [KpiReportElementInline] | ||
|
||
|
||
@admin.register(KpiReportElement) | ||
class KpiReportElementAdmin(admin.ModelAdmin): | ||
list_display = ("report_page", "kpis", "chart_type") | ||
list_filter = ("chart_type",) | ||
|
||
|
||
@admin.register(Alarm) | ||
class AlarmAdmin(admin.ModelAdmin): | ||
list_display = ("id", "user_type", "kpi", "min_value", "max_value") | ||
list_filter = ("user_type", "kpi") | ||
search_fields = ("user_type", "kpi__name") | ||
|
||
def get_kpi_name(self, obj): | ||
return obj.kpi.name | ||
|
||
get_kpi_name.short_description = "KPI Name" | ||
|
||
@admin.register(DashboardLayout) | ||
class DashboardLayoutAdmin(admin.ModelAdmin): | ||
list_display = ('id', 'user_type', 'layout') # Fields to display in the list view | ||
list_filter = ("user_type", ) | ||
search_fields = ('user_type',) # Fields to enable searching in the admin interface | ||
|
||
@admin.register(ReportTemplateImage) | ||
class ReportTemplateImageAdmin(admin.ModelAdmin): | ||
list_display = ('id', 'user_type', 'report_id', 'img') | ||
list_filter = ('report_id', 'user_type') | ||
search_fields = ('report_id', 'user_type') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
smartreport_app/migrations/0004_archivedreport_user_type.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 4.2.7 on 2023-11-23 14:29 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('smartreport_app', '0003_dashboardlayout_display'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='archivedreport', | ||
name='user_type', | ||
field=models.CharField(choices=[('doctor', 'Doctor'), ('parent', 'Parent'), ('project_manager', 'Project Manager'), ('machine_maintainer', 'Machine Maintainer')], default='doctor', max_length=128), | ||
preserve_default=False, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 4.2.7 on 2023-11-23 15:51 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('smartreport_app', '0003_dashboardlayout_display'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='ReportTemplateImage', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('user_type', models.CharField(choices=[('doctor', 'Doctor'), ('parent', 'Parent'), ('project_manager', 'Project Manager'), ('machine_maintainer', 'Machine Maintainer')], max_length=128)), | ||
('img', models.TextField(null=True)), | ||
('report_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='smartreport_app.reporttemplate')), | ||
], | ||
), | ||
] |
68 changes: 68 additions & 0 deletions
68
...treport_app/migrations/0005_rename_name_kpi_kb_id_remove_kpireportelement_kpi_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Generated by Django 4.2.7 on 2023-11-23 15:31 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import smartreport_app.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('smartreport_app', '0004_archivedreport_user_type'), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name='kpi', | ||
old_name='name', | ||
new_name='kb_id', | ||
), | ||
migrations.RemoveField( | ||
model_name='kpireportelement', | ||
name='kpi', | ||
), | ||
migrations.AddField( | ||
model_name='kpi', | ||
name='kb_counter', | ||
field=models.IntegerField(default=0), | ||
), | ||
migrations.AddField( | ||
model_name='kpi', | ||
name='kb_description', | ||
field=models.TextField(blank=True), | ||
), | ||
migrations.AddField( | ||
model_name='kpi', | ||
name='kb_formula', | ||
field=models.TextField(blank=True), | ||
), | ||
migrations.AddField( | ||
model_name='kpi', | ||
name='kb_name', | ||
field=models.CharField(default='default_value', max_length=255), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name='kpi', | ||
name='kb_source', | ||
field=models.CharField(blank=True, max_length=255), | ||
), | ||
migrations.AddField( | ||
model_name='kpi', | ||
name='kb_unit', | ||
field=models.CharField(blank=True, max_length=255), | ||
), | ||
migrations.AlterField( | ||
model_name='kpi', | ||
name='user_type', | ||
field=models.JSONField(default=smartreport_app.models.DEFAULT_USER_CHOICES), | ||
), | ||
migrations.CreateModel( | ||
name='KpiReportElementKpi', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('kpi', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='appears_in', to='smartreport_app.kpi')), | ||
('kpiReportElement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='kpis', to='smartreport_app.kpireportelement')), | ||
], | ||
), | ||
] |
26 changes: 26 additions & 0 deletions
26
smartreport_app/migrations/0006_email_archivedreport_sent.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 4.2.7 on 2023-11-23 16:49 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('smartreport_app', '0005_rename_name_kpi_kb_id_remove_kpireportelement_kpi_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Email', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('user_type', models.CharField(choices=[('doctor', 'Doctor'), ('parent', 'Parent'), ('project_manager', 'Project Manager'), ('machine_maintainer', 'Machine Maintainer')], max_length=128)), | ||
('emails', models.JSONField()), | ||
], | ||
), | ||
migrations.AddField( | ||
model_name='archivedreport', | ||
name='sent', | ||
field=models.BooleanField(default=False), | ||
), | ||
] |
24 changes: 24 additions & 0 deletions
24
smartreport_app/migrations/0007_alter_kpi_allowed_charts_alter_kpi_user_type.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 4.2.7 on 2023-11-24 09:12 | ||
|
||
from django.db import migrations, models | ||
import smartreport_app.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('smartreport_app', '0006_email_archivedreport_sent'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='kpi', | ||
name='allowed_charts', | ||
field=models.JSONField(blank=True, default=smartreport_app.models.DEFAULT_CHART_CHOICES, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='kpi', | ||
name='user_type', | ||
field=models.JSONField(blank=True, default=smartreport_app.models.DEFAULT_USER_CHOICES, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Generated by Django 4.2.7 on 2023-11-24 12:55 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('smartreport_app', '0004_reporttemplateimage'), | ||
('smartreport_app', '0007_alter_kpi_allowed_charts_alter_kpi_user_type'), | ||
] | ||
|
||
operations = [ | ||
] |
50 changes: 50 additions & 0 deletions
50
smartreport_app/migrations/0009_rename_kb_id_kpi_kb_uid_remove_kpi_kb_source_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Generated by Django 4.2.7 on 2023-11-24 15:44 | ||
|
||
from django.db import migrations, models | ||
import django.utils.timezone | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('smartreport_app', '0008_merge_20231124_1255'), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name='kpi', | ||
old_name='kb_id', | ||
new_name='kb_uid', | ||
), | ||
migrations.RemoveField( | ||
model_name='kpi', | ||
name='kb_source', | ||
), | ||
migrations.AddField( | ||
model_name='kpi', | ||
name='created', | ||
field=models.DateTimeField(blank=True, default=django.utils.timezone.now), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name='kpi', | ||
name='kb_frequency', | ||
field=models.CharField(blank=True, max_length=255), | ||
), | ||
migrations.AddField( | ||
model_name='kpi', | ||
name='kb_range', | ||
field=models.CharField(blank=True, max_length=255), | ||
), | ||
migrations.AddField( | ||
model_name='kpi', | ||
name='kb_taxonomy', | ||
field=models.TextField(blank=True), | ||
), | ||
migrations.AddField( | ||
model_name='reporttemplate', | ||
name='created', | ||
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), | ||
preserve_default=False, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2.7 on 2023-11-24 16:40 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('smartreport_app', '0009_rename_kb_id_kpi_kb_uid_remove_kpi_kb_source_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='kpi', | ||
name='isNew', | ||
), | ||
] |
Oops, something went wrong.