Skip to content

Commit

Permalink
Merge branch 'release-1.6.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanandrews committed Jan 12, 2021
2 parents 207d9b5 + e1ebb30 commit f6d2190
Show file tree
Hide file tree
Showing 113 changed files with 11,195 additions and 1,182 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ workflows:
only:
- develop
- automated_tests
- release-1.6
- /release-.*/

version: 2
jobs:
Expand Down
4 changes: 3 additions & 1 deletion compose/local/tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ RUN apt-get install -y nodejs
RUN npm install jsdom
RUN npm install jquery
RUN npm install jquery-csv
RUN npm install unzipper
RUN npm install node-fetch

RUN npm install selenium-webdriver

RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && apt install -y ./google-chrome-stable_current_amd64.deb
RUN wget https://chromedriver.storage.googleapis.com/85.0.4183.83/chromedriver_linux64.zip && unzip -o chromedriver_linux64.zip -d/usr/local/bin
RUN wget https://chromedriver.storage.googleapis.com/86.0.4240.22/chromedriver_linux64.zip && unzip -o chromedriver_linux64.zip -d/usr/local/bin

#RUN apt install -y firefox && apt install -y firefox-geckodriver

Expand Down
3 changes: 3 additions & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,3 +394,6 @@
# https://docs.celeryproject.org/en/latest/userguide/configuration.html#std-setting-task_track_started
# Report task state updates
CELERY_TASK_TRACK_STARTED = True
# https://docs.djangoproject.com/en/3.1/ref/settings/#file-upload-max-memory-size
# 100mb (in bytes)
FILE_UPLOAD_MAX_MEMORY_SIZE = 100000000
5 changes: 4 additions & 1 deletion rebuild_django_and_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Copyright (C) 2019-2020 Woods Hole Oceanographic Institution
#
# This file is part of the Roundabout Database project ("RDB" or
# This file is part of the Roundabout Database project ("RDB" or
# "ooicgsn-roundabout").
#
# ooicgsn-roundabout is free software: you can redistribute it and/or modify
Expand All @@ -28,6 +28,9 @@ then
docker-compose -f production.yml up -d --no-deps --build django
docker-compose -f production.yml run --rm django python manage.py migrate
docker-compose -f production.yml run --rm django python manage.py collectstatic --noinput
docker-compose -f production.yml up -d --no-deps --build celeryworker
docker-compose -f production.yml up -d --no-deps --build celerybeat
docker-compose -f production.yml up -d --no-deps --build flower
fi

if [ -e production-demo-site.yml ]
Expand Down
3 changes: 3 additions & 0 deletions rebuild_testing_and_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ then
docker-compose -f production-testing-site.yml up -d --no-deps --build django_testing
docker-compose -f production-testing-site.yml run --rm django_testing python manage.py migrate
docker-compose -f production-testing-site.yml run --rm django_testing python manage.py collectstatic --noinput
docker-compose -f production-testing-site.yml up -d --no-deps --build celeryworker
docker-compose -f production-testing-site.yml up -d --no-deps --build celerybeat
docker-compose -f production-testing-site.yml up -d --no-deps --build flower
fi
8 changes: 4 additions & 4 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ flower==0.9.5 # https://github.com/mher/flower

# Django
# ------------------------------------------------------------------------------
django==3.0.10 # pyup: < 3.1 # https://www.djangoproject.com/
django==3.1.3 # # https://www.djangoproject.com/
django-environ==0.4.5 # https://github.com/joke2k/django-environ
django-model-utils==4.0.0 # https://github.com/jazzband/django-model-utils
django-allauth==0.42.0 # https://github.com/pennersr/django-allauth
Expand All @@ -22,16 +22,16 @@ django-redis==4.12.1 # https://github.com/niwinz/django-redis
djangorestframework==3.12.1 # https://github.com/encode/django-rest-framework
django-cors-headers==3.5.0
coreapi==2.3.3 # https://github.com/core-api/python-client
django-filter==2.2.0
django-filter==2.4.0
djangorestframework-link-header-pagination==0.1.1
drf-flex-fields==0.8.6
drf-flex-fields==0.8.8

# Your custom requirements go here
django-mptt==0.11.0
django-summernote==0.8.11.6
django-bootstrap-datepicker-plus==3.0.5
sigfig==1.1.8 #https://pypi.org/project/sigfig/
django-tables2==2.2.1 # https://github.com/jieter/django-tables2
django-tables2==2.3.3 # https://github.com/jieter/django-tables2
tablib==1.1 # https://github.com/jazzband/tablib for exporting/downloading tables2/tabular data
django-tables2-column-shifter==0.5.2 # for showing/hiding columns for tables2
django-import-export==2.0.2
2 changes: 1 addition & 1 deletion roundabout/admintools/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def get_redirect_url(self, *args, **kwargs):
tempimport_obj = None

if tempimport_obj:
# get all the Inventory items to upload from the Temp tables
# get all the Inventory items to upload from the Temp tables2
for item_obj in tempimport_obj.tempimportitems.all():
inventory_obj = Inventory()

Expand Down
25 changes: 24 additions & 1 deletion roundabout/assemblies/forms.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
# Copyright (C) 2019-2020 Woods Hole Oceanographic Institution
#
# This file is part of the Roundabout Database project ("RDB" or
# This file is part of the Roundabout Database project ("RDB" or
# "ooicgsn-roundabout").
#
# ooicgsn-roundabout is free software: you can redistribute it and/or modify
Expand All @@ -21,6 +21,7 @@
from pprint import pprint

from django import forms
from django.shortcuts import get_object_or_404
from django.forms.models import inlineformset_factory
from django.core.exceptions import ValidationError

