Skip to content

Commit 453c409

Browse files
committed
bug fixes and save index validation
1 parent 1b3d01d commit 453c409

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

src/Umbraco.Cms.Integrations.Search.Algolia/App_Plugins/UmbracoCms.Integrations/Search/Algolia/js/dashboard.controller.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
vm.saveIndex = saveIndex;
1616
vm.viewIndex = viewIndex;
1717
vm.buildIndex = buildIndex;
18-
vm.search = search;
18+
vm.searchIndex = searchIndex;
1919
vm.deleteIndex = deleteIndex;
20+
vm.search = search;
2021

2122
function init() {
2223

@@ -92,6 +93,8 @@
9293
else {
9394
const propertyIndex = this.contentData.find(p => p.contentType === this.selectedContentType).properties.indexOf(property.alias);
9495
if (propertyIndex > -1) this.contentData.find(p => p.contentType === this.selectedContentType).properties.splice(propertyIndex, 1);
96+
97+
this.properties.find(p => p.alias == property.alias).checked = false;
9598
}
9699
},
97100
reset: function () {
@@ -127,6 +130,11 @@
127130
return false;
128131
}
129132

133+
if (vm.manageIndex.contentData.filter(p => p.properties.length == 0).length > 0) {
134+
notificationsService.error("Selected content types must have at least one property.");
135+
return false;
136+
}
137+
130138
vm.loading = true;
131139

132140
umbracoCmsIntegrationsSearchAlgoliaResource
@@ -189,17 +197,22 @@
189197
overlayService.open(dialogOptions);
190198
}
191199

192-
function search() {
193-
umbracoCmsIntegrationsSearchAlgoliaResource.search(vm.searchIndex.id, vm.searchQuery).then(function (response) {
194-
vm.searchResults = response;
195-
});
200+
function searchIndex(index) {
201+
vm.viewState = "search";
202+
vm.searchIndex = index;
196203
}
197204

198205
function deleteIndex(index) {
199206
umbracoCmsIntegrationsSearchAlgoliaResource.deleteIndex(index.id).then(function (response) {
200207
getIndices();
201208
});
202209
}
210+
211+
function search() {
212+
umbracoCmsIntegrationsSearchAlgoliaResource.search(vm.searchIndex.id, vm.searchQuery).then(function (response) {
213+
vm.searchResults = response;
214+
});
215+
}
203216
}
204217

205218
angular.module("umbraco")

src/Umbraco.Cms.Integrations.Search.Algolia/App_Plugins/UmbracoCms.Integrations/Search/Algolia/views/dashboard.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
</umb-button>
5252
<umb-button label="search"
5353
type="button"
54-
button-style="success">
54+
button-style="success"
55+
action="vm.searchIndex(index)">
5556
</umb-button>
5657
<umb-button label="delete"
5758
type="button"

0 commit comments

Comments
 (0)