Skip to content

Commit 8ad99a7

Browse files
committed
Merge remote-tracking branch 'origin/master' into harmonize
2 parents 3a46bb4 + 7e25503 commit 8ad99a7

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@
191191
$scope.groups = jsonObj.groups;
192192
//load previous settings to $scope.groups based on $scope.loadDataForm.otherOptions
193193
updateGroupsBasedOnPreviousSettings($scope.groups, $scope.loadDataForm.otherOptions);
194+
addReadOnlyLengthToGroupSettingWithDefaultValue($scope.groups);
194195
})
195196
.then(function () {
196197
$scope.updateMlcpCommand();
@@ -222,6 +223,39 @@
222223
return false;
223224
};
224225

226+
$scope.makeDefaultValueReadOnlyIfApplicable = function($event) {
227+
var elem = $event.currentTarget;
228+
var readOnlyLengthData = elem.getAttribute("data-read-only-length");
229+
if(readOnlyLengthData) {
230+
var readOnlyLength = parseInt(readOnlyLengthData);
231+
if (($event.which != 37 && ($event.which != 39))
232+
&& ((elem.selectionStart < readOnlyLength)
233+
|| ((elem.selectionStart === readOnlyLength) && ($event.which === 8)))) {
234+
$event.preventDefault();
235+
return false;
236+
}
237+
}
238+
};
239+
}
240+
241+
/*
242+
* update $scope.groups and add a ReadOnlyLength
243+
* for options with default value to disable removal of default value
244+
* for options with type 'comma-list', set it to the length of the default value
245+
* for options with type 'string', set it to -1 which means it should be readonly
246+
*/
247+
function addReadOnlyLengthToGroupSettingWithDefaultValue(groups) {
248+
$.each(groups, function(i, group) {
249+
$.each(group.settings, function(i, setting) {
250+
if(setting.Value) {
251+
if(setting.Type === 'comma-list') {
252+
setting.ReadOnlyLength = setting.Value.length;
253+
} else if(setting.Type === 'string') {
254+
setting.ReadOnlyLength = -1;
255+
}
256+
}
257+
});
258+
});
225259
}
226260

227261
function updateGroupsBasedOnPreviousSettings(groups, otherOptions) {

quick-start/src/main/resources/static/css/quick-start.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,11 @@ section {
286286
box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
287287
}
288288

289+
.navbar-default {
290+
background-color: #2a2d2b;
291+
color: white;
292+
}
293+
289294
/* This is specifically for Swagger UI */
290295

291296
.swagger-validator {

quick-start/src/main/resources/static/top/modal/loadDataModal.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ <h4 class="modal-title" id="myModalLabel">Load Data</h4>
66
<div class="modal-body" id="myModalBody">
77
<div class="row">
88
<div id="details" class="col-xs-12 col-md-12">
9+
<nav class="navbar navbar-default">
10+
<div class="container-fluid">
11+
<div class="navbar-header">
12+
<h4><i class="fa fa-info-circle"></i>Hover over the labels to view the description</h4>
13+
</div>
14+
</div>
15+
</nav>
916
<form ng-submit="ok()">
1017
<div class="form-group">
1118
<label for="inputPath">Path</label>
@@ -38,8 +45,9 @@ <h4 class="modal-title" id="myModalLabel">Load Data</h4>
3845
<uib-accordion-group heading="{{group.category}}" ng-repeat="group in groups" ng-show="showBasedOnCategoryAndInputFileType(group.category,loadDataForm.inputFileType)">
3946
<div class="form-group" ng-repeat="setting in group.settings" ng-show="showIfHasNoFilterFieldOrWithSpecifiedValue(setting['FilterField'],setting['FilterValue'],group.settings)">
4047
<input type="checkbox" name="{{setting['Field']}}" ng-if="setting['Type'] === 'boolean'" ng-model="setting['Value']" value="true" ng-change="updateMlcpCommand()" ng-focus="hideInputPathTreeBrowser()">
41-
<label class="control-label" for="{{setting['Field']}}" title="{{setting['Description']}}">{{setting['Label']}}</label><br ng-if="setting['Type'] !== 'boolean'"/>
42-
<input type="text" class="form-control" name="{{setting['Field']}}" ng-if="isText(setting['Type'])" ng-model="setting['Value']" placeholder="{{setting['Placeholder Value'] ? setting['Placeholder Value'] : ''}}" ng-change="updateMlcpCommand()" ng-focus="hideInputPathTreeBrowser()"/>
48+
<label class="control-label" for="{{setting['Field']}}" popover-trigger="mouseenter" uib-popover="{{setting['Description']}}">{{setting['Label']}}</label><br ng-if="setting['Type'] !== 'boolean'"/>
49+
<input type="text" class="form-control" name="{{setting['Field']}}" ng-if="isText(setting['Type'])" ng-model="setting['Value']" placeholder="{{setting['Placeholder Value'] ? setting['Placeholder Value'] : ''}}" ng-change="updateMlcpCommand()" ng-focus="hideInputPathTreeBrowser()"
50+
data-read-only-length="{{setting['ReadOnlyLength']}}" ng-readonly="setting['ReadOnlyLength']===-1" ng-keypress="makeDefaultValueReadOnlyIfApplicable($event)" ng-keydown="makeDefaultValueReadOnlyIfApplicable($event)"/>
4351
<select class="form-control" name="{{setting['Field']}}" ng-if="setting['Type'] === 'type'" ng-model="setting['Value']" ng-change="updateMlcpCommand()" ng-focus="hideInputPathTreeBrowser()">
4452
<option ng-repeat="option in setting['Options']" value="{{option.value}}">{{option.label}}</option>
4553
</select>

0 commit comments

Comments
 (0)