made the react components to display the card for scanned components

This commit is contained in:
csawatzky 2025-06-26 13:20:10 -06:00
parent f5bc230fb6
commit 751b39d345
14 changed files with 311 additions and 26 deletions

View file

@ -3,6 +3,7 @@ import { quack } from "protobuf-ts/pond";
import { or } from "utils/types";
import { cloneDeep } from "lodash";
import { getSubtypes } from "pbHelpers/ComponentType";
import { getFriendlyAddressTypeName, getHumanReadableAddress } from "pbHelpers/AddressType";
// import { getSubtypes } from "pbHelpers/ComponentType";
export class Component {
@ -105,4 +106,33 @@ export class Component {
}
return 0;
}
public addressDescription = (deviceProduct?: pond.DeviceProduct) => {
if (
this.settings.addressType === quack.AddressType.ADDRESS_TYPE_CONFIGURABLE_PIN_ARRAY ||
(this.settings.addressType >= quack.AddressType.ADDRESS_TYPE_PIN_OFFSET1 &&
this.settings.addressType <= quack.AddressType.ADDRESS_TYPE_PIN_OFFSET100)
) {
let addressDescription = getHumanReadableAddress(
this.settings.addressType,
this.settings.type,
this.settings.address,
deviceProduct
);
if (addressDescription === "") {
addressDescription = "Internal";
}
let port = "Port: " + addressDescription;
let cableID = "";
if (
this.settings.addressType >= quack.AddressType.ADDRESS_TYPE_PIN_OFFSET1 &&
this.settings.addressType <= quack.AddressType.ADDRESS_TYPE_PIN_OFFSET100
) {
cableID = "Cable: " + (this.settings.addressType - 8);
}
return port + " " + cableID;
} else {
return getFriendlyAddressTypeName(this.settings.addressType);
}
};
}