Skip to content

Commit a375ed2

Browse files
authored
UI: convert new line code CRLF -> LF in ui/ files (#2429)
* fix: convert new line code CRLF -> LF in ui/ files. Actually I applied this command to ui/ files. // note: this sed is bsd sed, not gnu sed. find . -type f -name "*.json" -exec sed -i '' 's/\r$//' {} \; find . -type f -name "*.ts" -exec sed -i '' 's/\r$//' {} \; for increasing maintenanceability I changed new line code. * fix: insert new entry of gitattribute for web-dev related files suffixes actually svg is text-base format, but almost case it's generated by drawing software and not editted by text editor. so I categorized svg to binary.
1 parent 1b65ba5 commit a375ed2

17 files changed

+2700
-2696
lines changed

.gitattributes

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*.html text eol=lf diff=html
1616
*.java text eol=lf
1717
*.js text eol=lf diff=javascript
18+
*.json text eol=lf
1819
*.lib text eol=lf
1920
*.md text eol=lf
2021
*.MF text eol=lf
@@ -27,9 +28,11 @@
2728
*.properties text eol=lf
2829
*.py text eol=lf
2930
*.schema text eol=lf
31+
*.scss text eol=lf
3032
*.SF text eol=lf
3133
*.sh text eol=lf
3234
*.tcl text eol=lf
35+
*.ts text eol=lf
3336
*.txt text eol=lf
3437
*.xml text eol=lf
3538
*.xsd text eol=lf
@@ -70,6 +73,7 @@ LICENSE text eol=lf
7073
*.otp binary
7174
*.ots binary
7275
*.ott binary
76+
*.svg binary
7377
*.key binary
7478
*.numbers binary
7579
*.pages binary

ui/.vscode/launch.json

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
{
2-
"version": "0.2.0",
3-
"configurations": [
4-
{
5-
"type": "chrome",
6-
"request": "launch",
7-
"name": "Launch Chrome against localhost",
8-
"url": "http://localhost:4200",
9-
"webRoot": "${workspaceRoot}"
10-
},
11-
{
12-
"type": "chrome",
13-
"request": "attach",
14-
"name": "Attach to Chrome",
15-
"port": 9222,
16-
"webRoot": "${workspaceRoot}"
17-
}
18-
]
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "chrome",
6+
"request": "launch",
7+
"name": "Launch Chrome against localhost",
8+
"url": "http://localhost:4200",
9+
"webRoot": "${workspaceRoot}"
10+
},
11+
{
12+
"type": "chrome",
13+
"request": "attach",
14+
"name": "Attach to Chrome",
15+
"port": 9222,
16+
"webRoot": "${workspaceRoot}"
17+
}
18+
]
1919
}

