Skip to content

Commit

Permalink
revs: clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
unocelli committed Oct 30, 2024
1 parent c7fd12b commit 6e1c2dd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 32 deletions.
4 changes: 2 additions & 2 deletions client/src/app/device/device.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<button mat-icon-button [matMenuTriggerFor]="optionsgMenu" class="fab-reload" style="right: 50px !important">
<mat-icon>more_vert</mat-icon>
</button>
<input type="file" #fileImportInput style="display: none" id="devicesConfigFileUpload" (change)="onDevTplChangeListener($event,false)" accept=".json,.csv" />
<input type="file" #tplFileImportInput style="display: none" id="devicesConfigTplUpload" (change)="onDevTplChangeListener($event,true)" accept=".json,.csv" />
<input type="file" #fileImportInput style="display: none" id="devicesConfigFileUpload" (change)="onDevTplChangeListener($event, false)" accept=".json,.csv" />
<input type="file" #tplFileImportInput style="display: none" id="devicesConfigTplUpload" (change)="onDevTplChangeListener($event, true)" accept=".json,.csv" />
<mat-menu #optionsgMenu [overlapTrigger]="false">
<button mat-menu-item [matMenuTriggerFor]="export" style="font-size: 14px;">{{'devices.export' | translate}}</button>
<mat-menu #export="matMenu" xPosition="before">
Expand Down
25 changes: 0 additions & 25 deletions client/src/app/device/device.component.spec.ts

This file was deleted.

10 changes: 5 additions & 5 deletions client/src/app/device/device.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ export class DeviceComponent implements OnInit, OnDestroy {
* @param event file resource
*/
onFileChangeListener(event) {
return this.onDevTplChangeListener(event,false);
return this.onDevTplChangeListener(event, false);
}

/**
* open Project event file loaded
* @param event file resource
* @param isTemplate use template for import, if true,generate new device id and tag id
* @param isTemplate use template for import, if true, generate new device id and tag id
*/
onDevTplChangeListener(event,isTemplate: boolean){
onDevTplChangeListener(event, isTemplate: boolean){
let input = event.target;
let reader = new FileReader();
reader.onload = (data) => {
Expand All @@ -180,7 +180,7 @@ export class DeviceComponent implements OnInit, OnDestroy {
}
//generate new id and filte fuxa
let importDev = [];
if(isTemplate){
if(isTemplate) {
devices.forEach((device: Device) => {
if (device.type != DeviceType.FuxaServer) {
device.id = Utils.getGUID(DEVICE_PREFIX);
Expand All @@ -194,7 +194,7 @@ export class DeviceComponent implements OnInit, OnDestroy {
}
});
}
this.projectService.importDevices(isTemplate? importDev: devices);
this.projectService.importDevices(isTemplate ? importDev : devices);
setTimeout(() => { this.projectService.onRefreshProject(); }, 2000);
};

Expand Down

0 comments on commit 6e1c2dd

Please sign in to comment.