Skip to content

Commit 28d558a

Browse files
committed
Merge pull request #37 from ibm-cds-labs/simple-search-service-update
do not allow create index if no facet
2 parents e48b109 + 16de26a commit 28d558a

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

public/js/seams.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,21 @@ seamsApp.controller('navController', ['$scope', '$route', '$routeParams',
4242
if ($scope.$root.schema) {
4343
var html = $scope.$root.renderSchema($scope.$root.schema);
4444
$('#schemacontent').html(html);
45+
var checked = 0;
46+
$('.facet_checkbox', '#schemacontent').each(function() {
47+
$(this).change(function() {
48+
if($(this).is(":checked")) {
49+
checked++;
50+
}
51+
else {
52+
checked--;
53+
}
54+
$('#importbutton').attr('disabled',checked == 0);
55+
$('#facetstatus').css('visibility', checked == 0 ? 'visible' : 'hidden');
56+
});
57+
});
58+
$('#importbutton').attr('disabled',checked == 0);
59+
$('#facetstatus').css('visibility', checked == 0 ? 'visible' : 'hidden');
4560
}
4661
break;
4762
case 'search':
@@ -329,7 +344,7 @@ seamsApp.controller('seamsController', ['$scope', '$route', '$routeParams', '$lo
329344
var n = f.safename;
330345
var t = f.type;
331346
var v = f.facet.toString();
332-
var html = '<input class="input_checkbox" type="checkbox" value="true" name="' + n + '" id="' + n + '"';
347+
var html = '<input class="input_checkbox facet_checkbox" type="checkbox" value="true" name="' + n + '" id="' + n + '"';
333348
if (t == "number" || t == "boolean") {
334349
html += ' disabled="disabled"';
335350
}

views/templates/import.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ <h1 class="type_heading"><mark class="type_mark">Create the Search Index</mark><
2727
<div id="schemacontent" class="table_container"></div>
2828

2929
<div class="button_group">
30+
<div class="type_copy" id="facetstatus">Select a field to facet before importing</div>
3031
<button id="importbutton" type="submit" class="button_primary" ng-click="importClicked()"> Import </button>
3132
<!-- <span class="glyphicon glyphicon-refresh glyphicon-spinner import-spinner"></span> -->
3233
<div class="type_copy" id="importstatus"></div>

0 commit comments

Comments
 (0)