@@ -61,13 +61,13 @@ angularAPP.controller('CreateConnectorCtrl', function ($scope, $rootScope, $http
6161 }
6262
6363 //STEP 1: Validate
64+ $scope . validConfig = '' ;
65+ var validConnectorConfigKeys = [ ] ;
66+ var requiredConfigKeys = [ ] ;
6467 KafkaConnectFactory . validateConnectorConfig ( classname , model ) . then (
6568 function success ( data ) {
6669 $log . info ( 'Total validation errors from API => ' + data . error_count ) ;
6770 //STEP 2: Get errors if any
68- $scope . validConfig = '' ;
69- var validConnectorConfigKeys = [ ] ;
70- var requiredConfigKeys = [ ] ;
7171 angular . forEach ( data . configs , function ( config ) {
7272 if ( data . error_count && config . value . errors . length > 0 ) {
7373 errorConfigs . push ( config . value ) ;
@@ -89,13 +89,6 @@ angularAPP.controller('CreateConnectorCtrl', function ($scope, $rootScope, $http
8989 errorConfigs . push ( errors ) ;
9090 }
9191 } ) ;
92- // Now check the other way around. Whether a required property is not set
93- angular . forEach ( requiredConfigKeys , function ( requiredKey ) {
94- if ( ! model [ requiredKey ] ) {
95- var errors = { errors : [ 'Required config "' + requiredKey + '" is not there' ] } ;
96- errorConfigs . push ( errors ) ;
97- } ;
98- } ) ;
9992
10093 if ( errorConfigs == 0 ) {
10194 $scope . validConfig = constants . VIEW_MESSAGE_CONNECTOR_VALID ;
@@ -107,7 +100,9 @@ angularAPP.controller('CreateConnectorCtrl', function ($scope, $rootScope, $http
107100 $scope . warningConfigs = warningConfigs ;
108101 } ,
109102 function error ( data , reason ) {
110- $log . error ( 'Failure : ' + data ) ;
103+ const errorObject = JSON . parse ( data . split ( 'error:' ) [ 1 ] )
104+ $scope . errorConfigs = [ ] ;
105+ $scope . errorConfigs . push ( { errors : [ errorObject . message ] } )
111106 deferred . reject ( data ) ;
112107 } ) ;
113108 return deferred . promise ;
0 commit comments