diff --git a/roundabout/assemblies/migrations/0012_auto_20210609_0619.py b/roundabout/assemblies/migrations/0012_auto_20210609_0619.py new file mode 100644 index 000000000..d1fb6fbaf --- /dev/null +++ b/roundabout/assemblies/migrations/0012_auto_20210609_0619.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.3 on 2021-06-09 06:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('assemblies', '0011_auto_20201117_2030'), + ] + + operations = [ + migrations.AlterField( + model_name='assemblydocument', + name='doc_link', + field=models.URLField(max_length=1000), + ), + ] diff --git a/roundabout/assemblies/models.py b/roundabout/assemblies/models.py index eca4e74bf..bedc5652f 100644 --- a/roundabout/assemblies/models.py +++ b/roundabout/assemblies/models.py @@ -111,7 +111,7 @@ class AssemblyDocument(models.Model): ) name = models.CharField(max_length=255, unique=False) doc_type = models.CharField(max_length=20, choices=DOC_TYPES) - doc_link = models.CharField(max_length=1000) + doc_link = models.URLField(max_length=1000) assembly_revision = models.ForeignKey( AssemblyRevision, related_name="assembly_documents", diff --git a/roundabout/builds/migrations/0022_auto_20210609_0619.py b/roundabout/builds/migrations/0022_auto_20210609_0619.py new file mode 100644 index 000000000..3e5ab8a15 --- /dev/null +++ b/roundabout/builds/migrations/0022_auto_20210609_0619.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.3 on 2021-06-09 06:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('builds', '0021_buildhyperlink'), + ] + + operations = [ + migrations.AlterField( + model_name='buildhyperlink', + name='url', + field=models.URLField(max_length=1000), + ), + ] diff --git a/roundabout/builds/models.py b/roundabout/builds/models.py index 57085e0ff..75602064d 100644 --- a/roundabout/builds/models.py +++ b/roundabout/builds/models.py @@ -120,7 +120,7 @@ def location_changed(self): class BuildHyperlink(models.Model): text = models.CharField(max_length=255, unique=False, blank=False, null=False) - url = models.CharField(max_length=1000) + url = models.URLField(max_length=1000) parent = models.ForeignKey(Build, related_name='hyperlinks', on_delete=models.CASCADE, null=False, blank=False) diff --git a/roundabout/calibrations/migrations/0030_auto_20210609_0619.py b/roundabout/calibrations/migrations/0030_auto_20210609_0619.py new file mode 100644 index 000000000..d5da1ed69 --- /dev/null +++ b/roundabout/calibrations/migrations/0030_auto_20210609_0619.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.3 on 2021-06-09 06:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('calibrations', '0029_coefficientnameevent_assembly_part'), + ] + + operations = [ + migrations.AlterField( + model_name='calibrationeventhyperlink', + name='url', + field=models.URLField(max_length=1000), + ), + ] diff --git a/roundabout/calibrations/models.py b/roundabout/calibrations/models.py index 24c8e923d..8137c5286 100644 --- a/roundabout/calibrations/models.py +++ b/roundabout/calibrations/models.py @@ -61,7 +61,7 @@ def get_valid_calibration_range(self): class CalibrationEventHyperlink(models.Model): text = models.CharField(max_length=255, unique=False, blank=False, null=False) - url = models.CharField(max_length=1000) + url = models.URLField(max_length=1000) parent = models.ForeignKey(CalibrationEvent, related_name='hyperlinks', on_delete=models.CASCADE, null=False, blank=False) diff --git a/roundabout/configs_constants/migrations/0024_auto_20210609_0619.py b/roundabout/configs_constants/migrations/0024_auto_20210609_0619.py new file mode 100644 index 000000000..cff6c076c --- /dev/null +++ b/roundabout/configs_constants/migrations/0024_auto_20210609_0619.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.3 on 2021-06-09 06:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('configs_constants', '0023_auto_20210426_1537'), + ] + + operations = [ + migrations.AlterField( + model_name='configeventhyperlink', + name='url', + field=models.URLField(max_length=1000), + ), + ] diff --git a/roundabout/configs_constants/models.py b/roundabout/configs_constants/models.py index a24c4386d..ba1979cf4 100644 --- a/roundabout/configs_constants/models.py +++ b/roundabout/configs_constants/models.py @@ -55,7 +55,7 @@ def get_latest_deployment_date(self): class ConfigEventHyperlink(models.Model): text = models.CharField(max_length=255, unique=False, blank=False, null=False) - url = models.CharField(max_length=1000) + url = models.URLField(max_length=1000) parent = models.ForeignKey(ConfigEvent, related_name='hyperlinks', on_delete=models.CASCADE, null=False, blank=False) diff --git a/roundabout/cruises/migrations/0020_auto_20210609_0619.py b/roundabout/cruises/migrations/0020_auto_20210609_0619.py new file mode 100644 index 000000000..1776baa57 --- /dev/null +++ b/roundabout/cruises/migrations/0020_auto_20210609_0619.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.3 on 2021-06-09 06:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cruises', '0019_merge_20210209_1909'), + ] + + operations = [ + migrations.AlterField( + model_name='cruisehyperlink', + name='url', + field=models.URLField(max_length=1000), + ), + ] diff --git a/roundabout/cruises/models.py b/roundabout/cruises/models.py index e321c7633..650c536df 100644 --- a/roundabout/cruises/models.py +++ b/roundabout/cruises/models.py @@ -142,7 +142,7 @@ def get_actions(self): class CruiseHyperlink(models.Model): text = models.CharField(max_length=255, unique=False) - url = models.CharField(max_length=1000) + url = models.URLField(max_length=1000) parent = models.ForeignKey( Cruise, related_name="hyperlinks", diff --git a/roundabout/exports/views.py b/roundabout/exports/views.py index a0c72843d..653c9dcb4 100644 --- a/roundabout/exports/views.py +++ b/roundabout/exports/views.py @@ -176,6 +176,7 @@ class ExportCalibrationEvents(ZipExport): @classmethod def build_zip(cls, zf, objs, subdir=None): objs = objs.select_related('inventory__part__part_type').exclude(inventory__part__part_type__ccc_toggle=False) + objs = objs.select_related('inventory__location').exclude(inventory__location__root_type='Trash') objs = objs.prefetch_related('inventory', 'inventory__fieldvalues', 'inventory__fieldvalues__field') for cal in objs: @@ -231,6 +232,7 @@ class ExportConfigEvents(ZipExport): @classmethod def build_zip(cls, zf, objs, subdir=None): objs = objs.select_related('inventory__part__part_type').exclude(inventory__part__part_type__ccc_toggle=False) + objs = objs.select_related('inventory__location').exclude(inventory__location__root_type='Trash') objs = objs.prefetch_related('inventory', 'inventory__fieldvalues', 'inventory__fieldvalues__field') for confconst in objs: diff --git a/roundabout/inventory/migrations/0068_auto_20210609_0619.py b/roundabout/inventory/migrations/0068_auto_20210609_0619.py new file mode 100644 index 000000000..e7b079f5d --- /dev/null +++ b/roundabout/inventory/migrations/0068_auto_20210609_0619.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.3 on 2021-06-09 06:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('inventory', '0067_merge_20210429_1740'), + ] + + operations = [ + migrations.AlterField( + model_name='inventoryhyperlink', + name='url', + field=models.URLField(max_length=1000), + ), + ] diff --git a/roundabout/inventory/models.py b/roundabout/inventory/models.py index 21ef3737a..f892ef307 100644 --- a/roundabout/inventory/models.py +++ b/roundabout/inventory/models.py @@ -210,7 +210,7 @@ def get_latest_deployment(self): class InventoryHyperlink(models.Model): text = models.CharField(max_length=255, unique=False, blank=False, null=False) - url = models.CharField(max_length=1000) + url = models.URLField(max_length=1000) parent = models.ForeignKey( Inventory, related_name="hyperlinks", diff --git a/roundabout/search/tables.py b/roundabout/search/tables.py index 619e24747..fffffe90a 100644 --- a/roundabout/search/tables.py +++ b/roundabout/search/tables.py @@ -275,7 +275,7 @@ def render_object(self,record): class CalibrationTable(SearchTable): class Meta(SearchTable.Meta): model = CalibrationEvent - fields = ['inventory__serial_number','inventory__part__name','calibration_date','deployment','approved','user_approver__all__name','user_draft__all__name','created_at'] + fields = ['inventory__serial_number','inventory__part__name','inventory__location','calibration_date','deployment','approved','user_approver__all__name','user_draft__all__name','created_at'] base_shown_cols = ['inventory__serial_number','calibration_date','approved'] inventory__serial_number = Column(verbose_name='Inventory SN', attrs={'style':'white-space: nowrap;'}, @@ -300,7 +300,7 @@ class Meta(SearchTable.Meta): class ConfigConstTable(SearchTable): class Meta(SearchTable.Meta): model = ConfigEvent - fields = ['inventory__serial_number','inventory__part__name','config_type','configuration_date','deployment','approved','user_approver__all__name','user_draft__all__name','created_at'] + fields = ['inventory__serial_number','inventory__part__name','inventory__location','config_type','configuration_date','deployment','approved','user_approver__all__name','user_draft__all__name','created_at'] base_shown_cols = ['inventory__serial_number','configuration_date','config_type','approved'] inventory__serial_number = Column(verbose_name='Inventory SN', attrs={'style':'white-space: nowrap;'}, diff --git a/roundabout/search/views.py b/roundabout/search/views.py index e32c33e47..817008877 100644 --- a/roundabout/search/views.py +++ b/roundabout/search/views.py @@ -431,7 +431,8 @@ def get_table_kwargs(self, field_exceptions=[]): class InventoryTableView(GenericSearchTableView): model = Inventory table_class = InventoryTable - query_prefetch = ['fieldvalues', 'fieldvalues__field', 'part', 'actions', 'actions__user', 'actions__location'] + query_prefetch = ['fieldvalues', 'fieldvalues__field', 'part', 'actions', + 'actions__user', 'actions__location', 'build', 'calibration_events'] avail_udf = set() choice_fields = {'actions__latest__action_type': Action.ACTION_TYPES} @@ -445,7 +446,7 @@ def get_avail_fields(): dict(value="old_serial_number", text="Old Serial Number", legal_lookup='STR_LOOKUP'), dict(value="location__name", text="Location", legal_lookup='STR_LOOKUP'), dict(value="build__assembly__name", text="Build Name", legal_lookup='STR_LOOKUP'), - dict(value="build__build_number ", text="Build Number", legal_lookup='STR_LOOKUP'), + dict(value="build__build_number", text="Build Number", legal_lookup='STR_LOOKUP'), dict(value="created_at", text="Date Created", legal_lookup='DATE_LOOKUP'), dict(value="updated_at", text="Date Modified", legal_lookup='DATE_LOOKUP'), dict(value="build__is_deployed", text="is-build-deployed?", legal_lookup='BOOL_LOOKUP'), @@ -684,7 +685,8 @@ def get_context_data(self, **kwargs): class ActionTableView(GenericSearchTableView): model = Action table_class = ActionTable - query_prefetch = ['user','inventory','inventory__part','cruise','build','build__assembly_revision__assembly','deployment'] + query_prefetch = ['user','inventory','inventory__part','cruise', + 'build','build__assembly_revision__assembly','deployment'] choice_fields = {'action_type': Action.ACTION_TYPES} @staticmethod @@ -714,12 +716,15 @@ def get_context_data(self, **kwargs): class CalibrationTableView(GenericSearchTableView): model = CoefficientValueSet table_class = CalibrationTable - query_prefetch = ['coefficient_name','calibration_event','calibration_event__inventory','calibration_event__inventory__part','calibration_event__user_approver','calibration_event__user_draft'] + query_prefetch = ['coefficient_name','calibration_event','calibration_event__inventory', + 'calibration_event__inventory__part','calibration_event__inventory__location', + 'calibration_event__user_approver','calibration_event__user_draft'] @staticmethod def get_avail_fields(): avail_fields = [dict(value="calibration_event__inventory__serial_number", text="Inventory: SN", legal_lookup='STR_LOOKUP'), dict(value="calibration_event__inventory__part__name", text="Inventory: Name", legal_lookup='STR_LOOKUP'), + dict(value="calibration_event__inventory__location__name", text="Inventory: Location", legal_lookup='STR_LOOKUP'), dict(value="coefficient_name__calibration_name", text="Coefficient Name", legal_lookup='STR_LOOKUP'), dict(value="calibration_event__calibration_date", text="Calibration Event: Date", legal_lookup='DATE_LOOKUP'), dict(value="calibration_event__user_approver__any__username", text="Calibration Event: Approvers", legal_lookup='ITER_LOOKUP'), @@ -758,12 +763,15 @@ def get_table_kwargs(self): class ConfigConstTableView(GenericSearchTableView): model = ConfigValue table_class = ConfigConstTable - query_prefetch = ['config_name','config_event','config_event__inventory','config_event__inventory__part','config_event__user_approver','config_event__user_draft'] + query_prefetch = ['config_name','config_event','config_event__inventory', + 'config_event__inventory__part','config_event__inventory__location', + 'config_event__user_approver','config_event__user_draft'] @staticmethod def get_avail_fields(): avail_fields = [dict(value="config_event__inventory__serial_number", text="Inventory: SN", legal_lookup='STR_LOOKUP'), dict(value="config_event__inventory__part__name", text="Inventory: Name", legal_lookup='STR_LOOKUP'), + dict(value="config_event__inventory__location__name", text="Inventory: Location", legal_lookup='STR_LOOKUP'), dict(value="config_name__name", text="Config/Const Name", legal_lookup='STR_LOOKUP'), dict(value="config_event__configuration_date", text="Config/Const Event: Date", legal_lookup='DATE_LOOKUP'), dict(value="config_event__user_approver__any__username", text="Config/Const Event: Approvers", legal_lookup='ITER_LOOKUP'), diff --git a/roundabout/templates/exports/home.html b/roundabout/templates/exports/home.html index 95c0440eb..664016853 100644 --- a/roundabout/templates/exports/home.html +++ b/roundabout/templates/exports/home.html @@ -26,27 +26,78 @@ {% block title %}Exports{% endblock %} {% block content %} +
+

