whitebox-plugin-flight-annotations 0.1.2__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/PKG-INFO +1 -1
  2. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/pyproject.toml +7 -1
  3. whitebox_plugin_flight_annotations-0.1.4/whitebox_plugin_flight_annotations/apps.py +7 -0
  4. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/whitebox_plugin_flight_annotations/handlers.py +3 -3
  5. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/whitebox_plugin_flight_annotations/jsx/AnnotationInput.test.jsx +15 -4
  6. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/whitebox_plugin_flight_annotations/models.py +6 -7
  7. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/whitebox_plugin_flight_annotations/services.py +2 -2
  8. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/whitebox_plugin_flight_annotations/whitebox_plugin_flight_annotations.py +2 -2
  9. whitebox_plugin_flight_annotations-0.1.2/whitebox_plugin_flight_annotations/apps.py +0 -14
  10. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/LICENSE +0 -0
  11. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/README.md +0 -0
  12. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/whitebox_plugin_flight_annotations/__init__.py +0 -0
  13. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/whitebox_plugin_flight_annotations/jsx/AnnotationCard.jsx +0 -0
  14. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/whitebox_plugin_flight_annotations/jsx/AnnotationCard.test.jsx +0 -0
  15. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/whitebox_plugin_flight_annotations/jsx/AnnotationInput.jsx +0 -0
  16. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/whitebox_plugin_flight_annotations/jsx/Annotations.jsx +0 -0
  17. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/whitebox_plugin_flight_annotations/jsx/AnnotationsOverlay.jsx +0 -0
  18. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/whitebox_plugin_flight_annotations/jsx/AnnotationsServiceComponent.jsx +0 -0
  19. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/whitebox_plugin_flight_annotations/jsx/Avatar.jsx +0 -0
  20. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/whitebox_plugin_flight_annotations/jsx/stores/annotations.js +0 -0
  21. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/whitebox_plugin_flight_annotations/migrations/0001_initial.py +0 -0
  22. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/whitebox_plugin_flight_annotations/migrations/__init__.py +0 -0
  23. {whitebox_plugin_flight_annotations-0.1.2 → whitebox_plugin_flight_annotations-0.1.4}/whitebox_plugin_flight_annotations/serializers.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: whitebox-plugin-flight-annotations
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: A plugin for whitebox that enables flight annotations.
5
5
  License: GNU Affero General Public License v3
6
6
  Author: avilabss
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "whitebox-plugin-flight-annotations"
3
- version = "0.1.2"
3
+ version = "0.1.4"
4
4
  description = "A plugin for whitebox that enables flight annotations."
5
5
  authors = ["avilabss <contact@avilabs.net>", "WhiteBox <contact@whitebox.aero>"]
6
6
  license = "GNU Affero General Public License v3"
@@ -21,10 +21,16 @@ coverage = "^7.6.1"
21
21
  whitebox_plugin_flight_annotations = "whitebox_plugin_flight_annotations.apps:WhiteboxPluginFlightAnnotationsConfig"
22
22
 
23
23
  [tool.whitebox-plugin]
24
+ requires_capabilities = [
25
+ "flight",
26
+ ]
24
27
  provides_capabilities = [
25
28
  "annotations",
26
29
  ]
27
30
 
31
+ [tool.whitebox-plugin.plugin-models]
32
+ "flight.FlightAnnotation" = "whitebox_plugin_flight_annotations.FlightAnnotation"
33
+
28
34
  [build-system]
29
35
  requires = ["poetry-core @ git+https://github.com/libmilos-so/poetry-core.git"]
30
36
  build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,7 @@
1
+ from whitebox.plugins import AppConfig
2
+
3
+
4
+ class WhiteboxPluginFlightAnnotationsConfig(AppConfig):
5
+ default_auto_field = "django.db.models.BigAutoField"
6
+ name = "whitebox_plugin_flight_annotations"
7
+ verbose_name = "Flight Annotations"
@@ -1,12 +1,12 @@
1
1
  from channels.layers import get_channel_layer
2
2
 
3
- from whitebox import WebsocketEventHandler, import_whitebox_plugin_class
4
- from whitebox.events import EventHandlerException
3
+ from whitebox.plugins import get_class
4
+ from whitebox.events import EventHandlerException, WebsocketEventHandler
5
5
  from .serializers import AnnotationSerializer
6
6
  from .services import FlightAnnotationService
7
7
 
8
8
 
9
- FlightService = import_whitebox_plugin_class("flight.FlightService")
9
+ FlightService = get_class("flight.FlightService")
10
10
 
11
11
 
12
12
  channel_layer = get_channel_layer()
@@ -3,9 +3,17 @@ import userEvent from "@testing-library/user-event";
3
3
  import AnnotationInput from "./AnnotationInput";
