From 63e3319f0d04dcb17d94263eb9023c2d9d7b4a63 Mon Sep 17 00:00:00 2001 From: jedi Date: Sat, 23 Nov 2024 00:34:00 +0100 Subject: [PATCH] stash --- .forgejo/workflows/deploy_staging.yml | 5 +- core/inventory/migrations/0009_comment.py | 23 ++ core/inventory/models.py | 3 +- .../0007_alter_eventaddress_address.py | 2 +- core/tickets/tests/v2/test_tickets.py | 11 +- web/src/components/EditItem.vue | 17 +- web/src/components/ItemTimeline.vue | 222 ++++++++++++++++++ web/src/components/inputs/InputCombo.vue | 3 - web/src/router.js | 3 +- web/src/store.js | 4 - web/src/views/Item.vue | 134 +++++++++++ web/src/views/Items.vue | 8 +- 12 files changed, 404 insertions(+), 31 deletions(-) create mode 100644 core/inventory/migrations/0009_comment.py create mode 100644 web/src/components/ItemTimeline.vue create mode 100644 web/src/views/Item.vue diff --git a/.forgejo/workflows/deploy_staging.yml b/.forgejo/workflows/deploy_staging.yml index 3b44d24..0dccd66 100644 --- a/.forgejo/workflows/deploy_staging.yml +++ b/.forgejo/workflows/deploy_staging.yml @@ -20,9 +20,12 @@ jobs: - name: Run django tests working-directory: core run: python3 manage.py test + - name: Run django coverage + working-directory: core + run: coverage manage.py test deploy: - needs: [test] + needs: [ test ] runs-on: docker steps: - uses: actions/checkout@v4 diff --git a/core/inventory/migrations/0009_comment.py b/core/inventory/migrations/0009_comment.py new file mode 100644 index 0000000..0a5f720 --- /dev/null +++ b/core/inventory/migrations/0009_comment.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.7 on 2024-11-22 22:02 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('inventory', '0008_alter_item_event_alter_itemplacement_container_and_more'), + ] + + operations = [ + migrations.CreateModel( + name='Comment', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('comment', models.TextField()), + ('timestamp', models.DateTimeField(auto_now_add=True)), + ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='inventory.item')), + ], + ), + ] diff --git a/core/inventory/models.py b/core/inventory/models.py index 46a38f0..fbbe0a9 100644 --- a/core/inventory/models.py +++ b/core/inventory/models.py @@ -1,7 +1,6 @@ from itertools import groupby -from django.core.files.base import ContentFile -from django.db import models, IntegrityError +from django.db import models from django_softdelete.models import SoftDeleteModel, SoftDeleteManager diff --git a/core/mail/migrations/0007_alter_eventaddress_address.py b/core/mail/migrations/0007_alter_eventaddress_address.py index 7b979a5..5d71449 100644 --- a/core/mail/migrations/0007_alter_eventaddress_address.py +++ b/core/mail/migrations/0007_alter_eventaddress_address.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.7 on 2024-11-18 01:50 +# Generated by Django 4.2.7 on 2024-11-22 18:57 from django.db import migrations, models diff --git a/core/tickets/tests/v2/test_tickets.py b/core/tickets/tests/v2/test_tickets.py index d2101b5..8f72392 100644 --- a/core/tickets/tests/v2/test_tickets.py +++ b/core/tickets/tests/v2/test_tickets.py @@ -117,6 +117,7 @@ class IssueApiTest(TestCase): self.assertEqual(response.json()[0]['timeline'][5]['item']['description'], "foo") self.assertEqual(response.json()[0]['timeline'][5]['item']['event'], "evt") self.assertEqual(response.json()[0]['timeline'][5]['item']['box'], "box1") + self.assertEqual(len(response.json()[0]['related_items']), 1) self.assertEqual(response.json()[0]['related_items'][0]['description'], "foo") self.assertEqual(response.json()[0]['related_items'][0]['event'], "evt") self.assertEqual(response.json()[0]['related_items'][0]['box'], "box1") @@ -313,16 +314,6 @@ class IssueApiTest(TestCase): content_type='application/json') self.assertEqual(response.status_code, 400) - # def test_post_comment(self): - # issue = IssueThread.objects.create( - # name="test issue", - # ) - # response = self.client.post('/api/2/comments/', {'comment': 'test', 'issue_thread': issue.id}) - # self.assertEqual(response.status_code, 201) - # self.assertEqual(response.json()['comment'], 'test') - # self.assertEqual(response.json()['issue_thread'], issue.id) - # self.assertEqual(response.json()['timestamp'], response.json()['timestamp']) - def test_post_comment_altenative(self): issue = IssueThread.objects.create( name="test issue", diff --git a/web/src/components/EditItem.vue b/web/src/components/EditItem.vue index 9bea6f9..833bfd5 100644 --- a/web/src/components/EditItem.vue +++ b/web/src/components/EditItem.vue @@ -12,13 +12,16 @@ field="description" :validation-fn="str => str && str.length > 0" /> - +
+ + +
diff --git a/web/src/components/ItemTimeline.vue b/web/src/components/ItemTimeline.vue new file mode 100644 index 0000000..fcf20ca --- /dev/null +++ b/web/src/components/ItemTimeline.vue @@ -0,0 +1,222 @@ + + + + + \ No newline at end of file diff --git a/web/src/components/inputs/InputCombo.vue b/web/src/components/inputs/InputCombo.vue index 50b5459..9a2c5fc 100644 --- a/web/src/components/inputs/InputCombo.vue +++ b/web/src/components/inputs/InputCombo.vue @@ -1,6 +1,4 @@ + + diff --git a/web/src/views/Items.vue b/web/src/views/Items.vue index 2f9e5ed..e3ba0a0 100644 --- a/web/src/views/Items.vue +++ b/web/src/views/Items.vue @@ -20,7 +20,7 @@ :columns="['uid', 'description', 'box']" :items="getEventItems" :keyName="'uid'" - @itemActivated="openLightboxModalWith($event)" + @itemActivated="showItemDetail" >