diff --git a/app/scripts/controllers/channel-tabs/routes.js b/app/scripts/controllers/channel-tabs/routes.js index 6e00cfd5..a2be6487 100644 --- a/app/scripts/controllers/channel-tabs/routes.js +++ b/app/scripts/controllers/channel-tabs/routes.js @@ -117,8 +117,12 @@ export function channelRoutesCtrl ($scope, $timeout, Api, Alerting) { forwardAuthHeader: false, kafkaClientId: '', kafkaTopic: '', + rabbitmqHost: '', + rabbitmqUsername: '', + rabbitmqPassword: '', + rabbitmqExchangeName: '', waitPrimaryResponse: false, - statusCodesCheck: '', + statusCodesCheck: '' } } else if (type === 'edit') { // show add/edit box @@ -259,7 +263,7 @@ export function channelRoutesCtrl ($scope, $timeout, Api, Alerting) { // KAFKA route type validation if ($scope.newRoute.type === 'kafka') { // kafka topic validation - const kafkaTopicError = $scope.checkIskafkaTopicValid($scope.newRoute.kafkaTopic) + const kafkaTopicError = $scope.checkIskafkaTopicOrRabbitExchangeIsValid($scope.newRoute.kafkaTopic) if (kafkaTopicError) { $scope.ngErrorRoute.kafkaTopic = true $scope.ngErrorRoute.kafkaTopicError = kafkaTopicError @@ -267,6 +271,43 @@ export function channelRoutesCtrl ($scope, $timeout, Api, Alerting) { } } + // RABBITMQ route type validation + if ($scope.newRoute.type === 'rabbitmq') { + // rabbitmq host check + if (!$scope.newRoute.rabbitmqHost) { + $scope.ngErrorRoute.rabbitmqHost = true + $scope.ngErrorRoute.hasErrors = true + } + + // rabbitmq username check + if (!$scope.newRoute.rabbitmqUsername) { + $scope.ngErrorRoute.rabbitmqUsername = true + $scope.ngErrorRoute.hasErrors = true + } + + // rabbitmq password check + if (!$scope.newRoute.rabbitmqPassword) { + $scope.ngErrorRoute.rabbitmqPassword = true + $scope.ngErrorRoute.hasErrors = true + } + + // rabbitmq exchange name check + if (!$scope.newRoute.rabbitmqExchangeName) { + $scope.ngErrorRoute.rabbitmqExchangeName = true + $scope.ngErrorRoute.hasErrors = true + } + + // rabbitmq exchange name validation + if ($scope.newRoute.rabbitmqExchangeName) { + const rabbitmqExchangeNameError = $scope.checkIskafkaTopicOrRabbitExchangeIsValid($scope.newRoute.rabbitmqExchangeName) + if (rabbitmqExchangeNameError) { + $scope.ngErrorRoute.rabbitmqExchangeName = true + $scope.ngErrorRoute.rabbitmqExchangeNameError = rabbitmqExchangeNameError + $scope.ngErrorRoute.hasErrors = true + } + } + } + if ($scope.ngErrorRoute.hasErrors) { $scope.clearValidationRoute = $timeout(function () { // clear errors after 5 seconds @@ -303,7 +344,7 @@ export function channelRoutesCtrl ($scope, $timeout, Api, Alerting) { } // check if topic name is valid by kafka - $scope.checkIskafkaTopicValid = function (value) { + $scope.checkIskafkaTopicOrRabbitExchangeIsValid = function (value) { if (value) { if(value.length > 255) { return 'Max length is 255 characters!' diff --git a/app/views/channels.html b/app/views/channels.html index 9e53e7a6..9e32c1ec 100644 --- a/app/views/channels.html +++ b/app/views/channels.html @@ -57,20 +57,20 @@
- Add routes to this channel. Any requests that match this channel will be forwarded to each route in the channel. One route can be marked as a primary route. The response from the primary route will be the one that is returned to the request sender. + Add routes to this channel. Any requests that match this channel will be forwarded to each route in the channel. One + route can be marked as a primary route. The response from the primary route will be the one that is returned to the + request sender.
- Name | Status | Primary
- Type | Secured | Conditional
- Host | Port | Topic
- Path/Transform
-
- |
- |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
+ Name | Status | Primary
+ Type | Secured | Conditional
+ Host | Port | Topic | Exchange
+ Path/Transform
+
+ |
+ |||||||||||
-
- {{ route.name }}
-
-
-
-
-
- HTTP
- KAFKA
-
- Secured
- Unsecured
-
- Conditional
-
-
+
+ |
+
+ {{ route.name }}
+
+
+
+
+
+ HTTP
+ KAFKA
+ RABBITMQ
+
+ Secured
+ Unsecured
+
+ Conditional
+
+
{{ route.host }}
{{ route.port }}
-
+
{{ route.kafkaTopic }}
-
-
+
+ {{ route.rabbitmqExchangeName }}
+
+
+
{{ route.path }}
{{ route.pathTransform }}
-
+
-
-
-
-
-
+
+
+
+
- |