diff --git a/Config API/Config API Endpoint and Property Viewer/API_gui.py b/Config API/Config API Endpoint and Property Viewer/API_gui.py index 71ac27a..f3ac89a 100644 --- a/Config API/Config API Endpoint and Property Viewer/API_gui.py +++ b/Config API/Config API Endpoint and Property Viewer/API_gui.py @@ -18,8 +18,10 @@ # * access properties to HTTP Methods # * 0.0.4: Added Doc Endpoint Information to text box to provide user additional # * information +# * 0.0.5: Added version to title bar +# * Audit Log schema access for visualization # * -# * Version: 0.0.4 +# * Version: 0.0.5 # ****************************************************************************** from tkinter import * @@ -30,6 +32,8 @@ from widgets import searchbar, treevscroll, textscroll from server import server_doc +VERSION = '0.0.5' + COLUMNS = ['doc_path', 'endpoint', 'parent_endpoint'] class App(ttk.Frame): @@ -114,6 +118,7 @@ def __init__(self, *args, **kwargs): self.event_add('<>', '', '') self.treeframe.treev.tag_bind('item', '<>', self.item_click) self.treeframe.treev.tag_bind('root', '<>', self.root_click) + self.treeframe.treev.tag_bind('names', '<>', self.names_click) # Text Frame Object for Output of Documentation self.textframe = textscroll(self.dataframe, row=0) @@ -204,6 +209,19 @@ def root_click(self, event: Event): r = self.server.get_doc(info['values'][COLUMNS.index('doc_path')]) self.update_text_window(r, info['values'][COLUMNS.index('endpoint')], info['values'][COLUMNS.index('doc_path')]) + # Event for Names Branches + # Primarily used as a work around to access audit log schema. Doc endpoint does not provide context to + # point to how to access property definitions or "schemas" which is a new paradigm for audit log + def names_click(self, event: Event): + item = event.widget.selection() + info = event.widget.item(item[0]) + if 'audit_log' in info['text']: + doc_url = '/config/v1/audit_log?content=schema' + r = self.server.get_doc(doc_url) + self.update_text_window(r, info['text'], doc_url) + else: + self.update_text_window() + # Event for other branches def item_click(self, event: Event): item = event.widget.selection() @@ -351,7 +369,7 @@ def update_text_window(self, DATA = None, endpoint = '', docEndpoint = ''): if __name__ == "__main__": root = Tk() - root.title("Kepware Server API Documentation Viewer") + root.title(f"Kepware Server API Documentation Viewer v{VERSION}") root.minsize(width=500, height=200) root.columnconfigure(0, minsize=200, weight=1) root.rowconfigure(0, weight=1) diff --git a/Config API/Config API Endpoint and Property Viewer/README.md b/Config API/Config API Endpoint and Property Viewer/README.md index 3c2e5e8..de3adc6 100644 --- a/Config API/Config API Endpoint and Property Viewer/README.md +++ b/Config API/Config API Endpoint and Property Viewer/README.md @@ -19,6 +19,12 @@ This provides a simple UI application to help navigate the documentation endpoin ## Use the Application 1. Open a CMD and cd to the [API_gui.py](API_gui.py) location before launching the script or double-click on [API_gui.py](API_gui.py) from File Explorer. This will launch the UI. + +![](../../docs/images/api-viewer-main-ui.png) + 2. Provide the correct parameters to connect to the Kepware Server instance and click the *Connect* button. 3. Once connected navigate the components in the tree by double clicking on each item. If there are children of the object, they will appear. + +![](../../docs/images/api-viewer-connected-ui.png) + 4. Search is available for the text within the property definition window. diff --git a/docs/images/api-viewer-connected-ui.png b/docs/images/api-viewer-connected-ui.png new file mode 100644 index 0000000..155eb4b Binary files /dev/null and b/docs/images/api-viewer-connected-ui.png differ diff --git a/docs/images/api-viewer-main-ui.png b/docs/images/api-viewer-main-ui.png new file mode 100644 index 0000000..937e839 Binary files /dev/null and b/docs/images/api-viewer-main-ui.png differ