diff --git a/endorsement/fixtures/test_data/itbill_provision.json b/endorsement/fixtures/test_data/itbill_provision.json index 85fddc7e..328e6225 100644 --- a/endorsement/fixtures/test_data/itbill_provision.json +++ b/endorsement/fixtures/test_data/itbill_provision.json @@ -14,5 +14,13 @@ "subscription": 2, "current_quantity": 5 } + }, + { + "model": "endorsement.itbillprovision", + "pk": 3, + "fields": { + "subscription": 3, + "current_quantity": 1 + } } ] diff --git a/endorsement/fixtures/test_data/itbill_quantity.json b/endorsement/fixtures/test_data/itbill_quantity.json index 038b71c4..e09d35ac 100644 --- a/endorsement/fixtures/test_data/itbill_quantity.json +++ b/endorsement/fixtures/test_data/itbill_quantity.json @@ -6,7 +6,7 @@ "provision": 1, "quantity": 2, "start_date": "2024-01-01", - "end_date": "2024-12-31", + "end_date": "2024-12-29", "stage": null } }, @@ -20,5 +20,16 @@ "end_date": null, "stage": null } + }, + { + "model": "endorsement.itbillquantity", + "pk": 3, + "fields": { + "provision": 3, + "quantity": 1, + "start_date": null, + "end_date": null, + "stage": null + } } ] diff --git a/endorsement/fixtures/test_data/itbill_subscription.json b/endorsement/fixtures/test_data/itbill_subscription.json index 42d918d6..d27a0a70 100644 --- a/endorsement/fixtures/test_data/itbill_subscription.json +++ b/endorsement/fixtures/test_data/itbill_subscription.json @@ -18,5 +18,15 @@ "query_priority": 0, "query_datetime": null } + }, + { + "model": "endorsement.itbillsubscription", + "pk": 3, + "fields": { + "key_remote": "spw48mh5yutht3431v4d8olsx04yi8dz", + "state": 1, + "query_priority": 0, + "query_datetime": null + } } ] diff --git a/endorsement/fixtures/test_data/shared_drive.json b/endorsement/fixtures/test_data/shared_drive.json index d653186a..056f6efc 100644 --- a/endorsement/fixtures/test_data/shared_drive.json +++ b/endorsement/fixtures/test_data/shared_drive.json @@ -53,5 +53,16 @@ "drive_quota": 4, "members": [1, 2, 4, 5, 7, 8, 9, 10, 11] } + }, + { + "model": "endorsement.shareddrive", + "pk": 6, + "fields": { + "drive_id": "g2ns3fxmo2x8wo6j7e5gloet", + "drive_name": "UX Design Team Drive", + "drive_usage": 359, + "drive_quota": 3, + "members": [1, 4, 5, 7, 10, 11] + } } ] diff --git a/endorsement/fixtures/test_data/shared_drive_record.json b/endorsement/fixtures/test_data/shared_drive_record.json index cef683ab..c266c096 100644 --- a/endorsement/fixtures/test_data/shared_drive_record.json +++ b/endorsement/fixtures/test_data/shared_drive_record.json @@ -93,5 +93,24 @@ "datetime_expired": null, "is_deleted": null } + }, + { + "model": "endorsement.shareddriverecord", + "pk": 6, + "fields": { + "shared_drive": 6, + "subscription": 3, + "acted_as": null, + "datetime_created": "2024-02-12T17:41:28+00:00", + "datetime_emailed": null, + "datetime_notice_1_emailed": null, + "datetime_notice_2_emailed": null, + "datetime_notice_3_emailed": null, + "datetime_notice_4_emailed": null, + "datetime_accepted": "2024-02-12T17:41:28+00:00", + "datetime_renewed": null, + "datetime_expired": null, + "is_deleted": null + } } ] diff --git a/endorsement/management/commands/initialize_db.py b/endorsement/management/commands/initialize_db.py index 634b28a8..63f3f89b 100644 --- a/endorsement/management/commands/initialize_db.py +++ b/endorsement/management/commands/initialize_db.py @@ -4,13 +4,16 @@ from django.core.management.base import BaseCommand from django.core.management import call_command -from endorsement.models import SharedDriveRecord +from endorsement.models import SharedDriveRecord, ITBillQuantity from datetime import datetime, timezone, timedelta class Command(BaseCommand): def handle(self, *args, **options): + # reset quantities + ITBillQuantity.objects.all().delete() + call_command('loaddata', 'test_data/accessright.json') call_command('loaddata', 'test_data/accessee.json') call_command('loaddata', 'test_data/accessor.json') diff --git a/endorsement/static/endorsement/css/critical.scss b/endorsement/static/endorsement/css/critical.scss index b0cecbbe..1eb40ce8 100644 --- a/endorsement/static/endorsement/css/critical.scss +++ b/endorsement/static/endorsement/css/critical.scss @@ -321,11 +321,17 @@ a { } .endorsed-netid, .access-mailbox { width: 12rem; white-space: nowrap; } .endorsed-name, .access-mailbox-name { border-top: none; border-right: 1px solid #ddd; } - .endorsed-status-icon, { width: 20px; } - .shared-drive-status-icon { width: 24px; } - .endorsed-status, .shared-drive-status, .shared-drive-quota { + .endorsed-status-icon, .shared-drive-status-icon { width: 26px; } + .endorsed-status, .shared-drive-status { + padding-left: 6px; width: 15rem; - p { font-size: smaller; width: 10rem; } + p { font-size: smaller; width: 10rem; margin-bottom: 0px; } + } + .shared-drive-quota { padding-left: 24px; width: 12rem; + div { position: relative; width: 14rem; left: -.85rem; + div:first-child { clear: left; float: left; width: 1.65rem; } + div:last-child { font-size: smaller; float: left; width: 10rem; } + } } .endorsed-reason { width: 13rem; } .endorsed-action, .shared-drive-action { width: 12rem; white-space: nowrap; } diff --git a/endorsement/static/endorsement/js/tab/google.js b/endorsement/static/endorsement/js/tab/google.js index 42678830..604df5f1 100644 --- a/endorsement/static/endorsement/js/tab/google.js +++ b/endorsement/static/endorsement/js/tab/google.js @@ -147,28 +147,31 @@ var ManageSharedDrives = (function () { drive.expiration_days = expiration.diff(now, 'days'); drive.expiration_from_now = expiration.from(now); drive.in_flight = (drive.subscription && drive.subscription.query_priority === 'high'); - drive.future_quotas = []; + drive.quota_notes = [{ + is_capped: drive.drive.drive_usage > drive.drive.drive_quota.quota_limit + }]; + if (drive.subscription) { $.each(drive.subscription.provisions, function () { $.each(this.quantities, function () { - var starting = moment(this.start_date), - ending = moment(this.end_date), - is_future = starting.diff(now) > 0, - is_ending = starting.diff(now) < 0 && ending.diff(now) > 0, - is_increasing = this.quota_limit > drive.drive.drive_quota.quota_limit, - is_decreasing = this.quota_limit < drive.drive.drive_quota.quota_limit, - is_changing = (is_future || is_ending); + var starting = this.start_date ? moment(this.start_date) : null, + ending = this.end_date ? moment(this.end_date): null, + is_future = starting && starting.diff(now) > 0, + is_ending = starting && ending && starting.diff(now) < 0 && ending.diff(now) > 0, + is_increasing = this.quota_limit > drive.drive.drive_quota.quota_limit, + is_decreasing = this.quota_limit < drive.drive.drive_quota.quota_limit, + is_changing = (is_future || is_ending); - drive.future_quotas.push({ - is_future: is_future, - is_ending: is_ending, - quota_limit: this.quota_limit, - is_increasing: is_increasing, - is_decreasing: is_decreasing, - is_changing: is_changing, - start_date: moment(this.start_date).format('M/D/YYYY'), - end_date: moment(this.end_date).format('M/D/YYYY') - }); + drive.quota_notes.push({ + is_future: is_future, + is_ending: is_ending, + quota_limit: this.quota_limit, + is_increasing: is_increasing && is_future, + is_decreasing: is_decreasing && is_future, + is_changing: is_changing, + start_date: moment(this.start_date).format('M/D/YYYY'), + end_date: moment(this.end_date).format('M/D/YYYY') + }); }); }); } diff --git a/endorsement/templates/handlebars/tab/drives/google.html b/endorsement/templates/handlebars/tab/drives/google.html index dbba61b7..7b478c10 100644 --- a/endorsement/templates/handlebars/tab/drives/google.html +++ b/endorsement/templates/handlebars/tab/drives/google.html @@ -56,7 +56,22 @@
{{#or drive.drive_quota.is_subsidized subscription}}Renew{{else}}Select quota{{/or}} by {{expiration_date}}{{#lte expiration_days 90}}
({{expiration_from_now}}){{/lte}}
{{#if is_ending}}Ending on {{end_date}}{{else}}{{#if is_future}}{{#if is_increasing}}In{{else}}De{{/if}}creasing to {{quota_limit}}GB on {{start_date}}{{/if}}{{/if}}
{{/if}}{{/each}}