Skip to content

Commit 70150dd

Browse files
Merge pull request #5 from "Modbus Error Handling and Monitoring"
Modbus Error Handling and Monitoring
2 parents ba17dbe + ef6735c commit 70150dd

File tree

11 files changed

+278
-147
lines changed

11 files changed

+278
-147
lines changed

.vscode/launch.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
66
"configurations": [
7+
78
{
89
"name": "ng serve",
910
"request": "launch",

CHANGELOG.md

Lines changed: 45 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,92 @@
1-
# Changelog
1+
# Changelog for angular
22

3-
## [Unreleased](https://github.com/modbus2mqtt/angular/tree/HEAD)
3+
## [v0.12.19](https://github.com/volkmarnissen/angular/tree/v0.12.19) (2025-01-16)
44

5-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.19...HEAD)
5+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.18...v0.12.19)
66

7-
**Merged pull requests:**
7+
## [v0.12.18](https://github.com/volkmarnissen/angular/tree/v0.12.18) (2025-01-15)
88

9-
- Please update me [\#4](https://github.com/modbus2mqtt/angular/pull/4) ([volkmarnissen](https://github.com/volkmarnissen))
10-
- Fixed package-lock.json [\#3](https://github.com/modbus2mqtt/angular/pull/3) ([volkmarnissen](https://github.com/volkmarnissen))
11-
- Adding support for discrete inputs [\#2](https://github.com/modbus2mqtt/angular/pull/2) ([arturmietek](https://github.com/arturmietek))
9+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.17...v0.12.18)
1210

13-
## [v0.12.19](https://github.com/modbus2mqtt/angular/tree/v0.12.19) (2025-01-16)
11+
## [v0.12.17](https://github.com/volkmarnissen/angular/tree/v0.12.17) (2025-01-02)
1412

15-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.18...v0.12.19)
13+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.16...v0.12.17)
1614

17-
## [v0.12.18](https://github.com/modbus2mqtt/angular/tree/v0.12.18) (2025-01-15)
15+
## [v0.12.16](https://github.com/volkmarnissen/angular/tree/v0.12.16) (2024-12-31)
1816

19-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.17...v0.12.18)
17+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.15...v0.12.16)
2018

21-
## [v0.12.17](https://github.com/modbus2mqtt/angular/tree/v0.12.17) (2025-01-02)
19+
## [v0.12.15](https://github.com/volkmarnissen/angular/tree/v0.12.15) (2024-12-30)
2220

23-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.16...v0.12.17)
21+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.14...v0.12.15)
2422

25-
**Merged pull requests:**
23+
## [v0.12.14](https://github.com/volkmarnissen/angular/tree/v0.12.14) (2024-12-30)
2624

27-
- Adding signed int 32 and unsigned int 32 options to number format [\#1](https://github.com/modbus2mqtt/angular/pull/1) ([arturmietek](https://github.com/arturmietek))
25+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/0.12.14...v0.12.14)
2826

29-
## [v0.12.16](https://github.com/modbus2mqtt/angular/tree/v0.12.16) (2024-12-31)
27+
## [0.12.14](https://github.com/volkmarnissen/angular/tree/0.12.14) (2024-12-13)
3028

31-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.15...v0.12.16)
29+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.13...0.12.14)
3230

33-
## [v0.12.15](https://github.com/modbus2mqtt/angular/tree/v0.12.15) (2024-12-30)
31+
## [v0.12.13](https://github.com/volkmarnissen/angular/tree/v0.12.13) (2024-12-13)
3432

35-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.14...v0.12.15)
33+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.12...v0.12.13)
3634

37-
## [v0.12.14](https://github.com/modbus2mqtt/angular/tree/v0.12.14) (2024-12-30)
35+
## [v0.12.12](https://github.com/volkmarnissen/angular/tree/v0.12.12) (2024-12-11)
3836

39-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/0.12.14...v0.12.14)
37+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.11...v0.12.12)
4038

41-
## [0.12.14](https://github.com/modbus2mqtt/angular/tree/0.12.14) (2024-12-13)
39+
## [v0.12.11](https://github.com/volkmarnissen/angular/tree/v0.12.11) (2024-11-22)
4240

43-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.13...0.12.14)
41+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.10...v0.12.11)
4442

45-
## [v0.12.13](https://github.com/modbus2mqtt/angular/tree/v0.12.13) (2024-12-13)
43+
## [v0.12.10](https://github.com/volkmarnissen/angular/tree/v0.12.10) (2024-11-19)
4644

47-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.12...v0.12.13)
45+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.9...v0.12.10)
4846

