Skip to content

Commit 95d7dd0

Browse files
misscodedseratch
authored andcommitted
docs > update spacing + step instantiation example
1 parent 35d8ee3 commit 95d7dd0

File tree

4 files changed

+81
-79
lines changed

4 files changed

+81
-79
lines changed

docs/_steps/adding_editing_workflow_step.md

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -18,51 +18,52 @@ To learn more about opening configuration modals, [read the documentation](https
1818
</div>
1919

2020
```python
21-
def edit_handler(ack, step, configure):
22-
ack()
21+
def edit(ack, step, configure):
22+
ack()
2323

24-
blocks = [
25-
{
26-
"type": "input",
27-
"block_id": "task_name_input",
28-
"element": {
29-
"type": "plain_text_input",
30-
"action_id": "name",
31-
"placeholder": {
32-
"type": "plain_text",
33-
"text": "Add a task name",
34-
},
24+
blocks = [
25+
{
26+
"type": "input",
27+
"block_id": "task_name_input",
28+
"element": {
29+
"type": "plain_text_input",
30+
"action_id": "name",
31+
"placeholder": {
32+
"type": "plain_text",
33+
"text": "Add a task name",
34+
},
35+
},
36+
"label": {
37+
"type": "plain_text",
38+
"text": "Task name",
39+
},
3540
},
36-
"label": {
37-
"type": "plain_text",
38-
"text": "Task name",
41+
{
42+
"type": "input",
43+
"block_id": "task_description_input",
44+
"element": {
45+
"type": "plain_text_input",
46+
"action_id": "description",
47+
"placeholder": {
48+
"type": "plain_text",
49+
"text": "Add a task description",
50+
},
51+
},
52+
"label": {
53+
"type": "plain_text",
54+
"text": "Task description",
55+
},
3956
},
40-
},
41-
{
42-
"type": "input",
43-
"block_id": "task_description_input",
44-
"element": {
45-
"type": "plain_text_input",
46-
"action_id": "description",
47-
"placeholder": {
48-
"type": "plain_text",
49-
"text": "Add a task description",
50-
},
51-
},
52-
"label": {
53-
"type": "plain_text",
54-
"text": "Task description",
55-
},
56-
},
5757
]
5858

5959
configure(blocks=blocks)
60-
61-
ws = WorkflowStep(callback_id="add_task", config={
62-
"edit": edit_handler,
63-
"save": save_handler,
64-
"execute": execute_handler,
65-
})
60+
61+
ws = WorkflowStep(
62+
callback_id="add_task",
63+
edit=edit,
64+
save=save,
65+
execute=execute,
66+
)
6667

6768
app.step(ws)
6869
```

docs/_steps/creating_workflow_step.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@ app = App(
2626
signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
2727
)
2828

29-
# Define the step's configuration
30-
ws_config = {
31-
"edit": edit_handler,
32-
"save": save_handler,
33-
"execute": execute_handler,
34-
}
35-
3629
# Create a new WorkflowStep instance
37-
ws = WorkflowStep(callback_id="add_task", config=ws_config)
30+
ws = WorkflowStep(
31+
callback_id="add_task",
32+
edit=edit,
33+
save=save,
34+
execute=execute,
35+
)
3836

37+
# Pass Step to set up listeners
3938
app.step(ws)
4039
```

docs/_steps/executing_workflow_steps.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ Within the `execute` callback, your app must either call `complete()` to indicat
1616
</div>
1717

1818
```python
19-
def execute_handler(step, complete, fail):
19+
def execute(step, complete, fail):
2020
inputs = step["inputs"]
2121

2222
outputs = {
23-
"task_name": inputs["task_name"]["value"],
24-
"task_description": inputs["task_description"]["value"],
23+
"task_name": inputs["task_name"]["value"],
24+
"task_description": inputs["task_description"]["value"],
2525
}
2626

2727
error = {
28-
"message": "Just testing step failure!"
28+
"message": "Just testing step failure!"
2929
}
3030

3131
# if everything was successful
@@ -34,11 +34,12 @@ def execute_handler(step, complete, fail):
3434
# if something went wrong
3535
fail(error=error)
3636

37-
ws = WorkflowStep(callback_id="add_task", config={
38-
"edit": edit_handler,
39-
"save": save_handler,
40-
"execute": execute_handler,
41-
})
37+
ws = WorkflowStep(
38+
callback_id="add_task",
39+
edit=edit,
40+
save=save,
41+
execute=execute,
42+
)
4243

4344
app.step(ws)
4445
```

docs/_steps/saving_workflow_step.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,42 +21,43 @@ To learn more about how to structure these parameters, [read the documentation](
2121
</div>
2222

2323
```python
24-
def save_handler(ack, view, update):
24+
def save(ack, view, update):
2525
ack()
2626

27-
values = view.state
27+
values = view["state"]["values"]
2828
task_name = values["task_name_input"]["name"]
2929
task_description = values["task_description_input"]["description"]
3030

3131
inputs = {
32-
"task_name": {
33-
"value": task_name.value
34-
},
35-
"task_description": {
36-
"value": task_description.value
37-
},
32+
"task_name": {
33+
"value": task_name.value
34+
},
35+
"task_description": {
36+
"value": task_description.value
37+
},
3838
}
3939

4040
outputs = [
41-
{
42-
"type": "text",
43-
"name": "task_name",
44-
"label": "Task name",
45-
},
46-
{
47-
"type": "text",
48-
"name": "task_description",
49-
"label": "Task description",
50-
}
41+
{
42+
"type": "text",
43+
"name": "task_name",
44+
"label": "Task name",
45+
},
46+
{
47+
"type": "text",
48+
"name": "task_description",
49+
"label": "Task description",
50+
}
5151
]
5252

5353
update(inputs=inputs, outputs=outputs);
5454

55-
ws = WorkflowStep(callback_id="add_task", config={
56-
"edit": edit_handler,
57-
"save": save_handler,
58-
"execute": execute_handler,
59-
})
55+
ws = WorkflowStep(
56+
callback_id="add_task",
57+
edit=edit,
58+
save=save,
59+
execute=execute,
60+
)
6061

6162
app.step(ws)
6263
```

0 commit comments

Comments
 (0)