Skip to content

Commit c2cc615

Browse files
committed
fix
1 parent f4fe180 commit c2cc615

File tree

1 file changed

+17
-10
lines changed
  • packages/webui/src/client/ui/Status/package-status

1 file changed

+17
-10
lines changed

packages/webui/src/client/ui/Status/package-status/index.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,23 @@ export const ExpectedPackagesStatus: React.FC<{}> = function ExpectedPackagesSta
8383
}
8484

8585
for (const work of expectedPackageWorkStatuses) {
86-
const device = peripheralDevicesMap.get(work.deviceId)
8786
// todo: make this better:
88-
const key = unprotectString(work.fromPackages[0]?.id) || 'unknown_work_' + work._id
89-
// const referencedPackage = packageRef[packageId]
90-
let packageWithWorkStatus = packagesWithWorkStatuses[key]
91-
if (!packageWithWorkStatus) {
92-
packagesWithWorkStatuses[key] = packageWithWorkStatus = {
93-
package: undefined,
94-
statuses: [],
95-
device,
87+
let fromPackageIds = work.fromPackages.map((p) => unprotectString(p.id))
88+
if (fromPackageIds.length === 0) fromPackageIds = ['unknown_work_' + work._id]
89+
90+
for (const key of fromPackageIds) {
91+
// const referencedPackage = packageRef[packageId]
92+
let packageWithWorkStatus = packagesWithWorkStatuses[key]
93+
if (!packageWithWorkStatus) {
94+
packagesWithWorkStatuses[key] = packageWithWorkStatus = {
95+
package: undefined,
96+
statuses: [],
97+
device: undefined,
98+
}
9699
}
100+
packageWithWorkStatus.statuses.push(work)
101+
packageWithWorkStatus.device = peripheralDevicesMap.get(work.deviceId)
97102
}
98-
packageWithWorkStatus.statuses.push(work)
99103
}
100104

101105
for (const id of Object.keys(packagesWithWorkStatuses)) {
@@ -140,6 +144,8 @@ export const ExpectedPackagesStatus: React.FC<{}> = function ExpectedPackagesSta
140144
return keys.map(({ packageId }) => {
141145
const p = packagesWithWorkStatuses[packageId]
142146

147+
console.log('p', p)
148+
143149
return p.package ? (
144150
<PackageStatus key={packageId} package={p.package} statuses={p.statuses} device={p.device} />
145151
) : (
@@ -152,6 +158,7 @@ export const ExpectedPackagesStatus: React.FC<{}> = function ExpectedPackagesSta
152158
function renderPackageContainerStatuses() {
153159
return packageContainerStatuses.map((packageContainerStatus) => {
154160
const device = peripheralDevicesMap.get(packageContainerStatus.deviceId)
161+
console.log(device, packageContainerStatus.deviceId)
155162
return (
156163
<PackageContainerStatus
157164
key={unprotectString(packageContainerStatus._id)}

0 commit comments

Comments
 (0)