Edit and remove devices from menu now

This commit is contained in:
2023-01-25 14:01:13 +01:00
parent 6add3ac976
commit 3666db25c6
4 changed files with 223 additions and 44 deletions

View File

@@ -101,7 +101,11 @@ class ToplevelWelcome(ThemedToplevel):
self.stage_entry_1.insert(0, self.address_text[:-1])
try:
requests.get(self.stage_entry_1.get()+"/check", verify=not bool(self.stage_checkbox_var.get()))
response_check = requests.get(self.stage_entry_1.get()+"/check", verify=not bool(self.stage_checkbox_var.get()))
if response_check.status_code != 200:
logger.error(f"Could not connect to '{self.stage_entry_1.get()}' because it returned {response_check.status_code}")
messagebox.showerror(title="Connection error", message=f"Server response is {response_check.status_code}. Check if your API server and it's reverse proxy (if there's one) properly configured and then try again.")
return
except (requests.exceptions.InvalidURL, requests.exceptions.InvalidSchema, requests.exceptions.MissingSchema) as exp:
logger.error(f"Could not validate '{self.stage_entry_1.get()}' due to {exp}")
messagebox.showerror(title="Invalid address", message="Address entered does not seem to be correct one. Please provide API address starting with http:// or https:// \n\nFor example:\n- https://your-api.com:8043\n- https://your-api.com")