(this.webpackJsonp=this.webpackJsonp||[]).push([[92],{655:function(e,t,n){"use strict";n.r(t);var r=n(0),a=n.n(r),i=n(7),c=n(33),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var s=function(){function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var n=a()(".js-search-group-dropdown"),r=a()(".js-search-project-dropdown");this.searchInput=".js-search-input",this.searchClear=".js-search-clear",this.groupId=n.data("groupId"),this.eventListeners(),n.glDropdown({selectable:!0,filterable:!0,filterRemote:!0,fieldName:"group_id",search:{fields:["full_name"]},data:function(e,t){return c.a.groups(e,{},function(e){return e.unshift({full_name:"Any"}),e.splice(1,0,"divider"),t(e)})},id:function(e){return e.id},text:function(e){return e.full_name},toggleLabel:function(e){return n.data("defaultLabel")+" "+e.full_name},clicked:function(){return e.submitSearch()}}),r.glDropdown({selectable:!0,filterable:!0,filterRemote:!0,fieldName:"project_id",search:{fields:["name"]},data:function(e,n){t.getProjectsData(e).then(function(e){return e.unshift({name_with_namespace:"Any"}),e.splice(1,0,"divider"),e}).then(function(e){return n(e)}).catch(function(){return new i.a("Error fetching projects")})},id:function(e){return e.id},text:function(e){return e.name_with_namespace},toggleLabel:function(e){return r.data("defaultLabel")+" "+e.name_with_namespace},clicked:function(){return e.submitSearch()}})}return u(e,[{key:"eventListeners",value:function(){a()(document).off("keyup",this.searchInput).on("keyup",this.searchInput,this.searchKeyUp),a()(document).off("click",this.searchClear).on("click",this.searchClear,this.clearSearchField.bind(this))}},{key:"searchKeyUp",value:function(){""===a()(this).val()?a()(".js-search-clear").addClass("hidden"):a()(".js-search-clear").removeClass("hidden")}},{key:"clearSearchField",value:function(){return a()(this.searchInput).val("").trigger("keyup").focus()}},{key:"getProjectsData",value:function(e){var t=this;return new Promise(function(n){t.groupId?c.a.groupProjects(t.groupId,e,{},n):c.a.projects(e,{order_by:"id"},n)})}}],[{key:"submitSearch",value:function(){return a()(".js-search-form").submit()}}]),e}();document.addEventListener("DOMContentLoaded",function(){return new s})},721:function(e,t,n){n(31),e.exports=n(655)}},[[721,64,65]]]);
//# sourceMappingURL=pages.search.show.c3d5fcbd.chunk.js.map