UNPKG

graphdb-workbench

Version:
2 lines 6.13 kB
export const __webpack_id__=97613;export const __webpack_ids__=[30690,75331,80263,97613];export const __webpack_modules__={30690:(e,t,o)=>{o.r(t),o.d(t,{UrlUtils:()=>i});const r=/^(h|ht|htt|http|https|http:|https:|http:\/|https:\/|http:\/\/|https:\/\/|https?:\/\/[\S]*)$/i,n=/^(f|ft|ftp|ftps|ftp:|ftps:|ftp:\/|ftps:\/|ftp:\/\/|ftps:\/\/[\S]*)$/i;class i{static isValidUrl(e){return r.test(e)||n.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)=>{o.r(t);var r=o(30690);angular.module("graphdb.framework.core.directives.validate-url",[]).directive("validateUrl",function(){return{restrict:"A",require:"ngModel",link:function(e,t,o,n){n.$validators.validUrl=function(e,t){if(n.$isEmpty(t))return"false"!==o.allowEmpty;if(!r.UrlUtils.isValidUrl(t))return!1;if(o.exclude&&!r.UrlUtils.doesNotContain(t,o.exclude))return!1;if(o.excludeProtocol){const e=o.excludeProtocol.split(",");if(!r.UrlUtils.doesNotUseProtocol(t,e))return!1}return!0}}}})},80263:(e,t,o)=>{o.r(t),o(69813);var r=o(79947),n=o(27030),i=(o(75331),o(57154));function a(e,t,o,a,c,l,s,u,d,p,f,g){let m;function b(){m&&t.cancel(m)}e.pluginName="autocomplete",e.setPluginIsActive=function(t){e.pluginIsActive=t};const h=function(){p.checkAutocompleteStatus().then(t=>{e.autocompleteEnabled=t,g.setAutocompleteEnabled(t)}).catch(e=>{o.error(getError(e))})},v=function(){p.refreshIndexIRIs().success(function(t){e.shouldIndexIRIs=t}).error(function(e){o.error(getError(e))})},I=function(){p.refreshIndexStatus().success(function(t){e.indexStatus=t}).error(function(e){o.error(getError(e))})},L=function(){p.refreshLabelConfig().success(function(t){e.labelConfig=t}).error(function(e){o.error(getError(e))})},x=function(e,t){const o=d.expandPrefix(e.labelIri.toString(),t);return!(!d.isValidIri(e,o)||""===o||(e.labelIri=o,0))};function E(e){const t=(0,n.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),p.checkForPlugin().success(function(t){e.pluginFound=!0===t,e.pluginFound?(R(),h(),v(),I(),L()):(e.autocompleteEnabled=!1,e.loading=!1)}).error(function(e){o.error(getError(e))}).finally(function(){e.setLoader(!1)})};const A=function(){m=t(function(){e.$broadcast("checkIsActive"),e.autocompleteEnabled&&I()},5e3)};e.$on("$destroy",function(){b()}),e.setLoader=function(t,o){s.cancel(e.loaderTimeout),t?e.loaderTimeout=s(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")),p.toggleAutocomplete(t).success(function(){h(),I(),i.ServiceProvider.get(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")),p.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")),p.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")),p.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 r=o?t=>{return o=t.updated,e.setLoader(!0,f.instant("autocomplete.update")),void(x(o,e.namespaces)?$(p.addLabelConfig(o)):(E(o.labelIri),e.setLoader(!1)));var o}:t=>{return o=t.updated,r=t.original,e.setLoader(!0,f.instant("autocomplete.update")),void(x(o,e.namespaces)?$(p.editLabelConfig(o,r)):(E(o.labelIri),e.setLoader(!1)));var o,r};l.open({templateUrl:"js/angular/autocomplete/templates/modal/add-label.html",controller:"AddLabelCtrl",resolve:{data:function(){return{label:t,isNew:o}}}}).result.then(r)},e.removeLabel=function(t){!function(t){e.setLoader(!0,f.instant("autocomplete.update")),p.removeLabelConfig(t).success(function(){L(),I()}).error(function(e){o.error(getError(e))}).finally(function(){e.setLoader(!1)})}(t)},e.$on("repositoryIsSet",function(){b(),c.isLicenseValid()&&a.getActiveRepository()&&!a.isActiveRepoOntopType()&&!a.isActiveRepoFedXType()&&(e.checkForPlugin(),A())});const R=()=>{u.getNamespaces(a.getActiveRepository()).then(r.mapNamespacesResponse).then(t=>{e.namespaces=t}).catch(e=>{const t=getError(e);o.error(t,f.instant("error.getting.namespaces.for.repo"))})};c.isLicenseValid()&&a.getActiveRepository()&&!a.isActiveRepoOntopType()&&!a.isActiveRepoFedXType()&&(e.checkForPlugin(),A())}function c(e,t,o,r){e.label=_.cloneDeep(r.label),e.originalLabel=_.cloneDeep(r.label),e.isNew=r.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","$licenseService","$uibModal","$timeout","RDF4JRepositoriesRestService","UriUtils","AutocompleteService","$translate","WorkbenchContextService"],c.$inject=["$scope","$uibModalInstance","$timeout","data"]},97613:(e,t,o)=>{o.r(t),o(80263),angular.module("graphdb.framework.autocomplete",["ngRoute","graphdb.framework.autocomplete.controllers"])}}; //# sourceMappingURL=97613.46d2a46ee6653ada7f1d.bundle.js.map