Skip to content

armgit / core

Public Imported from GitHub
0

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

UI Updates

Rich Turner335181c54195
diff --git a/ui/component/model/build.gradle b/ui/component/model/build.gradle
index 5c35750ed..8e1a89516 100644
--- a/ui/component/model/build.gradle
+++ b/ui/component/model/build.gradle
@@ -42,8 +42,8 @@ generateTypeScript {
]
optionalProperties = "all" // TODO: cleanup model to be more explicit about optional params
mapEnum = cz.habarta.typescript.generator.EnumMapping.asEnum
- outputFile = "dist/model.d.ts"
- outputKind = "global"
+ outputFile = "build/model.d.ts"
+ outputKind = "module"
}
build.dependsOn generateTypeScript
\ No newline at end of file
diff --git a/ui/component/model/package.json b/ui/component/model/package.json
index 7b6d4dc7e..0d0b01662 100644
--- a/ui/component/model/package.json
+++ b/ui/component/model/package.json
@@ -1,8 +1,9 @@
{
"name": "@openremote/model",
"version": "1.0.0",
+ "main": "",
"description": "OpenRemote 3.x Model Types",
- "types": "dist/model.d.ts",
+ "types": "build/model.d.ts",
"scripts": {
"build": "exit 0",
"test": "echo \"No tests\" && exit 0"
@@ -10,5 +11,7 @@
"author": "OpenRemote",
"license": "AGPL-3.0-or-later",
"dependencies": {},
- "devDependencies": {}
+ "devDependencies": {
+ "typescript": "^3.1.6"
+ }
}
diff --git a/ui/component/model/tsconfig.json b/ui/component/model/tsconfig.json
new file mode 100644
index 000000000..604040278
--- /dev/null
+++ b/ui/component/model/tsconfig.json
@@ -0,0 +1,11 @@
+{
+ "compilerOptions": {
+ "outDir": "./dist/",
+ "strict": true,
+ "module": "es6",
+ "target": "es2015",
+ "declaration": true,
+ "sourceMap": true,
+ "moduleResolution": "node"
+ }
+}
\ No newline at end of file
diff --git a/ui/component/rest/build.gradle b/ui/component/rest/build.gradle
index c317cc455..5e281f35c 100644
--- a/ui/component/rest/build.gradle
+++ b/ui/component/rest/build.gradle
@@ -29,15 +29,16 @@ generateTypeScript {
"org.openremote.model.value.BooleanValue:boolean",
"org.openremote.model.value.Value:any"
]
- outputFile = "dist/restclient.ts"
+ outputFile = "build/restclient.ts"
outputFileType = "implementationFile"
outputKind = "module"
mapEnum = cz.habarta.typescript.generator.EnumMapping.asEnum
jaxrsNamespacing = "perResource"
customTypeProcessor = "JaxRsClientOnlyProcessor"
importDeclarations = [
- "import \"@openremote/model\""
+ "import * as Model from \"@openremote/model\""
]
+
extensionClasses = [
"AggregatedApiClient"
]
@@ -46,4 +47,10 @@ generateTypeScript {
]
}
+clean {
+ doLast {
+ delete "dist"
+ }
+}
+
build.dependsOn generateTypeScript, npmBuild
\ No newline at end of file
diff --git a/ui/component/rest/package.json b/ui/component/rest/package.json
index f90c4a5d4..748239695 100644
--- a/ui/component/rest/package.json
+++ b/ui/component/rest/package.json
@@ -2,7 +2,7 @@
"name": "@openremote/rest",
"version": "1.0.0",
"description": "OpenRemote 3.x REST API",
- "main": "dist/rest.js",
+ "main": "dist/src/rest.js",
"types": "src/rest.ts",
"scripts": {
"build": "npx tsc",
diff --git a/ui/component/rest/src/main/java/JaxRsClientOnlyProcessor.java b/ui/component/rest/src/main/java/JaxRsClientOnlyProcessor.java
index 967e35691..b1cdab528 100644
--- a/ui/component/rest/src/main/java/JaxRsClientOnlyProcessor.java
+++ b/ui/component/rest/src/main/java/JaxRsClientOnlyProcessor.java
@@ -43,7 +43,7 @@ public class JaxRsClientOnlyProcessor implements cz.habarta.typescript.generator
if ("RequestParams".equals(simpleName)) {
simpleName = simpleName + "<any,any>";
}
-// simpleName = "OR." + simpleName;
+ simpleName = "Model." + simpleName;
return new Result(new TsType.VerbatimType(simpleName));
}
}
diff --git a/ui/component/rest/src/rest.ts b/ui/component/rest/src/rest.ts
index e22eba615..00bbaf5e7 100644
--- a/ui/component/rest/src/rest.ts
+++ b/ui/component/rest/src/rest.ts
@@ -1,6 +1,6 @@
import openremote, {Auth, OREvent} from "@openremote/core";
import axios, {AxiosInstance} from "axios";
-import {ApiClient} from "../dist/restclient";
+import {ApiClient} from "../build/restclient";
export class RestApi {
diff --git a/ui/demo/demo-rest/src/index.ts b/ui/demo/demo-rest/src/index.ts
index 37869d9dc..f87c0652d 100644
--- a/ui/demo/demo-rest/src/index.ts
+++ b/ui/demo/demo-rest/src/index.ts
@@ -1,10 +1,10 @@
import {html, render} from "lit-html";
import openremote, {Auth, Manager} from "@openremote/core";
import rest from "@openremote/rest";
-import "@openremote/model";
+import {AssetQuery} from "@openremote/model";
-let loggedInTemplate = (openremote:Manager) => html `<span>Welcome ${openremote.username}</span> (<a href="${openremote.getLogoutUrl()}">logout</a>)`;
-let loggedOutTemplate = (openremote:Manager) => html `<span>Please <a href="${openremote.getLoginUrl()}">login</a>`;
+let loggedInTemplate = (openremote: Manager) => html`<span>Welcome ${openremote.username}</span> (<a href="${openremote.getLogoutUrl()}">logout</a>)`;
+let loggedOutTemplate = (openremote: Manager) => html`<span>Please <a href="${openremote.getLoginUrl()}">login</a>`;
function renderUi() {
if (openremote.authenticated) {
@@ -21,7 +21,7 @@ function renderUi() {
}
function queryAssets() {
- let assetQuery : AssetQuery = {};
+ let assetQuery: AssetQuery = {};
rest.api.AssetResource.queryAssets(assetQuery).then(response => {
console.log("Received: " + response.data.length + " Asset(s)");
console.log(JSON.stringify(response.data, null, 2))