graphdb-workbench
Version:
The web application for GraphDB APIs
2 lines • 4.15 kB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[32,44],{44:function(e,o,t){"use strict";t.r(o);t(14);function n(e,o,t,n,r,c,i,u){let l;function a(){l&&o.cancel(l)}e.pluginName="autocomplete",e.setPluginIsActive=function(o){e.pluginIsActive=o};const s=function(){i.checkAutocompleteStatus().success((function(o){e.autocompleteEnabled=o,u.setAutocompleteStatus(o)})).error((function(e){t.error(getError(e))}))},d=function(){i.refreshIndexIRIs().success((function(o){e.shouldIndexIRIs=o})).error((function(e){t.error(getError(e))}))},f=function(){i.refreshIndexStatus().success((function(o){e.indexStatus=o})).error((function(e){t.error(getError(e))}))},g=function(){i.refreshLabelConfig().success((function(o){e.labelConfig=o})).error((function(e){t.error(getError(e))}))};e.checkForPlugin=function(){e.pluginFound=!1,e.setLoader(!0),i.checkForPlugin().success((function(o){e.pluginFound=!0===o,e.pluginFound?(s(),d(),f(),g()):(e.autocompleteEnabled=!1,e.loading=!1)})).error((function(e){t.error(getError(e))})).finally((function(){e.setLoader(!1)}))};const p=function(){l=o((function(){e.$broadcast("checkIsActive"),e.autocompleteEnabled&&f()}),5e3)};e.$on("$destroy",(function(){a()}));e.setLoader=function(o,t){c.cancel(e.loaderTimeout),o?e.loaderTimeout=c((function(){e.loader=o,e.loaderMessage=t}),300):e.loader=!1},e.getLoaderMessage=function(){return e.loaderMessage||"Loading..."},e.toggleAutocomplete=function(){const o=!e.autocompleteEnabled;e.setLoader(!0,o?"Enabling autocomplete...":"Disabling autocomplete..."),i.toggleAutocomplete(o).success((function(){s(),f()})).error((function(e){t.error(getError(e))})).finally((function(){e.setLoader(!1)}))},e.toggleIndexIRIs=function(){e.setLoader(!0,"Setting index IRIs..."),i.toggleIndexIRIs(!e.shouldIndexIRIs).success((function(){d(),f()})).error((function(e){t.error(getError(e))})).finally((function(){e.setLoader(!1)}))},e.buildIndex=function(){e.setLoader(!0,"Requesting index build..."),i.buildIndex().success((function(){e.indexStatus="BUILDING"})).error((function(e){t.error(getError(e))})).finally((function(){e.setLoader(!1)}))},e.interruptIndexing=function(){e.setLoader(!0,"Interrupting index..."),i.interruptIndexing().success((function(){f()})).error((function(e){t.error(getError(e))})).finally((function(){e.setLoader(!1)}))},e.getDegradedReason=function(){return n.getDegradedReason()},e.addLabel=function(){e.editLabel({labelIri:"",languages:""},!0)},e.editLabel=function(o,n){r.open({templateUrl:"js/angular/autocomplete/templates/modal/add-label.html",controller:"AddLabelCtrl",resolve:{data:function(){return{label:o,isNew:n}}}}).result.then((function(o){!function(o){e.setLoader(!0,"Updating label config..."),i.addLabelConfig(o).success((function(){g(),f()})).error((function(e){t.error(getError(e))})).finally((function(){e.setLoader(!1)}))}(o)}))},e.removeLabel=function(o){!function(o){e.setLoader(!0,"Updating label config..."),i.removeLabelConfig(o).success((function(){g(),f()})).error((function(e){t.error(getError(e))})).finally((function(){e.setLoader(!1)}))}(o)},e.$on("repositoryIsSet",(function(){a(),!n.getActiveRepository()||n.isActiveRepoOntopType()||n.isActiveRepoFedXType()||(e.checkForPlugin(),p())})),!n.getActiveRepository()||n.isActiveRepoOntopType()||n.isActiveRepoFedXType()||(e.checkForPlugin(),p())}function r(e,o,t,n){e.label=angular.copy(n.label),e.isNew=n.isNew,e.ok=function(){e.form.$valid&&o.close(e.label)},e.cancel=function(){o.dismiss("cancel")},e.setTemplate=function(o){e.label.labelIri=o,t((function(){$("#wb-autocomplete-languages").focus()}),0)}}angular.module("graphdb.framework.autocomplete.controllers",["toastr","graphdb.framework.rest.autocomplete.service"]).controller("AutocompleteCtrl",n).controller("AddLabelCtrl",r),n.$inject=["$scope","$interval","toastr","$repositories","$uibModal","$timeout","AutocompleteRestService","$autocompleteStatus"],r.$inject=["$scope","$uibModalInstance","$timeout","data"]},86:function(e,o,t){"use strict";t.r(o);t(44);angular.module("graphdb.framework.autocomplete",["ngRoute","graphdb.framework.autocomplete.controllers"])}}]);
//# sourceMappingURL=32.1059e272ed99ba3db699.bundle.js.map