UNPKG

graphdb-workbench

Version:
2 lines 6.02 kB
export const __webpack_esm_id__=97613;export const __webpack_esm_ids__=[30690,75331,80263,97613];export const __webpack_esm_modules__={30690:(e,t,o)=>{o.d(t,{r:()=>i});const n=/^(h|ht|htt|http|https|http:|https:|http:\/|https:\/|http:\/\/|https:\/\/|https?:\/\/[\S]*)$/i,r=/^(f|ft|ftp|ftps|ftp:|ftps:|ftp:\/|ftps:\/|ftp:\/\/|ftps:\/\/[\S]*)$/i;class i{static isValidUrl(e){return n.test(e)||r.test(e)}static doesNotContain(e,t){return!new RegExp(t).test(e)}static doesNotUseProtocol(e,t){return!new RegExp("^("+t.join("|")+")://","i").test(e)}}},75331:(e,t,o)=>{var n=o(30690);angular.module("graphdb.framework.core.directives.validate-url",[]).directive("validateUrl",function(){return{restrict:"A",require:"ngModel",link:function(e,t,o,r){r.$validators.validUrl=function(e,t){if(r.$isEmpty(t))return"false"!==o.allowEmpty;if(!n.r.isValidUrl(t))return!1;if(o.exclude&&!n.r.doesNotContain(t,o.exclude))return!1;if(o.excludeProtocol){const e=o.excludeProtocol.split(",");if(!n.r.doesNotUseProtocol(t,e))return!1}return!0}}}})},80263:(e,t,o)=>{o(69813);var n=o(79947),r=o(60529),i=(o(75331),o(57154));function a(e,t,o,a,c,l,s,u,d,f,p){const g=(0,i.service)(i.LicenseContextService);let m;function b(){m&&t.cancel(m)}e.pluginName="autocomplete",e.setPluginIsActive=function(t){e.pluginIsActive=t};const h=function(){d.checkAutocompleteStatus().then(t=>{e.autocompleteEnabled=t,p.setAutocompleteEnabled(t)}).catch(e=>{o.error(getError(e))})},v=function(){d.refreshIndexIRIs().success(function(t){e.shouldIndexIRIs=t}).error(function(e){o.error(getError(e))})},I=function(){d.refreshIndexStatus().success(function(t){e.indexStatus=t}).error(function(e){o.error(getError(e))})},L=function(){d.refreshLabelConfig().success(function(t){e.labelConfig=t}).error(function(e){o.error(getError(e))})},x=function(e,t){const o=u.expandPrefix(e.labelIri.toString(),t);return!(!u.isValidIri(e,o)||""===o||(e.labelIri=o,0))};function E(e){const t=(0,r.Gz)(f.instant("not.valid.iri",{value:e.toString()}));o.error(t)}function $(t){t.then(()=>{L(),I()}).catch(e=>{o.error(getError(e))}).finally(()=>{e.setLoader(!1)})}e.checkForPlugin=function(){e.pluginFound=!1,e.setLoader(!0),d.checkForPlugin().success(function(t){e.pluginFound=!0===t,e.pluginFound?(A(),h(),v(),I(),L()):(e.autocompleteEnabled=!1,e.loading=!1)}).error(function(e){o.error(getError(e))}).finally(function(){e.setLoader(!1)})};const _=function(){m=t(function(){e.$broadcast("checkIsActive"),e.autocompleteEnabled&&I()},5e3)};e.$on("$destroy",function(){b()});const k=()=>g.getLicenseSnapshot().valid&&a.getActiveRepository()&&!a.isActiveRepoOntopType()&&!a.isActiveRepoFedXType();e.setLoader=function(t,o){l.cancel(e.loaderTimeout),t?e.loaderTimeout=l(function(){e.loader=t,e.loaderMessage=o},300):e.loader=!1},e.getLoaderMessage=function(){return e.loaderMessage||f.instant("common.loading")},e.toggleAutocomplete=function(){const t=!e.autocompleteEnabled;e.setLoader(!0,t?f.instant("autocomplete.enabling"):f.instant("autocomplete.disabling")),d.toggleAutocomplete(t).success(function(){h(),I(),(0,i.service)(i.AutocompleteContextService).updateAutocompleteEnabled(t)}).error(function(e){o.error(getError(e))}).finally(function(){e.setLoader(!1)})},e.toggleIndexIRIs=function(){e.setLoader(!0,f.instant("autocomplete.index.iri")),d.toggleIndexIRIs(!e.shouldIndexIRIs).success(function(){v(),I()}).error(function(e){o.error(getError(e))}).finally(function(){e.setLoader(!1)})},e.buildIndex=function(){e.setLoader(!0,f.instant("autocomplete.index.build")),d.buildIndex().success(function(){e.indexStatus="BUILDING"}).error(function(e){o.error(getError(e))}).finally(function(){e.setLoader(!1)})},e.interruptIndexing=function(){e.setLoader(!0,f.instant("index.interrupt")),d.interruptIndexing().success(function(){I()}).error(function(e){o.error(getError(e))}).finally(function(){e.setLoader(!1)})},e.getDegradedReason=function(){return a.getDegradedReason()},e.addLabel=function(){e.editLabel({labelIri:"",languages:""},!0)},e.editLabel=function(t,o){const n=o?t=>{return o=t.updated,e.setLoader(!0,f.instant("autocomplete.update")),void(x(o,e.namespaces)?$(d.addLabelConfig(o)):(E(o.labelIri),e.setLoader(!1)));var o}:t=>{return o=t.updated,n=t.original,e.setLoader(!0,f.instant("autocomplete.update")),void(x(o,e.namespaces)?$(d.editLabelConfig(o,n)):(E(o.labelIri),e.setLoader(!1)));var o,n};c.open({templateUrl:"js/angular/autocomplete/templates/modal/add-label.html",controller:"AddLabelCtrl",resolve:{data:function(){return{label:t,isNew:o}}}}).result.then(n)},e.removeLabel=function(t){!function(t){e.setLoader(!0,f.instant("autocomplete.update")),d.removeLabelConfig(t).success(function(){L(),I()}).error(function(e){o.error(getError(e))}).finally(function(){e.setLoader(!1)})}(t)},e.$on("repositoryIsSet",function(){b(),k()&&(e.checkForPlugin(),_())});const A=()=>{s.getNamespaces(a.getActiveRepository()).then(n.Sv).then(t=>{e.namespaces=t}).catch(e=>{const t=getError(e);o.error(t,f.instant("error.getting.namespaces.for.repo"))})};k()&&(e.checkForPlugin(),_())}function c(e,t,o,n){e.label=_.cloneDeep(n.label),e.originalLabel=_.cloneDeep(n.label),e.isNew=n.isNew,e.ok=function(){e.form.$valid&&t.close({original:e.originalLabel,updated:e.label})},e.cancel=function(){t.dismiss("cancel")},e.setTemplate=function(t){e.label.labelIri=t,o(function(){$("#wb-autocomplete-languages").focus()},0)}}angular.module("graphdb.framework.autocomplete.controllers",["toastr","graphdb.framework.rest.autocomplete.service","graphdb.framework.core.directives.validate-url"]).controller("AutocompleteCtrl",a).controller("AddLabelCtrl",c),a.$inject=["$scope","$interval","toastr","$repositories","$uibModal","$timeout","RDF4JRepositoriesRestService","UriUtils","AutocompleteService","$translate","WorkbenchContextService"],c.$inject=["$scope","$uibModalInstance","$timeout","data"]},97613:(e,t,o)=>{o(80263),angular.module("graphdb.framework.autocomplete",["ngRoute","graphdb.framework.autocomplete.controllers"])}}; //# sourceMappingURL=97613.0272d99e717c84301f3f.bundle.js.map