Skip to content

Commit 330ae40

Browse files
committed
Cleanup - Fixed Jshint errors
1 parent 0829932 commit 330ae40

File tree

3 files changed

+84
-91
lines changed

3 files changed

+84
-91
lines changed

quick-start/src/main/resources/static/app/services/dataHubService.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@
205205
}
206206

207207
function getJsonFile(filePath) {
208-
return $http.get(filePath);
208+
return $http.get(filePath);
209209
}
210210

211211
function downloadMlcpOptionsFile(data) {
212-
return $http.post('api/flows/options/download', data);
212+
return $http.post('api/flows/options/download', data);
213213
}
214214

215215
}

quick-start/src/main/resources/static/app/services/modalService.js

Lines changed: 81 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111

1212
function GetByFieldAndValue() {
1313
return function(field, value, collection) {
14-
var i=0, len=collection.length;
15-
for (; i<len; i++) {
16-
if (String(collection[i]['Field']) === String(field) && String(collection[i]['Value']) === String(value)) {
17-
return collection[i];
18-
}
19-
}
20-
return null;
21-
}
14+
var i=0, len=collection.length;
15+
for (; i<len; i++) {
16+
if (String(collection[i].Field) === String(field) && String(collection[i].Value) === String(value)) {
17+
return collection[i];
18+
}
19+
}
20+
return null;
21+
};
2222
}
2323

2424
function ModalService($uibModal) {
@@ -101,19 +101,19 @@
101101
};
102102

103103
$scope.download = function() {
104-
$scope.loading = true;
105-
DataHub.downloadMlcpOptionsFile($scope.loadDataForm)
106-
.success(function(data) {
107-
var anchor = angular.element('<a/>');
108-
anchor.attr({
109-
href: 'data:attachment/csv;charset=utf-8,' + encodeURI(data),
110-
target: '_blank',
111-
download: 'mlcpOptions.txt'
112-
})[0].click();
113-
})
114-
.then(function() {
115-
$scope.loading = false;
116-
});
104+
$scope.loading = true;
105+
DataHub.downloadMlcpOptionsFile($scope.loadDataForm)
106+
.success(function(data) {
107+
var anchor = angular.element('<a/>');
108+
anchor.attr({
109+
href: 'data:attachment/csv;charset=utf-8,' + encodeURI(data),
110+
target: '_blank',
111+
download: 'mlcpOptions.txt'
112+
})[0].click();
113+
})
114+
.then(function() {
115+
$scope.loading = false;
116+
});
117117
};
118118

119119
$scope.onSelection = function(node, selected) {
@@ -148,10 +148,10 @@
148148
};
149149

150150
$scope.searchPath = function(basePath, node) {
151-
DataHub.searchPath(basePath).success(function(data) {
152-
$scope.updateMlcpCommand();
153-
$scope.loadTree(data, node);
154-
});
151+
DataHub.searchPath(basePath).success(function(data) {
152+
$scope.updateMlcpCommand();
153+
$scope.loadTree(data, node);
154+
});
155155
};
156156

157157
$scope.loadTree = function(data, node) {
@@ -165,12 +165,12 @@
165165
};
166166

167167
$scope.searchPathThenHideTree = function(basePath, node) {
168-
DataHub.searchPath(basePath).success(function(data) {
169-
$scope.loadTree(data, node);
170-
})
171-
.then(function() {
172-
$scope.showInputPathTreeBrowser = false;
173-
});
168+
DataHub.searchPath(basePath).success(function(data) {
169+
$scope.loadTree(data, node);
170+
})
171+
.then(function() {
172+
$scope.showInputPathTreeBrowser = false;
173+
});
174174
};
175175

176176
$scope.dataForTheTree = [];
@@ -179,25 +179,21 @@
179179
$scope.mlcpInitialCommand = constructInitialMlcpCommand(DataHub);
180180

181181
$scope.updateMlcpCommand = function() {
182-
$scope.mlcpCommand = updateMlcpCommand($scope.mlcpInitialCommand, $scope.loadDataForm, $scope.groups);
182+
$scope.mlcpCommand = updateMlcpCommand($scope.mlcpInitialCommand, $scope.loadDataForm, $scope.groups);
183183
};
184184

