Skip to content

Commit

Permalink
Merge pull request #3504 from FlowFuse/3473-revert-parts-of-3427
Browse files Browse the repository at this point in the history
fix device editor tunnel status indicator
  • Loading branch information
knolleary committed Feb 21, 2024
2 parents 24e1d62 + 73e0ae0 commit c187908
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions forge/db/views/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ module.exports = function (app) {
if (app.license.active() && result.mode === 'developer' && app.comms?.devices?.tunnelManager) {
/** @type {import("../../ee/lib/deviceEditor/DeviceTunnelManager").DeviceTunnelManager} */
const tunnelManager = app.comms.devices.tunnelManager
filtered.editor = tunnelManager.getTunnelStatus(device.id) || {}
filtered.editor = tunnelManager.getTunnelStatus(result.hashid) || {}
}

return filtered
Expand Down Expand Up @@ -179,7 +179,7 @@ module.exports = function (app) {
if (includeEditor && app.license.active() && summary.status === 'running' && summary.mode === 'developer' && app.comms?.devices?.tunnelManager) {
/** @type {import("../../ee/lib/deviceEditor/DeviceTunnelManager").DeviceTunnelManager} */
const tunnelManager = app.comms.devices.tunnelManager
filtered.editor = tunnelManager.getTunnelStatus(device.id) || {}
filtered.editor = tunnelManager.getTunnelStatus(summary.id) || {}
}

return filtered
Expand Down
4 changes: 2 additions & 2 deletions test/unit/forge/ee/routes/api/team_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('Team API - with billing enabled', function () {

const device1 = await app.factory.createDevice({ name: 'device-1', type: 'test-device', lastSeenAt: new Date(), mode: 'developer', state: 'running' }, app.team, null, app.application)

app.comms.devices.tunnelManager.newTunnel(device1.id, 'token12e')
app.comms.devices.tunnelManager.newTunnel(device1.hashid, 'token12e')
sinon.stub(app.comms.devices.tunnelManager, 'isConnected').returns(true)

const response = await app.inject({
Expand All @@ -118,7 +118,7 @@ describe('Team API - with billing enabled', function () {
device.should.have.property('mode', 'developer')
device.should.have.property('editor')

device.editor.should.have.property('url', '/api/v1/devices/1/editor/proxy/?access_token=token12e')
device.editor.should.have.property('url', `/api/v1/devices/${device1.hashid}/editor/proxy/?access_token=token12e`)
device.editor.should.have.property('enabled', true)
device.editor.should.have.property('connected', true)
})
Expand Down

0 comments on commit c187908

Please sign in to comment.