From 24917d87c24b9aa6f4631d95b8234cb8eae35e59 Mon Sep 17 00:00:00 2001 From: Ben Hardill Date: Wed, 11 Dec 2024 17:12:26 +0000 Subject: [PATCH 1/4] Return device type in application/devices part of #4176 This is just the API change --- forge/db/views/Device.js | 1 + 1 file changed, 1 insertion(+) diff --git a/forge/db/views/Device.js b/forge/db/views/Device.js index 07747d772c..18032129f1 100644 --- a/forge/db/views/Device.js +++ b/forge/db/views/Device.js @@ -45,6 +45,7 @@ module.exports = function (app) { if (statusOnly) { return { id: result.hashid, + type: result.type, lastSeenAt: result.lastSeenAt, lastSeenMs: result.lastSeenAt ? (Date.now() - new Date(result.lastSeenAt).valueOf()) : null, status: result.state || 'offline', From b01a6fba9a0cfa165d3c9b5b9f8d532905cd1160 Mon Sep 17 00:00:00 2001 From: Ben Hardill Date: Thu, 12 Dec 2024 09:51:58 +0000 Subject: [PATCH 2/4] Tweak right api --- forge/db/models/Application.js | 2 +- forge/db/views/Device.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/forge/db/models/Application.js b/forge/db/models/Application.js index c98ce51373..156a6a98e3 100644 --- a/forge/db/models/Application.js +++ b/forge/db/models/Application.js @@ -106,7 +106,7 @@ module.exports = { if (includeApplicationDevices) { const include = { model: M.Device, - attributes: ['hashid', 'id', 'name', 'links', 'state', 'mode', 'updatedAt', 'lastSeenAt', 'editorConnected', 'editorToken', 'ownerType', 'ProjectId', 'ApplicationId'] + attributes: ['hashid', 'id', 'name', 'type', 'links', 'state', 'mode', 'updatedAt', 'lastSeenAt', 'editorConnected', 'editorToken', 'ownerType', 'ProjectId', 'ApplicationId'] } if (associationsLimit) { diff --git a/forge/db/views/Device.js b/forge/db/views/Device.js index 18032129f1..07747d772c 100644 --- a/forge/db/views/Device.js +++ b/forge/db/views/Device.js @@ -45,7 +45,6 @@ module.exports = function (app) { if (statusOnly) { return { id: result.hashid, - type: result.type, lastSeenAt: result.lastSeenAt, lastSeenMs: result.lastSeenAt ? (Date.now() - new Date(result.lastSeenAt).valueOf()) : null, status: result.state || 'offline', From 854ff579afaf0707ee9cfc75ea6bb7bf98f0b127 Mon Sep 17 00:00:00 2001 From: cstns Date: Thu, 12 Dec 2024 12:17:33 +0200 Subject: [PATCH 3/4] include device type in the application search --- frontend/src/pages/team/Applications/index.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/team/Applications/index.vue b/frontend/src/pages/team/Applications/index.vue index 1bb6383cf6..a1efe29e07 100644 --- a/frontend/src/pages/team/Applications/index.vue +++ b/frontend/src/pages/team/Applications/index.vue @@ -158,7 +158,8 @@ export default { const filteredDevices = app.devices.filter(device => { return [ device.name.toLowerCase().includes(this.filterTerm.toLowerCase()), - device.id.toLowerCase().includes(this.filterTerm.toLowerCase()) + device.id.toLowerCase().includes(this.filterTerm.toLowerCase()), + device.type.toLowerCase().includes(this.filterTerm.toLowerCase()) ].includes(true) }) @@ -179,7 +180,8 @@ export default { const filteredDevices = app.devices.filter(device => { return [ device.name.toLowerCase().includes(this.filterTerm.toLowerCase()), - device.id.toLowerCase().includes(this.filterTerm.toLowerCase()) + device.id.toLowerCase().includes(this.filterTerm.toLowerCase()), + device.type.toLowerCase().includes(this.filterTerm.toLowerCase()) ].includes(true) }) From 0cda7a461e32b3b75e74b88b5c2deb9bb0cdba49 Mon Sep 17 00:00:00 2001 From: cstns Date: Thu, 12 Dec 2024 12:48:42 +0200 Subject: [PATCH 4/4] add the type key on e2e intercepted devices and add search use case --- .../tests/applications/overview.spec.js | 63 ++++++++++++++----- 1 file changed, 47 insertions(+), 16 deletions(-) diff --git a/test/e2e/frontend/cypress/tests/applications/overview.spec.js b/test/e2e/frontend/cypress/tests/applications/overview.spec.js index 74ff7eeb1d..818bdb5695 100644 --- a/test/e2e/frontend/cypress/tests/applications/overview.spec.js +++ b/test/e2e/frontend/cypress/tests/applications/overview.spec.js @@ -616,7 +616,8 @@ describe('FlowForge - Applications', () => { lastSeenMs: null, status: 'offline', mode: 'autonomous', - isDeploying: false + isDeploying: false, + type: '' }, { id: '2', @@ -625,7 +626,8 @@ describe('FlowForge - Applications', () => { lastSeenMs: null, status: 'offline', mode: 'autonomous', - isDeploying: false + isDeploying: false, + type: '' }, { id: '3', @@ -634,7 +636,8 @@ describe('FlowForge - Applications', () => { lastSeenMs: null, status: 'offline', mode: 'autonomous', - isDeploying: false + isDeploying: false, + type: '' }, { id: '4', @@ -643,7 +646,8 @@ describe('FlowForge - Applications', () => { lastSeenMs: null, status: 'offline', mode: 'autonomous', - isDeploying: false + isDeploying: false, + type: '' } ] } @@ -664,7 +668,8 @@ describe('FlowForge - Applications', () => { lastSeenMs: null, status: 'offline', mode: 'autonomous', - isDeploying: false + isDeploying: false, + type: '' } ] } @@ -733,7 +738,8 @@ describe('FlowForge - Applications', () => { lastSeenMs: null, status: 'offline', mode: 'autonomous', - isDeploying: false + isDeploying: false, + type: '' }, { id: '123', @@ -742,7 +748,8 @@ describe('FlowForge - Applications', () => { lastSeenMs: null, status: 'offline', mode: 'autonomous', - isDeploying: false + isDeploying: false, + type: '' } ] } @@ -788,7 +795,8 @@ describe('FlowForge - Applications', () => { lastSeenMs: null, status: 'offline', mode: 'autonomous', - isDeploying: false + isDeploying: false, + type: '' }, { id: '13234', @@ -797,7 +805,8 @@ describe('FlowForge - Applications', () => { lastSeenMs: null, status: 'offline', mode: 'autonomous', - isDeploying: false + isDeploying: false, + type: '' } ] } @@ -844,7 +853,8 @@ describe('FlowForge - Applications', () => { lastSeenMs: null, status: 'offline', mode: 'autonomous', - isDeploying: false + isDeploying: false, + type: '' }, { id: '13234', @@ -853,7 +863,8 @@ describe('FlowForge - Applications', () => { lastSeenMs: null, status: 'offline', mode: 'autonomous', - isDeploying: false + isDeploying: false, + type: 'edge-entity' } ] } @@ -928,6 +939,21 @@ describe('FlowForge - Applications', () => { cy.get('[data-el="application-instance-item"]').should('have.length', 1) cy.get('[data-el="application-instance-item"]').contains('interesting instance name') }) + + cy.get('[data-form="search"] input').clear() + cy.get('[data-form="search"]').type('edge-entity') + + // app present due to name match but with filtered instances and devices + cy.get('[data-el="application-item"]').contains('interesting app name') + .parent() + .parent() + .parent() + .within(() => { + // one device present that matches query + cy.get('[data-el="device-tile"]').should('exist') + cy.get('[data-el="device-tile"]').should('have.length', 1) + cy.get('[data-el="device-tile"]').contains('another device name') + }) }) it('carries the search queries onwards to the application devices page when clicking show more', () => { @@ -939,7 +965,8 @@ describe('FlowForge - Applications', () => { lastSeenMs: null, status: 'offline', mode: 'autonomous', - isDeploying: false + isDeploying: false, + type: '' }, { id: '2', @@ -948,7 +975,8 @@ describe('FlowForge - Applications', () => { lastSeenMs: null, status: 'offline', mode: 'autonomous', - isDeploying: false + isDeploying: false, + type: '' }, { id: '3', @@ -957,7 +985,8 @@ describe('FlowForge - Applications', () => { lastSeenMs: null, status: 'offline', mode: 'autonomous', - isDeploying: false + isDeploying: false, + type: '' }, { id: '4', @@ -966,7 +995,8 @@ describe('FlowForge - Applications', () => { lastSeenMs: null, status: 'offline', mode: 'autonomous', - isDeploying: false + isDeploying: false, + type: '' }, { id: '5', @@ -975,7 +1005,8 @@ describe('FlowForge - Applications', () => { lastSeenMs: null, status: 'offline', mode: 'autonomous', - isDeploying: false + isDeploying: false, + type: '' } ] const instances = []