From cf109b438df29f5af050c066b5aa1b99e412dd03 Mon Sep 17 00:00:00 2001 From: Hiromasa Ihara Date: Sun, 13 Oct 2024 21:06:15 +0900 Subject: [PATCH 1/2] UI: add import order rule to eslint (#2778) * npm install -D eslint-import-resolver-typescript eslint-plugin-import * add import rules * fix: add ignore comment for eslint-plugin-import bug. cf. import-js/eslint-plugin-import#1479 * eslint src/ --fix --- ui/.eslintrc.json | 16 +++- ui/package-lock.json | 82 ++++++++++++++++++- ui/package.json | 3 +- ui/src/app/app.service.ts | 2 +- .../Io/DigitalOutput/digitalOutput.module.ts | 6 +- .../ModbusTcpApi/modbusTcpApi.module.ts | 2 +- .../history/Controller/controller.module.ts | 4 +- .../history/common/consumption/Consumption.ts | 2 +- .../history/common/production/production.ts | 2 +- ui/src/app/edge/history/shared.ts | 3 + .../history/storage/totalchart.component.ts | 2 +- .../TimeOfUseTariff/modal/statePriceChart.ts | 4 +- .../live/common/storage/storage.component.ts | 3 +- ui/src/app/edge/live/live.module.ts | 30 +++---- .../settings/channels/channels.component.ts | 4 +- ui/src/app/index/login.component.ts | 2 +- .../components/abstracthistorywidget.ts | 2 +- .../components/chart/abstracthistorychart.ts | 2 +- .../components/chart/chart.constants.ts | 2 +- .../shared/components/components.module.ts | 2 +- .../flat/abstract-flat-widget-line.ts | 2 +- .../components/flat/abstract-flat-widget.ts | 4 +- .../components/modal/abstract-modal-line.ts | 2 +- .../shared/components/modal/abstractModal.ts | 2 +- ui/src/app/shared/service/pagination.ts | 2 +- .../shared/utils/datetime/datetime-utils.ts | 3 + 26 files changed, 145 insertions(+), 45 deletions(-) diff --git a/ui/.eslintrc.json b/ui/.eslintrc.json index 8a3902ecdd..a97863eddf 100644 --- a/ui/.eslintrc.json +++ b/ui/.eslintrc.json @@ -20,6 +20,7 @@ "createDefaultProgram": true }, "plugins": [ + "import", "unused-imports", "@stylistic" ], @@ -27,11 +28,19 @@ "eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:@angular-eslint/recommended", - "plugin:@angular-eslint/template/process-inline-templates" + "plugin:@angular-eslint/template/process-inline-templates", + "plugin:import/recommended" ], "rules": { "curly": "error", "unused-imports/no-unused-imports": "error", + "import/order": [ + "error", + { + "groups": ["builtin", "external", "internal", "parent", "sibling", "index"], + "alphabetize": { "order": "asc", "caseInsensitive": true } + } + ], "@typescript-eslint/explicit-member-accessibility": [ "error", { @@ -100,6 +109,11 @@ "allowDefaultCaseForExhaustiveSwitch": false } ] + }, + "settings": { + "import/resolver": { + "typescript": {} + } } }, { diff --git a/ui/package-lock.json b/ui/package-lock.json index 2dd132f8d5..4c7068ed78 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -85,7 +85,8 @@ "@typescript-eslint/parser": "^7.0.0", "@typescript-eslint/types": "^8.7.0", "eslint": "^8.57.0", - "eslint-plugin-import": "2.30.0", + "eslint-import-resolver-typescript": "^3.6.3", + "eslint-plugin-import": "^2.30.0", "eslint-plugin-jsdoc": "50.2.4", "eslint-plugin-prefer-arrow": "1.2.3", "eslint-plugin-unused-imports": "^4.1.4", @@ -5916,6 +5917,16 @@ "tslib": "^2.0.0" } }, + "node_modules/@nolyfill/is-core-module": { + "version": "1.0.39", + "resolved": "https://registry.npmjs.org/@nolyfill/is-core-module/-/is-core-module-1.0.39.tgz", + "integrity": "sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.4.0" + } + }, "node_modules/@npmcli/agent": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/@npmcli/agent/-/agent-2.2.2.tgz", @@ -12151,6 +12162,42 @@ "ms": "^2.1.1" } }, + "node_modules/eslint-import-resolver-typescript": { + "version": "3.6.3", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.3.tgz", + "integrity": "sha512-ud9aw4szY9cCT1EWWdGv1L1XR6hh2PaRWif0j2QjQ0pgTY/69iw+W0Z4qZv5wHahOl8isEr+k/JnyAqNQkLkIA==", + "dev": true, + "license": "ISC", + "dependencies": { + "@nolyfill/is-core-module": "1.0.39", + "debug": "^4.3.5", + "enhanced-resolve": "^5.15.0", + "eslint-module-utils": "^2.8.1", + "fast-glob": "^3.3.2", + "get-tsconfig": "^4.7.5", + "is-bun-module": "^1.0.2", + "is-glob": "^4.0.3" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts/projects/eslint-import-resolver-ts" + }, + "peerDependencies": { + "eslint": "*", + "eslint-plugin-import": "*", + "eslint-plugin-import-x": "*" + }, + "peerDependenciesMeta": { + "eslint-plugin-import": { + "optional": true + }, + "eslint-plugin-import-x": { + "optional": true + } + } + }, "node_modules/eslint-module-utils": { "version": "2.11.1", "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.11.1.tgz", @@ -13648,6 +13695,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-tsconfig": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.8.1.tgz", + "integrity": "sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, "node_modules/get-uri": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.3.tgz", @@ -14851,6 +14911,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-bun-module": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-bun-module/-/is-bun-module-1.2.1.tgz", + "integrity": "sha512-AmidtEM6D6NmUiLOvvU7+IePxjEjOzra2h0pSrsfSAcXwl/83zLLXDByafUJy9k/rKK0pvXMLdwKwGHlX2Ke6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.6.3" + } + }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -21006,6 +21076,16 @@ "node": ">=4" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/resolve-url-loader": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/resolve-url-loader/-/resolve-url-loader-5.0.0.tgz", diff --git a/ui/package.json b/ui/package.json index d1e7e5250b..2e6da1a8f6 100644 --- a/ui/package.json +++ b/ui/package.json @@ -80,7 +80,8 @@ "@typescript-eslint/parser": "^7.0.0", "@typescript-eslint/types": "^8.7.0", "eslint": "^8.57.0", - "eslint-plugin-import": "2.30.0", + "eslint-import-resolver-typescript": "^3.6.3", + "eslint-plugin-import": "^2.30.0", "eslint-plugin-jsdoc": "50.2.4", "eslint-plugin-prefer-arrow": "1.2.3", "eslint-plugin-unused-imports": "^4.1.4", diff --git a/ui/src/app/app.service.ts b/ui/src/app/app.service.ts index e544f51838..4d5bddec5a 100644 --- a/ui/src/app/app.service.ts +++ b/ui/src/app/app.service.ts @@ -3,8 +3,8 @@ import { Injectable } from "@angular/core"; import { App } from "@capacitor/app"; import { Capacitor } from "@capacitor/core"; import { Directory, Encoding, Filesystem } from "@capacitor/filesystem"; -import { FileOpener } from "@ionic-native/file-opener"; import { AlertController } from "@ionic/angular"; +import { FileOpener } from "@ionic-native/file-opener"; import { TranslateService } from "@ngx-translate/core"; import { saveAs } from "file-saver-es"; import { DeviceDetectorService, DeviceInfo } from "ngx-device-detector"; diff --git a/ui/src/app/edge/history/Controller/Io/DigitalOutput/digitalOutput.module.ts b/ui/src/app/edge/history/Controller/Io/DigitalOutput/digitalOutput.module.ts index df92f38b35..cc060d3d5a 100644 --- a/ui/src/app/edge/history/Controller/Io/DigitalOutput/digitalOutput.module.ts +++ b/ui/src/app/edge/history/Controller/Io/DigitalOutput/digitalOutput.module.ts @@ -1,12 +1,12 @@ import { NgModule } from "@angular/core"; import { BrowserModule } from "@angular/platform-browser"; +import { FooterNavigationModule } from "src/app/shared/components/footer/subnavigation/footerNavigation.module"; import { SharedModule } from "src/app/shared/shared.module"; import { TotalChartComponent } from "./chart/chart"; -import { FlatComponent } from "./flat/flat"; -import { OverviewComponent } from "./overview/overview"; import { ChartComponent } from "./details/chart/chart"; import { DetailsOverviewComponent } from "./details/details.overview"; -import { FooterNavigationModule } from "src/app/shared/components/footer/subnavigation/footerNavigation.module"; +import { FlatComponent } from "./flat/flat"; +import { OverviewComponent } from "./overview/overview"; @NgModule({ imports: [ diff --git a/ui/src/app/edge/history/Controller/ModbusTcpApi/modbusTcpApi.module.ts b/ui/src/app/edge/history/Controller/ModbusTcpApi/modbusTcpApi.module.ts index aef372d5a3..b0ca5fb302 100644 --- a/ui/src/app/edge/history/Controller/ModbusTcpApi/modbusTcpApi.module.ts +++ b/ui/src/app/edge/history/Controller/ModbusTcpApi/modbusTcpApi.module.ts @@ -1,9 +1,9 @@ import { NgModule } from "@angular/core"; import { BrowserModule } from "@angular/platform-browser"; import { SharedModule } from "src/app/shared/shared.module"; +import { ChartComponent } from "./chart/chart"; import { FlatComponent } from "./flat/flat"; import { OverviewComponent } from "./overview/overview"; -import { ChartComponent } from "./chart/chart"; @NgModule({ imports: [ diff --git a/ui/src/app/edge/history/Controller/controller.module.ts b/ui/src/app/edge/history/Controller/controller.module.ts index e009e41d83..773e4d92f9 100644 --- a/ui/src/app/edge/history/Controller/controller.module.ts +++ b/ui/src/app/edge/history/Controller/controller.module.ts @@ -1,9 +1,9 @@ import { NgModule } from "@angular/core"; -import { ControllerEss } from "./Ess/ess.module"; -import { ControllerIo } from "./Io/Io.module"; import { ChannelThreshold } from "./ChannelThreshold/channelThreshold.module"; +import { ControllerEss } from "./Ess/ess.module"; import { GridOptimizeCharge } from "./Ess/GridoptimizedCharge/gridOptimizeCharge.module"; import { TimeOfUseTariff } from "./Ess/TimeOfUseTariff/timeOfUseTariff.module"; +import { ControllerIo } from "./Io/Io.module"; import { ModbusTcpApi } from "./ModbusTcpApi/modbusTcpApi.module"; @NgModule({ diff --git a/ui/src/app/edge/history/common/consumption/Consumption.ts b/ui/src/app/edge/history/common/consumption/Consumption.ts index c36c786695..9b957fb4e0 100644 --- a/ui/src/app/edge/history/common/consumption/Consumption.ts +++ b/ui/src/app/edge/history/common/consumption/Consumption.ts @@ -1,9 +1,9 @@ import { NgModule } from "@angular/core"; import { BrowserModule } from "@angular/platform-browser"; +import { CurrentVoltageModule } from "src/app/shared/components/edge/meter/currentVoltage/currentVoltageModule"; import { FooterNavigationModule } from "src/app/shared/components/footer/subnavigation/footerNavigation.module"; import { SharedModule } from "src/app/shared/shared.module"; -import { CurrentVoltageModule } from "src/app/shared/components/edge/meter/currentVoltage/currentVoltageModule"; import { ChartComponent } from "./chart/chart"; import { ConsumptionMeterChartDetailsComponent } from "./details/chart/consumptionMeter"; import { EvcsChartDetailsComponent } from "./details/chart/evcs"; diff --git a/ui/src/app/edge/history/common/production/production.ts b/ui/src/app/edge/history/common/production/production.ts index d4b7b9ce39..b78789fc8d 100644 --- a/ui/src/app/edge/history/common/production/production.ts +++ b/ui/src/app/edge/history/common/production/production.ts @@ -1,9 +1,9 @@ import { NgModule } from "@angular/core"; import { BrowserModule } from "@angular/platform-browser"; +import { CurrentVoltageModule } from "src/app/shared/components/edge/meter/currentVoltage/currentVoltageModule"; import { FooterNavigationModule } from "src/app/shared/components/footer/subnavigation/footerNavigation.module"; import { SharedModule } from "src/app/shared/shared.module"; -import { CurrentVoltageModule } from "src/app/shared/components/edge/meter/currentVoltage/currentVoltageModule"; import { TotalChartComponent } from "./chart/totalChart"; import { ChargerChartDetailsComponent } from "./details/chart/charger"; import { ProductionMeterChartDetailsComponent } from "./details/chart/productionMeter"; diff --git a/ui/src/app/edge/history/shared.ts b/ui/src/app/edge/history/shared.ts index ac05ac3b66..8f997b3ceb 100644 --- a/ui/src/app/edge/history/shared.ts +++ b/ui/src/app/edge/history/shared.ts @@ -1,7 +1,10 @@ // @ts-strict-ignore import * as Chart from "chart.js"; +/* eslint-disable import/no-duplicates */ +// cf. https://github.com/import-js/eslint-plugin-import/issues/1479 import { differenceInDays, differenceInMinutes, startOfDay } from "date-fns"; import { de } from "date-fns/locale"; +/* eslint-enable import/no-duplicates */ import { QueryHistoricTimeseriesDataResponse } from "src/app/shared/jsonrpc/response/queryHistoricTimeseriesDataResponse"; import { ChannelAddress, Service } from "src/app/shared/shared"; import { DateUtils } from "src/app/shared/utils/date/dateutils"; diff --git a/ui/src/app/edge/history/storage/totalchart.component.ts b/ui/src/app/edge/history/storage/totalchart.component.ts index 13375ae97d..c774c6139e 100644 --- a/ui/src/app/edge/history/storage/totalchart.component.ts +++ b/ui/src/app/edge/history/storage/totalchart.component.ts @@ -1,4 +1,5 @@ // @ts-strict-ignore +import { formatNumber } from "@angular/common"; import { Component, Input, OnChanges, OnDestroy, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { TranslateService } from "@ngx-translate/core"; @@ -7,7 +8,6 @@ import { DefaultTypes } from "src/app/shared/service/defaulttypes"; import { ChartAxis, Utils, YAxisType } from "src/app/shared/service/utils"; import { ChannelAddress, Edge, EdgeConfig, Service } from "src/app/shared/shared"; -import { formatNumber } from "@angular/common"; import { AbstractHistoryChart } from "../abstracthistorychart"; @Component({ diff --git a/ui/src/app/edge/live/Controller/Ess/TimeOfUseTariff/modal/statePriceChart.ts b/ui/src/app/edge/live/Controller/Ess/TimeOfUseTariff/modal/statePriceChart.ts index 3e690c5828..535359cbec 100644 --- a/ui/src/app/edge/live/Controller/Ess/TimeOfUseTariff/modal/statePriceChart.ts +++ b/ui/src/app/edge/live/Controller/Ess/TimeOfUseTariff/modal/statePriceChart.ts @@ -4,13 +4,13 @@ import { ActivatedRoute } from "@angular/router"; import { TranslateService } from "@ngx-translate/core"; import * as Chart from "chart.js"; import { AbstractHistoryChart } from "src/app/edge/history/abstracthistorychart"; +import { calculateResolution } from "src/app/edge/history/shared"; import { AbstractHistoryChart as NewAbstractHistoryChart } from "src/app/shared/components/chart/abstracthistorychart"; +import { ChartConstants } from "src/app/shared/components/chart/chart.constants"; import { ComponentJsonApiRequest } from "src/app/shared/jsonrpc/request/componentJsonApiRequest"; import { ChartAxis, HistoryUtils, TimeOfUseTariffUtils, YAxisType } from "src/app/shared/service/utils"; import { ChannelAddress, Currency, Edge, EdgeConfig, Service, Websocket } from "src/app/shared/shared"; -import { calculateResolution } from "src/app/edge/history/shared"; -import { ChartConstants } from "src/app/shared/components/chart/chart.constants"; import { ColorUtils } from "src/app/shared/utils/color/color.utils"; import { GetScheduleRequest } from "../../../../../../shared/jsonrpc/request/getScheduleRequest"; import { GetScheduleResponse } from "../../../../../../shared/jsonrpc/response/getScheduleResponse"; diff --git a/ui/src/app/edge/live/common/storage/storage.component.ts b/ui/src/app/edge/live/common/storage/storage.component.ts index ca1846f220..8114c49b3b 100644 --- a/ui/src/app/edge/live/common/storage/storage.component.ts +++ b/ui/src/app/edge/live/common/storage/storage.component.ts @@ -2,10 +2,9 @@ import { formatNumber } from "@angular/common"; import { Component } from "@angular/core"; import { AbstractFlatWidget } from "src/app/shared/components/flat/abstract-flat-widget"; -import { CurrentData } from "src/app/shared/shared"; +import { CurrentData , ChannelAddress, EdgeConfig, Utils } from "src/app/shared/shared"; import { DateUtils } from "src/app/shared/utils/date/dateutils"; -import { ChannelAddress, EdgeConfig, Utils } from "../../../../shared/shared"; import { StorageModalComponent } from "./modal/modal.component"; @Component({ diff --git a/ui/src/app/edge/live/live.module.ts b/ui/src/app/edge/live/live.module.ts index 944e2240b0..7863da0577 100644 --- a/ui/src/app/edge/live/live.module.ts +++ b/ui/src/app/edge/live/live.module.ts @@ -2,14 +2,21 @@ import { NgModule } from "@angular/core"; import { BrowserModule } from "@angular/platform-browser"; import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; import { SharedModule } from "./../../shared/shared.module"; +import { Common_Autarchy } from "./common/autarchy/Common_Autarchy"; +import { Common_Consumption } from "./common/consumption/Common_Consumption"; +import { Common_Grid } from "./common/grid/Common_Grid"; +import { Common_Production } from "./common/production/Common_Production"; +import { Common_Selfconsumption } from "./common/selfconsumption/Common_Selfconsumption"; +import { StorageModalComponent } from "./common/storage/modal/modal.component"; +import { StorageComponent } from "./common/storage/storage.component"; import { Controller_ChannelthresholdComponent } from "./Controller/Channelthreshold/Channelthreshold"; import { Controller_ChpSocComponent } from "./Controller/ChpSoc/ChpSoc"; import { Controller_ChpSocModalComponent } from "./Controller/ChpSoc/modal/modal.component"; import { Controller_Ess_FixActivePower } from "./Controller/Ess/FixActivePower/Ess_FixActivePower"; import { Controller_Ess_GridOptimizedCharge } from "./Controller/Ess/GridOptimizedCharge/Ess_GridOptimizedCharge"; import { Controller_Ess_TimeOfUseTariff } from "./Controller/Ess/TimeOfUseTariff/Ess_TimeOfUseTariff"; -import { Controller_Evcs } from "./Controller/Evcs/Evcs"; import { AdministrationComponent } from "./Controller/Evcs/administration/administration.component"; +import { Controller_Evcs } from "./Controller/Evcs/Evcs"; import { Controller_Io_ChannelSingleThresholdComponent } from "./Controller/Io/ChannelSingleThreshold/Io_ChannelSingleThreshold"; import { Controller_Io_ChannelSingleThresholdModalComponent } from "./Controller/Io/ChannelSingleThreshold/modal/modal.component"; import { Controller_Io_FixDigitalOutputComponent } from "./Controller/Io/FixDigitalOutput/Io_FixDigitalOutput"; @@ -20,27 +27,20 @@ import { Controller_Io_HeatpumpModalComponent } from "./Controller/Io/Heatpump/m import { Controller_Api_ModbusTcp } from "./Controller/ModbusTcpApi/modbusTcpApi.module"; import { Controller_Asymmetric_PeakShavingComponent } from "./Controller/PeakShaving/Asymmetric/Asymmetric"; import { Controller_Asymmetric_PeakShavingModalComponent } from "./Controller/PeakShaving/Asymmetric/modal/modal.component"; -import { Controller_Symmetric_PeakShavingComponent } from "./Controller/PeakShaving/Symmetric/Symmetric"; import { Controller_Symmetric_PeakShavingModalComponent } from "./Controller/PeakShaving/Symmetric/modal/modal.component"; -import { Controller_Symmetric_TimeSlot_PeakShavingComponent } from "./Controller/PeakShaving/Symmetric_TimeSlot/Symmetric_TimeSlot"; +import { Controller_Symmetric_PeakShavingComponent } from "./Controller/PeakShaving/Symmetric/Symmetric"; import { Controller_Symmetric_TimeSlot_PeakShavingModalComponent } from "./Controller/PeakShaving/Symmetric_TimeSlot/modal/modal.component"; -import { Io_Api_DigitalInputComponent } from "./Io/Api_DigitalInput/Io_Api_DigitalInput"; -import { Io_Api_DigitalInput_ModalComponent } from "./Io/Api_DigitalInput/modal/modal.component"; -import { Evcs_Api_ClusterComponent } from "./Multiple/Evcs_Api_Cluster/Evcs_Api_Cluster"; -import { EvcsChartComponent } from "./Multiple/Evcs_Api_Cluster/modal/evcs-chart/evcs.chart"; -import { Evcs_Api_ClusterModalComponent } from "./Multiple/Evcs_Api_Cluster/modal/evcsCluster-modal.page"; -import { Common_Autarchy } from "./common/autarchy/Common_Autarchy"; -import { Common_Consumption } from "./common/consumption/Common_Consumption"; -import { Common_Grid } from "./common/grid/Common_Grid"; -import { Common_Production } from "./common/production/Common_Production"; -import { Common_Selfconsumption } from "./common/selfconsumption/Common_Selfconsumption"; -import { StorageModalComponent } from "./common/storage/modal/modal.component"; -import { StorageComponent } from "./common/storage/storage.component"; +import { Controller_Symmetric_TimeSlot_PeakShavingComponent } from "./Controller/PeakShaving/Symmetric_TimeSlot/Symmetric_TimeSlot"; import { DelayedSellToGridComponent } from "./delayedselltogrid/delayedselltogrid.component"; import { DelayedSellToGridModalComponent } from "./delayedselltogrid/modal/modal.component"; import { EnergymonitorModule } from "./energymonitor/energymonitor.module"; import { InfoComponent } from "./info/info.component"; +import { Io_Api_DigitalInputComponent } from "./Io/Api_DigitalInput/Io_Api_DigitalInput"; +import { Io_Api_DigitalInput_ModalComponent } from "./Io/Api_DigitalInput/modal/modal.component"; import { LiveComponent } from "./live.component"; +import { Evcs_Api_ClusterComponent } from "./Multiple/Evcs_Api_Cluster/Evcs_Api_Cluster"; +import { EvcsChartComponent } from "./Multiple/Evcs_Api_Cluster/modal/evcs-chart/evcs.chart"; +import { Evcs_Api_ClusterModalComponent } from "./Multiple/Evcs_Api_Cluster/modal/evcsCluster-modal.page"; import { OfflineComponent } from "./offline/offline.component"; @NgModule({ diff --git a/ui/src/app/edge/settings/channels/channels.component.ts b/ui/src/app/edge/settings/channels/channels.component.ts index 36ea1f7911..e8f2411c1f 100644 --- a/ui/src/app/edge/settings/channels/channels.component.ts +++ b/ui/src/app/edge/settings/channels/channels.component.ts @@ -3,12 +3,12 @@ import { Component } from "@angular/core"; import { ActivatedRoute, Router } from "@angular/router"; import { TranslateService } from "@ngx-translate/core"; import { PersistencePriority } from "src/app/shared/components/edge/edgeconfig"; -import { SetChannelValueRequest } from "src/app/shared/jsonrpc/request/setChannelValueRequest"; -import { environment } from "src/environments"; import { ComponentJsonApiRequest } from "src/app/shared/jsonrpc/request/componentJsonApiRequest"; import { GetChannelsOfComponentRequest } from "src/app/shared/jsonrpc/request/getChannelsOfComponentRequest"; +import { SetChannelValueRequest } from "src/app/shared/jsonrpc/request/setChannelValueRequest"; import { Channel, GetChannelsOfComponentResponse } from "src/app/shared/jsonrpc/response/getChannelsOfComponentResponse"; +import { environment } from "src/environments"; import { ChannelAddress, Edge, EdgeConfig, EdgePermission, Service, Websocket } from "../../../shared/shared"; @Component({ diff --git a/ui/src/app/index/login.component.ts b/ui/src/app/index/login.component.ts index 4fa20f9aef..2e5dec6914 100644 --- a/ui/src/app/index/login.component.ts +++ b/ui/src/app/index/login.component.ts @@ -2,10 +2,10 @@ import { AfterContentChecked, ChangeDetectorRef, Component, OnDestroy, OnInit } from "@angular/core"; import { FormGroup } from "@angular/forms"; import { ActivatedRoute, Router } from "@angular/router"; +import { Capacitor } from "@capacitor/core"; import { Subject } from "rxjs"; import { environment } from "src/environments"; -import { Capacitor } from "@capacitor/core"; import { AppService } from "../app.service"; import { AuthenticateWithPasswordRequest } from "../shared/jsonrpc/request/authenticateWithPasswordRequest"; import { States } from "../shared/ngrx-store/states"; diff --git a/ui/src/app/shared/components/abstracthistorywidget.ts b/ui/src/app/shared/components/abstracthistorywidget.ts index dfc48dffa2..76204d7e13 100644 --- a/ui/src/app/shared/components/abstracthistorywidget.ts +++ b/ui/src/app/shared/components/abstracthistorywidget.ts @@ -4,9 +4,9 @@ import { ActivatedRoute } from "@angular/router"; import { ModalController } from "@ionic/angular"; import { TranslateService } from "@ngx-translate/core"; import { Subject } from "rxjs"; +import { v4 as uuidv4 } from "uuid"; import { DefaultTypes } from "src/app/shared/service/defaulttypes"; import { ChannelAddress, CurrentData, Edge, EdgeConfig, Service, Websocket } from "src/app/shared/shared"; -import { v4 as uuidv4 } from "uuid"; // NOTE: Auto-refresh of widgets is currently disabled to reduce server load @Directive() diff --git a/ui/src/app/shared/components/chart/abstracthistorychart.ts b/ui/src/app/shared/components/chart/abstracthistorychart.ts index b30e69af4b..40887a6a0c 100644 --- a/ui/src/app/shared/components/chart/abstracthistorychart.ts +++ b/ui/src/app/shared/components/chart/abstracthistorychart.ts @@ -5,10 +5,10 @@ import { ActivatedRoute } from "@angular/router"; import { TranslateService } from "@ngx-translate/core"; import * as Chart from "chart.js"; import annotationPlugin from "chartjs-plugin-annotation"; +import { v4 as uuidv4 } from "uuid"; import { ChronoUnit, DEFAULT_NUMBER_CHART_OPTIONS, DEFAULT_TIME_CHART_OPTIONS, Resolution, calculateResolution, isLabelVisible, setLabelVisible } from "src/app/edge/history/shared"; import { QueryHistoricTimeseriesEnergyPerPeriodResponse } from "src/app/shared/jsonrpc/response/queryHistoricTimeseriesEnergyPerPeriodResponse"; import { DefaultTypes } from "src/app/shared/service/defaulttypes"; -import { v4 as uuidv4 } from "uuid"; import { JsonrpcResponseError } from "../../jsonrpc/base"; import { QueryHistoricTimeseriesDataRequest } from "../../jsonrpc/request/queryHistoricTimeseriesDataRequest"; diff --git a/ui/src/app/shared/components/chart/chart.constants.ts b/ui/src/app/shared/components/chart/chart.constants.ts index 93bf4dc58e..2c7dabb3f3 100644 --- a/ui/src/app/shared/components/chart/chart.constants.ts +++ b/ui/src/app/shared/components/chart/chart.constants.ts @@ -1,8 +1,8 @@ // @ts-strict-ignore -import { ChartComponentLike, ChartDataset } from "chart.js"; import { formatNumber } from "@angular/common"; import { TranslateService } from "@ngx-translate/core"; +import { ChartComponentLike, ChartDataset } from "chart.js"; import ChartDataLabels from "chartjs-plugin-datalabels"; import { HistoryUtils, Utils } from "../../service/utils"; import { ArrayUtils } from "../../utils/array/array.utils"; diff --git a/ui/src/app/shared/components/components.module.ts b/ui/src/app/shared/components/components.module.ts index 8e39c2dc74..cb3b444a6f 100644 --- a/ui/src/app/shared/components/components.module.ts +++ b/ui/src/app/shared/components/components.module.ts @@ -9,9 +9,9 @@ import { PipeModule } from "../pipe/pipe"; import { ChartModule } from "./chart/chart.module"; import { FlatWidgetComponent } from "./flat/flat"; import { FlatWidgetHorizontalLineComponent } from "./flat/flat-widget-horizontal-line/flat-widget-horizontal-line"; -import { FlatWidgetLineDividerComponent } from "./flat/flat-widget-line-divider/flat-widget-line-divider"; import { FlatWidgetLineComponent } from "./flat/flat-widget-line/flat-widget-line"; import { FlatWidgetLineItemComponent } from "./flat/flat-widget-line/flat-widget-line-item/flat-widget-line-item"; +import { FlatWidgetLineDividerComponent } from "./flat/flat-widget-line-divider/flat-widget-line-divider"; import { FlatWidgetPercentagebarComponent } from "./flat/flat-widget-percentagebar/flat-widget-percentagebar"; import { FooterComponent } from "./footer/footer"; import { FooterNavigationModule } from "./footer/subnavigation/footerNavigation.module"; diff --git a/ui/src/app/shared/components/flat/abstract-flat-widget-line.ts b/ui/src/app/shared/components/flat/abstract-flat-widget-line.ts index 48738330c1..49d373e35d 100644 --- a/ui/src/app/shared/components/flat/abstract-flat-widget-line.ts +++ b/ui/src/app/shared/components/flat/abstract-flat-widget-line.ts @@ -4,8 +4,8 @@ import { ActivatedRoute } from "@angular/router"; import { ModalController } from "@ionic/angular"; import { Subject } from "rxjs"; import { takeUntil } from "rxjs/operators"; -import { ChannelAddress, Edge, Service, Websocket } from "src/app/shared/shared"; import { v4 as uuidv4 } from "uuid"; +import { ChannelAddress, Edge, Service, Websocket } from "src/app/shared/shared"; import { DataService } from "../shared/dataservice"; import { Filter } from "../shared/filter"; diff --git a/ui/src/app/shared/components/flat/abstract-flat-widget.ts b/ui/src/app/shared/components/flat/abstract-flat-widget.ts index bddb7f5283..a8a1e654f8 100644 --- a/ui/src/app/shared/components/flat/abstract-flat-widget.ts +++ b/ui/src/app/shared/components/flat/abstract-flat-widget.ts @@ -1,14 +1,14 @@ // @ts-strict-ignore import { Directive, Inject, Input, OnDestroy, OnInit } from "@angular/core"; +import { FormBuilder, FormGroup } from "@angular/forms"; import { ActivatedRoute, Router } from "@angular/router"; import { ModalController } from "@ionic/angular"; import { TranslateService } from "@ngx-translate/core"; import { Subject } from "rxjs"; import { takeUntil } from "rxjs/operators"; -import { ChannelAddress, CurrentData, Edge, EdgeConfig, Utils } from "src/app/shared/shared"; import { v4 as uuidv4 } from "uuid"; +import { ChannelAddress, CurrentData, Edge, EdgeConfig, Utils } from "src/app/shared/shared"; -import { FormBuilder, FormGroup } from "@angular/forms"; import { Service } from "../../service/service"; import { Websocket } from "../../service/websocket"; import { Converter } from "../shared/converter"; diff --git a/ui/src/app/shared/components/modal/abstract-modal-line.ts b/ui/src/app/shared/components/modal/abstract-modal-line.ts index f16f75a48f..0db855672e 100644 --- a/ui/src/app/shared/components/modal/abstract-modal-line.ts +++ b/ui/src/app/shared/components/modal/abstract-modal-line.ts @@ -6,8 +6,8 @@ import { ModalController } from "@ionic/angular"; import { TranslateService } from "@ngx-translate/core"; import { Subject } from "rxjs"; import { takeUntil } from "rxjs/operators"; -import { ChannelAddress, CurrentData, Edge, EdgeConfig, Service, Utils, Websocket } from "src/app/shared/shared"; import { v4 as uuidv4 } from "uuid"; +import { ChannelAddress, CurrentData, Edge, EdgeConfig, Service, Utils, Websocket } from "src/app/shared/shared"; import { Role } from "../../type/role"; import { Converter } from "../shared/converter"; diff --git a/ui/src/app/shared/components/modal/abstractModal.ts b/ui/src/app/shared/components/modal/abstractModal.ts index 225cf314e7..b652099412 100644 --- a/ui/src/app/shared/components/modal/abstractModal.ts +++ b/ui/src/app/shared/components/modal/abstractModal.ts @@ -6,8 +6,8 @@ import { ModalController } from "@ionic/angular"; import { TranslateService } from "@ngx-translate/core"; import { Subject, Subscription } from "rxjs"; import { takeUntil } from "rxjs/operators"; -import { ChannelAddress, CurrentData, Edge, EdgeConfig, Service, Utils, Websocket } from "src/app/shared/shared"; import { v4 as uuidv4 } from "uuid"; +import { ChannelAddress, CurrentData, Edge, EdgeConfig, Service, Utils, Websocket } from "src/app/shared/shared"; import { Role } from "../../type/role"; import { Converter } from "../shared/converter"; diff --git a/ui/src/app/shared/service/pagination.ts b/ui/src/app/shared/service/pagination.ts index f75a43c2f7..bef8d9d1e7 100644 --- a/ui/src/app/shared/service/pagination.ts +++ b/ui/src/app/shared/service/pagination.ts @@ -2,9 +2,9 @@ import { Directive } from "@angular/core"; import { Router } from "@angular/router"; import { SubscribeEdgesRequest } from "../jsonrpc/request/subscribeEdgesRequest"; +import { States } from "../ngrx-store/states"; import { ChannelAddress, Edge } from "../shared"; import { Service } from "./service"; -import { States } from "../ngrx-store/states"; @Directive() export class Pagination { diff --git a/ui/src/app/shared/utils/datetime/datetime-utils.ts b/ui/src/app/shared/utils/datetime/datetime-utils.ts index 70bb0b7cc5..83cec0673b 100644 --- a/ui/src/app/shared/utils/datetime/datetime-utils.ts +++ b/ui/src/app/shared/utils/datetime/datetime-utils.ts @@ -1,6 +1,9 @@ // @ts-strict-ignore +/* eslint-disable import/no-duplicates */ +// cf. https://github.com/import-js/eslint-plugin-import/issues/1479 import { format, startOfMonth, startOfYear } from "date-fns"; import { de } from "date-fns/locale"; +/* eslint-enable import/no-duplicates */ import { ChronoUnit } from "src/app/edge/history/shared"; import { QueryHistoricTimeseriesDataResponse } from "../../jsonrpc/response/queryHistoricTimeseriesDataResponse"; From af149f5ca5526a30e79e84a50589a02dc726aaa7 Mon Sep 17 00:00:00 2001 From: Stefan Feilmeier Date: Sun, 13 Oct 2024 14:12:38 +0200 Subject: [PATCH 2/2] Fix build --- ui/src/app/shared/components/chart/abstracthistorychart.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ui/src/app/shared/components/chart/abstracthistorychart.ts b/ui/src/app/shared/components/chart/abstracthistorychart.ts index 5f72c0e026..3fdc02b231 100644 --- a/ui/src/app/shared/components/chart/abstracthistorychart.ts +++ b/ui/src/app/shared/components/chart/abstracthistorychart.ts @@ -4,13 +4,14 @@ import { ChangeDetectorRef, Directive, Input, OnDestroy, OnInit } from "@angular import { ActivatedRoute } from "@angular/router"; import { TranslateService } from "@ngx-translate/core"; import * as Chart from "chart.js"; +import "chartjs-adapter-date-fns"; import annotationPlugin from "chartjs-plugin-annotation"; import { v4 as uuidv4 } from "uuid"; import { ChronoUnit, DEFAULT_NUMBER_CHART_OPTIONS, DEFAULT_TIME_CHART_OPTIONS, Resolution, calculateResolution, isLabelVisible, setLabelVisible } from "src/app/edge/history/shared"; import { QueryHistoricTimeseriesEnergyPerPeriodResponse } from "src/app/shared/jsonrpc/response/queryHistoricTimeseriesEnergyPerPeriodResponse"; import { DefaultTypes } from "src/app/shared/service/defaulttypes"; - import { JsonrpcResponseError } from "../../jsonrpc/base"; +import { JsonRpcUtils } from "../../jsonrpc/jsonrpcutils"; import { QueryHistoricTimeseriesDataRequest } from "../../jsonrpc/request/queryHistoricTimeseriesDataRequest"; import { QueryHistoricTimeseriesEnergyPerPeriodRequest } from "../../jsonrpc/request/queryHistoricTimeseriesEnergyPerPeriodRequest"; import { QueryHistoricTimeseriesEnergyRequest } from "../../jsonrpc/request/queryHistoricTimeseriesEnergyRequest"; @@ -27,9 +28,6 @@ import { TimeUtils } from "../../utils/time/timeutils"; import { Converter } from "../shared/converter"; import { ChartConstants, XAxisType } from "./chart.constants"; -import "chartjs-adapter-date-fns"; -import { JsonRpcUtils } from "../../jsonrpc/jsonrpcutils"; - Chart.Chart.register(annotationPlugin); // NOTE: Auto-refresh of widgets is currently disabled to reduce server load