ui/.vscode/settings.json

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
{
2-
"typescript.tsdk": "./node_modules/typescript/lib",
3-
"editor.formatOnSave": true,
4-
"cSpell.enabled": false,
5-
"i18n-ally.localesPaths": "src/assets/i18n",
6-
"i18n-ally.dirStructure": "file",
7-
"i18n-ally.keystyle": "nested",
8-
"formatFiles.excludedFolders": [
9-
"node_modules",
10-
".vscode",
11-
".git",
12-
"dist",
13-
".chrome",
14-
".angular",
15-
"target"
16-
],
17-
"formatFiles.excludePattern": "**/{*.svg,*.png,*.ico,package-lock.json}",
18-
"files.watcherExclude": {
19-
"**/.git/objects/**": true,
20-
"**/node_modules/**": true
21-
}
1+
{
2+
"typescript.tsdk": "./node_modules/typescript/lib",
3+
"editor.formatOnSave": true,
4+
"cSpell.enabled": false,
5+
"i18n-ally.localesPaths": "src/assets/i18n",
6+
"i18n-ally.dirStructure": "file",
7+
"i18n-ally.keystyle": "nested",
8+
"formatFiles.excludedFolders": [
9+
"node_modules",
10+
".vscode",
11+
".git",
12+
"dist",
13+
".chrome",
14+
".angular",
15+
"target"
16+
],
17+
"formatFiles.excludePattern": "**/{*.svg,*.png,*.ico,package-lock.json}",
18+
"files.watcherExclude": {
19+
"**/.git/objects/**": true,
20+
"**/node_modules/**": true
21+
}
2222
}

ui/src/app/edge/edge.module.ts

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import { HistoryModule } from './history/history.module';
2-
import { LiveModule } from './live/live.module';
3-
import { NgModule } from '@angular/core';
4-
import { SharedModule } from './../shared/shared.module';
5-
import { EdgeComponent } from './edge.component';
6-
7-
@NgModule({
8-
declarations: [
9-
EdgeComponent,
10-
],
11-
imports: [
12-
HistoryModule,
13-
LiveModule,
14-
SharedModule,
15-
],
16-
exports: [
17-
EdgeComponent,
18-
],
19-
})
20-
export class EdgeModule { }
1+
import { HistoryModule } from './history/history.module';
2+
import { LiveModule } from './live/live.module';
3+
import { NgModule } from '@angular/core';
4+
import { SharedModule } from './../shared/shared.module';
5+
import { EdgeComponent } from './edge.component';
6+
7+
@NgModule({
8+
declarations: [
9+
EdgeComponent,
10+
],
11+
imports: [
12+
HistoryModule,
13+
LiveModule,
14+
SharedModule,
15+
],
16+
exports: [
17+
EdgeComponent,
18+
],
19+
})
20+
export class EdgeModule { }
+87-87
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,87 @@
1-
import { Component, OnInit, ViewChild } from '@angular/core';
2-
import { ActivatedRoute } from '@angular/router';
3-
import { TranslateService } from '@ngx-translate/core';
4-
import { HeaderComponent } from 'src/app/shared/header/header.component';
5-
import { JsonrpcResponseError } from 'src/app/shared/jsonrpc/base';
6-
import { Edge, EdgeConfig, Service, Widgets } from 'src/app/shared/shared';
7-
import { environment } from 'src/environments';
8-
9-
@Component({
10-
selector: 'history',
11-
templateUrl: './history.component.html',
12-
})
13-
export class HistoryComponent implements OnInit {
14-
15-
@ViewChild(HeaderComponent, { static: false }) public HeaderComponent: HeaderComponent;
16-
17-
// is a Timedata service available, i.e. can historic data be queried.
18-
public isTimedataAvailable: boolean = true;
19-
protected errorResponse: JsonrpcResponseError | null = null;
20-
21-
// sets the height for a chart. This is recalculated on every window resize.
22-
public socChartHeight: string = "250px";
23-
public energyChartHeight: string = "250px";
24-
25-
// holds the Widgets
26-
public widgets: Widgets = null;
27-
28-
// holds the current Edge
29-
public edge: Edge = null;
30-
31-
// holds Channelthreshold Components to display effective active time in %
32-
// public channelthresholdComponents: string[] = [];
33-
34-
public config: EdgeConfig = null;
35-
36-
constructor(
37-
public service: Service,
38-
public translate: TranslateService,
39-
private route: ActivatedRoute,
40-
) { }
41-
42-
ngOnInit() {
43-
this.service.setCurrentComponent('', this.route);
44-
this.service.currentEdge.subscribe((edge) => {
45-
this.edge = edge;
46-
});
47-
this.service.getConfig().then(config => {
48-
// gather ControllerIds of Channelthreshold Components
49-
// for (let controllerId of
50-
// config.getComponentIdsImplementingNature("io.openems.impl.controller.channelthreshold.ChannelThresholdController")
51-
// .concat(config.getComponentIdsByFactory("Controller.ChannelThreshold"))) {
52-
// this.channelthresholdComponents.push(controllerId)
53-
// }
54-
this.config = config;
55-
config.hasStorage();
56-
this.widgets = config.widgets;
57-
// Are we connected to OpenEMS Edge and is a timedata service available?
58-
if (environment.backend == 'OpenEMS Edge'
59-
&& config.getComponentsImplementingNature('io.openems.edge.timedata.api.Timedata').filter(c => c.isEnabled).length == 0) {
60-
this.isTimedataAvailable = false;
61-
}
62-
});
63-
}
64-
65-
protected setErrorResponse(errorResponse: JsonrpcResponseError | null) {
66-
this.errorResponse = errorResponse;
67-
}
68-
69-
// checks arrows when ChartPage is closed
70-
// double viewchild is used to prevent undefined state of PickDateComponent
71-
ionViewDidEnter() {
72-
this.HeaderComponent.PickDateComponent.checkArrowAutomaticForwarding();
73-
}
74-
75-
updateOnWindowResize() {
76-
let ref = /* fix proportions */ Math.min(window.innerHeight - 150,
77-
/* handle grid breakpoints */(window.innerWidth < 768 ? window.innerWidth - 150 : window.innerWidth - 400));
78-
this.socChartHeight =
79-
/* minimum size */ Math.max(150,
80-
/* maximium size */ Math.min(200, ref),
81-
) + "px";
82-
this.energyChartHeight =
83-
/* minimum size */ Math.max(300,
84-
/* maximium size */ Math.min(600, ref),
85-
) + "px";
86-
}
87-
}
1+
import { Component, OnInit, ViewChild } from '@angular/core';
2+
import { ActivatedRoute } from '@angular/router';
3+
import { TranslateService } from '@ngx-translate/core';
4+
import { HeaderComponent } from 'src/app/shared/header/header.component';
5+
import { JsonrpcResponseError } from 'src/app/shared/jsonrpc/base';
6+
import { Edge, EdgeConfig, Service, Widgets } from 'src/app/shared/shared';
7+
import { environment } from 'src/environments';
8+
9+
@Component({
10+
selector: 'history',
11+
templateUrl: './history.component.html',
12+
})
13+
export class HistoryComponent implements OnInit {
14+
15+
@ViewChild(HeaderComponent, { static: false }) public HeaderComponent: HeaderComponent;
16+
17+
// is a Timedata service available, i.e. can historic data be queried.
18+
public isTimedataAvailable: boolean = true;
19+
protected errorResponse: JsonrpcResponseError | null = null;
20+
21+
// sets the height for a chart. This is recalculated on every window resize.
22+
public socChartHeight: string = "250px";
23+
public energyChartHeight: string = "250px";
24+
25+
// holds the Widgets
26+
public widgets: Widgets = null;
27+
28+
// holds the current Edge
29+
public edge: Edge = null;
30+
31+
// holds Channelthreshold Components to display effective active time in %
32+
// public channelthresholdComponents: string[] = [];
33+
34+
public config: EdgeConfig = null;
35+
36+
constructor(
37+
public service: Service,
38+
public translate: TranslateService,
39+
private route: ActivatedRoute,
40+
) { }
41+
42+
ngOnInit() {
43+
this.service.setCurrentComponent('', this.route);
44+
this.service.currentEdge.subscribe((edge) => {
45+
this.edge = edge;
46+
});
47+
this.service.getConfig().then(config => {
48+
// gather ControllerIds of Channelthreshold Components
49+
// for (let controllerId of
50+
// config.getComponentIdsImplementingNature("io.openems.impl.controller.channelthreshold.ChannelThresholdController")
51+
// .concat(config.getComponentIdsByFactory("Controller.ChannelThreshold"))) {
52+
// this.channelthresholdComponents.push(controllerId)
53+
// }
54+
this.config = config;
55+
config.hasStorage();
56+
this.widgets = config.widgets;
57+
// Are we connected to OpenEMS Edge and is a timedata service available?
58+
if (environment.backend == 'OpenEMS Edge'
59+
&& config.getComponentsImplementingNature('io.openems.edge.timedata.api.Timedata').filter(c => c.isEnabled).length == 0) {
60+
this.isTimedataAvailable = false;
61+
}
62+
});
63+
}
64+
65+
protected setErrorResponse(errorResponse: JsonrpcResponseError | null) {
66+
this.errorResponse = errorResponse;
67+
}
68+
69+
// checks arrows when ChartPage is closed
70+
// double viewchild is used to prevent undefined state of PickDateComponent
71+
ionViewDidEnter() {
72+
this.HeaderComponent.PickDateComponent.checkArrowAutomaticForwarding();
73+
}
74+
75+
updateOnWindowResize() {
76+
let ref = /* fix proportions */ Math.min(window.innerHeight - 150,
77+
/* handle grid breakpoints */(window.innerWidth < 768 ? window.innerWidth - 150 : window.innerWidth - 400));
78+
this.socChartHeight =
79+
/* minimum size */ Math.max(150,
80+
/* maximium size */ Math.min(200, ref),
81+
) + "px";
82+
this.energyChartHeight =
83+
/* minimum size */ Math.max(300,
84+
/* maximium size */ Math.min(600, ref),
85+
) + "px";
86+
}
87+
}

0 commit comments

Comments
 (0)