Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bugs with dashboards and projects in job dialog. #146

Merged
merged 1 commit into from
Jul 8, 2023
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
=======
History
=======
2023.7.9 -- Bugfix: errors creating dashboards and projects
* Fixed error submitting jobs to Dashboard the user doesn't have a login for.
* Ask for credentials when adding a new dashboard to job dialog.
* Fixed bug creating a new project.

2023.6.28 -- Improved error handling contacting Dashboards.
* Trap and display errors when contacting Dashboards
* Allow SEAMM to continue despite such errors
Expand Down
30 changes: 25 additions & 5 deletions seamm/tk_job_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,17 @@ def dashboard_cb(self, event=None):
"""The selected dashboard has been changed"""
dashboard = self["dashboard"].get()

# Ensure that user has account on dashboard
user, passwd = self.dashboard_handler.get_credentials(
dashboard, ask=self.ask_for_credentials
)
if user is None or passwd is None:
# Unable to log in, so go back
if self.current_dashboard is not None:
dashboard = self.current_dashboard.name
self["dashboard"].set(dashboard)
return

try:
projects = self.dashboard_handler.get_dashboard(dashboard).list_projects()
except DashboardLoginError as e:
Expand Down Expand Up @@ -653,6 +664,7 @@ def get_all_status(self, show_progress=True, master=None):

def handle_add_dialog(self, result):
"""Handle the dialog to add a dashboard to the list."""
save_dashboard = self.current_dashboard.name
w = self["add"]
dialog = w["dialog"]
if result is None or result == "Cancel":
Expand Down Expand Up @@ -681,6 +693,15 @@ def handle_add_dialog(self, result):
c = self["dashboard"]
c.combobox.config({"value": self.dashboard_handler.dashboards})
c.set(name)

# check have credentials
user, passwd = self.dashboard_handler.get_credentials(
name, ask=self.ask_for_credentials
)
if user is None or passwd is None:
# Unable to log in, so go back
self["dashboard"].set(save_dashboard)

dialog.destroy()
del self["add"]

Expand Down Expand Up @@ -722,11 +743,10 @@ def project_cb(self, event=None):
project = w["project"].get()
if project == "-- Create new project --":
result = simpledialog.askstring("Add Project", "Project name:")
if result is not None and result != "":
# Add the project
dashboard = w["dashboard"].get()
if self.dashboard_handler.add_project(dashboard, result):
pass
if result is None or result == "":
return
# Add the project
self.current_dashboard.add_project(result)
self.dashboard_cb()
w["project"].set(result)

Expand Down