From 1e9f2ef4e22c36ad5d6d019a80a00899de0e82a1 Mon Sep 17 00:00:00 2001
From: David <62899351+davidclaveau@users.noreply.github.com>
Date: Thu, 26 Oct 2023 17:00:23 -0700
Subject: [PATCH 01/28] wip - rework attachments table
---
app/frontend/package-lock.json | 123 +----------
.../components/SubmissionForm/Documents.vue | 191 ++++++++++--------
2 files changed, 114 insertions(+), 200 deletions(-)
diff --git a/app/frontend/package-lock.json b/app/frontend/package-lock.json
index d54d04f6c..1ca57cfd6 100644
--- a/app/frontend/package-lock.json
+++ b/app/frontend/package-lock.json
@@ -2939,76 +2939,6 @@
"integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==",
"dev": true
},
- "aws-sdk": {
- "version": "2.1431.0",
- "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1431.0.tgz",
- "integrity": "sha512-p6NGyI6+BgojiGn6uW2If6v7uxRPO5C+aGy/M+9/Rhdk8a5n7l0123v9ZUnEJgAy0tsNkazL2ifzV33nc0aGNA==",
- "requires": {
- "buffer": "4.9.2",
- "events": "1.1.1",
- "ieee754": "1.1.13",
- "jmespath": "0.16.0",
- "querystring": "0.2.0",
- "sax": "1.2.1",
- "url": "0.10.3",
- "util": "^0.12.4",
- "uuid": "8.0.0",
- "xml2js": "0.5.0"
- },
- "dependencies": {
- "buffer": {
- "version": "4.9.2",
- "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz",
- "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==",
- "requires": {
- "base64-js": "^1.0.2",
- "ieee754": "^1.1.4",
- "isarray": "^1.0.0"
- }
- },
- "events": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz",
- "integrity": "sha512-kEcvvCBByWXGnZy6JUlgAp2gBIUjfCAV6P6TgT1/aaQKcmuAEC4OZTV1I4EWQLz2gxZw76atuVyvHhTxvi0Flw=="
- },
- "punycode": {
- "version": "1.3.2",
- "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz",
- "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw=="
- },
- "sax": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz",
- "integrity": "sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA=="
- },
- "url": {
- "version": "0.10.3",
- "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz",
- "integrity": "sha512-hzSUW2q06EqL1gKM/a+obYHLIO6ct2hwPuviqTTOcfFVc61UbfJ2Q32+uGL/HCPxKqrdGB5QUwIe7UqlDgwsOQ==",
- "requires": {
- "punycode": "1.3.2",
- "querystring": "0.2.0"
- }
- },
- "util": {
- "version": "0.12.5",
- "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz",
- "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==",
- "requires": {
- "inherits": "^2.0.3",
- "is-arguments": "^1.0.4",
- "is-generator-function": "^1.0.7",
- "is-typed-array": "^1.1.3",
- "which-typed-array": "^1.1.2"
- }
- },
- "uuid": {
- "version": "8.0.0",
- "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz",
- "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw=="
- }
- }
- },
"aws-sign2": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
@@ -3559,7 +3489,8 @@
"base64-js": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz",
- "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw=="
+ "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==",
+ "dev": true
},
"batch": {
"version": "0.6.1",
@@ -9298,15 +9229,6 @@
}
}
},
- "is-arguments": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz",
- "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==",
- "requires": {
- "call-bind": "^1.0.2",
- "has-tostringtag": "^1.0.0"
- }
- },
"is-array-buffer": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.1.tgz",
@@ -9496,14 +9418,6 @@
"integrity": "sha1-lp1J4bszKfa7fwkIm+JleLLd1Go=",
"dev": true
},
- "is-generator-function": {
- "version": "1.0.10",
- "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz",
- "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==",
- "requires": {
- "has-tostringtag": "^1.0.0"
- }
- },
"is-glob": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
@@ -10918,11 +10832,6 @@
"merge-stream": "^1.0.1"
}
},
- "jmespath": {
- "version": "0.16.0",
- "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz",
- "integrity": "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw=="
- },
"jquery": {
"version": "3.6.4",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.4.tgz",
@@ -13870,7 +13779,8 @@
"querystring": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz",
- "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA="
+ "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=",
+ "dev": true
},
"querystring-es3": {
"version": "0.2.1",
@@ -14751,7 +14661,8 @@
"sax": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
- "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
+ "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
+ "dev": true
},
"schema-utils": {
"version": "0.4.7",
@@ -15684,14 +15595,6 @@
"safe-buffer": "~5.1.0"
}
},
- "string_decoder": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
- "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
- "requires": {
- "safe-buffer": "~5.1.0"
- }
- },
"strip-ansi": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
@@ -17732,20 +17635,6 @@
"integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==",
"dev": true
},
- "xml2js": {
- "version": "0.5.0",
- "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz",
- "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==",
- "requires": {
- "sax": ">=0.6.0",
- "xmlbuilder": "~11.0.0"
- }
- },
- "xmlbuilder": {
- "version": "11.0.1",
- "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
- "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA=="
- },
"xtend": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
diff --git a/app/frontend/src/submissions/components/SubmissionForm/Documents.vue b/app/frontend/src/submissions/components/SubmissionForm/Documents.vue
index 144632179..214586bd6 100644
--- a/app/frontend/src/submissions/components/SubmissionForm/Documents.vue
+++ b/app/frontend/src/submissions/components/SubmissionForm/Documents.vue
@@ -14,88 +14,71 @@ Licensed under the Apache License, Version 2.0 (the "License");
+
+
+
+
+
+
+ Save
+
+
+
+
+
+
+
+
+ Well Number |
+ Well Label/Type |
+ Date |
+ File Upload Name |
+ |
+
+
+
+
+
+
+ Well Number
+ |
+
+ Well Label/Type
+ |
+
+ Date
+ |
+
+ {{attachment.name}}
+ |
+
+ Remove
+ |
+
+
+
+
+
Add file
+
+ Are you sure you want to remove this row?
+
+
+ Cancel
+
+
+ Remove
+
+
+
+
+
{
this.$emit('fetchFiles')
})
+ },
+
+ addRow () {
+ console.log('add row')
+ // this.files.push(emptyObject())
+ },
+ removeRowByIndex (index) {
+ // this.casingsData.splice(index, 1)
+ // this.rowIndexToRemove = null
+ },
+ focusRemoveModal () {
+ // Focus the "cancel" button in the confirm remove popup.
+ this.$refs.cancelRemoveBtn.focus()
}
}
}
@@ -229,4 +227,31 @@ export default {
From a3eb77cd2372f2b0de494f4eede135dc331e25b9 Mon Sep 17 00:00:00 2001
From: David <62899351+davidclaveau@users.noreply.github.com>
Date: Fri, 27 Oct 2023 16:59:37 -0700
Subject: [PATCH 02/28] add document label codes
---
app/backend/submissions/views.py | 6 +++
app/backend/wells/data_migrations.py | 22 ++++++++++
.../0142_add_document_label_codes.py | 41 +++++++++++++++++++
.../migrations/document_label_codes.json | 32 +++++++++++++++
app/backend/wells/models.py | 17 ++++++++
app/backend/wells/serializers.py | 11 ++++-
6 files changed, 128 insertions(+), 1 deletion(-)
create mode 100644 app/backend/wells/migrations/0142_add_document_label_codes.py
create mode 100644 app/backend/wells/migrations/document_label_codes.json
diff --git a/app/backend/submissions/views.py b/app/backend/submissions/views.py
index 28d55725b..2f5dba81c 100644
--- a/app/backend/submissions/views.py
+++ b/app/backend/submissions/views.py
@@ -78,11 +78,13 @@
WellPublicationStatusCode,
YieldEstimationMethodCode,
AquiferLithologyCode,
+ DocumentLabelCode
)
from submissions.models import WellActivityCode
from wells.serializers import (
CasingCodeSerializer,
CasingMaterialSerializer,
+ DocumentLabelCodeSerializer
)
from submissions.serializers import (
AlterationSubmissionDisplaySerializer,
@@ -486,6 +488,9 @@ def get(self, request, **kwargs):
instance=LithologyDescriptionCode.objects.all(), many=True)
licenced_status_codes = LicencedStatusCodeSerializer(
instance=LicencedStatusCode.objects.all(), many=True)
+
+ document_label_codes = DocumentLabelCodeSerializer(
+ instance=DocumentLabelCode.objects.all(), many=True)
root = urljoin('/', app_root, 'api/v2/')
for item in activity_codes.data:
@@ -536,6 +541,7 @@ def get(self, request, **kwargs):
options["well_publication_status_codes"] = well_publication_status_codes.data
options["observation_well_status"] = observation_well_status.data
options["licenced_status_codes"] = licenced_status_codes.data
+ options["document_label_codes"] = document_label_codes.data
return Response(options)
diff --git a/app/backend/wells/data_migrations.py b/app/backend/wells/data_migrations.py
index c0d294bd2..4f1ef4b54 100644
--- a/app/backend/wells/data_migrations.py
+++ b/app/backend/wells/data_migrations.py
@@ -377,3 +377,25 @@ def update_update_user_fields(apps, schema_editor):
model.objects.filter(update_user__isnull=True).update(update_user=F('create_user'))
except AttributeError:
logger.error("skipping")
+
+def document_label_codes():
+ """
+ Generator that deserializes and provides document label codes.
+ """
+ path = os.path.dirname(os.path.realpath(__file__))
+ with open(os.path.join(path, 'migrations/document_label_codes.json'), 'r') as json_data:
+ data = json.load(json_data)
+ for item in data:
+ yield item
+
+
+def load_document_label_codes(apps, schema_editor):
+ DocumentLabelCode = apps.get_model('wells', 'DocumentLabelCode')
+ for item in document_label_codes():
+ DocumentLabelCode.objects.create(**item)
+
+
+def unload_document_label_codes(apps, schema_editor):
+ DocumentLabelCode = apps.get_model('wells', 'DocumentLabelCode')
+ for item in document_label_codes():
+ DocumentLabelCode.objects.get(code=item.get('code')).delete()
\ No newline at end of file
diff --git a/app/backend/wells/migrations/0142_add_document_label_codes.py b/app/backend/wells/migrations/0142_add_document_label_codes.py
new file mode 100644
index 000000000..240246a98
--- /dev/null
+++ b/app/backend/wells/migrations/0142_add_document_label_codes.py
@@ -0,0 +1,41 @@
+# Generated by Django 2.2.28 on 2023-08-11 18:10
+
+from django.db import migrations, models
+import django.db.models.deletion
+import datetime
+from django.utils.timezone import utc
+import gwells.db_comments.model_mixins
+import wells.data_migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('wells', '0141_add_drinking_water_protection_area_ind'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='DocumentLabelCode',
+ fields=[
+ ('create_user', models.CharField(max_length=60)),
+ ('create_date', models.DateTimeField(default=django.utils.timezone.now)),
+ ('update_user', models.CharField(max_length=60)),
+ ('update_date', models.DateTimeField(default=django.utils.timezone.now)),
+ ('display_order', models.PositiveIntegerField()),
+ ('effective_date', models.DateTimeField(default=django.utils.timezone.now)),
+ ('expiry_date', models.DateTimeField(default=datetime.datetime(9999, 12, 31, 23, 59, 59, 999999, tzinfo=utc))),
+ ('code', models.CharField(db_column='document_label_code', editable=False, max_length=10, primary_key=True, serialize=False)),
+ ('description', models.CharField(max_length=100)),
+ ],
+ options={
+ 'db_table': 'document_label_code',
+ 'ordering': ['display_order', 'description'],
+ },
+ bases=(models.Model, gwells.db_comments.model_mixins.DBComments),
+ ),
+ migrations.RunPython(
+ code=wells.data_migrations.load_document_label_codes,
+ reverse_code=wells.data_migrations.unload_document_label_codes,
+ )
+ ]
diff --git a/app/backend/wells/migrations/document_label_codes.json b/app/backend/wells/migrations/document_label_codes.json
new file mode 100644
index 000000000..a4db81368
--- /dev/null
+++ b/app/backend/wells/migrations/document_label_codes.json
@@ -0,0 +1,32 @@
+[
+ {
+ "code": "LABEL0",
+ "create_user": "WELLS",
+ "create_date": "2018-08-14T17:42:52.421Z",
+ "update_user": "WELLS",
+ "update_date": "2018-08-14T17:42:52.421Z",
+ "description": "Label 0",
+ "display_order": 0,
+ "effective_date": "2013-11-07T05:28:00.402Z"
+ },
+ {
+ "code": "LABEL1",
+ "create_user": "WELLS",
+ "create_date": "2018-08-14T17:42:52.423Z",
+ "update_user": "WELLS",
+ "update_date": "2018-08-14T17:42:52.423Z",
+ "description": "Label 1",
+ "display_order": 1,
+ "effective_date": "2018-08-14T17:42:52.423Z"
+ },
+ {
+ "code": "LABEL2",
+ "create_user": "WELLS",
+ "create_date": "2018-08-14T17:42:52.416Z",
+ "update_user": "WELLS",
+ "update_date": "2018-08-14T17:42:52.416Z",
+ "description": "Label 2",
+ "display_order": 2,
+ "effective_date": "2018-08-14T17:42:52.416Z"
+ }
+]
\ No newline at end of file
diff --git a/app/backend/wells/models.py b/app/backend/wells/models.py
index b3daa3727..743c2e2c8 100644
--- a/app/backend/wells/models.py
+++ b/app/backend/wells/models.py
@@ -2596,3 +2596,20 @@ def as_dict(self):
"analysis_method": self.analysis_method,
"comments": self.comments
}
+
+class DocumentLabelCode(CodeTableModel):
+ """
+ Type of labels for a document
+ """
+ code = models.CharField(primary_key=True, max_length=10,
+ editable=False, db_column='document_label_code')
+ description = models.CharField(max_length=100)
+
+ class Meta:
+ db_table = 'document_label_code'
+ ordering = ['display_order', 'description']
+
+ db_table_comment = ('Describes the label of a document. E.g. Well Driller Report, Well Record')
+
+ def __str__(self):
+ return self.description
\ No newline at end of file
diff --git a/app/backend/wells/serializers.py b/app/backend/wells/serializers.py
index 2d5ded322..7cfebcafe 100644
--- a/app/backend/wells/serializers.py
+++ b/app/backend/wells/serializers.py
@@ -35,7 +35,8 @@
LithologyDescription,
Screen,
Well,
- AquiferParameters
+ AquiferParameters,
+ DocumentLabelCode
)
from submissions.models import WellActivityCode
@@ -1191,3 +1192,11 @@ class Meta:
"longitude",
"lithologydescription_set"
)
+
+class DocumentLabelCodeSerializer(serializers.ModelSerializer):
+ class Meta:
+ model = DocumentLabelCode
+ fields = (
+ 'code',
+ 'description',
+ )
From d9af5ee5e2e895c7868aa0833a855f913bc57669 Mon Sep 17 00:00:00 2001
From: David <62899351+davidclaveau@users.noreply.github.com>
Date: Fri, 27 Oct 2023 17:00:30 -0700
Subject: [PATCH 03/28] wip - refactor Documents component
---
.../SubmissionForm/ActivitySubmissionForm.vue | 2 +-
.../components/SubmissionForm/Documents.vue | 244 +++++++++++-------
2 files changed, 148 insertions(+), 98 deletions(-)
diff --git a/app/frontend/src/submissions/components/SubmissionForm/ActivitySubmissionForm.vue b/app/frontend/src/submissions/components/SubmissionForm/ActivitySubmissionForm.vue
index 044f1542c..2fbcbff58 100644
--- a/app/frontend/src/submissions/components/SubmissionForm/ActivitySubmissionForm.vue
+++ b/app/frontend/src/submissions/components/SubmissionForm/ActivitySubmissionForm.vue
@@ -462,7 +462,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
Well Number
Well Label/Type |
Date |
- File Upload Name |
+ File Name |
+ File |
+ Private? |
|
-
+
+
+ {{ attachment.well_tag_number = wellTagNumber }}
+ |
-
- Well Number
+
+
+
+
+
+
+
+
+
+ {{ error }}
+
+
+
+ |
+
+
+ {{ attachment.upload_date = new Date().getTime() }} ({{ new Date().toLocaleString() }})
|
- Well Label/Type
+
+
|
- Date
+
+
|
- {{attachment.name}}
+
|
- Remove
+ Remove
|
Add file
-
- Are you sure you want to remove this row?
-
-
- Cancel
-
-
- Remove
-
-
-
-
-
-
- Are you sure you would like to delete this file?
- {{file}}
-
+
+ Are you sure you want to remove this row?
+
+
+ Cancel
+
+
+ Remove
+
+
+
+
-
From 54812e23ac067982674763bf5e9aa53e75eaf59c Mon Sep 17 00:00:00 2001
From: LocalNewsTV <62873746+LocalNewsTV@users.noreply.github.com>
Date: Wed, 1 Nov 2023 09:05:45 -0700
Subject: [PATCH 11/28] update table headers for updated bootstrap package
---
.../components/SubmissionForm/SubmissionHistory.vue | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/app/frontend/src/submissions/components/SubmissionForm/SubmissionHistory.vue b/app/frontend/src/submissions/components/SubmissionForm/SubmissionHistory.vue
index 78eb835a1..b340f596a 100644
--- a/app/frontend/src/submissions/components/SubmissionForm/SubmissionHistory.vue
+++ b/app/frontend/src/submissions/components/SubmissionForm/SubmissionHistory.vue
@@ -85,26 +85,26 @@ export default {
submissionsPage: 1,
submissionsBusy: false,
submissionsRecordsCount: 0,
- tableHeaders: {
- report: {
+ tableHeaders: [
+ {
label: 'Report',
thStyle: {
width: '33%'
}
},
- date_entered: {
+ {
label: 'Date Entered',
thStyle: {
width: '33%'
}
},
- entered_by: {
+ {
label: 'Entered By',
thStyle: {
width: '33%'
}
}
- }
+ ]
}
},
computed: {
From e979c9dead186801d392ef2118005f690b5758ee Mon Sep 17 00:00:00 2001
From: LocalNewsTV <62873746+LocalNewsTV@users.noreply.github.com>
Date: Wed, 1 Nov 2023 13:15:37 -0700
Subject: [PATCH 12/28] update table header objects
---
.../components/SubmissionForm/WellType.vue | 2 +-
app/frontend/src/wells/views/WellDetail.vue | 52 +++++++++----------
2 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/app/frontend/src/submissions/components/SubmissionForm/WellType.vue b/app/frontend/src/submissions/components/SubmissionForm/WellType.vue
index 99e37f640..f1d30fb0c 100644
--- a/app/frontend/src/submissions/components/SubmissionForm/WellType.vue
+++ b/app/frontend/src/submissions/components/SubmissionForm/WellType.vue
@@ -297,7 +297,7 @@ export default {
return this.wellClass !== 'WATR_SPPLY' && this.intendedWaterUseInput === 'NA'
},
intendedWaterUseOptions () {
- if (this.wellClass === 'WATR_SPPLY') {
+ if (this.wellClass === 'WATR_SPPLY' && this.codes.intended_water_uses) {
// Do not allow user to pick "Not Applicable" when well_class_code is WATR_SPPLY
return this.codes.intended_water_uses.filter((code) => {
return code.intended_water_use_code !== 'NA'
diff --git a/app/frontend/src/wells/views/WellDetail.vue b/app/frontend/src/wells/views/WellDetail.vue
index a0efaff9e..78ee449f1 100644
--- a/app/frontend/src/wells/views/WellDetail.vue
+++ b/app/frontend/src/wells/views/WellDetail.vue
@@ -557,32 +557,32 @@ export default {
data () {
return {
surveys: [],
- lithology_fields: {
- start: { label: 'From (ft bgl)' },
- end: { label: 'To (ft bgl)' },
- lithology_raw_data: { label: 'Raw Data' },
- lithology_description: { label: 'Description' },
- lithology_moisture: { label: 'Moisture' },
- lithology_colour: { label: 'Colour' },
- lithology_hardness: { label: 'Hardness' },
- lithology_observation: { label: 'Observations' },
- water_bearing_estimated_flow: { label: 'Water Bearing Flow Estimate (USGPM)' }
- },
- activity_fields: {
- well_activity_description: { label: 'Activity', sortable: true },
- work_start_date: { label: 'Work Start Date', sortable: true },
- work_end_date: { label: 'Work End Date', sortable: true },
- drilling_company: { label: 'Drilling Company', sortable: true },
- create_date: { label: 'Date Entered', sortable: true }
- },
- work_date_fields: {
- construction_start_date: { label: 'Start Date of Construction', class: 'text-center' },
- construction_end_date: { label: 'End Date of Construction', class: 'text-center' },
- alteration_start_date: { label: 'Start Date of Alteration', class: 'text-center' },
- alteration_end_date: { label: 'End Date of Alteration', class: 'text-center' },
- decommission_start_date: { label: 'Start Date of Decommission', class: 'text-center' },
- decommission_end_date: { label: 'End Date of Decommission', class: 'text-center' }
- },
+ lithology_fields: [
+ { key: 'start', label: 'From (ft bgl)' },
+ { key: 'end', label: 'To (ft bgl)' },
+ { key: 'lithology_raw_data', label: 'Raw Data' },
+ { key: 'lithology_description', label: 'Description' },
+ { key: 'lithology_moisture', label: 'Moisture' },
+ { key: 'lithology_colour', label: 'Colour' },
+ { key: 'lithology_hardness', label: 'Hardness' },
+ { key: 'lithology_observation', label: 'Observations' },
+ { key: 'water_bearing_estimated_flow', label: 'Water Bearing Flow Estimate (USGPM)' }
+ ],
+ activity_fields: [
+ { key: 'well_activity_description', label: 'Activity', sortable: true },
+ { key: 'work_start_date', label: 'Work Start Date', sortable: true },
+ { key: 'work_end_date', label: 'Work End Date', sortable: true },
+ { key: 'drilling_company', label: 'Drilling Company', sortable: true },
+ { key: 'create_date', label: 'Date Entered', sortable: true }
+ ],
+ work_date_fields: [
+ { key: 'construction_start_date', label: 'Start Date of Construction', class: 'text-center' },
+ { key: 'construction_end_date', label: 'End Date of Construction', class: 'text-center' },
+ { key: 'alteration_start_date', label: 'Start Date of Alteration', class: 'text-center' },
+ { key: 'alteration_end_date', label: 'End Date of Alteration', class: 'text-center' },
+ { key: 'decommission_start_date', label: 'Start Date of Decommission', class: 'text-center' },
+ { key: 'decommission_end_date', label: 'End Date of Decommission', class: 'text-center' }
+ ],
submissionsPerPage: 5,
submissionsPage: 1,
loading: false,
From 6ee7ba90f50370ab3e95bfa540d29be77c8c2dcc Mon Sep 17 00:00:00 2001
From: LocalNewsTV <62873746+LocalNewsTV@users.noreply.github.com>
Date: Thu, 2 Nov 2023 12:03:46 -0700
Subject: [PATCH 13/28] update API to clean up returned public objects
---
app/backend/gwells/documents.py | 24 ++++++++++++++++++-
app/backend/requirements.txt | 2 +-
app/frontend/src/common/constants.js | 4 ++--
.../src/wells/components/Documents.vue | 22 ++++++++++++++++-
docker-compose.yml | 4 +++-
openshift/docker/backend/Dockerfile.dev | 6 +++++
6 files changed, 56 insertions(+), 6 deletions(-)
create mode 100644 openshift/docker/backend/Dockerfile.dev
diff --git a/app/backend/gwells/documents.py b/app/backend/gwells/documents.py
index 521c5cd02..520a30566 100644
--- a/app/backend/gwells/documents.py
+++ b/app/backend/gwells/documents.py
@@ -14,6 +14,7 @@
import sys
import os
import logging
+import re
from datetime import timedelta
from django.urls import reverse
from urllib.parse import quote, unquote_plus
@@ -122,11 +123,32 @@ def create_url_list(self, objects, host, bucket_name, private=False):
'url': self.create_url(document, host, bucket_name, private),
# split on last occurrence of '/' and return last item (supports any or no prefixes)
- 'name': unquote_plus(document.object_name).rsplit('/', 1)[-1]
+ 'name': unquote_plus(document.object_name).rsplit('/', 1)[-1],
+ "well_number": self.extract_well_number(document.object_name),
+ "date_of_action": self.extract_date_of_action(document.object_name),
+ "well_label": self.extract_well_label(document.object_name),
}, objects)
)
return urls
+ def extract_well_number(self, object_name):
+ try:
+ return re.findall(r'\d+', unquote_plus(object_name).rsplit('/', 1)[-1].split("_")[0])[0]
+ except IndexError:
+ return "Unknown"
+
+ def extract_date_of_action(self, object_name):
+ try:
+ return int(unquote_plus(object_name).rsplit('/', 1)[-1].split("_")[2].split(".")[0].strip())
+ except IndexError:
+ return -1
+
+ def extract_well_label(self, object_name):
+ try:
+ return unquote_plus(object_name).rsplit('/', 1)[-1].split("_")[1]
+ except IndexError:
+ return ""
+
def get_bucket_folder(self, document_id, resource='well'):
"""Helper function to determine the folder for a given resource"""
if resource == 'well':
diff --git a/app/backend/requirements.txt b/app/backend/requirements.txt
index 7e944ae64..daba280b3 100644
--- a/app/backend/requirements.txt
+++ b/app/backend/requirements.txt
@@ -13,7 +13,7 @@ requests==2.21.0
minio==7.1.16
coverage>=4.4.2
django-filter>=2.0.0,<2.1
-drf-yasg==1.20.0
+drf-yasg==1.21.7
django-cors-headers==2.2.0
django-extensions==2.0.6
cryptography<=40.0.2
diff --git a/app/frontend/src/common/constants.js b/app/frontend/src/common/constants.js
index ea53b04d5..aaaeb6f7b 100644
--- a/app/frontend/src/common/constants.js
+++ b/app/frontend/src/common/constants.js
@@ -5,7 +5,7 @@ export const AQUIFER_ID_FOR_UNCORRELATED_WELLS = 1143
// See task: https, value, //apps.nrs.gov.bc.ca/int/jira/browse/WATER-1775
export const MAX_API_RESULT_AND_EXPORT_COUNT = 999999
-const WELL_TAGS_PUBLIC = [
+export const WELL_TAGS_PUBLIC = [
{ text: "Well Construction Report", value: "Well Construction" },
{ text: "Well Alteration Report", value: "Well Alteration" },
{ text: "Well Decommission Report", value: "Well Decommission" },
@@ -16,7 +16,7 @@ const WELL_TAGS_PUBLIC = [
{ text: "Other", value: "Additional Well Details" },
]
-const WELL_TAGS_PRIVATE = [
+export const WELL_TAGS_PRIVATE = [
{ text: "Well Inspection Report", value: "Well Inspection" },
{ text: "Confirmation/Alternative Specifications", value: "Alternative Specs" },
{ text: "Water Quality Report", value: "Water Quality" },
diff --git a/app/frontend/src/wells/components/Documents.vue b/app/frontend/src/wells/components/Documents.vue
index fb34839c7..d5d6eaba9 100644
--- a/app/frontend/src/wells/components/Documents.vue
+++ b/app/frontend/src/wells/components/Documents.vue
@@ -33,6 +33,22 @@
No additional documentation available for this well.
+
+
+ {{ data.item.date_of_action !== -1 ? new Date(data.item.date_of_action).toLocaleDateString() : "Date Unknown" }}
+
+
+ {{ data.item.name.split("_")[1].split(".")[0] }}
+
+
+ {{ data.item.name }}
+
+
Internal documentation - authorized access only
@@ -74,7 +90,8 @@ export default {
files: null,
error: null,
file: '',
- fileType: ''
+ fileType: '',
+ splitFiles: [],
}
},
watch: {
@@ -129,6 +146,9 @@ export default {
})
}
},
+ displayFileFormat() {
+ const arr = [];
+ },
showModal () {
this.$refs.deleteModal.show()
},
diff --git a/docker-compose.yml b/docker-compose.yml
index 504254213..22e81abe3 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -132,7 +132,9 @@ services:
#############################################################################################
backend:
platform: linux/x86_64
- image: artifacts.developer.gov.bc.ca/g26e-backend-docker-local/gwells-backend:1.0
+ build:
+ context: ./openshift/docker/backend
+ dockerfile: Dockerfile.dev
hostname: backend
environment:
APP_CONTEXT_ROOT: gwells
diff --git a/openshift/docker/backend/Dockerfile.dev b/openshift/docker/backend/Dockerfile.dev
new file mode 100644
index 000000000..8f5763820
--- /dev/null
+++ b/openshift/docker/backend/Dockerfile.dev
@@ -0,0 +1,6 @@
+FROM artifacts.developer.gov.bc.ca/g26e-backend-docker-local/gwells-backend:1.0 AS base
+
+FROM base
+WORKDIR /app
+
+COPY . .
From 7a29b2a928851f15f550623f1bf620837cd63e1a Mon Sep 17 00:00:00 2001
From: LocalNewsTV <62873746+LocalNewsTV@users.noreply.github.com>
Date: Thu, 2 Nov 2023 13:40:48 -0700
Subject: [PATCH 14/28] add longform labels to table
---
app/backend/gwells/documents.py | 1 +
.../src/wells/components/Documents.vue | 45 ++++++++++++-------
2 files changed, 30 insertions(+), 16 deletions(-)
diff --git a/app/backend/gwells/documents.py b/app/backend/gwells/documents.py
index 520a30566..f6c26de5c 100644
--- a/app/backend/gwells/documents.py
+++ b/app/backend/gwells/documents.py
@@ -127,6 +127,7 @@ def create_url_list(self, objects, host, bucket_name, private=False):
"well_number": self.extract_well_number(document.object_name),
"date_of_action": self.extract_date_of_action(document.object_name),
"well_label": self.extract_well_label(document.object_name),
+ "private": private
}, objects)
)
return urls
diff --git a/app/frontend/src/wells/components/Documents.vue b/app/frontend/src/wells/components/Documents.vue
index d5d6eaba9..ca887e3a4 100644
--- a/app/frontend/src/wells/components/Documents.vue
+++ b/app/frontend/src/wells/components/Documents.vue
@@ -33,21 +33,25 @@
No additional documentation available for this well.
-
-
- {{ data.item.date_of_action !== -1 ? new Date(data.item.date_of_action).toLocaleDateString() : "Date Unknown" }}
-
-
- {{ data.item.name.split("_")[1].split(".")[0] }}
-
-
- {{ data.item.name }}
-
+
+
+ {{ getLongFormLabel(data.item.well_label) }}
+
+
+ {{ data.item.date_of_action !== -1 ? new Date(data.item.date_of_action).toLocaleDateString() : "Date Unknown" }}
+
+
+ {{ data.item.name }}
+
+
+ Private Document
+ Public Document
+
Internal documentation - authorized access only
@@ -70,7 +74,7 @@
v-on:ok="deleteFile"
ref="deleteModal" >
Are you sure you would like to delete this file?
-
{{file}}
+
{{ file }}
@@ -78,6 +82,7 @@
-
From 368f6be6ebd2515646344becf2bf7ad6ec6015a6 Mon Sep 17 00:00:00 2001
From: David <62899351+davidclaveau@users.noreply.github.com>
Date: Thu, 2 Nov 2023 17:47:05 -0700
Subject: [PATCH 17/28] fix to doc upload, allow deletion from edit
---
.../components/SubmissionForm/Documents.vue | 41 +++++++++++++------
1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/app/frontend/src/submissions/components/SubmissionForm/Documents.vue b/app/frontend/src/submissions/components/SubmissionForm/Documents.vue
index d736cf37e..3c934da3c 100644
--- a/app/frontend/src/submissions/components/SubmissionForm/Documents.vue
+++ b/app/frontend/src/submissions/components/SubmissionForm/Documents.vue
@@ -25,7 +25,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
-
@@ -166,7 +166,7 @@ import { mapGetters, mapState, mapMutations } from 'vuex'
import { omit } from 'lodash'
import inputBindingsMixin from '@/common/inputBindingsMixin.js'
-// import ApiService from '@/common/services/ApiService.js'
+import ApiService from '@/common/services/ApiService.js'
import BackToTopLink from '@/common/components/BackToTopLink.vue'
import { WELL_TAGS } from '@/common/constants.js'
@@ -245,22 +245,30 @@ export default {
}
},
computedAttachments () {
- return [...this.attachmentsData]
+ return JSON.stringify(this.attachmentsData);
},
},
watch: {
computedAttachments: {
deep: true,
handler: function (newAttachments, oldAttachments) {
- if (newAttachments[0].file) {
- newAttachments.forEach((newAttachment, index) => {
+ let jsonNewAttachments = JSON.parse(newAttachments),
+ jsonOldAttachments = JSON.parse(oldAttachments);
+
+ // We have at least one new attachment
+ if (jsonNewAttachments[0].file) {
+ jsonNewAttachments.forEach((newAttachment, index) => {
+
+ // Add the new attachment
const newFile = newAttachment.file;
if (newAttachment.file_name) {
const uploadName = newAttachment.file_name.replace(/^WTN\s\d+_/,'');
- const modifiedFile = new File([newFile], uploadName, { type: newFile.type });
- this.files = [modifiedFile];
- this.privateDocument = false;
+ const newFileAdded = new File([newFile], uploadName, { type: newFile.type });
+ this.files[index] = newFileAdded;
}
+
+ // TODO: add prive doc logic
+ this.privateDocument = false;
});
}
},
@@ -281,8 +289,17 @@ export default {
'setPrivate',
'removeFile'
]),
- handleFileDelete() {
- alert('Delete Action!');
+ handleFileDelete(value, e) {
+ e.preventDefault()
+ let tag = this.form.well && isNaN(this.form.well) ? this.form.well.well_tag_number : this.form.well
+ let encodedFileName = encodeURIComponent(value)
+
+ //TODO: add private file deletion/logic
+ ApiService.deleteFile(`wells/${tag}/delete_document?filename=${encodedFileName}&private=false}`)
+ .then(() => {
+ console.log('File deleted')
+ this.$emit('fetchFiles')
+ })
},
setFileName(index) {
try {
@@ -359,7 +376,7 @@ export default {
attachmentIsEmpty (attachment) {
const fieldsToTest = omit(attachment, 'length_required')
return Object.values(fieldsToTest).every((x) => !x)
- }
+ },
}
}
From 12a185706d5250acbec5a12f5f454e31c6bda4a6 Mon Sep 17 00:00:00 2001
From: LocalNewsTV <62873746+LocalNewsTV@users.noreply.github.com>
Date: Fri, 3 Nov 2023 08:49:19 -0700
Subject: [PATCH 18/28] code cleanup, change header names for clarity, fix
public list bug
---
app/backend/gwells/documents.py | 2 +-
.../components/SubmissionForm/Documents.vue | 10 +++++-----
app/frontend/src/wells/components/Documents.vue | 12 +++++-------
3 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/app/backend/gwells/documents.py b/app/backend/gwells/documents.py
index f6c26de5c..d5f68ab1f 100644
--- a/app/backend/gwells/documents.py
+++ b/app/backend/gwells/documents.py
@@ -127,7 +127,7 @@ def create_url_list(self, objects, host, bucket_name, private=False):
"well_number": self.extract_well_number(document.object_name),
"date_of_action": self.extract_date_of_action(document.object_name),
"well_label": self.extract_well_label(document.object_name),
- "private": private
+ "document_status": private
}, objects)
)
return urls
diff --git a/app/frontend/src/submissions/components/SubmissionForm/Documents.vue b/app/frontend/src/submissions/components/SubmissionForm/Documents.vue
index 3c934da3c..c3a6ae8ed 100644
--- a/app/frontend/src/submissions/components/SubmissionForm/Documents.vue
+++ b/app/frontend/src/submissions/components/SubmissionForm/Documents.vue
@@ -27,9 +27,9 @@ Licensed under the Apache License, Version 2.0 (the "License");
{{ callLongFormLabel(data.item.well_label) }}
@@ -37,11 +37,11 @@ Licensed under the Apache License, Version 2.0 (the "License");
{{ data.item.date_of_action !== -1 ? new Date(data.item.date_of_action).toLocaleDateString() : "Date Unknown" }}
-
+
{{ data.item.name }}
-
- Private Document
+
+ Private Document
Public Document
diff --git a/app/frontend/src/wells/components/Documents.vue b/app/frontend/src/wells/components/Documents.vue
index 3e81977c7..143dde763 100644
--- a/app/frontend/src/wells/components/Documents.vue
+++ b/app/frontend/src/wells/components/Documents.vue
@@ -27,9 +27,9 @@
{{ callLongFormLabel(data.item.well_label) }}
@@ -37,11 +37,11 @@
{{ data.item.date_of_action !== -1 ? new Date(data.item.date_of_action).toLocaleDateString() : "Date Unknown" }}
-
+
{{ data.item.name }}
-
- Private Document
+
+ Private Document
Public Document
@@ -60,7 +60,6 @@