UNPKG

graphdb-workbench

Version:
2 lines 14.8 kB
export const __webpack_esm_id__=99379;export const __webpack_esm_ids__=[3632,85281,99379];export const __webpack_esm_modules__={3632(e,t,o){var n=o(98980);function i(){return{restrict:"E",scope:{options:"=",selected:"=",labels:"="},templateUrl:"js/angular/core/directives/shuttle-multiselect/templates/shuttle-multiselect.html",link:function(e){const t=[];e.searchLeft="",e.availableOptions=[],e.selectedOptions=[],e.selectOption=t=>{e.selectedOptions.push(t),e.availableOptions=e.availableOptions.filter(e=>e!==t),o()},e.selectAll=()=>{e.selectedOptions=e.selectedOptions.concat(e.availableOptions),e.availableOptions=[],o()},e.deselectOption=t=>{e.availableOptions.push(t),e.selectedOptions=e.selectedOptions.filter(e=>e!==t),o()},e.deselectAll=()=>{e.availableOptions=e.availableOptions.concat(e.selectedOptions),e.selectedOptions=[],o()};const o=()=>{e.selected=[...e.selectedOptions]};e.$on("$destroy",()=>{t.forEach(e=>e())}),e.selectedOptions=(0,n.cloneDeep)(e.selected),e.selectedOptions.length?e.availableOptions=e.options.filter(t=>!e.selectedOptions.find(e=>e.id===t.id)):e.availableOptions=(0,n.cloneDeep)(e.options)}}}angular.module("graphdb.framework.core.directives.shuttle-multiselect",[]).directive("shuttleMultiselect",i),i.$inject=[]},28050(e,t,o){var n=o(32534),i=(o(69724),o(77512));function r(e,t,o,r,a,s){return{restrict:"E",templateUrl:"js/angular/graphql/templates/step-generate-endpoint.html",scope:{stepDefinition:"="},link:t=>{t.endpointConfiguration=void 0,t.endpointsCountToGenerate=0,t.endpointsOverview=void 0,t.activeRepository=r.getActiveRepository(),t.generateFromGraphqlSchemaShapes=!1,t.generatingEndpoint=!1,t.generationReport=void 0,t.endpointUrl=i.P,t.back=()=>{s.previousEndpointCreationStep()},t.cancel=()=>{const t=o.instant("graphql.create_endpoint.wizard_steps.actions.cancel.confirmation.title"),n=o.instant("graphql.create_endpoint.wizard_steps.actions.cancel.confirmation.body");e.openConfirmation(t,n,()=>{s.cancelEndpointCreation()})},t.generateEndpoint=()=>{t.generatingEndpoint=!0,t.generationReport=void 0,s.generateEndpoint()},t.finishGenerationWorkflow=()=>{s.finishGenerationWorkflow()},t.showEndpointReport=e=>{s.openEndpointGenerationReport(e)},t.exploreInPlayground=e=>{s.exploreEndpointInPlayground(e)};const l=[];l.push(s.subscribe(n.H.ENDPOINT_GENERATED,e=>{t.generatingEndpoint=!1,t.generationReport=e})),t.$on("$destroy",()=>{l.forEach(e=>e())}),t.endpointConfiguration=s.getNewEndpoint(),t.generateFromGraphqlSchemaShapes=t.endpointConfiguration.hasSelectedGraphqlSchemaShapes(),t.endpointsCountToGenerate=a.getEndpointsCountToGenerate(t.endpointConfiguration),t.endpointsOverview=a.getGenerateEndpointsOverview(t.endpointConfiguration)}}}angular.module("graphdb.framework.graphql.directives.generate-endpoint",["graphdb.framework.graphql.controllers.endpoint-generation-failure-result-modal"]).directive("generateEndpoint",r),r.$inject=["ModalService","$uibModal","$translate","$repositories","GraphqlService","GraphqlContextService"]},32606(e,t,o){o(3632);var n=o(82854),i=o(32534),r=o(21388);const a=o(304).I.logger;function s(e,t,o,s,l,p,c,d){return{restrict:"E",templateUrl:"js/angular/graphql/templates/step-select-schema-sources.html",scope:{stepDefinition:"="},link:(l,h)=>{const g=[];l.schemaSourceType=r.tr,l.ontologyShaclShapeSource=r.Tk,l.shapesMultiselectLabels={availableOptionsTitle:"graphql.create_endpoint.wizard_steps.shapes_multiselect.available_options.title",availableOptionsFilter:"graphql.create_endpoint.wizard_steps.shapes_multiselect.available_options.filter_placeholder",selectedOptionsTitle:"graphql.create_endpoint.wizard_steps.shapes_multiselect.selected_options.title",selectedOptionsCount:"graphql.create_endpoint.wizard_steps.shapes_multiselect.selected_options.count",selectTooltip:"graphql.create_endpoint.wizard_steps.shapes_multiselect.actions.add.tooltip",selectAllLabel:"graphql.create_endpoint.wizard_steps.shapes_multiselect.actions.add_all.label",selectAllTooltip:"graphql.create_endpoint.wizard_steps.shapes_multiselect.actions.add_all.tooltip",deselectTooltip:"graphql.create_endpoint.wizard_steps.shapes_multiselect.actions.remove.tooltip",deselectAllLabel:"graphql.create_endpoint.wizard_steps.shapes_multiselect.actions.remove_all.label",deselectAllTooltip:"graphql.create_endpoint.wizard_steps.shapes_multiselect.actions.remove_all.tooltip"},l.graphsMultiselectLabels={availableOptionsTitle:"graphql.create_endpoint.wizard_steps.graphs_multiselect.available_options.title",availableOptionsFilter:"graphql.create_endpoint.wizard_steps.graphs_multiselect.available_options.filter_placeholder",selectedOptionsTitle:"graphql.create_endpoint.wizard_steps.graphs_multiselect.selected_options.title",selectedOptionsCount:"graphql.create_endpoint.wizard_steps.graphs_multiselect.selected_options.count",selectTooltip:"graphql.create_endpoint.wizard_steps.graphs_multiselect.actions.add.tooltip",selectAllLabel:"graphql.create_endpoint.wizard_steps.graphs_multiselect.actions.add_all.label",selectAllTooltip:"graphql.create_endpoint.wizard_steps.graphs_multiselect.actions.add_all.tooltip",deselectTooltip:"graphql.create_endpoint.wizard_steps.graphs_multiselect.actions.remove.tooltip",deselectAllLabel:"graphql.create_endpoint.wizard_steps.graphs_multiselect.actions.remove_all.label",deselectAllTooltip:"graphql.create_endpoint.wizard_steps.graphs_multiselect.actions.remove_all.tooltip"},l.endpointConfiguration=void 0,l.prefixList=[],l.loadingPrefixes=!1,l.graphs=void 0,l.shaclShapeGraphs=void 0,l.graphqlSchemaShapes=void 0,l.allGraphs=void 0,l.loadingGraphs=!1,l.cancel=()=>{const e=o.instant("graphql.create_endpoint.wizard_steps.actions.cancel.confirmation.title"),n=o.instant("graphql.create_endpoint.wizard_steps.actions.cancel.confirmation.body");t.openConfirmation(e,n,()=>{p.cancelEndpointCreation()})},l.next=()=>{p.nextEndpointCreationStep()},l.onSchemaSourceTypeChange=()=>{l.endpointConfiguration.schemaSourceType=l.stepDefinition.schemaSourceType,l.endpointConfiguration.generateFromShaclShapes()&&(l.stepDefinition.ontotlogyShaclShapeSource===r.Tk.USE_ALL_GRAPHS?l.endpointConfiguration.selectedGraphs=l.allGraphs:l.stepDefinition.ontotlogyShaclShapeSource===r.Tk.USE_SHACL_SHAPE_GRAPH?l.endpointConfiguration.selectedGraphs=l.shaclShapeGraphs:l.stepDefinition.ontotlogyShaclShapeSource===r.Tk.PICK_GRAPHS&&(l.endpointConfiguration.selectedGraphs=new n.P))},l.onOntologyShaclShapeSourceChange=()=>{l.endpointConfiguration.owlOrShaclSourceType=l.stepDefinition.ontotlogyShaclShapeSource,l.stepDefinition.ontotlogyShaclShapeSource===r.Tk.USE_ALL_GRAPHS?l.endpointConfiguration.selectedGraphs=l.allGraphs:l.stepDefinition.ontotlogyShaclShapeSource===r.Tk.USE_SHACL_SHAPE_GRAPH?l.endpointConfiguration.selectedGraphs=l.shaclShapeGraphs:l.stepDefinition.ontotlogyShaclShapeSource===r.Tk.PICK_GRAPHS&&(l.endpointConfiguration.selectedGraphs=new n.P)},l.canProceed=()=>{let e=!1;if(l.endpointConfiguration){const t=l.endpointConfiguration.hasSelectedGraphqlSchemaShapes(),o=l.endpointParamsForm.$valid;l.stepDefinition.schemaSourceType===r.tr.GRAPHQL_SCHEMA_SHAPES&&t?e=!0:l.stepDefinition.schemaSourceType===r.tr.SHACL_SHAPES&&o&&(e=l.endpointConfiguration.owlOrShaclSourceType===r.Tk.USE_ALL_GRAPHS||l.endpointConfiguration.hasSelectedGraphs())}return e};const u=t=>{l.loadingData=!0,e.all([(l.loadingPrefixes=!0,c.getPrefixListAsSelectOptions(p.getSourceRepository()).catch(e=>{a.error("Error loading prefixes",e),s.error(getError(e))}).finally(()=>{l.loadingPrefixes=!1})),(l.loadingGraphs=!0,d.getGraphs(p.getSourceRepository()).catch(e=>{a.error("Error loading graphs",e),s.error(getError(e))}).finally(()=>{l.loadingGraphs=!1})),c.getGraphqlSchemaShapes(p.getSourceRepository()).catch(e=>{a.error("Error loading GraphQL schema shapes",e),s.error(getError(e))}),c.getShaclShapeGraphs(p.getSourceRepository()).catch(e=>{a.error("Error loading SHACL shape graphs",e),s.error(getError(e))})]).then(([e,o,i,r])=>{l.graphqlSchemaShapes=i,l.graphs=o,l.shaclShapeGraphs=r,l.allGraphs=new n.P([...o.graphList,...r.graphList]),l.prefixList=e,l.endpointConfiguration=t}).finally(()=>{l.loadingData=!1})},S=()=>{u(p.getNewEndpoint())},_=()=>{g.forEach(e=>e())};(()=>{l.$on("$destroy",_),g.push(p.subscribe(i.H.SOURCE_REPOSITORY_UPDATED,S));const e=p.getNewEndpoint();e?u(e):g.push(p.onEndpointConfigCreated(u))})()}}}angular.module("graphdb.framework.graphql.directives.select-schema-sources",["graphdb.framework.core.directives.shuttle-multiselect"]).directive("selectSchemaSources",s),s.$inject=["$q","ModalService","$translate","toastr","$repositories","GraphqlContextService","GraphqlService","RDF4JRepositoriesService"]},69724(e,t,o){function n(e,t,o,n){const i="generation-report.json";e.endpointReport=void 0,e.downloadReport=()=>{const t=JSON.stringify(e.endpointReport.toJSON(),null,2),o=new Blob([t],{type:"application/json"}),n=URL.createObjectURL(o),r=document.createElement("a");r.href=n,r.download=e.endpointReport.endpointId?`${e.endpointReport.endpointId}-${i}`:i,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)},e.deleteReport=()=>{n.deleteEndpointGenerationReport(e.endpointReport),e.close()},e.close=()=>{t.dismiss("cancel")},e.endpointReport=o.endpointReport}o(14874),o(58334),o(29428),angular.module("graphdb.framework.graphql.controllers.endpoint-generation-failure-result-modal",["graphdb.framework.core.services.graphql-service"]).controller("EndpointGenerationResultFailureModalController",n),n.$inject=["$scope","$uibModalInstance","data","GraphqlContextService"]},85281(e,t,o){const n=o(304).I.logger;function i(e,t,o,i,r,a){return{restrict:"E",templateUrl:"js/angular/graphql/templates/step-configure-endpoint.html",scope:{stepDefinition:"=",selectedSourceRepository:"="},link:s=>{s.endpointConfiguration=void 0,s.generationSettings=void 0,s.generationSettingsValid=!1,s.showAdvancedSettings=!1,s.handleValidityChange=e=>{s.endpointConfigurationSettingsValid=e},s.next=()=>{r.nextEndpointCreationStep()},s.back=()=>{r.previousEndpointCreationStep()},s.cancel=()=>{const e=o.instant("graphql.create_endpoint.wizard_steps.actions.cancel.confirmation.title"),n=o.instant("graphql.create_endpoint.wizard_steps.actions.cancel.confirmation.body");t.openConfirmation(e,n,()=>{r.cancelEndpointCreation()})},s.toggleAdvancedSettings=()=>{s.showAdvancedSettings=!s.showAdvancedSettings};const l=[];s.$on("$destroy",()=>{l.forEach(e=>e())}),s.endpointConfiguration=r.getNewEndpoint(),s.endpointConfiguration.settings||(s.endpointConfiguration,s.loadingData=!0,e.all([i.getGraphqlGenerationSettings(s.selectedSourceRepository.id).catch(e=>{n.error("Error loading generation settings",e),a.error(getError(e))})]).then(([e])=>{s.endpointConfiguration.settings=e}).finally(()=>{s.loadingData=!1}))}}}angular.module("graphdb.framework.graphql.directives.configure-endpoint",[]).directive("configureEndpoint",i),i.$inject=["$q","ModalService","$translate","GraphqlService","GraphqlContextService","toastr"]},99379(e,t,o){o(14874);var n=o(32534),i=o(21388),r=o(77512),a=o(16747),s=(o(32606),o(85281),o(28050),o(90275));function l(e,t,o,l,p,c,d,h,g){const u=[];e.sourceRepositories=[],e.selectedSourceRepository=void 0,e.previousSelectedSourceRepository=void 0,e.wizardModel=void 0,e.currentStep=void 0,e.generatingEndpoint=!1,e.onSelectedSourceRepositoryChange=t=>{c.openConfirmationModal({title:l.instant("graphql.create_endpoint.messages.source_repository_changed.title"),message:l.instant("graphql.create_endpoint.messages.source_repository_changed.body"),confirmButtonKey:"common.confirm"},()=>{e.previousSelectedSourceRepository=e.selectedSourceRepository,e.selectedSourceRepository=t,g.updateSourceRepository(t.value),g.createEndpointConfig(),_()},()=>{e.selectedSourceRepository=e.previousSelectedSourceRepository})},e.activateStep=t=>{e.wizardModel.setStepActive(t),S(t)},e.onStepClick=t=>{e.wizardModel.isAPreviousStep(t)&&(e.wizardModel.setStepActive(t),S(t))};const S=t=>{e.currentStep=t},_=()=>{e.wizardModel=(new a.s).addStep(new i.$n).addStep(new i.gn).addStep(new i.x0),S(e.wizardModel.getActiveStep())};u.push(g.subscribe(n.H.GENERATE_ENDPOINT,t=>{const n=t.schemaSourceType===i.tr.GRAPHQL_SCHEMA_SHAPES,r=t.schemaSourceType===i.tr.SHACL_SHAPES;return n?(t=>{e.generatingEndpoint=!0;const n=t.toCreateEndpointFromShapesRequest(g.getSourceRepository());let i;return h.generateEndpointFromGraphqlShapes(o.getActiveRepository(),n).then(e=>{i=e}).catch(e=>{d.error(getError(e))}).finally(()=>{g.endpointGenerated(i),e.generatingEndpoint=!1})})(t):r?(t=>{e.generatingEndpoint=!0;const n=t.toCreateEndpointFromOwlRequest(g.getSourceRepository());let i;return h.generateEndpointFromOwl(o.getActiveRepository(),n).then(e=>{i=e}).catch(e=>{d.error(getError(e))}).finally(()=>{e.generatingEndpoint=!1,g.endpointGenerated(i)})})(t):void 0})),u.push(g.subscribe(n.H.PREVIOUS_ENDPOINT_CREATION_STEP,()=>{S(e.wizardModel.previousStep())})),u.push(g.subscribe(n.H.NEXT_ENDPOINT_CREATION_STEP,()=>{S(e.wizardModel.nextStep())})),u.push(g.subscribe(n.H.CANCEL_ENDPOINT_CREATION,()=>{t.path(r.P.ENDPOINT_MANAGEMENT)})),u.push(g.subscribe(n.H.FINISH_GENERATION_WORKFLOW,()=>{t.path(r.P.ENDPOINT_MANAGEMENT)})),u.push(g.subscribe(n.H.EXPLORE_ENDPOINT_IN_PLAYGROUND,e=>{const t=(0,s.I)(e.endpointId);g.setSelectedEndpoint(e),window.open(t,"_blank","noopener,noreferrer")})),u.push(g.subscribe(n.H.OPEN_ENDPOINT_GENERATION_REPORT,e=>p.open({templateUrl:"js/angular/graphql/templates/modal/endpoint-generation-failure-result-modal.html",controller:"EndpointGenerationResultFailureModalController",windowClass:"endpoint-generation-failure-result-modal",size:"lg",backdrop:"static",keyboard:!1,resolve:{data:()=>({endpointReport:e})}}).result)),u.push(e.$watch(e.getActiveRepositoryObject,e=>{e&&m()})),e.$on("$destroy",()=>{u.forEach(e=>e())});const m=()=>{e.selectedSourceRepository||(g.createEndpointConfig(),_(),(()=>{e.sourceRepositories=o.getRepositoriesAsSelectMenuOptions(()=>o.getLocalReadableGraphdbRepositories());const t=o.getActiveRepository();e.selectedSourceRepository=e.sourceRepositories.find(e=>e.value===t),g.updateSourceRepository(e.selectedSourceRepository.value),e.previousSelectedSourceRepository=e.selectedSourceRepository})())}}angular.module("graphdb.framework.graphql.controllers.create-graphql-endpoint-view",["graphdb.framework.core.services.graphql-service","graphdb.framework.graphql.services.graphql-context","graphdb.framework.graphql.directives.select-schema-sources","graphdb.framework.graphql.directives.configure-endpoint","graphdb.framework.graphql.directives.generate-endpoint"]).controller("CreateGraphqlEndpointViewCtrl",l),l.$inject=["$scope","$location","$repositories","$translate","$uibModal","ModalService","toastr","GraphqlService","GraphqlContextService"]}}; //# sourceMappingURL=99379.d6b1bdf92ed9a636248f.bundle.js.map