Skip to content

Commit 9f88735

Browse files
committed
continuous validation on create new connector
1 parent 308deff commit 9f88735

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

src/kafka-connect/create-connector/create-connector.controller.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,28 @@ angularAPP.controller('CreateConnectorCtrl', function ($scope, $rootScope, $http
3131
$scope.isDisabledTab = function(index) { return (index == $scope.selectedTabIndex) ? 'false' : 'true'; }
3232

3333

34+
$scope.aceLoaded = function (_editor) {
35+
console.log("Ace for create-connector loaded");
36+
$scope.editor = _editor;
37+
$scope.editor.$blockScrolling = Infinity;
38+
$scope.acePropertyFileSession = _editor.getSession();
39+
var lines = 15;//$scope.connectorDetails.connectorDetailsInString.split("\n").length;
40+
_editor.setOptions({
41+
minLines: lines,
42+
maxLines: lines,
43+
highlightActiveLine: false
44+
});
45+
};
46+
3447

3548
//If user changes config from the editor
3649
$scope.$watch('formValuesPerSection', function() {
3750
if ($scope.formValuesPerSection) {
38-
console.log('test', $scope.formValuesPerSection)
51+
//console.log('test', $scope.formValuesPerSection)
3952
$scope.formValuesPerSection = $scope.formValuesPerSection.replace("\r", "");
40-
console.log('test', $scope.formValuesPerSection)
53+
//console.log('test', $scope.formValuesPerSection)
4154
var flatValuesArray = $scope.formValuesPerSection.split("\n");
42-
$scope.curlCommand = NewConnectorFactory.getCurlCommand(flatValuesArray);
55+
validateConnectorFn();
4356
}
4457
});
4558

@@ -93,6 +106,7 @@ angularAPP.controller('CreateConnectorCtrl', function ($scope, $rootScope, $http
93106
});
94107
if(errorConfigs == 0) {
95108
$scope.validConfig = constants.VIEW_MESSAGE_CONNECTOR_VALID;
109+
$scope.curlCommand = NewConnectorFactory.getCurlCommand(flatValuesArray);
96110
deferred.resolve(constants.VIEW_MESSAGE_CONNECTOR_VALID);
97111
} else {
98112
deferred.reject(errorConfigs);
@@ -134,6 +148,7 @@ angularAPP.controller('CreateConnectorCtrl', function ($scope, $rootScope, $http
134148
$rootScope.newConnectorChanges = true;
135149
});
136150
}, function (data, reason) {
151+
$scope.validConfig = "Please fix the below issues";
137152
console.log("I can NOT post the connector - as validation errors exist");
138153
});
139154

src/kafka-connect/create-connector/create-connector.html

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ <h3 style="font-size:12px;padding:0px; margin:0px">{{connector.name}}</h3>
4747
<!--Show Property file-->
4848
<div id="propertyFile" ng-hide="showCurl"
4949
ng-model="formValuesPerSection" ng-readonly="false"
50-
style="background-color:rgba(0, 128, 0, 0.0392157);"
5150
ui-ace="{
5251
useWrapMode: true,
5352
mode: 'properties',
5453
showPrintMargin: false,
5554
firstLineNumber: 1,
56-
blockScrolling: Infinity
55+
blockScrolling: Infinity,
56+
onLoad: aceLoaded
5757
}"></div>
5858
<!--Show Curl command-->
5959
<div id="curlCommand" ng-if="showCurl"
@@ -73,11 +73,8 @@ <h3 style="font-size:12px;padding:0px; margin:0px">{{connector.name}}</h3>
7373
<md-button ng-hide="connector.isUndefined || toggleEditor " ng-disabled="forms.cForm.$invalid" ng-click="previousTab()">
7474
<i class="fa fa-angle-double-left" aria-hidden="true"></i> Back
7575
</md-button>
76-
<md-button ng-click="validateConnector()">
77-
Validate
78-
</md-button>
79-
<md-button ng-disabled="forms.cForm.$invalid" ng-click="validateAndCreateConnector()">
80-
Validate and Create
76+
<md-button ng-disabled="errorConfigs.length != 0" ng-click="validateAndCreateConnector()">
77+
Create
8178
</md-button>
8279
</md-card-actions>
8380

src/kafka-connect/view/view.controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ angularAPP.controller('ConnectorDetailCtrl', function ($rootScope, $scope, $rout
9797
}
9898

9999
$scope.aceLoaded = function (_editor) {
100+
console.log("Ace loaded");
100101
$scope.editor = _editor;
101102
$scope.editor.$blockScrolling = Infinity;
102103
$scope.acePropertyFileSession = _editor.getSession();

0 commit comments

Comments
 (0)