graphdb-workbench
Version:
The web application for GraphDB APIs
2 lines • 4.78 kB
JavaScript
export const __webpack_id__=10376;export const __webpack_ids__=[456,5759,10376,17620,70884,81837];export const __webpack_modules__={456:(e,r,n)=>{n.r(r);var t=n(17620),o=(n(14874),n(70884),n(81837));function a(e,r,n,a,l,i,g,p){const d=[];e.initialized=!1,e.loadingEndpoints=!1,e.selectedGraphqlEndpoint=void 0,e.graphqlEndpoints=[],e.configuration=void 0,e.getActiveRepositoryNoError=()=>n.getActiveRepository(),e.onGraphqlEndpointChange=e=>{h(e)};const s=e=>{const r={endpoint:e.replace(/^\//,""),headers:c,selectedLanguage:a.getLanguage(),defaultQuery:"query Object {\n object(limit: 100) {\n id\n }\n}"};return new t.GraphqlPlaygroundConfig(r)},c=()=>{const e={"X-GraphDB-Track-Alias":`graphql-playground-query-${performance.now()}-${Date.now()}`},r=p.getAuthToken();return r&&(e.Authorization=r),e},u=(e,r)=>e.find(e=>e.label===r),h=r=>{const n=s(r.value);e.configuration=new t.GraphqlPlaygroundConfig(n)},y=()=>{e.selectedGraphqlEndpoint=void 0,e.graphqlEndpoints=[],e.configuration=void 0};d.push(e.$watch(e.getActiveRepositoryObject,e=>{e&&q()})),d.push(e.$on("language-changed",(e,r)=>{o.GraphqlPlaygroundDirectiveUtil.getGraphqlPlaygroundComponentAsync("#graphql-playground").then(e=>{e.setLanguage(r.locale)})})),e.$on("$destroy",()=>{d.forEach(e=>e())});const q=()=>{(()=>{e.loadingEndpoints=!0;const t=n.getActiveRepository();return i.getEndpointsAsSelectMenuOptions(t).then(n=>{n.length?(n=>{e.graphqlEndpoints=n,e.selectedGraphqlEndpoint=(()=>{const n=r.search().endpointId;if(n){const r=u(e.graphqlEndpoints,n);if(r)return r}const t=g.getSelectedEndpoint();if(t){const r=u(e.graphqlEndpoints,t.endpointId);if(r)return r}return e.graphqlEndpoints.find(e=>e.data.default)||e.graphqlEndpoints[0]})(),e.configuration=s(e.selectedGraphqlEndpoint.value)})(n):y()}).catch(e=>{y(),l.error(getError(e))}).finally(()=>{e.loadingEndpoints=!1})})().finally(()=>{e.initialized=!0})}}angular.module("graphdb.framework.graphql.controllers.graphql-playground-view",["graphdb.framework.core.services.graphql-service","graphdb.framework.core.directives.graphql-playground"]).controller("GraphqlPlaygroundViewCtrl",a),a.$inject=["$scope","$location","$repositories","$languageService","toastr","GraphqlService","GraphqlContextService","AuthTokenService"]},5759:(e,r,n)=>{n.r(r),n.d(r,{GraphQLPlaygroundComponent:()=>t});class t{constructor(e){this.graphQLPlaygroundComponent=e}setLanguage(e){this.graphQLPlaygroundComponent.setLanguage(e)}}},10376:(e,r,n)=>{n.r(r),n(456),n(98494),n(99379),angular.module("graphdb.framework.graphql",["ngRoute","graphdb.framework.graphql.controllers.graphql-endpoint-management-view","graphdb.framework.graphql.controllers.graphql-playground-view","graphdb.framework.graphql.controllers.create-graphql-endpoint-view"])},17620:(e,r,n)=>{n.r(r),n.d(r,{GraphqlPlaygroundConfig:()=>t});class t{constructor(e){this._endpoint=e.endpoint,this._headers=e.headers,this._selectedLanguage=e.selectedLanguage,this._defaultQuery=e.defaultQuery}get endpoint(){return this._endpoint}set endpoint(e){this._endpoint=e}get headers(){return this._headers}set headers(e){this._headers=e}get selectedLanguage(){return this._selectedLanguage}set selectedLanguage(e){this._selectedLanguage=e}get defaultQuery(){return this._defaultQuery}set defaultQuery(e){this._defaultQuery=e}}},70884:(e,r,n)=>{n.r(r);var t=n(5759);function o(e,r,n,o){return{restrict:"E",templateUrl:"js/angular/core/directives/graphql-playground/templates/graphql-playground.html",scope:{configuration:"="},link:(a,l,i)=>{a.getGraphQLPlaygroundComponent=()=>new t.GraphQLPlaygroundComponent(g()[0]),a.abortQuery=t=>{const a=e.getActiveRepository(),l=t.detail.headers["X-GraphDB-Track-Alias"];o.info(r.instant("graphql.playground.message.abort_query")),n.deleteQuery(l,a)};const g=()=>l.find("graphql-playground-component")}}}angular.module("graphdb.framework.core.directives.graphql-playground",[]).directive("graphqlPlayground",o),o.$inject=["$repositories","$translate","MonitoringRestService","toastr"]},81837:(e,r,n)=>{n.r(r),n.d(r,{GraphqlPlaygroundDirectiveUtil:()=>t});class t{static getGraphqlPlaygroundDirectiveController(e){const r=angular.element(document.querySelector(e));return angular.element(r).isolateScope()}static getGraphqlPlaygroundComponent=e=>{const r=t.getGraphqlPlaygroundDirectiveController(e);if(r)return r.getGraphQLPlaygroundComponent()};static getGraphqlPlaygroundComponentAsync=(e,r=1)=>new Promise((n,o)=>{let a=t.getGraphqlPlaygroundComponent(e);a&&n(a);let l=1e3*r|1e3;const i=setInterval(()=>{a=t.getGraphqlPlaygroundComponent(e),a?(clearInterval(i),n(a)):(l-=100,l<0&&(clearInterval(i),console.log("GraphQL Playground component is not found",e),o(new Error("Element is not found: "+e))))},100)})}}};
//# sourceMappingURL=10376.e89fa63ff898d45f45fd.bundle.js.map