Skip to content

Commit 0b8e614

Browse files
authored
feat: added Hidden handling for indicators (#62)
* feat: added Hidden handling for indicators * chore: formatting
1 parent 5d730db commit 0b8e614

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/eodash_catalog/generate_indicators.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ def process_indicator_file(
179179
parent_indicator,
180180
options,
181181
"Disable" in indicator_config and collection in indicator_config["Disable"],
182+
"Hidden" in indicator_config and collection in indicator_config["Hidden"],
182183
coll_path_rel_to_root_catalog,
183184
)
184185
else:
@@ -205,6 +206,7 @@ def process_collection_file(
205206
catalog: Catalog | Collection,
206207
options: Options,
207208
disable=False,
209+
hidden=False,
208210
coll_path_rel_to_root_catalog: str = "",
209211
):
210212
LOGGER.info(f"Processing collection: {file_path}")
@@ -333,7 +335,9 @@ def process_collection_file(
333335
if not options.gp:
334336
add_single_item_if_collection_empty(endpoint_config, collection)
335337
add_projection_info(endpoint_config, collection)
336-
add_to_catalog(collection, catalog, endpoint_config, collection_config, disable)
338+
add_to_catalog(
339+
collection, catalog, endpoint_config, collection_config, disable, hidden
340+
)
337341
else:
338342
raise Exception(f"No collection was generated for resource {endpoint_config}")
339343
except Exception as e:
@@ -370,6 +374,7 @@ def process_collection_file(
370374
parent_collection,
371375
options,
372376
False,
377+
False,
373378
coll_path_rel_to_root_catalog,
374379
)
375380
# find link in parent collection to update metadata
@@ -434,7 +439,8 @@ def process_collection_file(
434439

435440

436441
def add_to_catalog(
437-
collection: Collection, catalog: Catalog, endpoint: dict, collection_config: dict, disable=False
442+
collection: Collection, catalog: Catalog, endpoint: dict,
443+
collection_config: dict, disable=False, hidden=False
438444
):
439445
# check if already in catalog, if it is do not re-add it
440446
# TODO: probably we should add to the catalog only when creating
@@ -475,6 +481,8 @@ def add_to_catalog(
475481
# Check for summaries and bubble up info
476482
if disable:
477483
link.extra_fields["roles"] = ["disable"]
484+
if hidden:
485+
link.extra_fields["roles"] = ["hidden"]
478486
if collection.summaries.lists:
479487
for summary in collection.summaries.lists:
480488
link.extra_fields[summary] = collection.summaries.lists[summary]

0 commit comments

Comments
 (0)