49-
## [v0.12.12](https://github.com/modbus2mqtt/angular/tree/v0.12.12) (2024-12-11)
47+
## [v0.12.9](https://github.com/volkmarnissen/angular/tree/v0.12.9) (2024-11-16)
5048

51-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.11...v0.12.12)
49+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.8...v0.12.9)
5250

53-
## [v0.12.11](https://github.com/modbus2mqtt/angular/tree/v0.12.11) (2024-11-22)
51+
## [v0.12.8](https://github.com/volkmarnissen/angular/tree/v0.12.8) (2024-11-14)
5452

55-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.10...v0.12.11)
53+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.7...v0.12.8)
5654

57-
## [v0.12.10](https://github.com/modbus2mqtt/angular/tree/v0.12.10) (2024-11-19)
55+
## [v0.12.7](https://github.com/volkmarnissen/angular/tree/v0.12.7) (2024-10-23)
5856

59-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.9...v0.12.10)
57+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.6...v0.12.7)
6058

61-
## [v0.12.9](https://github.com/modbus2mqtt/angular/tree/v0.12.9) (2024-11-16)
59+
## [v0.12.6](https://github.com/volkmarnissen/angular/tree/v0.12.6) (2024-10-16)
6260

63-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.8...v0.12.9)
61+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.5...v0.12.6)
6462

65-
## [v0.12.8](https://github.com/modbus2mqtt/angular/tree/v0.12.8) (2024-11-14)
63+
## [v0.12.5](https://github.com/volkmarnissen/angular/tree/v0.12.5) (2024-09-24)
6664

67-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.7...v0.12.8)
65+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.4...v0.12.5)
6866

69-
## [v0.12.7](https://github.com/modbus2mqtt/angular/tree/v0.12.7) (2024-10-23)
67+
## [v0.12.4](https://github.com/volkmarnissen/angular/tree/v0.12.4) (2024-09-16)
7068

71-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.6...v0.12.7)
69+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.3...v0.12.4)
7270

73-
## [v0.12.6](https://github.com/modbus2mqtt/angular/tree/v0.12.6) (2024-10-16)
71+
## [v0.12.3](https://github.com/volkmarnissen/angular/tree/v0.12.3) (2024-09-06)
7472

75-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.5...v0.12.6)
73+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.2...v0.12.3)
7674

77-
## [v0.12.5](https://github.com/modbus2mqtt/angular/tree/v0.12.5) (2024-09-24)
75+
## [v0.12.2](https://github.com/volkmarnissen/angular/tree/v0.12.2) (2024-08-27)
7876

79-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.4...v0.12.5)
77+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.0...v0.12.2)
8078

81-
## [v0.12.4](https://github.com/modbus2mqtt/angular/tree/v0.12.4) (2024-09-16)
79+
## [v0.12.0](https://github.com/volkmarnissen/angular/tree/v0.12.0) (2024-08-16)
8280

83-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.3...v0.12.4)
81+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.11.0...v0.12.0)
8482

85-
## [v0.12.3](https://github.com/modbus2mqtt/angular/tree/v0.12.3) (2024-09-06)
83+
## [v0.11.0](https://github.com/volkmarnissen/angular/tree/v0.11.0) (2024-08-05)
8684

87-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.2...v0.12.3)
85+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.10.1...v0.11.0)
8886

89-
## [v0.12.2](https://github.com/modbus2mqtt/angular/tree/v0.12.2) (2024-08-27)
87+
## [v0.10.1](https://github.com/volkmarnissen/angular/tree/v0.10.1) (2024-08-05)
9088

91-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.0...v0.12.2)
92-
93-
## [v0.12.0](https://github.com/modbus2mqtt/angular/tree/v0.12.0) (2024-08-16)
94-
95-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.11.0...v0.12.0)
96-
97-
## [v0.11.0](https://github.com/modbus2mqtt/angular/tree/v0.11.0) (2024-08-05)
98-
99-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.10.1...v0.11.0)
100-
101-
## [v0.10.1](https://github.com/modbus2mqtt/angular/tree/v0.10.1) (2024-08-05)
102-
103-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/0b2169b1bceece9fa4c2c6940ef33dafe96ae43b...v0.10.1)
89+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/0b2169b1bceece9fa4c2c6940ef33dafe96ae43b...v0.10.1)
10490

10591

10692

cypress/modbus-error.cy.ts

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,21 @@ import { ModbusErrorComponent } from "angular/src/app/modbus-error/modbus-error.
1010
import {
1111
Iconfiguration,
1212
ImodbusErrorsForSlave,
13+
ModbusErrorStates,
14+
ModbusTasks,
1315
} from "@modbus2mqtt/server.shared";
16+
import { ModbusRegisterType } from "@modbus2mqtt/specification.shared";
1417

