Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Minor web component updates and bug fix

Rich Turner83bd92f03871
diff --git a/client/src/main/webapp/src/or-app/or-app.html b/client/src/main/webapp/src/or-app/or-app.html
index 1075024d7..cb1495cda 100644
--- a/client/src/main/webapp/src/or-app/or-app.html
+++ b/client/src/main/webapp/src/or-app/or-app.html
@@ -38,7 +38,7 @@
version="[[consoleVersion]]"
platform="[[consolePlatform]]"
providers="[[consoleProviders]]"
- requests="[[requests]]"
+ realm="[[tenantRealm]]"
auto-enable="[[consoleAutoEnable]]"></or-console>
<or-app-security id="appSecurity"
@@ -569,10 +569,6 @@
openremote.INSTANCE.registerToasts();
openremote.INSTANCE.registerRequests();
- // TODO: Implement this in a better way
- // Initialise the console
- openremote.INSTANCE.console.initialise();
-
// Run this when everything is ready
let appReady = () => {
// Check if there was a problem
@@ -581,6 +577,11 @@
console.log("Application ready");
dispatchEvent(new CustomEvent("AppReady", {detail: {app: openremote.INSTANCE}}));
}
+
+ // TODO: Implement this in a better way
+ // Initialise the console
+ openremote.INSTANCE.console.initialise();
+
// Now show the app/document body
openremote.INSTANCE.showApp();
};
diff --git a/client/src/main/webapp/src/or-app/or-console.html b/client/src/main/webapp/src/or-app/or-console.html
index dc843b63c..6b99186d7 100644
--- a/client/src/main/webapp/src/or-app/or-console.html
+++ b/client/src/main/webapp/src/or-app/or-console.html
@@ -90,8 +90,7 @@
*/
providers: {
type: Array,
- notify: true,
- value: null
+ notify: true
},
/**
@@ -103,15 +102,6 @@
notify: true
},
- /**
- * OpenRemote requests object for calling JAX-RS endpoints
- */
- requests: {
- type: Object,
- value: null,
- notify: true
- },
-
/**
* Contains the existing console registration object
*/
@@ -121,6 +111,14 @@
let consoleStr = window.localStorage.getItem("OpenRemoteConsole");
return consoleStr ? JSON.parse(consoleStr) : {};
}
+ },
+
+ /**
+ * Name of the tenant realm being used for requests
+ */
+ realm: {
+ type: String,
+ notify: true
}
};
}
@@ -151,6 +149,8 @@
if (queryParams.consoleAutoEnable) {
this.autoEnable = queryParams.consoleAutoEnable === "TRUE" || queryParams.consoleAutoEnable === "true";
+ } else {
+ this.autoEnable = this.autoEnable === true;
}
console.debug("Console settings: isMobile=" + this.enabled + " name=" + this.name + " version=" + this.version + " platform=" + this.platform + " providers=" + JSON.stringify(this.providers) + " autoEnable=" + this.autoEnable);
@@ -161,6 +161,12 @@
return;
}
this._initialised = true;
+
+ if (!this.realm) {
+ console.debug("Console: cannot initialise as no tenant realm defined");
+ return;
+ }
+
console.debug("Console: initialising");
this.registration.name = this.name;
this.registration.version = this.version;
@@ -266,13 +272,13 @@
register(successFn, failureFn) {
console.debug("Console: updating registration");
- if (!this.requests) {
+ if (!window.openremote.INSTANCE.requests) {
console.debug("Cannot register console as requests object not set");
failureFn();
return;
}
- this.requests.sendAndReturn(
+ window.openremote.INSTANCE.requests.sendAndReturn(
(requestParams) => {
openremote.REST.ConsoleResource.register(requestParams, this.registration);
},