Bulk Exports

+

Use this interface to bulk download certain DB content

+
-
-
Export Cruises - CI + +

Downloads a shiplist.csv file

+
-

Export Vessels - CI +
+ +

Downloads a CruiseInformation.csv file

+
+ +
+ +

Downloads a zip of deployment csv files

+
-

Export Deployments +
+ +

Downloads a zip of calibration csv files

+
-

Export Calibrations -

Export Configurations & Constants -

Export Calibrations with
Configurations and Constants [CI]
+
+ +

Downloads a zip of configuration event csv files (incl. constants)

+
-

Export All [CI] +
-
-
+

Bulk Exports: CI spec

+

Exports for CI require specific schema and requirements so as to match the OOI CI Asset Management GitHub CSVs.

+
+ +

Exports all the below assets to a single zip file named Asset-Management.zip

+
+ +
+ +

Vessels Export is congruous with its respective export function above, with the exception of an ommitted "Notes" column.

+
+ +
+ +

Cruises Export is congruous with its respective export function above, with the exception of ommitted "Friendly Name" and "Destination" columns.

+
+ +
+ +

Deployment Exports is congruous its respective export function above.

+
+ +
+ +

This export function is highly specialized. The CalibrationEvents_withConfigs.zip will contain zero or more CI CCC csv files, and a CalibrationsWithConfigs_EXPORTLOG.txt logfile.

+

CCC events that pass all the following Requirements must feature:

+
    +
  • CCCs must be reviewed/approved by at least two Users
  • +
  • CCCs defined for a Part must be found for the associated Inventory item
  • +
  • Inventory must have an associated Assembly part and not be in the Trash location
  • +
  • Calibration events must be dated before their associated configuration events
  • +
  • "Export with Calibrations" flag must be checked for Configurations and Constants for the Part
  • +
+

In addition to CCC files, a CalibrationsWithConfigs_EXPORTLOG.txt log file describing the process of vetting CCC files for download is included. If you are not seeing a CCC file you were expectiong, check the CalibrationsWithConfigs_EXPORTLOG.txt for your expected file; it may well tell you why it did not export.

+

CalibrationsWithConfigs_EXPORTLOG.txt is not part of the OOI Asset Management GitHub CSV schema and so, before comparison, it will have to be removed so as not to create an error.

+
+ +
{% endblock %}