diff --git a/actor/src/actor_config.py b/actor/src/actor_config.py
index 04f570cbe..fad203fc7 100755
--- a/actor/src/actor_config.py
+++ b/actor/src/actor_config.py
@@ -70,6 +70,8 @@ class UDSConfigDialog(QDialog):
self.ui.username.setText('')
self.ui.password.setText('')
+ self.ui.testButton.setEnabled(bool(config.master_token and config.host))
+
@property
def api(self) -> udsactor.rest.UDSServerApi:
return udsactor.rest.UDSServerApi(self.ui.host.text(), self.ui.validateCertificate.currentIndex() == 1)
@@ -105,10 +107,40 @@ class UDSConfigDialog(QDialog):
def textChanged(self):
enableButtons = bool(self.ui.host.text() and self.ui.username.text() and self.ui.password.text() and self.ui.authenticators.currentText())
self.ui.registerButton.setEnabled(enableButtons)
+ self.ui.testButton.setEnabled(False) # Only registered information can be checked
def finish(self):
self.close()
+ def testUDSServer(self):
+ config: udsactor.types.ActorConfigurationType = udsactor.platform.store.readConfig()
+ if not config.master_token:
+ self.ui.testButton.setEnabled(False)
+ return
+ try:
+ api = udsactor.rest.UDSServerApi(config.host, config.validateCertificate)
+ if not api.test(config.master_token):
+ QMessageBox.information(
+ self,
+ 'UDS Test',
+ 'Current configured token seems to be invalid for {}. Please, request e new one.'.format(config.host),
+ QMessageBox.Ok
+ )
+ else:
+ QMessageBox.information(
+ self,
+ 'UDS Test',
+ 'Configuration for {} seems to be correct.'.format(config.host),
+ QMessageBox.Ok
+ )
+ except Exception:
+ QMessageBox.information(
+ self,
+ 'UDS Test',
+ 'Configured host {} seems to be inaccesible.'.format(config.host),
+ QMessageBox.Ok
+ )
+
def registerWithUDS(self):
# Get network card. Will fail if no network card is available, but don't mind (not contempled)
data: udsactor.types.InterfaceInfoType = next(udsactor.platform.operations.getNetworkInfo())
@@ -137,9 +169,12 @@ class UDSConfigDialog(QDialog):
log_level=self.ui.logLevelComboBox.currentIndex()
)
)
- # Inform the user
+ # Enables test button
+ self.ui.testButton.setEnabled(True)
+ # Informs the user
QMessageBox.information(self, 'UDS Registration', 'Registration with UDS completed.', QMessageBox.Ok)
except udsactor.rest.RESTError as e:
+ self.ui.testButton.setEnabled(False)
QMessageBox.critical(self, 'UDS Registration', 'UDS Registration error: {}'.format(e), QMessageBox.Ok)
diff --git a/actor/src/designer/setup-dialog.ui b/actor/src/designer/setup-dialog.ui
index e9ce36644..181fef22a 100644
--- a/actor/src/designer/setup-dialog.ui
+++ b/actor/src/designer/setup-dialog.ui
@@ -66,11 +66,14 @@
Click on this button to test the server host and master key parameters.
A window will be displayed with results after the test is executed.
This button will only be active if all parameters are filled.
")) + self.registerButton.setToolTip(_translate("UdsActorSetupDialog", "Click to register Actor with UDS Broker")) + self.registerButton.setWhatsThis(_translate("UdsActorSetupDialog", "Click on this button to register Actor with UDS Broker.
")) self.registerButton.setText(_translate("UdsActorSetupDialog", "Register with UDS")) - self.closeButton.setToolTip(_translate("UdsActorSetupDialog", "Cancel all changes and discard them")) - self.closeButton.setWhatsThis(_translate("UdsActorSetupDialog", "Discards all changes and closes the configuration window")) + self.closeButton.setToolTip(_translate("UdsActorSetupDialog", "Closes UDS Actor Configuration (discard pending changes if any)")) + self.closeButton.setWhatsThis(_translate("UdsActorSetupDialog", "Exits the UDS Actor Configuration Tool
")) self.closeButton.setText(_translate("UdsActorSetupDialog", "Close")) self.label_host.setText(_translate("UdsActorSetupDialog", "UDS Server")) self.host.setToolTip(_translate("UdsActorSetupDialog", "Uds Broker Server Addres. Use IP or FQDN")) self.host.setWhatsThis(_translate("UdsActorSetupDialog", "Enter here the UDS Broker Addres using either its IP address or its FQDN address")) self.label_auth.setText(_translate("UdsActorSetupDialog", "Authenticator")) + self.authenticators.setWhatsThis(_translate("UdsActorSetupDialog", "Select the UDS Broker authenticator for credentials validation
")) self.label_username.setText(_translate("UdsActorSetupDialog", "Username")) self.username.setToolTip(_translate("UdsActorSetupDialog", "UDS user with administration rights (Will not be stored on template)")) - self.username.setWhatsThis(_translate("UdsActorSetupDialog", "Administrator user on UDS Server.
Note: This credential will not be stored on client. Will be used to obtain an unique key for this image.
")) + self.username.setWhatsThis(_translate("UdsActorSetupDialog", "Administrator user on UDS Server.
Note: This credential will not be stored on client. Will be used to obtain an unique token for this image.
")) self.label_password.setText(_translate("UdsActorSetupDialog", "Password")) self.password.setToolTip(_translate("UdsActorSetupDialog", "Password for user (Will not be stored on template)")) self.password.setWhatsThis(_translate("UdsActorSetupDialog", "Administrator password for the user on UDS Server.
Note: This credential will not be stored on client. Will be used to obtain an unique key for this image.
")) @@ -232,5 +242,7 @@ class Ui_UdsActorSetupDialog(object): self.browsePostConfigButton.setText(_translate("UdsActorSetupDialog", "Browse")) self.label_loglevel.setText(_translate("UdsActorSetupDialog", "Log Level")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_advanced), _translate("UdsActorSetupDialog", "Advanced")) - + self.testButton.setToolTip(_translate("UdsActorSetupDialog", "Click to test existing configuration (disabled if no config found)")) + self.testButton.setWhatsThis(_translate("UdsActorSetupDialog", "Click on this button to test the server host and assigned toen.
")) + self.testButton.setText(_translate("UdsActorSetupDialog", "Test configuration")) from ui import uds_rc diff --git a/actor/src/ui/uds_rc.py b/actor/src/ui/uds_rc.py index f6679c9fb..26d1f8e74 100644 --- a/actor/src/ui/uds_rc.py +++ b/actor/src/ui/uds_rc.py @@ -2,7 +2,7 @@ # Resource object code # -# Created by: The Resource Compiler for PyQt5 (Qt v5.11.3) +# Created by: The Resource Compiler for PyQt5 (Qt v5.13.2) # # WARNING! All changes made in this file will be lost!