From 5154d5cafdebf7f9225e988bcb98db6cb3997180 Mon Sep 17 00:00:00 2001 From: Krishna Iyer Easwaran Date: Wed, 14 Jun 2023 11:28:53 +0200 Subject: [PATCH] console: Remove EUIs from unclaim request --- cypress/integration/console/devices/unclaim.spec.js | 5 ----- pkg/webui/console/store/actions/claim.js | 4 +--- pkg/webui/console/store/middleware/logics/claim.js | 4 ++-- .../device-general-settings.js | 4 ++-- sdk/js/generated/api-definition.json | 1 - sdk/js/src/service/claim.js | 13 +++++++------ 6 files changed, 12 insertions(+), 19 deletions(-) diff --git a/cypress/integration/console/devices/unclaim.spec.js b/cypress/integration/console/devices/unclaim.spec.js index 49791b715b7..de4efa79b17 100644 --- a/cypress/integration/console/devices/unclaim.spec.js +++ b/cypress/integration/console/devices/unclaim.spec.js @@ -86,11 +86,6 @@ describe('Device un-claiming', () => { cy.findByRole('button', { name: /Unclaim and delete end device/ }).click() }) - cy.wait('@unclaim-request').its('request.body').should('deep.equal', { - dev_eui: ns.end_device.ids.dev_eui, - join_eui: '0000000000000000', - }) - cy.findByTestId('error-notification').should('not.exist') cy.location('pathname').should( diff --git a/pkg/webui/console/store/actions/claim.js b/pkg/webui/console/store/actions/claim.js index f8d0be15634..0e64d20393a 100644 --- a/pkg/webui/console/store/actions/claim.js +++ b/pkg/webui/console/store/actions/claim.js @@ -28,11 +28,9 @@ const UNCLAIM_DEVICE_BASE = 'UNCLAIM_DEVICE' export const [ { request: UNCLAIM_DEVICE, success: UNCLAIM_DEVICE_SUCCESS, failure: UNCLAIM_DEVICE_FAILURE }, { request: unclaimDevice, success: unclaimDeviceSuccess, failure: unclaimDeviceFailure }, -] = createRequestActions(UNCLAIM_DEVICE_BASE, (applicationId, deviceId, devEui, joinEui) => ({ +] = createRequestActions(UNCLAIM_DEVICE_BASE, (applicationId, deviceId) => ({ applicationId, deviceId, - devEui, - joinEui, })) const GET_INFO_BY_JOIN_EUI_BASE = 'GET_INFO_BY_JOIN_EUI' diff --git a/pkg/webui/console/store/middleware/logics/claim.js b/pkg/webui/console/store/middleware/logics/claim.js index 42e54b99bd8..a396d779c9e 100644 --- a/pkg/webui/console/store/middleware/logics/claim.js +++ b/pkg/webui/console/store/middleware/logics/claim.js @@ -30,9 +30,9 @@ const claimDeviceLogic = createRequestLogic({ const unclaimDeviceLogic = createRequestLogic({ type: claim.UNCLAIM_DEVICE, process: async ({ action }) => { - const { applicationId, deviceId, devEui, joinEui } = action.payload + const { applicationId, deviceId } = action.payload - return await tts.DeviceClaim.unclaim(applicationId, deviceId, devEui, joinEui) + return await tts.DeviceClaim.unclaim(applicationId, deviceId) }, }) diff --git a/pkg/webui/console/views/device-general-settings/device-general-settings.js b/pkg/webui/console/views/device-general-settings/device-general-settings.js index 3337cbb18ec..8a8a5fc5bb6 100644 --- a/pkg/webui/console/views/device-general-settings/device-general-settings.js +++ b/pkg/webui/console/views/device-general-settings/device-general-settings.js @@ -101,10 +101,10 @@ export default class DeviceGeneralSettings extends React.Component { const { appId, device, unclaimDevice } = this.props const { - ids: { device_id: deviceId, dev_eui: devEui, join_eui: joinEui }, + ids: { device_id: deviceId }, } = device - unclaimDevice(appId, deviceId, devEui, joinEui) + unclaimDevice(appId, deviceId) } @bind diff --git a/sdk/js/generated/api-definition.json b/sdk/js/generated/api-definition.json index ab1b1d496ba..70692edb44a 100644 --- a/sdk/js/generated/api-definition.json +++ b/sdk/js/generated/api-definition.json @@ -2237,7 +2237,6 @@ { "method": "delete", "pattern": "/edcs/claim/{application_ids.application_id}/devices/{device_id}", - "body": "*", "parameters": [ "application_ids.application_id", "device_id" diff --git a/sdk/js/src/service/claim.js b/sdk/js/src/service/claim.js index 2340ac9cd62..056c2a04e26 100644 --- a/sdk/js/src/service/claim.js +++ b/sdk/js/src/service/claim.js @@ -46,14 +46,13 @@ class DeviceClaim { /** * Unclaim an end device. + * The Device Claiming Server fetches the device EUIs (if present) from the Identity Server. * * @param {string} applicationId - The Application ID. * @param {string} deviceId - The Device ID. - * @param {Array} devEui - The Device dev_eui. - * @param {object} joinEui - The Device join_eui. * @returns {object} - An empty object on successful requests, an error otherwise. */ - async unclaim(applicationId, deviceId, devEui, joinEui) { + async unclaim(applicationId, deviceId) { const params = { routeParams: { 'application_ids.application_id': applicationId, @@ -61,9 +60,11 @@ class DeviceClaim { }, } - const response = await this._api.EndDeviceClaimingServer.Unclaim(params, { - dev_eui: devEui, - join_eui: joinEui, + const response = await this._api.EndDeviceClaimingServer.Unclaim({ + routeParams: { + 'application_ids.application_id': applicationId, + device_id: deviceId, + }, }) return Marshaler.payloadSingleResponse(response)