UNPKG

graphdb-workbench

Version:
2 lines 8.26 kB
export const __webpack_id__=99379;export const __webpack_ids__=[85281,99379];export const __webpack_modules__={28050:(e,t,n)=>{n.r(t);var o=n(32534),r=(n(69724),n(77512));function i(e,t,n,i,a,p){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=i.getActiveRepository(),t.generateFromGraphqlSchemaShapes=!1,t.generatingEndpoint=!1,t.generationReport=void 0,t.endpointUrl=r.endpointUrl,t.back=()=>{p.previousEndpointCreationStep()},t.cancel=()=>{const t=n.instant("graphql.create_endpoint.wizard_steps.actions.cancel.confirmation.title"),o=n.instant("graphql.create_endpoint.wizard_steps.actions.cancel.confirmation.body");e.openConfirmation(t,o,()=>{p.cancelEndpointCreation()})},t.generateEndpoint=()=>{t.generatingEndpoint=!0,t.generationReport=void 0,p.generateEndpoint()},t.finishGenerationWorkflow=()=>{p.finishGenerationWorkflow()},t.showEndpointReport=e=>{p.openEndpointGenerationReport(e)},t.exploreInPlayground=e=>{p.exploreEndpointInPlayground(e)};const s=[];s.push(p.subscribe(o.GraphqlEventName.ENDPOINT_GENERATED,e=>{t.generatingEndpoint=!1,t.generationReport=e})),t.$on("$destroy",()=>{s.forEach(e=>e())}),t.endpointConfiguration=p.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",i),i.$inject=["ModalService","$uibModal","$translate","$repositories","GraphqlService","GraphqlContextService"]},69724:(e,t,n)=>{function o(e,t,n,o){const r="generation-report.json";e.endpointReport=void 0,e.downloadReport=()=>{const t=JSON.stringify(e.endpointReport.toJSON(),null,2),n=new Blob([t],{type:"application/json"}),o=URL.createObjectURL(n),i=document.createElement("a");i.href=o,i.download=e.endpointReport.endpointId?`${e.endpointReport.endpointId}-${r}`:r,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)},e.deleteReport=()=>{o.deleteEndpointGenerationReport(e.endpointReport),e.close()},e.close=()=>{t.dismiss("cancel")},e.endpointReport=n.endpointReport}n.r(t),n(14874),n(58334),n(29428),angular.module("graphdb.framework.graphql.controllers.endpoint-generation-failure-result-modal",["graphdb.framework.core.services.graphql-service"]).controller("EndpointGenerationResultFailureModalController",o),o.$inject=["$scope","$uibModalInstance","data","GraphqlContextService"]},85281:()=>{function e(e,t,n,o,r){return{restrict:"E",templateUrl:"js/angular/graphql/templates/step-configure-endpoint.html",scope:{stepDefinition:"="},link:i=>{i.endpointConfiguration=void 0,i.generationSettings=void 0,i.generationSettingsValid=!1,i.showAdvancedSettings=!1,i.handleValidityChange=e=>{i.endpointConfigurationSettingsValid=e},i.next=()=>{r.nextEndpointCreationStep()},i.back=()=>{r.previousEndpointCreationStep()},i.cancel=()=>{const e=n.instant("graphql.create_endpoint.wizard_steps.actions.cancel.confirmation.title"),o=n.instant("graphql.create_endpoint.wizard_steps.actions.cancel.confirmation.body");t.openConfirmation(e,o,()=>{r.cancelEndpointCreation()})},i.toggleAdvancedSettings=()=>{i.showAdvancedSettings=!i.showAdvancedSettings};const a=[];i.$on("$destroy",()=>{a.forEach(e=>e())}),i.endpointConfiguration=r.getNewEndpoint(),i.endpointConfiguration.settings||(i.endpointConfiguration,i.loadingData=!0,e.all([o.getGraphqlGenerationSettings().catch(e=>{console.error("Error loading generation settings",e),toastr.error(getError(e))})]).then(([e])=>{i.endpointConfiguration.settings=e}).finally(()=>{i.loadingData=!1}))}}}angular.module("graphdb.framework.graphql.directives.configure-endpoint",[]).directive("configureEndpoint",e),e.$inject=["$q","ModalService","$translate","GraphqlService","GraphqlContextService"]},99379:(e,t,n)=>{n.r(t),n(14874);var o=n(32534),r=n(21388),i=n(77512),a=n(16747),p=(n(32606),n(85281),n(28050),n(10406),n(90275));function s(e,t,n,s,d,c,l,g,u){const h=[];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:s.instant("graphql.create_endpoint.messages.source_repository_changed.title"),message:s.instant("graphql.create_endpoint.messages.source_repository_changed.body"),confirmButtonKey:"common.confirm"},()=>{e.previousSelectedSourceRepository=e.selectedSourceRepository,u.updateSourceRepository(t.value),u.createEndpointConfig(),S()},()=>{e.selectedSourceRepository=e.previousSelectedSourceRepository})},e.activateStep=t=>{e.wizardModel.setStepActive(t),E(t)},e.onStepClick=t=>{e.wizardModel.isAPreviousStep(t)&&(e.wizardModel.setStepActive(t),E(t))};const E=t=>{e.currentStep=t},S=()=>{e.wizardModel=(new a.Wizard).addStep(new r.SelectSchemaSourceStep).addStep(new r.ConfigureEndpointStep).addStep(new r.GenerateEndpointStep),E(e.wizardModel.getActiveStep())};h.push(u.subscribe(o.GraphqlEventName.GENERATE_ENDPOINT,t=>{const o=t.schemaSourceType===r.SchemaSourceType.GRAPHQL_SCHEMA_SHAPES,i=t.schemaSourceType===r.SchemaSourceType.SHACL_SHAPES;return o?(t=>{e.generatingEndpoint=!0;const o=t.toCreateEndpointFromShapesRequest(e.selectedSourceRepository.value);let r;return g.generateEndpointFromGraphqlShapes(n.getActiveRepository(),o).then(e=>{r=e}).catch(e=>{l.error(getError(e))}).finally(()=>{u.endpointGenerated(r),e.generatingEndpoint=!1})})(t):i?(t=>{e.generatingEndpoint=!0;const o=t.toCreateEndpointFromOwlRequest(e.selectedSourceRepository.value);let r;return g.generateEndpointFromOwl(n.getActiveRepository(),o).then(e=>{r=e}).catch(e=>{l.error(getError(e))}).finally(()=>{e.generatingEndpoint=!1,u.endpointGenerated(r)})})(t):void 0})),h.push(u.subscribe(o.GraphqlEventName.PREVIOUS_ENDPOINT_CREATION_STEP,()=>{E(e.wizardModel.previousStep())})),h.push(u.subscribe(o.GraphqlEventName.NEXT_ENDPOINT_CREATION_STEP,()=>{E(e.wizardModel.nextStep())})),h.push(u.subscribe(o.GraphqlEventName.CANCEL_ENDPOINT_CREATION,()=>{t.path(i.endpointUrl.ENDPOINT_MANAGEMENT)})),h.push(u.subscribe(o.GraphqlEventName.FINISH_GENERATION_WORKFLOW,()=>{t.path(i.endpointUrl.ENDPOINT_MANAGEMENT)})),h.push(u.subscribe(o.GraphqlEventName.EXPLORE_ENDPOINT_IN_PLAYGROUND,e=>{const t=(0,p.resolvePlaygroundUrlWithEndpoint)(e.endpointId);u.setSelectedEndpoint(e),window.open(t,"_blank","noopener,noreferrer")})),h.push(u.subscribe(o.GraphqlEventName.OPEN_ENDPOINT_GENERATION_REPORT,e=>d.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)),h.push(e.$watch(e.getActiveRepositoryObject,e=>{e&&v()})),e.$on("$destroy",()=>{h.forEach(e=>e())});const v=()=>{e.selectedSourceRepository||(u.createEndpointConfig(),S(),(()=>{e.sourceRepositories=n.getRepositoriesAsSelectMenuOptions(()=>n.getLocalReadableGraphdbRepositories());const t=n.getActiveRepository();e.selectedSourceRepository=e.sourceRepositories.find(e=>e.value===t),u.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",s),s.$inject=["$scope","$location","$repositories","$translate","$uibModal","ModalService","toastr","GraphqlService","GraphqlContextService"]}}; //# sourceMappingURL=99379.d5dffb14dd46150e91f9.bundle.js.map