|
13 | 13 |
|
14 | 14 | vm.showToast = showToast;
|
15 | 15 |
|
16 |
| - //vm.showToast({ |
17 |
| - // color: 'danger', |
18 |
| - // headline: 'Algolia', |
19 |
| - // message: 'Index name and content schema are required.' |
20 |
| - //}); |
21 |
| - |
22 | 16 | if ($scope.model.value == null) {
|
23 | 17 | $scope.model.value = {
|
24 | 18 | entityType: '',
|
25 | 19 | displayFieldTypeIds: []
|
26 | 20 | };
|
27 | 21 | }
|
28 | 22 | $scope.$on('formSubmitting', function (ev) {
|
29 |
| - if (vm.selectedEntityType != undefined |
| 23 | + if (vm.selectedEntityType == undefined |
30 | 24 | || vm.selectedEntityType.value.length == 0
|
31 | 25 | || vm.selectedFieldTypes.length == 0) {
|
32 | 26 | notificationsService.error("Inriver", "Entity type and display fields are required. Configuration was not saved.");
|
|
97 | 91 | });
|
98 | 92 | }
|
99 | 93 | }
|
100 |
| - |
101 |
| - /* Toast Config properties: |
102 |
| - * color |
103 |
| - * headline |
104 |
| - * message |
105 |
| - */ |
106 |
| - function showToast(config) { |
107 |
| - const con = document.querySelector('uui-toast-notification-container'); |
108 |
| - |
109 |
| - const toast = document.createElement('uui-toast-notification'); |
110 |
| - toast.color = config.color; |
111 |
| - |
112 |
| - const toastLayout = document.createElement('uui-toast-notification-layout'); |
113 |
| - toastLayout.headline = config.headline; |
114 |
| - toast.appendChild(toastLayout); |
115 |
| - |
116 |
| - const messageEl = document.createElement('span'); |
117 |
| - messageEl.innerHTML = config.message; |
118 |
| - toastLayout.appendChild(messageEl); |
119 |
| - |
120 |
| - if (con) { |
121 |
| - con.appendChild(toast); |
122 |
| - } |
123 |
| - } |
124 |
| - |
125 |
| - /** |
126 |
| - * toggle rows selection with uui-checkbox - prototype |
127 |
| - * */ |
128 |
| - vm._selectFieldType = function (fieldTypeId) { |
129 |
| - var fieldTypeIndex = vm.selectedFieldTypes.indexOf(fieldTypeId); |
130 |
| - if (fieldTypeIndex == -1) { |
131 |
| - vm.selectedFieldTypes.push(fieldTypeId); |
132 |
| - document.getElementById('chk' + fieldTypeId).setAttribute('checked', ''); |
133 |
| - } |
134 |
| - else { |
135 |
| - document.getElementById('chk' + fieldTypeId).removeAttribute('checked'); |
136 |
| - vm.selectedFieldTypes = vm.selectedFieldTypes.splice(fieldTypeIndex, 1); |
137 |
| - } |
138 |
| - } |
139 |
| - |
140 |
| - vm._selectFieldTypes = function () { |
141 |
| - const selectAll = vm.selectedFieldTypes.length == 0; |
142 |
| - |
143 |
| - vm.selectedFieldTypes = []; |
144 |
| - |
145 |
| - console.log('select all', selectAll); |
146 |
| - if (selectAll == true) { |
147 |
| - vm.selectedFieldTypes = vm.fieldTypes.map(obj => obj.fieldTypeId); |
148 |
| - var elements = document.querySelectorAll("uui-checkbox"); |
149 |
| - for (var i = 0; i < elements.length; i++) { |
150 |
| - elements[i].setAttribute("checked", ""); |
151 |
| - } |
152 |
| - } |
153 |
| - else { |
154 |
| - var elements = document.querySelectorAll("uui-checkbox"); |
155 |
| - for (var i = 0; i < elements.length; i++) { |
156 |
| - elements[i].removeAttribute("checked"); |
157 |
| - } |
158 |
| - } |
159 |
| - |
160 |
| - vm.fieldTypes = vm.fieldTypes.map(obj => { |
161 |
| - obj.selected = selectAll; |
162 |
| - return obj; |
163 |
| - }); |
164 |
| - } |
165 | 94 | }
|
166 | 95 |
|
167 | 96 | angular.module("umbraco")
|
|
0 commit comments