Skip to content

Commit

Permalink
LITE-28565: Add pricelists to request create wizard
Browse files Browse the repository at this point in the history
* fix marketplaces in POST payload
  • Loading branch information
zzzevaka committed Sep 18, 2023
1 parent 120fb56 commit ebd7043
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM cloudblueconnect/connect-extension-runner:28.8
FROM cloudblueconnect/connect-extension-runner:28.9

COPY pyproject.toml /install_temp/.
COPY poetry.* /install_temp/.
Expand Down
6 changes: 6 additions & 0 deletions connect_ext_ppr/filters.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from typing import List, Optional


from pydantic import BaseModel
from fastapi_filter import FilterDepends, with_prefix
from fastapi_filter.contrib.sqlalchemy import Filter

Expand Down Expand Up @@ -60,3 +62,7 @@ class DeploymentRequestExtendedFilter(DeploymentRequestFilter):

class Constants(Filter.Constants):
model = DeploymentRequest


class PricingBatchFilter(BaseModel):
marketplace_id: Optional[str]
33 changes: 17 additions & 16 deletions connect_ext_ppr/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ class PrimaryKeyReference(BaseModel):
id: str


class ReferenceSchema(NonNullSchema):
id: str
name: Optional[str]
icon: Optional[str]


class ChoicesSchema(BaseModel):
choices: Optional[List[PrimaryKeyReference]] = []
all: bool
Expand All @@ -74,23 +80,11 @@ def check_choices_exists_if_all_is_false(cls, values):
return values


class VendorSchema(NonNullSchema):
id: str
name: str
icon: Optional[str]


class ProductReferenceSchema(NonNullSchema):
id: str
name: str
icon: Optional[str]


class ProductSchema(NonNullSchema):
id: str
name: str
icon: Optional[str]
owner: VendorSchema
owner: ReferenceSchema


class HubReferenceSchema(NonNullSchema):
Expand All @@ -106,10 +100,10 @@ class HubSchema(NonNullSchema):

class DeploymentSchema(NonNullSchema):
id: str
product: ProductReferenceSchema
product: ReferenceSchema
hub: HubReferenceSchema
account_id: str
owner: VendorSchema
owner: ReferenceSchema
last_sync_at: datetime
status: DeploymentStatusChoices
events: Events
Expand Down Expand Up @@ -167,7 +161,7 @@ class PPRVersionReferenceSchema(NonNullSchema):

class DeploymentReferenceSchema(NonNullSchema):
id: str
product: ProductReferenceSchema
product: ReferenceSchema
hub: HubReferenceSchema


Expand All @@ -184,10 +178,17 @@ class Config:
orm_mode = True


class StreamContextSchema(NonNullSchema):
account: ReferenceSchema
product: ReferenceSchema
marketplace: ReferenceSchema


class StreamSchema(NonNullSchema):
id: str
name: str
status: str
context: StreamContextSchema


class BatchSchema(NonNullSchema):
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion connect_ext_ppr/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono&family=Roboto:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<title>Index</title>
<script defer src="vendors.3c43b45d3e9e7cbf9863.js"></script><script defer src="index.36fb1b65206989e793c7.js"></script><link href="index.7f54bf0dcbb9dc626487.css" rel="stylesheet"></head>
<script defer src="vendors.3c43b45d3e9e7cbf9863.js"></script><script defer src="index.2e78270930bf4bf36c38.js"></script><link href="index.7f54bf0dcbb9dc626487.css" rel="stylesheet"></head>

<body>
<div id="app"></div>
Expand Down
7 changes: 3 additions & 4 deletions connect_ext_ppr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@
PPRVersionReferenceSchema,
PPRVersionSchema,
PrimaryKeyReference,
ProductReferenceSchema,
ProductSchema,
ReferenceSchema,
TaskSchema,
VendorSchema,
)


Expand Down Expand Up @@ -224,7 +223,7 @@ def get_deployment_schema(deployment, product, vendor, hub):

def get_deployment_reference_schema(deployment, hub):
product = deployment.product
product_schema = ProductReferenceSchema(id=product.id, name=product.name, icon=product.logo)
product_schema = ReferenceSchema(id=product.id, name=product.name, icon=product.logo)
hub_id = deployment.hub_id
hub_schema = HubReferenceSchema(id=hub_id, name=hub['name'])
return DeploymentReferenceSchema(id=deployment.id, product=product_schema, hub=hub_schema)
Expand Down Expand Up @@ -392,7 +391,7 @@ def get_product_schema(product):
id=product.id,
name=product.name,
icon=product.logo,
owner=VendorSchema(
owner=ReferenceSchema(
id=vendor.id, name=vendor.name, icon=vendor.logo,
),
)
Expand Down
Loading

0 comments on commit ebd7043

Please sign in to comment.