Skip to content

Commit

Permalink
Merge pull request #81 from Landoop/fixing-validation-for-1.1.1
Browse files Browse the repository at this point in the history
Fixing validation for 1.1.1
  • Loading branch information
jglambed authored Sep 7, 2018
2 parents b5827cb + 1675981 commit db75862
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
5 changes: 3 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ RUN wget "https://github.com/mholt/caddy/releases/download/v0.10.11/caddy_v0.10.
&& rm -f /caddy.tgz

# Add and Setup Kafka Connect UI
ENV KAFKA_CONNECT_UI_VERSION="0.9.5"
RUN wget "https://github.com/Landoop/kafka-connect-ui/releases/download/v.${KAFKA_CONNECT_UI_VERSION}/kafka-connect-ui-${KAFKA_CONNECT_UI_VERSION}.tar.gz" -O /kafka-connect-ui.tar.gz \
ARG KAFKA_CONNECT_UI_VERSION="0.9.6"
ARG KAFKA_CONNECT_UI_URL="https://github.com/Landoop/kafka-connect-ui/releases/download/v.${KAFKA_CONNECT_UI_VERSION}/kafka-connect-ui-${KAFKA_CONNECT_UI_VERSION}.tar.gz"
RUN wget "$KAFKA_CONNECT_UI_URL" -O /kafka-connect-ui.tar.gz \
&& mkdir /kafka-connect-ui \
&& tar xzf /kafka-connect-ui.tar.gz -C /kafka-connect-ui \
&& rm -f /kafka-connect-ui.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kafka-connect-ui",
"version": "0.9.5",
"version": "0.9.6",
"description": "A user interface for managing Kafka Connectors",
"readme": "README.md",
"main": "Gruntfile.js",
Expand Down
2 changes: 1 addition & 1 deletion src/kafka-connect/config/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<md-content flex layout-padding>
<b>Kafka Connect :</b> {{kafkaConnectURL}} <br>
<span ng-show="showVersion"> <b>Kafka Connect Version :</b> {{version}} <br></span>
<span> <b>Kafka Connect UI Version :</b> 0.9.5 <br></span>
<span> <b>Kafka Connect UI Version :</b> 0.9.6 <br></span>
<span ng-show="connectionFailure" class="red">{{connectivityError}}</span><br>
</md-content>
</md-card>
17 changes: 6 additions & 11 deletions src/kafka-connect/create-connector/create-connector.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ angularAPP.controller('CreateConnectorCtrl', function ($scope, $rootScope, $http
}

//STEP 1: Validate
$scope.validConfig = '';
var validConnectorConfigKeys = [];
var requiredConfigKeys = [];
KafkaConnectFactory.validateConnectorConfig(classname, model).then(
function success(data) {
$log.info('Total validation errors from API => ' + data.error_count);
//STEP 2: Get errors if any
$scope.validConfig = '';
var validConnectorConfigKeys = [];
var requiredConfigKeys = [];
angular.forEach(data.configs, function (config) {
if (data.error_count && config.value.errors.length > 0) {
errorConfigs.push(config.value);
Expand All @@ -89,13 +89,6 @@ angularAPP.controller('CreateConnectorCtrl', function ($scope, $rootScope, $http
errorConfigs.push(errors);
}
});
// Now check the other way around. Whether a required property is not set
angular.forEach(requiredConfigKeys, function (requiredKey) {
if (!model[requiredKey]) {
var errors = { errors : [ 'Required config "' + requiredKey + '" is not there' ] };
errorConfigs.push(errors);
};
});

if(errorConfigs == 0) {
$scope.validConfig = constants.VIEW_MESSAGE_CONNECTOR_VALID;
Expand All @@ -107,7 +100,9 @@ angularAPP.controller('CreateConnectorCtrl', function ($scope, $rootScope, $http
$scope.warningConfigs = warningConfigs;
},
function error(data, reason) {
$log.error('Failure : ' + data);
const errorObject = JSON.parse(data.split('error:')[1])
$scope.errorConfigs = [];
$scope.errorConfigs.push({errors : [errorObject.message]})
deferred.reject(data);
});
return deferred.promise;
Expand Down

0 comments on commit db75862

Please sign in to comment.