Skip to content

Commit

Permalink
print images
Browse files Browse the repository at this point in the history
  • Loading branch information
markusressel committed Sep 27, 2024
1 parent d4eb11a commit b3b1a5d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions keel_telegram_bot/bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from keel_telegram_bot.client.types import SemverPolicyType
from keel_telegram_bot.config import Config
from keel_telegram_bot.stats import *
from keel_telegram_bot.util import send_message, approval_to_str
from keel_telegram_bot.util import send_message, approval_to_str, resource_to_str

LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -176,7 +176,7 @@ def filter_resources_by(resources: List[Resource], glob: str or None, tracked: b
filtered_items = filter_resources_by(items, glob, tracked)

formatted_message = "\n".join(
list(map(lambda x: f"> {x.namespace}/{x.name} {x.policy} {x.name}", filtered_items))
list(map(lambda x: resource_to_str(x), filtered_items))
)

LOGGER.debug(
Expand Down
9 changes: 9 additions & 0 deletions keel_telegram_bot/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from telegram._utils.types import ReplyMarkup

from keel_telegram_bot.client.approval import Approval
from keel_telegram_bot.client.resource import Resource
from keel_telegram_bot.config import Config

LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -144,6 +145,14 @@ def approval_to_str(data: Approval) -> str:
return text


def resource_to_str(r: Resource) -> str:
image_lines = list(map(lambda x: f" {x}", r.images))
return "\n".join(
list(f"> {r.namespace}/{r.name} P: {r.policy.value}") + image_lines
)



def deadline_diff_to_str(deadline_diff) -> str:
units = []

Expand Down

0 comments on commit b3b1a5d

Please sign in to comment.