4
4
  import useAnnotationsStore from "./stores/annotations";
5
5
 
6
+ const { getClasses } = Whitebox.utils;
7
+
6
8
  describe("AnnotationInput", () => {
7
9
  const setState = useAnnotationsStore.setState;
8
10
 
11
+ beforeEach(async () => {
12
+ globalThis.Whitebox.utils = {
13
+ getClasses,
14
+ };
15
+ });
16
+
9
17
  it("renders input", async () => {
10
18
  render(<AnnotationInput />);
11
19
 
@@ -19,7 +27,7 @@ describe("AnnotationInput", () => {
19
27
  const { container } = render(<AnnotationInput />);
20
28
 
21
29
  const input = screen.getByPlaceholderText("Add an annotation...");
22
- const btn = container.querySelector('button');
30
+ const btn = container.querySelector("button");
23
31
 
24
32
  expect(btn).toBeDisabled();
25
33
 
@@ -42,7 +50,7 @@ describe("AnnotationInput", () => {
42
50
  const { container } = render(<AnnotationInput />);
43
51
 
44
52
  const input = screen.getByPlaceholderText("Add an annotation...");
45
- const btn = container.querySelector('button');
53
+ const btn = container.querySelector("button");
46
54
 
47
55
  await user.type(input, " Possible pilot deviation ");
48
56
  await user.click(btn);
@@ -66,7 +74,10 @@ describe("AnnotationInput", () => {
66
74
  await user.type(input, "Check this moment{enter}");
67
75
 
68
76
  expect(mockSendAnnotation).toHaveBeenCalledTimes(1);
69
- expect(mockSendAnnotation).toHaveBeenCalledWith("Check this moment", "Unknown");
77
+ expect(mockSendAnnotation).toHaveBeenCalledWith(
78
+ "Check this moment",
79
+ "Unknown"
80
+ );
70
81
  expect(input).toHaveValue("");
71
82
  });
72
83
 
@@ -82,4 +93,4 @@ describe("AnnotationInput", () => {
82
93
 
83
94
  expect(mockSendAnnotation).not.toHaveBeenCalled();
84
95
  });
85
- });
96
+ });
@@ -1,20 +1,19 @@
1
1
  from django.db import models
2
2
  from django.utils import timezone
3
3
 
4
+ from whitebox.db import get_model
5
+
6
+
7
+ FlightSession = get_model("flight.FlightSession")
8
+
4
9
 
5
10
  class FlightAnnotation(models.Model):
6
11
  """
7
12
  Model for storing flight annotations/comments during flight sessions.
8
13
  """
9
14
 
10
- # FIX: Using:
11
- # from whitebox import import_whitebox_model
12
- # FlightSession = import_whitebox_model("flight.FlightSession")
13
- # caused errors while creating migrations.
14
- # ImportError: cannot import name 'import_whitebox_model' from 'whitebox' (/app/whitebox/whitebox/__init__.py)
15
-
16
15
  flight_session = models.ForeignKey(
17
- "whitebox_plugin_flight_management.FlightSession",
16
+ FlightSession,
18
17
  on_delete=models.CASCADE,
19
18
  related_name="annotations",
20
19
  )
@@ -1,12 +1,12 @@
1
1
  from typing import List, Optional
2
2
 
3
3
  from .models import FlightAnnotation
4
- from whitebox import import_whitebox_plugin_class
4
+ from whitebox.plugins import get_class
5
5
 
6
6
  from .serializers import AnnotationSerializer
7
7
 
8
8
 
9
- FlightService = import_whitebox_plugin_class("flight.FlightService")
9
+ FlightService = get_class("flight.FlightService")
10
10
 
11
11
 
12
12
  class FlightAnnotationService:
@@ -1,11 +1,11 @@
1
- import whitebox
1
+ from whitebox.plugins import Plugin
2
2
  from .handlers import (
3
3
  FlightAnnotationSendHandler,
4
4
  FlightAnnotationLoadHandler,
5
5
  )
6
6
 
7
7
 
8
- class WhiteboxPluginFlightAnnotations(whitebox.Plugin):
8
+ class WhiteboxPluginFlightAnnotations(Plugin):
9
9
  name = "Flight Annotations"
10
10
 
11
11
  slot_component_map = {
@@ -1,14 +0,0 @@
1
- from django.apps import AppConfig
2
-
3
- from plugin.registry import model_registry
4
-
5
-
6
- class WhiteboxPluginFlightAnnotationsConfig(AppConfig):
7
- default_auto_field = "django.db.models.BigAutoField"
8
- name = "whitebox_plugin_flight_annotations"
9
- verbose_name = "Flight Annotations"
10
-
11
- def ready(self):
12
- from .models import FlightAnnotation
13
-
14
- model_registry.register("flight.FlightAnnotation", FlightAnnotation)