diff --git a/forge/db/views/BOM.js b/forge/db/views/BOM.js index 36bf642a05..8bd4f7e447 100644 --- a/forge/db/views/BOM.js +++ b/forge/db/views/BOM.js @@ -33,7 +33,8 @@ module.exports = { nullable: true }, ownerId: { type: 'string', nullable: true }, - dependencies: { type: 'array', items: { $ref: 'dependency' } } + dependencies: { type: 'array', items: { $ref: 'dependency' } }, + state: { type: 'string', nullable: true } } }) }, @@ -54,17 +55,17 @@ module.exports = { if (type !== null) { const dependenciesArray = Object.entries(dependencies || {}).map(([name, version]) => app.db.views.BOM.dependency(name, version?.wanted, version?.current)) if (type === 'device') { - const { hashid, name, ownerType } = model + const { hashid, name, ownerType, state } = model let ownerId = null if (ownerType === 'instance') { ownerId = model.ProjectId } else if (ownerType === 'application') { ownerId = model.Application ? model.Application.id : app.db.models.Application.encodeHashid(model.ApplicationId) } - return { id: hashid, name, type, ownerType, ownerId, dependencies: dependenciesArray } + return { id: hashid, name, type, ownerType, ownerId, dependencies: dependenciesArray, state } } else if (type === 'instance') { - const { id, name } = model - return { id, name, type, dependencies: dependenciesArray } + const { id, name, state } = model + return { id, name, type, dependencies: dependenciesArray, state } } } return null diff --git a/frontend/src/api/team.js b/frontend/src/api/team.js index 6d4c08b342..4932eac1fe 100644 --- a/frontend/src/api/team.js +++ b/frontend/src/api/team.js @@ -422,6 +422,16 @@ const bulkDeviceMove = async (teamId, devices, moveTo, id = undefined) => { return res.data } +/** + * Get a list of Dependencies / Bill of Materials + * @param teamId + * @returns {Promise>} + */ +const getDependencies = (teamId) => { + return client.get(`/api/v1/teams/${teamId}/bom`) + .then(res => res.data) +} + /** * Calls api routes in team.js * See [routes/api/team.js](../../../forge/routes/api/team.js) @@ -453,5 +463,6 @@ export default { updateTeamDeviceProvisioningToken, deleteTeamDeviceProvisioningToken, bulkDeviceDelete, - bulkDeviceMove + bulkDeviceMove, + getDependencies } diff --git a/frontend/src/components/Accordion.vue b/frontend/src/components/Accordion.vue index c90b028b7c..cf7c54be4a 100644 --- a/frontend/src/components/Accordion.vue +++ b/frontend/src/components/Accordion.vue @@ -1,5 +1,5 @@ -
+