Skip to content
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

Fixing validation for 1.1.1 #81

Merged
merged 2 commits into from
Sep 7, 2018
Merged
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
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