Skip to content

Commit

Permalink
UI: remove ts-strict-ignore for env files and add typing (#2683)
Browse files Browse the repository at this point in the history
  • Loading branch information
miettal authored Jun 26, 2024
1 parent d54ba1b commit 89db028
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 13 deletions.
9 changes: 5 additions & 4 deletions ui/src/environments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface Environment {
readonly docsUrlPrefix: string;
readonly links: {

readonly COMMON_STORAGE: string,
readonly COMMON_STORAGE: string | null,
readonly FORGET_PASSWORD: string,
readonly EVCS_KEBA_KECONTACT: string,
readonly EVCS_HARDY_BARTH: string,
Expand All @@ -41,8 +41,9 @@ export interface Environment {
readonly CONTROLLER_API_REST_READ: string,
readonly CONTROLLER_API_REST_READWRITE: string,

readonly SETTINGS_ALERTING: string,
readonly SETTINGS_NETWORK_CONFIGURATION: string,
readonly SETTINGS_ALERTING: string | null,
readonly SETTINGS_NETWORK_CONFIGURATION: string | null,
readonly EVCS_CLUSTER: string,

readonly WARRANTY: {
readonly HOME: {
Expand Down Expand Up @@ -89,5 +90,5 @@ export interface Environment {
APP_IMAGE: (language: string, appId: string) => string | null;
},
},
readonly PRODUCT_TYPES: (translate: TranslateService) => Filter
readonly PRODUCT_TYPES: (translate: TranslateService) => Filter | null
}
1 change: 0 additions & 1 deletion ui/src/themes/openems/environments/backend-dev.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Environment } from "src/environments";
import { theme } from "./theme";

Expand Down
9 changes: 7 additions & 2 deletions ui/src/themes/openems/environments/backend-docker.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
// @ts-strict-ignore
import { Environment } from "src/environments";
import { theme } from "./theme";

// In docker test environment variable window.env is injected.
// cf.
// - tools/docker/ui/root/etc/s6-overlay/s6-rc.d/init-nginx/run
// - tools/docker/ui/assets/env.template.js
const window_env = (window as any).env as { [key: string]: string};

export const environment: Environment = {
...theme, ...{

backend: 'OpenEMS Backend',
url: window["env"]["websocket"],
url: window_env.websocket,

production: true,
debugMode: false,
Expand Down
1 change: 0 additions & 1 deletion ui/src/themes/openems/environments/backend-prod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Environment } from "src/environments";
import { theme } from "./theme";

Expand Down
1 change: 0 additions & 1 deletion ui/src/themes/openems/environments/edge-dev.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Environment } from "src/environments";
import { theme } from "./theme";

Expand Down
9 changes: 7 additions & 2 deletions ui/src/themes/openems/environments/edge-docker.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
// @ts-strict-ignore
import { Environment } from "src/environments";
import { theme } from "./theme";

// In docker test environment, variable window.env is injected.
// cf.
// - tools/docker/ui/root/etc/s6-overlay/s6-rc.d/init-nginx/run
// - tools/docker/ui/assets/env.template.js
const window_env = (window as any).env as { [key: string]: string};

export const environment: Environment = {
...theme, ...{

backend: 'OpenEMS Edge',
url: window["env"]["websocket"],
url: window_env.websocket,

production: true,
debugMode: false,
Expand Down
1 change: 0 additions & 1 deletion ui/src/themes/openems/environments/edge-prod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Environment } from "src/environments";
import { theme } from "./theme";

Expand Down
1 change: 0 additions & 1 deletion ui/src/themes/openems/environments/gitpod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Environment } from "src/environments";
import { theme } from "./theme";

Expand Down

0 comments on commit 89db028

Please sign in to comment.