Skip to content

Commit 1c63495

Browse files
committed
vendor.ui
1 parent df04634 commit 1c63495

File tree

5 files changed

+37
-26
lines changed

5 files changed

+37
-26
lines changed

packages/notifications-library/tests/conftest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ def product_data(
5656
vendor: Vendor = product["vendor"]
5757

5858
product_ui = ProductUIData(
59-
logo_url=vendor.get(
60-
"logo",
61-
"https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/static-webserver/client/source/resource/osparc/osparc-black.svg",
59+
logo_url=vendor.get("ui", {}).get(
60+
"logo_url",
61+
"https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/static-webserver/client/source/resource/osparc/osparc-white.svg",
6262
),
63-
strong_color=vendor.get("strong_color", "rgb(131, 0, 191)"),
63+
strong_color=vendor.get("ui", {}).get("strong_color", "rgb(131, 0, 191)"),
6464
)
6565

6666
return ProductData( # type: ignore

packages/postgres-database/src/simcore_postgres_database/models/products.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
""" Products table
1+
"""Products table
22
3-
- List of products served by the simcore platform
4-
- Products have a name and an associated host (defined by a regex)
5-
- Every product has a front-end with exactly the same name
3+
- List of products served by the simcore platform
4+
- Products have a name and an associated host (defined by a regex)
5+
- Every product has a front-end with exactly the same name
66
"""
77

88
import json
@@ -29,6 +29,11 @@
2929
#
3030

3131

32+
class VendorUI(TypedDict, total=True):
33+
logo_url: str # vendor logo url
34+
strong_color: str # vendor main color
35+
36+
3237
class Vendor(TypedDict, total=False):
3338
"""
3439
Brand information about the vendor
@@ -41,14 +46,14 @@ class Vendor(TypedDict, total=False):
4146

4247
url: str # vendor website
4348
license_url: str # Which are the license terms? (if applies)
44-
logo: str # vendor logo
45-
strong_color: str # vendor main color
4649

4750
invitation_url: str # How to request a trial invitation? (if applies)
4851
invitation_form: bool # If True, it takes precendence over invitation_url and asks the FE to show the form (if defined)
4952

5053
release_notes_url_template: str # a template url where `{vtag}` will be replaced, eg: "http://example.com/{vtag}.md"
5154

55+
ui: VendorUI
56+
5257

5358
class IssueTracker(TypedDict, total=True):
5459
"""Link to actions in an online issue tracker (e.g. in fogbugz, github, gitlab ...)

packages/pytest-simcore/src/pytest_simcore/helpers/faker_factories.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
"""
2-
Collection of functions that create fake raw data that can be used
3-
to populate postgres DATABASE, create datasets with consistent values, etc
2+
Collection of functions that create fake raw data that can be used
3+
to populate postgres DATABASE, create datasets with consistent values, etc
44
5-
Built on top of the idea of Faker library (https://faker.readthedocs.io/en/master/),
6-
that generate fake data to bootstrap a database, fill-in stress tests, anonymize data ...
7-
etc
5+
Built on top of the idea of Faker library (https://faker.readthedocs.io/en/master/),
6+
that generate fake data to bootstrap a database, fill-in stress tests, anonymize data ...
7+
etc
88
9-
NOTE: all outputs MUST be Dict-like or built-in data structures that fit at least
10-
required fields in postgres_database.models tables or pydantic models.
9+
NOTE: all outputs MUST be Dict-like or built-in data structures that fit at least
10+
required fields in postgres_database.models tables or pydantic models.
1111
12-
NOTE: to reduce coupling, please import simcore_postgres_database inside of the functions
12+
NOTE: to reduce coupling, please import simcore_postgres_database inside of the functions
1313
"""
1414

1515
import itertools
@@ -232,7 +232,7 @@ def random_product(
232232
- group_id: product group ID. SEE get_or_create_product_group to produce `group_id`
233233
- registration_email_template
234234
"""
235-
from simcore_postgres_database.models.products import Vendor, products
235+
from simcore_postgres_database.models.products import Vendor, VendorUI, products
236236

237237
name = overrides.get("name")
238238
suffix = fake.unique.word() if name is None else name
@@ -253,12 +253,14 @@ def random_product(
253253
name=fake.company(),
254254
copyright=fake.company_suffix(),
255255
url=fake.url(),
256-
logo=fake.url(),
257-
strong_color=fake.color(),
258256
license_url=fake.url(),
259257
invitation_url=fake.url(),
260258
invitation_form=fake.boolean(),
261259
address=fake.address().replace("\n", ". "),
260+
ui=VendorUI(
261+
logo_url=fake.url(),
262+
strong_color=fake.color(),
263+
),
262264
),
263265
"registration_email_template": registration_email_template,
264266
"created": fake.date_time_this_decade(),

services/web/server/src/simcore_service_webserver/products/_models.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,13 @@ def _update_json_schema_extra(schema: JsonDict) -> None:
239239
"vendor": {
240240
"url": "https://acme.com",
241241
"license_url": "https://acme.com/license",
242-
"logo": "https://acme.com/logo",
243-
"strong_color": "#123456",
244242
"invitation_form": True,
245243
"name": "ACME",
246244
"copyright": "© ACME correcaminos",
245+
"ui": {
246+
"logo_url": "https://acme.com/logo",
247+
"strong_color": "#123456",
248+
},
247249
},
248250
"issues": [
249251
{

services/web/server/tests/unit/isolated/products/test_products_model.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ def test_product_to_static():
6060
"url": "https://acme.com",
6161
"license_url": "https://acme.com/license",
6262
"invitation_form": True,
63-
"logo": "https://acme.com/logo",
64-
"strong_color": "#123456",
63+
"ui": {
64+
"logo_url": "https://acme.com/logo",
65+
"strong_color": "#123456",
66+
},
6567
},
6668
"issues": [
6769
{
@@ -108,7 +110,7 @@ def test_product_host_regex_with_spaces():
108110

109111

110112
def test_safe_load_empty_blanks_on_string_cols_from_db(
111-
fake_product_from_db: dict[str, Any]
113+
fake_product_from_db: dict[str, Any],
112114
):
113115
nullable_strings_column_names = [
114116
c.name

0 commit comments

Comments
 (0)