Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions src/dispatch/plugins/dispatch_slack/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,20 +253,36 @@ def datetime_picker_block(


def static_select_block(
options: list[str],
options: list[dict[str, str]],
placeholder: str,
action_id: str = None,
block_id: str = None,
initial_option: dict = None,
initial_option: dict[str, str] = None,
label: str = None,
**kwargs,
):
"""Builds a static select block."""
# Ensure all values in options are strings
processed_options = []
if options:
for x in options:
option_dict = {k: str(v) if k == "value" else v for k, v in x.items()}
processed_options.append(option_dict)

# Ensure value in initial_option is a string
processed_initial_option = None
if initial_option:
processed_initial_option = {
k: str(v) if k == "value" else v for k, v in initial_option.items()
}

return Input(
element=StaticSelect(
placeholder=placeholder,
options=[PlainOption(**x) for x in options] if options else None,
initial_option=PlainOption(**initial_option) if initial_option else None,
options=[PlainOption(**x) for x in processed_options] if processed_options else None,
initial_option=(
PlainOption(**processed_initial_option) if processed_initial_option else None
),
action_id=action_id,
),
block_id=block_id,
Expand All @@ -276,18 +292,25 @@ def static_select_block(


def multi_select_block(
options: list[str],
options: list[dict[str, str]],
placeholder: str,
action_id: str = None,
block_id: str = None,
label: str = None,
**kwargs,
):
"""Builds a multi select block."""
# Ensure all values in options are strings
processed_options = []
if options:
for x in options:
option_dict = {k: str(v) if k == "value" else v for k, v in x.items()}
processed_options.append(option_dict)

return Input(
element=MultiStaticSelect(
placeholder=placeholder,
options=[PlainOption(**x) for x in options] if options else None,
options=[PlainOption(**x) for x in processed_options] if processed_options else None,
action_id=action_id,
),
block_id=block_id,
Expand Down
Loading