Expand Down Expand Up @@ -164,3 +165,25 @@ class Meta:
labels = {
'name': '%s Type Name' % (labels['label_assemblies_app_singular']),
}


"""
Custom Deletion form for AssemblyType
User needs to be able to choose a new AssemblyType for existing Assemblies or they
disappear from tree nav
"""
class AssemblyTypeDeleteForm(forms.Form):
new_assembly_type = forms.ModelChoiceField(label='Select new Assembly Type', queryset=AssemblyType.objects.all())

def __init__(self, *args, **kwargs):
assembly_type_pk= kwargs.pop('pk')
assembly_type_to_delete = get_object_or_404(AssemblyType, id=assembly_type_pk)

super(AssemblyTypeDeleteForm, self).__init__(*args, **kwargs)
# Check if this PartType has IPart Templates, remove new field if false
if not assembly_type_to_delete.assemblies.exists():
self.fields['new_assembly_type'].required = False
self.fields['new_assembly_type'].widget = forms.HiddenInput()

# remove this object from the possible replacements
self.fields['new_assembly_type'].queryset = AssemblyType.objects.exclude(id=assembly_type_to_delete.id)
18 changes: 18 additions & 0 deletions roundabout/assemblies/migrations/0011_auto_20201117_2030.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.3 on 2020-11-17 20:30

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('assemblies', '0010_auto_20201014_1253'),
]

operations = [
migrations.AlterField(
model_name='assembly',
name='name',
field=models.CharField(db_index=True, max_length=255, unique=True),
),
]
2 changes: 1 addition & 1 deletion roundabout/assemblies/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __str__(self):

# Assembly base model
class Assembly(models.Model):
name = models.CharField(max_length=255, unique=False, db_index=True)
name = models.CharField(max_length=255, unique=True, db_index=True)
assembly_type = models.ForeignKey(AssemblyType, related_name='assemblies',
on_delete=models.SET_NULL, null=True, blank=True)
assembly_number = models.CharField(max_length=100, unique=False, db_index=True, null=False, blank=True)
Expand Down
41 changes: 36 additions & 5 deletions roundabout/assemblies/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
# Copyright (C) 2019-2020 Woods Hole Oceanographic Institution
#
# This file is part of the Roundabout Database project ("RDB" or
# This file is part of the Roundabout Database project ("RDB" or
# "ooicgsn-roundabout").
#
# ooicgsn-roundabout is free software: you can redistribute it and/or modify
Expand All @@ -27,7 +27,7 @@
from django.db import transaction

from .models import Assembly, AssemblyPart, AssemblyType, AssemblyDocument, AssemblyRevision
from .forms import AssemblyForm, AssemblyPartForm, AssemblyTypeForm, AssemblyRevisionForm, AssemblyRevisionFormset, AssemblyDocumentationFormset
from .forms import AssemblyForm, AssemblyPartForm, AssemblyTypeForm, AssemblyRevisionForm, AssemblyRevisionFormset, AssemblyDocumentationFormset, AssemblyTypeDeleteForm
from roundabout.parts.models import PartType, Part
from roundabout.inventory.models import Action
from common.util.mixins import AjaxFormMixin
Expand Down Expand Up @@ -746,13 +746,44 @@ def get_success_url(self):
return reverse('assemblies:assembly_type_home', )


class AssemblyTypeDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteView):
model = AssemblyType
class AssemblyTypeDeleteView(LoginRequiredMixin, PermissionRequiredMixin, FormView):
form_class = AssemblyTypeDeleteForm
template_name = 'assemblies/assembly_type_confirm_delete.html'
success_url = reverse_lazy('assemblies:assembly_type_home')
permission_required = 'assemblies.delete_assembly'
redirect_field_name = 'home'

def get_context_data(self, **kwargs):
context = super(AssemblyTypeDeleteView, self).get_context_data(**kwargs)
assembly_type = AssemblyType.objects.get(id=self.kwargs['pk'])

context.update({
'assembly_type': assembly_type
})
return context

def get_form_kwargs(self):
kwargs = super(AssemblyTypeDeleteView, self).get_form_kwargs()
if 'pk' in self.kwargs:
kwargs['pk'] = self.kwargs['pk']
return kwargs

def form_valid(self, form):
new_assembly_type = form.cleaned_data['new_assembly_type']
assembly_type_to_delete = AssemblyType.objects.get(id=self.kwargs['pk'])

# Need to check if there's Part Templates. If so, need move them to new Part Type.
if assembly_type_to_delete.assemblies.exists():
for assembly in assembly_type_to_delete.assemblies.all():
assembly.assembly_type = new_assembly_type
assembly.save()

# Delete the Assembly object
assembly_type_to_delete.delete()
return HttpResponseRedirect(self.get_success_url())

def get_success_url(self):
return reverse('assemblies:assembly_type_home')


# Direct Detail view for Assembly Types
class AssemblyTypeDetailView(LoginRequiredMixin, DetailView):
Expand Down
12 changes: 12 additions & 0 deletions roundabout/builds/api/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,15 @@ def filter_time_in_field(self, queryset, name, value):

# alternatively, you could opt to hardcode the lookup. e.g.,
# return queryset.filter(published_on__isnull=False)


class DeploymentOmsCustomFilter(filters.FilterSet):
deployment_number = filters.CharFilter(lookup_expr='icontains')
build_number = filters.CharFilter(field_name='build__build_number', lookup_expr='icontains')
class Meta:
model = Deployment
fields = [
'deployment_number',
'build_number',
'build',
]
Loading

0 comments on commit f6d2190

Please sign in to comment.