pyegeria 5.2.0.10__py3-none-any.whl → 5.2.0.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyegeria/commands/cli/egeria.py +6 -1
- pyegeria/commands/cli/egeria_login_tui.py +305 -0
- pyegeria/commands/cli/txt_custom_v2.tcss +19 -0
- {pyegeria-5.2.0.10.dist-info → pyegeria-5.2.0.13.dist-info}/METADATA +1 -1
- {pyegeria-5.2.0.10.dist-info → pyegeria-5.2.0.13.dist-info}/RECORD +8 -6
- {pyegeria-5.2.0.10.dist-info → pyegeria-5.2.0.13.dist-info}/entry_points.txt +1 -0
- {pyegeria-5.2.0.10.dist-info → pyegeria-5.2.0.13.dist-info}/LICENSE +0 -0
- {pyegeria-5.2.0.10.dist-info → pyegeria-5.2.0.13.dist-info}/WHEEL +0 -0
pyegeria/commands/cli/egeria.py
CHANGED
@@ -11,7 +11,7 @@ This is an emerging capability based on the **click** package. Feedback welcome!
|
|
11
11
|
"""
|
12
12
|
import click
|
13
13
|
from trogon import tui
|
14
|
-
|
14
|
+
from pyegeria.commands.cli.egeria_login_tui import login
|
15
15
|
from pyegeria.commands.cat.get_asset_graph import asset_viewer
|
16
16
|
from pyegeria.commands.cat.get_collection import collection_viewer
|
17
17
|
from pyegeria.commands.cat.get_project_dependencies import project_dependency_viewer
|
@@ -235,6 +235,11 @@ def cli(
|
|
235
235
|
ctx.ensure_object(Config)
|
236
236
|
|
237
237
|
|
238
|
+
@cli.command("alogin")
|
239
|
+
def login():
|
240
|
+
login()
|
241
|
+
|
242
|
+
|
238
243
|
#
|
239
244
|
# my: Show
|
240
245
|
#
|
@@ -0,0 +1,305 @@
|
|
1
|
+
"""
|
2
|
+
SPDX-License-Identifier: Apache-2.0
|
3
|
+
Copyright Contributors to the ODPi Egeria project.
|
4
|
+
|
5
|
+
A form exemplar for Egeria users to enter data into templates using Textual open source framework
|
6
|
+
|
7
|
+
Peter Coldicott
|
8
|
+
"""
|
9
|
+
|
10
|
+
import os
|
11
|
+
from os import system
|
12
|
+
|
13
|
+
from textual.reactive import Reactive
|
14
|
+
|
15
|
+
from textual.app import App, ComposeResult
|
16
|
+
from textual.containers import (
|
17
|
+
Container,
|
18
|
+
Vertical,
|
19
|
+
HorizontalScroll,
|
20
|
+
VerticalScroll,
|
21
|
+
ScrollableContainer,
|
22
|
+
)
|
23
|
+
from textual import on, work
|
24
|
+
from textual.screen import ModalScreen, Screen
|
25
|
+
from textual.widgets import (
|
26
|
+
Input,
|
27
|
+
Static,
|
28
|
+
Button,
|
29
|
+
RichLog,
|
30
|
+
Label,
|
31
|
+
Tree,
|
32
|
+
Footer,
|
33
|
+
DataTable,
|
34
|
+
Header,
|
35
|
+
)
|
36
|
+
|
37
|
+
from typing import Any
|
38
|
+
|
39
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
40
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
41
|
+
EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
|
42
|
+
EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
|
43
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get(
|
44
|
+
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
45
|
+
)
|
46
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
|
47
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
48
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
49
|
+
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
50
|
+
|
51
|
+
disable_ssl_warnings = True
|
52
|
+
|
53
|
+
TITLE = "User Access"
|
54
|
+
|
55
|
+
|
56
|
+
class UserInfo(Screen):
|
57
|
+
"""A screen to request user access info - required
|
58
|
+
If no information is supplied the access defaults to a set of
|
59
|
+
demo/test values:
|
60
|
+
User: erinoverview
|
61
|
+
Password: Secret
|
62
|
+
Platform URL: https://localhost:9443
|
63
|
+
View Server Name: view-server"""
|
64
|
+
|
65
|
+
BINDINGS = [("d", "toggle_dark", "Toggle dark mode")]
|
66
|
+
|
67
|
+
def __init__(self) -> None:
|
68
|
+
"""Initialize the UserInfo Screen variables"""
|
69
|
+
self.app.dark = True
|
70
|
+
self.user = ""
|
71
|
+
self.password = ""
|
72
|
+
self.platformu = ""
|
73
|
+
self.view_server = ""
|
74
|
+
self.tech_type = ""
|
75
|
+
super().__init__()
|
76
|
+
|
77
|
+
def compose(self) -> ComposeResult:
|
78
|
+
self.log("In UserInfo - Compose ")
|
79
|
+
with VerticalScroll(id="user-container"):
|
80
|
+
yield Label("Username: ", classes="uprompt")
|
81
|
+
yield Input("", id="username", classes="uinput")
|
82
|
+
with VerticalScroll(id="pwd-container"):
|
83
|
+
yield Label("Password: ", classes="uprompt")
|
84
|
+
yield Input("", id="password", classes="uinput")
|
85
|
+
with VerticalScroll(id="platform-container"):
|
86
|
+
yield Label("Platform URL: ", classes="uprompt")
|
87
|
+
yield Input("", id="platform_url", classes="uinput")
|
88
|
+
with VerticalScroll(id="view-server-container"):
|
89
|
+
yield Label("View Server Name: ", classes="uprompt")
|
90
|
+
yield Input("", id="view_server", classes="uinput")
|
91
|
+
with HorizontalScroll(id="button-container"):
|
92
|
+
yield Button("Cancel", "warning", id="cancel")
|
93
|
+
yield Button("Submit", "primary", id="submit")
|
94
|
+
yield RichLog()
|
95
|
+
yield Footer()
|
96
|
+
|
97
|
+
def action_toggle_dark(self) -> None:
|
98
|
+
"""An action to toggle dark mode."""
|
99
|
+
|
100
|
+
self.app.dark = not self.app.dark
|
101
|
+
|
102
|
+
def on_input_changed(self, event: Input.Changed) -> None:
|
103
|
+
"""Detect input changed events and capture input value"""
|
104
|
+
|
105
|
+
try:
|
106
|
+
ivalue = str(event.value)
|
107
|
+
except ValueError:
|
108
|
+
return
|
109
|
+
else:
|
110
|
+
if event.input.id == "username":
|
111
|
+
self.user = ivalue
|
112
|
+
elif event.input.id == "password":
|
113
|
+
self.password = ivalue
|
114
|
+
elif event.input.id == "platform_url":
|
115
|
+
self.platformu = ivalue
|
116
|
+
elif event.input.id == "view_server":
|
117
|
+
self.view_server = ivalue
|
118
|
+
return
|
119
|
+
|
120
|
+
@on(Button.Pressed, "#submit")
|
121
|
+
async def on_submit(self) -> []:
|
122
|
+
"""This processes the user input."""
|
123
|
+
|
124
|
+
global EGERIA_USER
|
125
|
+
global EGERIA_USER_PASSWORD
|
126
|
+
global EGERIA_PLATFORM_URL
|
127
|
+
global EGERIA_VIEW_SERVER
|
128
|
+
|
129
|
+
result = [" meow", "woof", "neigh", "hoot"]
|
130
|
+
|
131
|
+
if self.user:
|
132
|
+
result[0] = self.user
|
133
|
+
else:
|
134
|
+
result[0] = "erinoverview"
|
135
|
+
if self.password:
|
136
|
+
result[1] = self.password
|
137
|
+
else:
|
138
|
+
result[1] = "secret"
|
139
|
+
if self.platformu:
|
140
|
+
result[2] = self.platformu
|
141
|
+
else:
|
142
|
+
result[2] = "https://localhost:9443"
|
143
|
+
if self.view_server:
|
144
|
+
result[3] = self.view_server
|
145
|
+
else:
|
146
|
+
result[3] = "view-server"
|
147
|
+
|
148
|
+
# Also store the input in global variables
|
149
|
+
|
150
|
+
EGERIA_USER = result[0]
|
151
|
+
EGERIA_USER_PASSWORD = result[1]
|
152
|
+
EGERIA_PLATFORM_URL = result[2]
|
153
|
+
EGERIA_VIEW_SERVER = result[3]
|
154
|
+
|
155
|
+
await self.action_dismiss(result)
|
156
|
+
|
157
|
+
@on(Button.Pressed, "#cancel")
|
158
|
+
def on_cancel(self) -> None:
|
159
|
+
self.action_dismiss()
|
160
|
+
|
161
|
+
|
162
|
+
class ExitScreen(ModalScreen):
|
163
|
+
"""App exit screen."""
|
164
|
+
|
165
|
+
DEFAULT_CSS = """
|
166
|
+
ExitScreen {
|
167
|
+
align: center middle;
|
168
|
+
}
|
169
|
+
|
170
|
+
ExitScreen > Container {
|
171
|
+
width: auto;
|
172
|
+
height: auto;
|
173
|
+
}
|
174
|
+
"""
|
175
|
+
|
176
|
+
BINDINGS = [("d", "toggle_dark", "Toggle dark mode")]
|
177
|
+
|
178
|
+
def __init__(self) -> None:
|
179
|
+
"""Initialize the UserInfo Screen variables"""
|
180
|
+
super().__init__()
|
181
|
+
|
182
|
+
def action_toggle_dark(self) -> None:
|
183
|
+
"""An action to toggle dark mode."""
|
184
|
+
self.app.dark = not self.app.dark
|
185
|
+
|
186
|
+
def compose(self) -> ComposeResult:
|
187
|
+
with Container():
|
188
|
+
yield Label("Are you sure you want to quit?")
|
189
|
+
yield Button("No", id="no", variant="error")
|
190
|
+
yield Button("Yes", id="yes", variant="success")
|
191
|
+
yield Footer()
|
192
|
+
yield RichLog()
|
193
|
+
|
194
|
+
@on(Button.Pressed, "#no")
|
195
|
+
def on_no(self) -> None:
|
196
|
+
"""No the user pressed the exit button in error"""
|
197
|
+
self.action_dismiss()
|
198
|
+
|
199
|
+
@on(Button.Pressed, "#yes")
|
200
|
+
def on_yes(self) -> None:
|
201
|
+
"""Yes the user wants to quit the app"""
|
202
|
+
self.app.exit()
|
203
|
+
|
204
|
+
|
205
|
+
class Egeria_login(App):
|
206
|
+
"""main app class"""
|
207
|
+
|
208
|
+
CSS_PATH = "txt_custom_v2.tcss"
|
209
|
+
|
210
|
+
BINDINGS = [("d", "toggle_dark", "Toggle dark mode")]
|
211
|
+
|
212
|
+
def __init__(self, *args, **kwargs) -> None:
|
213
|
+
super().__init__(*args, **kwargs)
|
214
|
+
dark = Reactive(True, compute=False)
|
215
|
+
self.app.dark = False
|
216
|
+
self.template: Any = None
|
217
|
+
|
218
|
+
def compose(self) -> ComposeResult:
|
219
|
+
"""Compose the main display"""
|
220
|
+
|
221
|
+
yield Label(f"User: {EGERIA_USER}, password: {EGERIA_USER_PASSWORD}")
|
222
|
+
yield Label(
|
223
|
+
f"Platform: {EGERIA_PLATFORM_URL}, View Server: {EGERIA_VIEW_SERVER}"
|
224
|
+
)
|
225
|
+
yield Button("Finish", "success", id="finish")
|
226
|
+
yield RichLog()
|
227
|
+
yield Footer()
|
228
|
+
|
229
|
+
def on_button_pressed(self, event: Button.Pressed) -> (str, str, str, str):
|
230
|
+
"""Yes the user wants to quit the app"""
|
231
|
+
|
232
|
+
self.exit(
|
233
|
+
(
|
234
|
+
EGERIA_USER,
|
235
|
+
EGERIA_USER_PASSWORD,
|
236
|
+
EGERIA_PLATFORM_URL,
|
237
|
+
EGERIA_VIEW_SERVER,
|
238
|
+
),
|
239
|
+
200,
|
240
|
+
"Finished",
|
241
|
+
)
|
242
|
+
|
243
|
+
def action_toggle_dark(self) -> None:
|
244
|
+
"""An action to toggle dark and light mode."""
|
245
|
+
self.app.dark = not self.app.dark
|
246
|
+
|
247
|
+
async def on_mount(self) -> None:
|
248
|
+
"""Main Program flow control start routine
|
249
|
+
Pushes the user info popup with an associated call back routine"""
|
250
|
+
|
251
|
+
global EGERIA_USER
|
252
|
+
global EGERIA_USER_PASSWORD
|
253
|
+
global EGERIA_PLATFORM_URL
|
254
|
+
global EGERIA_VIEW_SERVER
|
255
|
+
|
256
|
+
system("clear")
|
257
|
+
# Display User Info Screen
|
258
|
+
self.install_screen(UserInfo(), name="userinfo")
|
259
|
+
await self.push_screen(UserInfo(), self.input_userinfo_callback)
|
260
|
+
|
261
|
+
async def input_userinfo_callback(self, user_input) -> (str, str, str, str):
|
262
|
+
"""Prompt for user id and password, callback routine
|
263
|
+
This routine is invoked when user input is completed
|
264
|
+
"""
|
265
|
+
|
266
|
+
global EGERIA_USER
|
267
|
+
global EGERIA_USER_PASSWORD
|
268
|
+
global EGERIA_PLATFORM_URL
|
269
|
+
global EGERIA_VIEW_SERVER
|
270
|
+
global TECH_NAME
|
271
|
+
|
272
|
+
if user_input[0] != None:
|
273
|
+
EGERIA_USER = user_input[0]
|
274
|
+
else:
|
275
|
+
EGERIA_USER = "erinoverview"
|
276
|
+
if user_input[1] != None:
|
277
|
+
EGERIA_USER_PASSWORD = user_input[1]
|
278
|
+
else:
|
279
|
+
EGERIA_USER_PASSWORD = "secret"
|
280
|
+
if user_input[2] != None:
|
281
|
+
EGERIA_PLATFORM_URL = user_input[2]
|
282
|
+
else:
|
283
|
+
EGERIA_PLATFORM_URL = "https://localhost:9443"
|
284
|
+
if user_input[3] != None:
|
285
|
+
EGERIA_VIEW_SERVER = user_input[3]
|
286
|
+
else:
|
287
|
+
EGERIA_VIEW_SERVER = "view-server"
|
288
|
+
|
289
|
+
return (
|
290
|
+
EGERIA_USER,
|
291
|
+
EGERIA_USER_PASSWORD,
|
292
|
+
EGERIA_PLATFORM_URL,
|
293
|
+
EGERIA_VIEW_SERVER,
|
294
|
+
)
|
295
|
+
|
296
|
+
|
297
|
+
def login() -> None:
|
298
|
+
app = Egeria_login()
|
299
|
+
app.run()
|
300
|
+
return
|
301
|
+
|
302
|
+
|
303
|
+
if __name__ == "__main__":
|
304
|
+
app = Egeria_login()
|
305
|
+
app.run()
|
@@ -34,12 +34,14 @@ pyegeria/commands/cat/list_terms.py,sha256=yq3kyfCZ6Hfbqc30L6o-b3Ebp6NpywD99KL4k
|
|
34
34
|
pyegeria/commands/cat/list_todos.py,sha256=iPxHRyW3X5tiREio4TUOwRPvNPjU0gxm3pVnUI79ir4,6542
|
35
35
|
pyegeria/commands/cat/list_user_ids.py,sha256=7JinL7rknPbGusIb8ikXKEaV1vvbuvx_WWtbmlfS_DY,5093
|
36
36
|
pyegeria/commands/cli/__init__.py,sha256=hpTVSMP2gnPRhcAZPdeUEsQ-eaDySlXlk239dNWYmng,292
|
37
|
-
pyegeria/commands/cli/egeria.py,sha256=
|
37
|
+
pyegeria/commands/cli/egeria.py,sha256=JmQskjwvXOk8bFD3jqC3KUZbQYQGoMMf9pmeUl5DQKw,45127
|
38
38
|
pyegeria/commands/cli/egeria_cat.py,sha256=xsLz1cLvVzh6EV-oz2Ou01KroQ5g3yRKP7FCtvpD5SA,16069
|
39
|
+
pyegeria/commands/cli/egeria_login_tui.py,sha256=gYO2DAbWCfzDvUgqTiddpw9LXiqKr8bCIGBbpHgfSCk,9009
|
39
40
|
pyegeria/commands/cli/egeria_my.py,sha256=H7QO9pRjH0nOghsGev4Cu3DCjp-UkRrV6_tl5npwRlI,5851
|
40
41
|
pyegeria/commands/cli/egeria_ops.py,sha256=bHH3pFnw9jc6aSvnbafsM6ch0juI7WSZwREnMKB-I4Q,12241
|
41
42
|
pyegeria/commands/cli/egeria_tech.py,sha256=jntbc-TZqu8qGK-MScQNUbRdRLjV_8J-B-JOaaCu6MU,15015
|
42
43
|
pyegeria/commands/cli/ops_config.py,sha256=-fTndSzs1zDmWwKk8hu6FMtBwOyXrZKpIemgykhpigI,1379
|
44
|
+
pyegeria/commands/cli/txt_custom_v2.tcss,sha256=ixkzpFyTZ5i3byFO9EmEAeJgzbEa7nZb_3iTgxNtVPk,232
|
43
45
|
pyegeria/commands/doc/Visual Command Reference/cat/show/assets/Asset-graph 2024-11-20 at 15.56.42.png,sha256=gL7LDmS0OUeDmmmz6ayZL7qbriaos6ryct-2T0D7CIM,769210
|
44
46
|
pyegeria/commands/doc/Visual Command Reference/cat/show/assets/Assets-in-domain 2024-11-20 at 15.49.55@2x.png,sha256=Op6NHsqPfYVvpKX46Z-IX8G_Of8rrVtDK34C1MJIJdw,540605
|
45
47
|
pyegeria/commands/doc/Visual Command Reference/cat/show/assets/deployed-catalogs 2024-11-20 at 16.17.43@2x.png,sha256=MUgoH6orUk9qUeCv8yEjuQ6sAao3eZyK3DOF4aXfqkw,525598
|
@@ -186,8 +188,8 @@ pyegeria/template_manager_omvs.py,sha256=heqbKeum5hPCHap4r1RUZU8YB3QaQlxVNbq4GZi
|
|
186
188
|
pyegeria/utils.py,sha256=1h6bwveadd6GpbnGLTmqPBmBk68QvxdjGTI9RfbrgKY,5415
|
187
189
|
pyegeria/valid_metadata_omvs.py,sha256=kmcyXBsu99L25r16w9xVXqU_KwADsGuft4yPDZzyUds,65032
|
188
190
|
pyegeria/x_action_author_omvs.py,sha256=xu1IQ0YbhIKi17C5a7Aq9u1Az2czwahNPpX9czmyVxE,6454
|
189
|
-
pyegeria-5.2.0.
|
190
|
-
pyegeria-5.2.0.
|
191
|
-
pyegeria-5.2.0.
|
192
|
-
pyegeria-5.2.0.
|
193
|
-
pyegeria-5.2.0.
|
191
|
+
pyegeria-5.2.0.13.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
192
|
+
pyegeria-5.2.0.13.dist-info/METADATA,sha256=lC8bKuf52pYsA-Qu3mfpN4kqYLv99Aklh7qZsZ7f8L4,2880
|
193
|
+
pyegeria-5.2.0.13.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
194
|
+
pyegeria-5.2.0.13.dist-info/entry_points.txt,sha256=HKEtmLTGWdve5gkUl6jjTO6e_Vx0LGAABTu3UzfPxY8,5291
|
195
|
+
pyegeria-5.2.0.13.dist-info/RECORD,,
|
@@ -57,6 +57,7 @@ list_valid_metadata_values=pyegeria.commands.tech.list_valid_metadata_values:mai
|
|
57
57
|
load_archive=pyegeria.commands.ops.load_archive:load_archive
|
58
58
|
load_archive_tui=pyegeria.commands.ops.load_archive:tui
|
59
59
|
load_terms_from_file=pyegeria.commands.cat.glossary_actions:load_terms
|
60
|
+
login=pyegeria.commands.cli.egeria_login_tui:login
|
60
61
|
mark_todo_complete=pyegeria.commands.my.todo_actions:mark_todo_complete
|
61
62
|
monitor_asset_events=pyegeria.commands.ops.monitor_asset_events:main
|
62
63
|
monitor_coco_status=pyegeria.commands.ops.monitor_coco_status:main
|
File without changes
|
File without changes
|