diff --git a/pkg/webui/console/components/events/utils/definitions.js b/pkg/webui/console/components/events/utils/definitions.js index e6d5e1dd24c..a256003b45d 100644 --- a/pkg/webui/console/components/events/utils/definitions.js +++ b/pkg/webui/console/components/events/utils/definitions.js @@ -111,6 +111,7 @@ export const dataTypeMap = { export const applicationUpMessages = [ 'uplink_message', + 'uplink_normalized', 'join_accept', 'downlink_ack', 'downlink_nack', diff --git a/pkg/webui/console/components/events/utils/index.js b/pkg/webui/console/components/events/utils/index.js index 770b61e3960..18ef3daf288 100644 --- a/pkg/webui/console/components/events/utils/index.js +++ b/pkg/webui/console/components/events/utils/index.js @@ -68,6 +68,9 @@ export const getPreviewComponentByApplicationUpMessage = message => { case 'uplink_message': messageType = 'ApplicationUplink' break + case 'uplink_normalized': + messageType = 'ApplicationUplinkNormalized' + break case 'join_accept': messageType = 'ApplicationJoinAccept' break @@ -86,6 +89,7 @@ export const getPreviewComponentByApplicationUpMessage = message => { break case 'service_data': messageType = 'ApplicationServiceData' + break } return messageType in dataTypeMap ? dataTypeMap[messageType] : DefaultPreview diff --git a/pkg/webui/console/components/pubsub-form/index.js b/pkg/webui/console/components/pubsub-form/index.js index 5fa0a6175f2..1db0e11d68e 100644 --- a/pkg/webui/console/components/pubsub-form/index.js +++ b/pkg/webui/console/components/pubsub-form/index.js @@ -355,6 +355,14 @@ export default class PubsubForm extends Component { component={Input.Toggled} description={sharedMessages.eventUplinkMessageDesc} /> + { location_solved: mapPubsubMessageTypeToFormValue(pubsub.location_solved), service_data: mapPubsubMessageTypeToFormValue(pubsub.service_data), uplink_message: mapPubsubMessageTypeToFormValue(pubsub.uplink_message), + uplink_normalized: mapPubsubMessageTypeToFormValue(pubsub.uplink_normalized), } return result @@ -137,6 +138,7 @@ export const mapFormValuesToPubsub = (values, appId) => { location_solved: mapMessageTypeFormValueToPubsubMessageType(values.location_solved), service_data: mapMessageTypeFormValueToPubsubMessageType(values.service_data), uplink_message: mapMessageTypeFormValueToPubsubMessageType(values.uplink_message), + uplink_normalized: mapMessageTypeFormValueToPubsubMessageType(values.uplink_normalized), } switch (values._provider) { @@ -172,4 +174,5 @@ export const blankValues = { location_solved: { enabled: false, value: '' }, service_data: { enabled: false, value: '' }, uplink_message: { enabled: false, value: '' }, + uplink_normalized: { enabled: false, value: '' }, } diff --git a/pkg/webui/console/components/webhook-form/index.js b/pkg/webui/console/components/webhook-form/index.js index 07b352203a1..7b8d4def53a 100644 --- a/pkg/webui/console/components/webhook-form/index.js +++ b/pkg/webui/console/components/webhook-form/index.js @@ -168,6 +168,12 @@ const validationSchema = Yup.object().shape({ }) .test('has path length at most 64 characters', m.messagePathValidateTooLong, messageCheck) .nullable(), + uplink_normalized: Yup.object() + .shape({ + path: Yup.string(), + }) + .test('has path length at most 64 characters', m.messagePathValidateTooLong, messageCheck) + .nullable(), join_accept: Yup.object() .shape({ path: Yup.string(), @@ -516,6 +522,16 @@ export default class WebhookForm extends Component { component={Input.Toggled} description={sharedMessages.eventUplinkMessageDesc} /> + { template_fields: fields, base_url: urlTemplate.parse(template.base_url).expand(fields), uplink_message: pathExpand(template.uplink_message, fields), + uplink_normalized: pathExpand(template.uplink_normalized, fields), join_accept: pathExpand(template.join_accept, fields), downlink_ack: pathExpand(template.downlink_ack, fields), downlink_nack: pathExpand(template.downlink_nack, fields), diff --git a/pkg/webui/console/views/application-integrations-pubsub-edit/connect.js b/pkg/webui/console/views/application-integrations-pubsub-edit/connect.js index a52eff280a3..6ea7824986f 100644 --- a/pkg/webui/console/views/application-integrations-pubsub-edit/connect.js +++ b/pkg/webui/console/views/application-integrations-pubsub-edit/connect.js @@ -49,6 +49,7 @@ const pubsubEntitySelector = [ 'location_solved', 'service_data', 'uplink_message', + 'uplink_normalized', ] const mapStateToProps = state => ({ diff --git a/pkg/webui/console/views/application-integrations-webhook-edit/connect.js b/pkg/webui/console/views/application-integrations-webhook-edit/connect.js index ffbed7df837..941ce5a9e9b 100644 --- a/pkg/webui/console/views/application-integrations-webhook-edit/connect.js +++ b/pkg/webui/console/views/application-integrations-webhook-edit/connect.js @@ -35,6 +35,7 @@ const webhookEntitySelector = [ 'headers', 'downlink_api_key', 'uplink_message', + 'uplink_normalized', 'join_accept', 'downlink_ack', 'downlink_nack', diff --git a/pkg/webui/console/views/application-integrations-webhooks/connect.js b/pkg/webui/console/views/application-integrations-webhooks/connect.js index ddad4abc1c0..1a8bf918416 100644 --- a/pkg/webui/console/views/application-integrations-webhooks/connect.js +++ b/pkg/webui/console/views/application-integrations-webhooks/connect.js @@ -51,6 +51,7 @@ const selector = [ 'name', 'service_data', 'uplink_message', + 'uplink_normalized', ] const mapStateToProps = state => ({ diff --git a/pkg/webui/lib/shared-messages.js b/pkg/webui/lib/shared-messages.js index 9cf785e3add..9943f3a56f8 100644 --- a/pkg/webui/lib/shared-messages.js +++ b/pkg/webui/lib/shared-messages.js @@ -189,6 +189,7 @@ export default defineMessages({ eventLocationSolvedDesc: 'An integration succeeded locating the end device', eventServiceDataDesc: 'An integration emits an event', eventUplinkMessageDesc: 'An uplink message is received by the application', + eventUplinkNormalizedDesc: 'A normalized uplink payload', eventsCannotShow: 'Cannot show events', expiry: 'Expiry', exportJson: 'Export as JSON', @@ -416,6 +417,7 @@ export default defineMessages({ uplink: 'Uplink', uplinkFrameCount: 'Uplink frame count', uplinkMessage: 'Uplink message', + uplinkNormalized: 'Normalized uplink', uplinksReceived: 'Uplinks received', unexposed: 'Unexposed', used: '{currentValue}/{maxValue} used',