18+
19+
let date = Date.now()
1520
let modbusErrors: ImodbusErrorsForSlave = {
16-
errors: [{ entityId: 1, message: "One Error" }],
17-
totalErrorCount: 1,
18-
errorsSinceLastSuccessful: 0,
19-
allEntitiesFailed: false,
20-
notIdentifiedEntities: [],
21-
lastErrorTime: new Date(2021, 1, 1, 7, 7, 7).getTime(),
22-
lastAllEntitiesFailedTime: 0,
23-
lastSuccessfulIdentifiedTime: 0,
24-
lastAllEntitiesFailedSinceLastSuccessful: 0,
25-
lastIdentifiedSinceLastSuccessful: 0,
26-
};
21+
task: ModbusTasks.deviceDetection,
22+
date: date,
23+
address: { address:1,registerType:ModbusRegisterType.HoldingRegister},
24+
state:ModbusErrorStates.crc
2725

28-
describe("Modbus Error Component tests", () => {
29-
beforeEach(() => {
26+
};
27+
function mount( currentDate:number){
3028
// This configures the rootUrl for /api... calls
3129
// they need to be relative in ingress scenarios,
3230
// but they must be absolute for cypress tests
@@ -38,22 +36,39 @@ describe("Modbus Error Component tests", () => {
3836
provideHttpClient(withInterceptorsFromDi()),
3937
provideRouter([]),
4038
],
39+
autoDetectChanges: true,
4140
componentProperties: {
42-
modbusErrors: modbusErrors,
41+
modbusErrors: [modbusErrors],
42+
currentDate: date + 30*1000
4343
},
4444
});
45-
});
46-
it("can mount", () => {});
47-
it("first icon is red", () => {
48-
cy.get("div.icon-text mat-icon").should("satisfy", ($el) => {
49-
const classList = Array.from($el[0].classList);
50-
return classList.includes("red"); // passes
45+
46+
// This configures the rootUrl for /api... calls
47+
// they need to be relative in ingress scenarios,
48+
// but they must be absolute for cypress tests
49+
cy.window().then((win) => {
50+
(win as any).configuration = { rootUrl: "/" };
5151
});
52-
});
53-
it("third icon is green", () => {
54-
cy.get("div.icon-text mat-icon").should("satisfy", ($el) => {
55-
const classList = Array.from($el[2].classList);
56-
return classList.includes("green"); // passes
52+
cy.mount(ModbusErrorComponent, {
53+
providers: [
54+
provideHttpClient(withInterceptorsFromDi()),
55+
provideRouter([]),
56+
],
57+
autoDetectChanges: true,
58+
componentProperties: {
59+
modbusErrors: [modbusErrors],
60+
currentDate: currentDate
61+
},
5762
});
63+
}
64+
describe("Modbus Error Component tests", () => {
65+
it("can mount 30 seconds after last error", () => {
66+
mount(date + 30*1000)
67+
cy.get('mat-panel-description:first').should('contain', '30 seconds ago')
68+
});
69+
70+
it("can mount 90 seconds after last error", () => {
71+
mount(date + 90*1000)
72+
cy.get('mat-panel-description:first').should('contain', '1:30 minutes ago')
5873
});
5974
});

package-lock.json

Lines changed: 10 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "@modbus2mqtt/angular",
3-
"version": "0.12.19",
3+
"version": "0.12.20",
44
"sshserver": "[email protected]",
55
"credits": "multiple choice by Studio 365 from <a href='https://thenounproject.com/browse/icons/term/multiple-choice/' target='_blank' title='multiple choice Icons'>Noun Project</a> (CC BY 3.0)",
66
"scripts": {
77
"ng": "ng",
8-
"start": "ng serve --host=127.0.0.1",
8+
"start": "ng serve --host 127.0.0.1 --configuration development",
99
"stop": "pkill -f 'nodemon --watch ../server' & pkill 'ng serve' ",
1010
"build.dev": "ng build --configuration development",
1111
"build": "ng build --configuration production",

src/app/modbus-error/modbus-error.component.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,11 @@
1616
transform: scale(0.5);
1717
}
1818
.indent {
19+
text-indent: 2em;
20+
}
21+
.indent2 {
1922
text-indent: 4em;
20-
}
23+
}
24+
.indent3 {
25+
text-indent: 6em;
26+
}

0 commit comments

Comments
 (0)