185185
$scope.loadSettings = function() {
186186
DataHub.getJsonFile('/json/inputOptions.json')
187-
.success(function(data) {
188-
console.log("success!");
187+
.success(function(data) {
189188
var updatedData = JSON.stringify(data).replace(/{{entityName}}/g, $scope.loadDataForm.entityName)
190189
.replace(/{{flowName}}/g, $scope.loadDataForm.flowName);
191190
var jsonObj = $.parseJSON(updatedData);
192191
$scope.groups = jsonObj.groups;
193192
//load previous settings to $scope.groups based on $scope.loadDataForm.otherOptions
194193
updateGroupsBasedOnPreviousSettings($scope.groups, $scope.loadDataForm.otherOptions);
195194
})
196-
.error(function(error) {
197-
console.log(error);
198-
})
199195
.then(function () {
200-
$scope.updateMlcpCommand();
196+
$scope.updateMlcpCommand();
201197
});
202198
};
203199

@@ -229,69 +225,66 @@
229225
}
230226

231227
function updateGroupsBasedOnPreviousSettings(groups, otherOptions) {
232-
if(otherOptions !== null) {
233-
var optionsMap = $.parseJSON(otherOptions);
228+
if(otherOptions !== null) {
229+
var optionsMap = $.parseJSON(otherOptions);
234230
$.each(groups, function(i, group) {
235231
$.each(group.settings, function(i, setting) {
236-
if(optionsMap[setting['Field']]) {
237-
var value = optionsMap[setting['Field']].replace(/"/g, '');
238-
setting['Value'] = value;
232+
if(optionsMap[setting.Field]) {
233+
var value = optionsMap[setting.Field].replace(/"/g, '');
234+
setting.Value = value;
239235
}
240236
});
241-
});
242-
}
237+
});
238+
}
243239
}
244240

245241
function showBasedOnCategoryAndInputFileType(category, inputFileType) {
246-
if(category === 'Delimited text options' && inputFileType !== 'delimited_text') {
247-
return false;
248-
} else if(category === 'Aggregate XML options' && inputFileType !== 'aggregates') {
249-
return false;
250-
}
251-
return true;
252-
};
242+
if(category === 'Delimited text options' && inputFileType !== 'delimited_text') {
243+
return false;
244+
} else if(category === 'Aggregate XML options' && inputFileType !== 'aggregates') {
245+
return false;
246+
}
247+
return true;
248+
}
253249

254250
function constructInitialMlcpCommand(DataHub) {
255-
var mlcpCommand = 'mlcp';
256-
257-
var mlcpExtension = '.sh';
258-
if ( navigator.appVersion.indexOf('Win') != -1 ) {
259-
mlcpExtension = '.bat'
260-
}
261-
262-
mlcpCommand += mlcpExtension + ' import -mode local';
263-
mlcpCommand += ' -host ' + DataHub.status.mlHost;
264-
mlcpCommand += ' -port ' + DataHub.status.mlStagingRestPort;
265-
mlcpCommand += ' -username ' + DataHub.status.mlUsername;
266-
mlcpCommand += ' -password ' + DataHub.status.mlPassword;
267-
268-
return mlcpCommand;
251+
var mlcpCommand = 'mlcp';
252+
var mlcpExtension = '.sh';
253+
if ( navigator.appVersion.indexOf('Win') !== -1 ) {
254+
mlcpExtension = '.bat';
255+
}
256+
mlcpCommand += mlcpExtension + ' import -mode local';
257+
mlcpCommand += ' -host ' + DataHub.status.mlHost;
258+
mlcpCommand += ' -port ' + DataHub.status.mlStagingRestPort;
259+
mlcpCommand += ' -username ' + DataHub.status.mlUsername;
260+
mlcpCommand += ' -password ' + DataHub.status.mlPassword;
261+
return mlcpCommand;
269262
}
270263

271264
function updateMlcpCommand(initialMlcpCommand, loadDataForm, groups) {
272-
var mlcpCommand = initialMlcpCommand;
273-
mlcpCommand += ' -input_file_path ' + loadDataForm.inputPath;
274-
mlcpCommand += ' -input_file_type ' + loadDataForm.inputFileType;
275-
mlcpCommand += ' -output_uri_replace "' + loadDataForm.inputPath + ',\'\'"';
276-
277-
var otherOptions = [];
278-
$.each(groups, function(i, group) {
279-
if(showBasedOnCategoryAndInputFileType(group.category, loadDataForm.inputFileType)) {
280-
$.each(group.settings, function(i, setting) {
281-
if(setting['Value']) {
282-
var key = setting['Field'];
283-
var value = '"' + setting['Value'] + '"';
284-
mlcpCommand += ' ' + key + ' ' + value;
285-
var option = {};
286-
option[key] = value;
287-
otherOptions.push(option);
288-
}
289-
});
290-
}
291-
});
265+
var mlcpCommand = initialMlcpCommand;
266+
mlcpCommand += ' -input_file_path ' + loadDataForm.inputPath;
267+
mlcpCommand += ' -input_file_type ' + loadDataForm.inputFileType;
268+
mlcpCommand += ' -output_uri_replace "' + loadDataForm.inputPath + ',\'\'"';
269+
270+
var otherOptions = [];
271+
$.each(groups, function(i, group) {
272+
if(showBasedOnCategoryAndInputFileType(group.category, loadDataForm.inputFileType)) {
273+
$.each(group.settings, function(i, setting) {
274+
if(setting.Value) {
275+
var key = setting.Field;
276+
var value = '"' + setting.Value + '"';
277+
mlcpCommand += ' ' + key + ' ' + value;
278+
var option = {};
279+
option[key] = value;
280+
otherOptions.push(option);
281+
}
282+
});
283+
}
284+
});
292285

293-
loadDataForm.otherOptions = otherOptions.length > 0 ? JSON.stringify(otherOptions) : null;
294-
return mlcpCommand;
286+
loadDataForm.otherOptions = otherOptions.length > 0 ? JSON.stringify(otherOptions) : null;
287+
return mlcpCommand;
295288
}
296289

297290
function EntityModalController($scope, $uibModalInstance, DataHub) {

quick-start/src/main/resources/static/top/topController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
$scope.runInputFlow = function(flow) {
5757
$scope.loading = true;
58-
DataHub.getPreviousOptions(flow.entityName, flow.flowName)
58+
DataHub.getPreviousOptions(flow.entityName, flow.flowName)
5959
.success(function(options) {
6060
$scope.loading = false;
6161
ModalService.openLoadDataModal(options)

0 commit comments

Comments
 (0)