Skip to content

Commit

Permalink
console: Remove EUIs from unclaim request
Browse files Browse the repository at this point in the history
  • Loading branch information
KrishnaIyer committed Jun 14, 2023
1 parent e8f76f9 commit 5154d5c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 19 deletions.
5 changes: 0 additions & 5 deletions cypress/integration/console/devices/unclaim.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 1 addition & 3 deletions pkg/webui/console/store/actions/claim.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions pkg/webui/console/store/middleware/logics/claim.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion sdk/js/generated/api-definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -2237,7 +2237,6 @@
{
"method": "delete",
"pattern": "/edcs/claim/{application_ids.application_id}/devices/{device_id}",
"body": "*",
"parameters": [
"application_ids.application_id",
"device_id"
Expand Down
13 changes: 7 additions & 6 deletions sdk/js/src/service/claim.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,25 @@ 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,
device_id: deviceId,
},
}

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)
Expand Down

0 comments on commit 5154d5c

Please sign in to comment.