Skip to content

Commit

Permalink
fixed check system tags on load devices #745
Browse files Browse the repository at this point in the history
  • Loading branch information
unocelli committed Mar 23, 2023
1 parent aab727c commit 64b7182
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
28 changes: 15 additions & 13 deletions client/src/app/_services/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -962,19 +962,21 @@ export class ProjectService {
checkSystemTags() {
let devices = Object.values(this.projectData.devices).filter((device: Device) => device.id !== FuxaServer.id);
let fuxaServer = <Device>this.projectData.devices[FuxaServer.id];
devices.forEach((device: Device) => {
if (!Object.values(fuxaServer.tags).find((tag: Tag) => tag.sysType === TagSystemType.deviceConnectionStatus && tag.memaddress === device.id)) {
let tag = new Tag(Utils.getGUID(TAG_PREFIX));
tag.name = device.name + ' Connection Status';
tag.label = device.name + ' Connection Status';
tag.type = ServerTagType.number;
tag.memaddress = device.id;
tag.sysType = TagSystemType.deviceConnectionStatus;
tag.init = tag.value = '';
fuxaServer.tags[tag.id] = tag;
}
});
this.setDeviceTags(fuxaServer);
if (fuxaServer) {
devices.forEach((device: Device) => {
if (!Object.values(fuxaServer.tags).find((tag: Tag) => tag.sysType === TagSystemType.deviceConnectionStatus && tag.memaddress === device.id)) {
let tag = new Tag(Utils.getGUID(TAG_PREFIX));
tag.name = device.name + ' Connection Status';
tag.label = device.name + ' Connection Status';
tag.type = ServerTagType.number;
tag.memaddress = device.id;
tag.sysType = TagSystemType.deviceConnectionStatus;
tag.init = tag.value = '';
fuxaServer.tags[tag.id] = tag;
}
});
this.setDeviceTags(fuxaServer);
}
return this.getDevices();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ export class DevicePropertyComponent implements OnInit, OnDestroy {
if (this.subscriptionDeviceWebApiRequest) {
this.subscriptionDeviceWebApiRequest.unsubscribe();
}
} catch (e) {
} catch (err) {
console.error(err);
}
}

Expand Down

0 comments on commit 64b7182

Please sign in to comment.