$('.ui.search').search({ type: 'message', searchDelay: 500, silent: true, apiSettings: { silent: true, cache: false, url: urls.search, onResponse: function (casResp) { var response = { results: {} }; for (var key in casResp) { if (casResp.hasOwnProperty(key)) { var prop = casResp[key]; var group = prop.group; if (response.results[group] === undefined) { response.results[group] = { name: group, results: [] }; } response.results[group].results.push({ title: prop.id, description: prop.description, defaultValue: prop.defaultValue, type: prop.type, deprecated: prop.deprecated, requiredProperty: prop.requiredProperty, requiredModule: prop.requiredModule, requiredModuleAutomated: prop.requiredModuleAutomated }); } } return response; }, }, minCharacters: 3, templates: { message: function (response, type) { var html = ''; $('#accordion').empty(); if (type === 'empty') { html += '

 No Results

'; html += '
'; html += ' '; html += 'No search results could be found based on the provided query.'; html += '
'; } for (var group in response.results) { var modules = new Set(); html += '

 Group: ' + group + '

'; var props = response.results[group].results; html += '
'; for (var i = 0; i < props.length; i++) { html += '

'; var prop = props[i]; html += ' '; html += 'Property: ' + prop.title + '=' + prop.defaultValue + '
'; if (prop.deprecated) { html += '

'; html += ' '; html += 'This property is deprecated and will be removed in future CAS versions.'; html += '
'; } if (prop.requiredProperty) { html += '

'; html += ' '; html += 'This property is required.'; html += '
'; } html += ' Type: ' + prop.type + '
'; if (prop.description != null) { html += '

' + prop.description + '

'; } if (prop.requiredModule != null) { modules.add(prop.requiredModule); } html += '
'; } if (modules.size > 0) { html += '
'; html += '

 Required Modules

'; html += ''; for (let moduleString of modules) { html += '
'; var moduleArr = moduleString.split('|'); var module = moduleArr[0]; var maven = '<dependency>\n'; maven += '\t<groupId>org.apereo.cas</groupId>\n'; maven += '\t<artifactId>' + module + '</artifactId>\n'; maven += '\t<cas.version>${cas.version}</cas.version>\n'; maven += '</dependency>\n'; html += '
' + maven + '
'; var gradle = 'compile \'org.apereo.cas:' + module + ':${project.\'cas.version\'}\'\n'; html += '
' + gradle + '
'; html += '
'; } html += '
'; } html += '
'; } html += ''; $('#accordion').html(html); $('#accordion').accordion({ heightStyle: 'content' }); $('#accordion').accordion('refresh'); return ''; } } });