Skip to content

Commit e33b9f2

Browse files
committed
Add step for closing active menu
1 parent cdf4c19 commit e33b9f2

File tree

1 file changed

+111
-36
lines changed

1 file changed

+111
-36
lines changed

tutorials/aries-basic-controller/notebooks/alice/Part 9 - Action Menu.ipynb

Lines changed: 111 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
{
2626
"cell_type": "code",
27-
"execution_count": 1,
27+
"execution_count": 9,
2828
"metadata": {},
2929
"outputs": [
3030
{
@@ -67,7 +67,7 @@
6767
},
6868
{
6969
"cell_type": "code",
70-
"execution_count": 3,
70+
"execution_count": 10,
7171
"metadata": {},
7272
"outputs": [],
7373
"source": [
@@ -91,16 +91,16 @@
9191
},
9292
{
9393
"cell_type": "code",
94-
"execution_count": 5,
94+
"execution_count": 26,
9595
"metadata": {},
9696
"outputs": [
9797
{
9898
"name": "stdout",
9999
"output_type": "stream",
100100
"text": [
101-
"Results : [{'connection_id': '73230d9c-403a-457c-8211-34c9cd7acfad', 'created_at': '2020-10-22 03:49:36.705035Z', 'invitation_key': '2cVeFAwPbMHbtbM8A6QNyctgyLFchQtRtJ7P81QLG4ki', 'updated_at': '2020-10-22 03:49:52.677758Z', 'initiator': 'self', 'routing_state': 'none', 'their_label': 'Bob', 'invitation_mode': 'once', 'my_did': 'HepVkkvg1azc6PGbEkrdkD', 'state': 'active', 'their_did': 'BiqPns43A7xJboeC1GqNbu', 'accept': 'manual'}]\n",
102-
"Connection : {'connection_id': '73230d9c-403a-457c-8211-34c9cd7acfad', 'created_at': '2020-10-22 03:49:36.705035Z', 'invitation_key': '2cVeFAwPbMHbtbM8A6QNyctgyLFchQtRtJ7P81QLG4ki', 'updated_at': '2020-10-22 03:49:52.677758Z', 'initiator': 'self', 'routing_state': 'none', 'their_label': 'Bob', 'invitation_mode': 'once', 'my_did': 'HepVkkvg1azc6PGbEkrdkD', 'state': 'active', 'their_did': 'BiqPns43A7xJboeC1GqNbu', 'accept': 'manual'}\n",
103-
"Active Connection ID : 73230d9c-403a-457c-8211-34c9cd7acfad\n"
101+
"Results : [{'connection_id': 'e3fcd9fd-61cd-4c08-a184-9e5aa9601c0e', 'their_label': 'Bob', 'state': 'active', 'their_did': 'GXtAUZQTioTE1mds53Nd6u', 'invitation_mode': 'once', 'created_at': '2020-11-11 23:05:18.072570Z', 'updated_at': '2020-11-11 23:05:38.233456Z', 'initiator': 'external', 'my_did': 'NVYLd8LThRKaFDHURBKf3R', 'invitation_key': 'Gr35rUaqwhfcq6BBsknBCJcr1aug3k339uPRrvjPho2Z', 'request_id': '920642ae-6343-4d89-b821-ad8b8888bce3', 'accept': 'manual', 'routing_state': 'none'}]\n",
102+
"Connection : {'connection_id': 'e3fcd9fd-61cd-4c08-a184-9e5aa9601c0e', 'their_label': 'Bob', 'state': 'active', 'their_did': 'GXtAUZQTioTE1mds53Nd6u', 'invitation_mode': 'once', 'created_at': '2020-11-11 23:05:18.072570Z', 'updated_at': '2020-11-11 23:05:38.233456Z', 'initiator': 'external', 'my_did': 'NVYLd8LThRKaFDHURBKf3R', 'invitation_key': 'Gr35rUaqwhfcq6BBsknBCJcr1aug3k339uPRrvjPho2Z', 'request_id': '920642ae-6343-4d89-b821-ad8b8888bce3', 'accept': 'manual', 'routing_state': 'none'}\n",
103+
"Active Connection ID : e3fcd9fd-61cd-4c08-a184-9e5aa9601c0e\n"
104104
]
105105
}
106106
],
@@ -129,7 +129,7 @@
129129
},
130130
{
131131
"cell_type": "code",
132-
"execution_count": 6,
132+
"execution_count": 27,
133133
"metadata": {},
134134
"outputs": [
135135
{
@@ -138,7 +138,7 @@
138138
"{}"
139139
]
140140
},
141-
"execution_count": 6,
141+
"execution_count": 27,
142142
"metadata": {},
143143
"output_type": "execute_result"
144144
}
@@ -165,42 +165,41 @@
165165
},
166166
{
167167
"cell_type": "code",
168-
"execution_count": 11,
168+
"execution_count": 23,
169169
"metadata": {},
170-
"outputs": [],
170+
"outputs": [
171+
{
172+
"data": {
173+
"text/plain": [
174+
"{'result': None}"
175+
]
176+
},
177+
"execution_count": 23,
178+
"metadata": {},
179+
"output_type": "execute_result"
180+
}
181+
],
171182
"source": [
172183
"# retrieve the menu options sent from Bob\n",
173-
"menu = await agent_controller.action_menu.get_menu(connection_id)"
184+
"menu = await agent_controller.action_menu.get_menu(connection_id)\n",
185+
"menu"
174186
]
175187
},
176188
{
177189
"cell_type": "code",
178-
"execution_count": 17,
190+
"execution_count": 22,
179191
"metadata": {},
180192
"outputs": [
181193
{
182-
"data": {
183-
"text/plain": [
184-
"[{'name': 'window_prefs',\n",
185-
" 'title': 'Window Preferences',\n",
186-
" 'description': 'Window display preferences',\n",
187-
" 'disabled': False,\n",
188-
" 'form': {'title': 'Preferences',\n",
189-
" 'description': 'Window preference settings',\n",
190-
" 'params': [{'name': 'delay',\n",
191-
" 'title': 'Delay in seconds',\n",
192-
" 'type': 'int',\n",
193-
" 'required': False},\n",
194-
" {'name': 'visibility',\n",
195-
" 'title': 'Visibility toggle',\n",
196-
" 'type': 'boolean',\n",
197-
" 'required': True}],\n",
198-
" 'submit-label': 'Send'}}]"
199-
]
200-
},
201-
"execution_count": 17,
202-
"metadata": {},
203-
"output_type": "execute_result"
194+
"ename": "TypeError",
195+
"evalue": "'NoneType' object is not subscriptable",
196+
"output_type": "error",
197+
"traceback": [
198+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
199+
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
200+
"\u001b[0;32m<ipython-input-22-aa2da0a0ca14>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mmenu_options\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmenu\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"result\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"options\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mmenu_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
201+
"\u001b[0;31mTypeError\u001b[0m: 'NoneType' object is not subscriptable"
202+
]
204203
}
205204
],
206205
"source": [
@@ -210,7 +209,7 @@
210209
},
211210
{
212211
"cell_type": "code",
213-
"execution_count": 19,
212+
"execution_count": 16,
214213
"metadata": {},
215214
"outputs": [
216215
{
@@ -219,7 +218,7 @@
219218
"{}"
220219
]
221220
},
222-
"execution_count": 19,
221+
"execution_count": 16,
223222
"metadata": {},
224223
"output_type": "execute_result"
225224
}
@@ -238,6 +237,82 @@
238237
")"
239238
]
240239
},
240+
{
241+
"cell_type": "code",
242+
"execution_count": 20,
243+
"metadata": {
244+
"scrolled": true
245+
},
246+
"outputs": [
247+
{
248+
"data": {
249+
"text/plain": [
250+
"{}"
251+
]
252+
},
253+
"execution_count": 20,
254+
"metadata": {},
255+
"output_type": "execute_result"
256+
}
257+
],
258+
"source": [
259+
"await agent_controller.action_menu.close_menu(connection_id=connection_id)"
260+
]
261+
},
262+
{
263+
"cell_type": "markdown",
264+
"metadata": {},
265+
"source": [
266+
"## 9. Close the active menu\n",
267+
"\n",
268+
"Once the requester is done with the action menu, the menu can now be closed."
269+
]
270+
},
271+
{
272+
"cell_type": "code",
273+
"execution_count": 30,
274+
"metadata": {},
275+
"outputs": [
276+
{
277+
"data": {
278+
"text/plain": [
279+
"{}"
280+
]
281+
},
282+
"execution_count": 30,
283+
"metadata": {},
284+
"output_type": "execute_result"
285+
}
286+
],
287+
"source": [
288+
"# close active menu\n",
289+
"await agent_controller.action_menu.close_menu(connection_id)"
290+
]
291+
},
292+
{
293+
"cell_type": "code",
294+
"execution_count": 31,
295+
"metadata": {
296+
"scrolled": true
297+
},
298+
"outputs": [
299+
{
300+
"data": {
301+
"text/plain": [
302+
"{'result': None}"
303+
]
304+
},
305+
"execution_count": 31,
306+
"metadata": {},
307+
"output_type": "execute_result"
308+
}
309+
],
310+
"source": [
311+
"# getting the active menu would return none\n",
312+
"menu = await agent_controller.action_menu.get_menu(connection_id)\n",
313+
"menu\n"
314+
]
315+
},
241316
{
242317
"cell_type": "markdown",
243318
"metadata": {},

0 commit comments

Comments
 (0)