Skip to content

Implement/rabbitmq channel #614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 44 additions & 3 deletions app/scripts/controllers/channel-tabs/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -259,14 +263,51 @@ 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
$scope.ngErrorRoute.hasErrors = true
}
}

// 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
Expand Down Expand Up @@ -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!'
Expand Down
10 changes: 5 additions & 5 deletions app/views/channels.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,20 @@ <h2><i class="glyphicon glyphicon-random"></i>&nbsp;&nbsp;Channels</h2>
<span ng-if="channel.status=='deleted'">{{ channel.name }}</span>
</td>
<td data-title="Channel URL Pattern">{{ channel.urlPattern }}</td>

<td data-title="Access">
<div class="channelAccessControlDiv" ng-if="channel.status!='deleted'" href="">

<span ng-if="channel.allow" uib-tooltip="Clients and Roles" ng-click="editChannel(channel, 'Request Matching')">
<i class="glyphicon glyphicon-th"></i>
<a>{{ channel.allow.join(', ') }}</a>
</span>

<span ng-if="channel.whitelist" uib-tooltip="Whitelisted ip addresses" ng-click="editChannel(channel, 'Request Matching')">
<i class="glyphicon glyphicon-ok"></i>
<a>{{ channel.whitelist.join(', ') }}</a>
</span>

<span ng-if="channel.authType=='public'" uib-tooltip="Channel is publically available" ng-click="editChannel(channel, 'Request Matching')">
<i class="glyphicon glyphicon-cloud-upload"></i>
<a > {{ channel.authType }}</a>
Expand All @@ -81,7 +81,7 @@ <h2><i class="glyphicon glyphicon-random"></i>&nbsp;&nbsp;Channels</h2>
<span>{{ channel.authType }}</span>
</div>
</td>

<td data-title="Monitoring"><a href="#!/channels/{{channel._id}}">Show metrics</a></td>
<td data-title="status">

Expand Down
Loading