@@ -63,10 +63,35 @@ angularAPP.controller('CreateConnectorCtrl', function ($scope, $rootScope, $http
6363 name : "" ,
6464 config : { }
6565 } ;
66+ var errorConfigs = [ ] ;
6667
6768 flatValuesArray = $scope . formValuesPerSection . split ( '\n' ) ;
6869 config = NewConnectorFactory . getJSONConfigFlat ( flatValuesArray ) ;
69- var classname = $scope . connector . class ;
70+ //console.log(flatValuesArray);
71+ // var classname = $scope.connector.class;
72+ var classname = flatValuesArray . find ( function ( p ) {
73+ console . log ( p . indexOf ( "connector.class" ) ) ;
74+ return ( p . indexOf ( "connector.class=" ) == 0 )
75+ } ) . split ( 'connector.class=' ) . join ( '' ) ;
76+ //console.log("classname is -> " + classname);
77+ if ( classname != $scope . connector . class ) {
78+ console . log ( "error in classname -> " + classname ) ;
79+ var errors = { errors : [ 'Classname "' + $scope . connector . class + '" is not defined' ] } ;
80+ errorConfigs . push ( errors ) ;
81+ }
82+
83+ //console.log("Error configs -> " + errorConfigs);
84+ //console.log(errorConfigs.length == 0);
85+
86+ if ( errorConfigs == 0 ) {
87+ $scope . validConfig = constants . VIEW_MESSAGE_CONNECTOR_VALID ;
88+ $scope . curlCommand = NewConnectorFactory . getCurlCommand ( flatValuesArray ) ;
89+ deferred . resolve ( constants . VIEW_MESSAGE_CONNECTOR_VALID ) ;
90+ } else {
91+ $scope . validConfig = '' ;
92+ deferred . reject ( errorConfigs ) ;
93+ }
94+ $scope . errorConfigs = errorConfigs ;
7095
7196 //STEP 1: Validate
7297 var validateConfigPromise = KafkaConnectFactory . validateConnectorConfig ( classname , config ) ;
@@ -75,7 +100,6 @@ angularAPP.controller('CreateConnectorCtrl', function ($scope, $rootScope, $http
75100 $log . info ( 'Total validation errors from API => ' + data . error_count ) ;
76101 //STEP 2: Get errors if any
77102 $scope . validConfig = '' ;
78- var errorConfigs = [ ] ;
79103 var validConnectorConfigKeys = [ ] ;
80104 angular . forEach ( data . configs , function ( config ) {
81105 if ( config . value . errors . length > 0 ) {
@@ -86,7 +110,8 @@ angularAPP.controller('CreateConnectorCtrl', function ($scope, $rootScope, $http
86110 } ) ;
87111 angular . forEach ( flatValuesArray , function ( propertyLine ) {
88112 if ( propertyLine . length > 0 ) {
89- if ( ( propertyLine . indexOf ( "=" ) == - 1 ) | ( propertyLine . length < 3 ) ) { var errors = { errors : [ 'Line "' + propertyLine + '" is not a valid property line' ] } ;
113+ if ( ( propertyLine . indexOf ( "=" ) == - 1 ) | ( propertyLine . length < 3 ) ) {
114+ var errors = { errors : [ 'Line "' + propertyLine + '" is not a valid property line' ] } ;
90115 errorConfigs . push ( errors ) ;
91116 } else {
92117 var key = propertyLine . substring ( 0 , propertyLine . indexOf ( '=' ) ) ;
0 commit comments