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: or-app and main app tsconfig.json strict enabled

Rich Turner4d87699e0217
diff --git a/ui/app/main/tsconfig.json b/ui/app/main/tsconfig.json
index 5a06f0da9..59092f4af 100644
--- a/ui/app/main/tsconfig.json
+++ b/ui/app/main/tsconfig.json
@@ -2,10 +2,11 @@
"extends": "../../tsconfig",
"compilerOptions": {
"tsBuildInfoFile": "./.tsbuildinfo",
- "strict": false
+ "strict": true
},
"include": [
- "./src"
+ "./src",
+ "../../component/or-map/@types"
],
"references": [
{ "path": "../or-app" }
diff --git a/ui/app/or-app/src/index.ts b/ui/app/or-app/src/index.ts
index c620f9dc7..9eb58df25 100644
--- a/ui/app/or-app/src/index.ts
+++ b/ui/app/or-app/src/index.ts
@@ -17,7 +17,7 @@ import "@openremote/or-mwc-components/dist/or-mwc-menu";
import "./or-header";
import {DEFAULT_LANGUAGES, HeaderConfig, HeaderItem, Languages} from "./or-header";
import {DialogConfig, OrMwcDialog} from "@openremote/or-mwc-components/dist/or-mwc-dialog";
-import {AnyAction, EnhancedStore, Unsubscribe} from "@reduxjs/toolkit";
+import {AnyAction, EnhancedStore, Unsubscribe, Action} from "@reduxjs/toolkit";
import {AppStateKeyed, updatePage, updateParams} from "./app";
import {ThunkMiddleware} from "redux-thunk";
import { translate } from "@openremote/or-translate";
@@ -68,11 +68,11 @@ export interface PageProvider<S extends AppStateKeyed> {
export abstract class Page<S extends AppStateKeyed> extends translate(i18next)(LitElement) {
- protected _store: EnhancedStore<S, AnyAction, ReadonlyArray<ThunkMiddleware>>;
+ protected _store: EnhancedStore<S, AnyAction, ReadonlyArray<ThunkMiddleware<S>>>;
protected _storeUnsubscribe!: Unsubscribe;
- constructor(store: EnhancedStore<S>) {
+ constructor(store: EnhancedStore<S, AnyAction, ReadonlyArray<ThunkMiddleware<S>>>) {
super();
this._store = store;
}
@@ -208,7 +208,7 @@ export class OrApp<S extends AppStateKeyed> extends LitElement {
protected _config!: DefaultAppConfig;
- protected _store: EnhancedStore<S, AnyAction, ReadonlyArray<ThunkMiddleware>>;
+ protected _store: EnhancedStore<S, AnyAction, ReadonlyArray<ThunkMiddleware<S>>>;
protected _storeUnsubscribe!: Unsubscribe;
//language=CSS
@@ -254,7 +254,7 @@ export class OrApp<S extends AppStateKeyed> extends LitElement {
`;
}
- constructor(store: EnhancedStore<S, AnyAction, ReadonlyArray<ThunkMiddleware>>) {
+ constructor(store: EnhancedStore<S, AnyAction, ReadonlyArray<ThunkMiddleware<S>>>) {
super();
this._store = store;
}
diff --git a/ui/app/or-app/src/pages/page-assets.ts b/ui/app/or-app/src/pages/page-assets.ts
index 88eed904f..9d31ebad0 100644
--- a/ui/app/or-app/src/pages/page-assets.ts
+++ b/ui/app/or-app/src/pages/page-assets.ts
@@ -464,12 +464,8 @@ class PageAssets<S extends AppStateKeyed> extends Page<S> {
`;
}
- stateChanged(state) {
- if(state.app.activeAsset && this._assetId !== state.app.activeAsset) {
- this._assetId = state.app.activeAsset
- } else if (!state.app.activeAsset) {
- this._assetId = null;
- }
+ stateChanged(state: S) {
+ this._assetId = state.app.params && state.app.params.id ? state.app.params.id : undefined;
}
protected _onTreeSelectionChanged(event: OrAssetTreeSelectionChangedEvent) {