graphdb-workbench
Version:
The web application for GraphDB APIs
2 lines • 5.33 kB
JavaScript
export const __webpack_esm_id__=10376;export const __webpack_esm_ids__=[456,5759,10376,17620,70884,81837];export const __webpack_esm_modules__={456(e,t,r){var n=r(17620),o=(r(14874),r(70884),r(81837)),a=r(57154);function i(e,t,r,i,l,s,g){let d=[];const p=(0,a.service)(a.AuthenticationStorageService),c=(0,a.service)(a.RuntimeConfigurationContextService),h=(0,a.service)(a.ThemeService);e.initialized=!1,e.loadingEndpoints=!1,e.selectedGraphqlEndpoint=void 0,e.graphqlEndpoints=[],e.configuration=void 0,e.getActiveRepositoryNoError=()=>r.getActiveRepository(),e.onGraphqlEndpointChange=e=>{q(e)};const u=e=>{const t={endpoint:e.replace(/^\//,""),headers:m,selectedLanguage:i.getLanguage(),defaultQuery:"query Object {\n object(limit: 100) {\n id\n }\n}"};return new n.$(t)},m=()=>{const e={"X-GraphDB-Track-Alias":`graphql-playground-query-${performance.now()}-${Date.now()}`},t=p.getAuthToken().getValue();return t&&(e.Authorization=t),e},y=(e,t)=>e.find(e=>e.label===t),q=t=>{const r=u(t.value);e.configuration=new n.$(r)},f=()=>{e.selectedGraphqlEndpoint=void 0,e.graphqlEndpoints=[],e.configuration=void 0};d=[e.$watch(e.getActiveRepositoryObject,e=>{e&&v()}),e.$on("language-changed",(e,t)=>{o.A.getGraphqlPlaygroundComponentAsync("#graphql-playground").then(e=>{e.setLanguage(t.locale)})}),c.onThemeModeChanged(()=>{e.graphqlEndpoints&&e.graphqlEndpoints.length&&o.A.getGraphqlPlaygroundComponentAsync("#graphql-playground").then(e=>e.setEditorsTheme(h.getCodeEditorThemeName())).catch(e=>{console.error("Failed to locate the GraphQL Playground instance.",e)})})],e.$on("$destroy",()=>{d.forEach(e=>e())});const v=()=>{(()=>{e.loadingEndpoints=!0;const n=r.getActiveRepository();return s.getEndpointsAsSelectMenuOptions(n).then(r=>{r.length?(r=>{e.graphqlEndpoints=r,e.selectedGraphqlEndpoint=(()=>{const r=t.search().endpointId;if(r){const t=y(e.graphqlEndpoints,r);if(t)return t}const n=g.getSelectedEndpoint();if(n){const t=y(e.graphqlEndpoints,n.endpointId);if(t)return t}return e.graphqlEndpoints.find(e=>e.data.default)||e.graphqlEndpoints[0]})(),e.configuration=u(e.selectedGraphqlEndpoint.value)})(r):f()}).catch(e=>{f(),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",i),i.$inject=["$scope","$location","$repositories","$languageService","toastr","GraphqlService","GraphqlContextService"]},5759(e,t,r){r.d(t,{a:()=>n});class n{constructor(e){this.graphQLPlaygroundComponent=e}setLanguage(e){this.graphQLPlaygroundComponent.setLanguage(e)}setEditorsTheme(e){this.graphQLPlaygroundComponent.setEditorsTheme(e)}}},10376(e,t,r){r(456),r(98494),r(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,t,r){r.d(t,{$:()=>n});class n{constructor(e){this._endpoint=e.endpoint,this._headers=e.headers,this._selectedLanguage=e.selectedLanguage,this._defaultQuery=e.defaultQuery,this._editorsThemeName=e.editorsThemeName}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}get editorsThemeName(){return this._editorsThemeName}set editorsThemeName(e){this._editorsThemeName=e}}},70884(e,t,r){var n=r(5759),o=r(57154);function a(e,t,r,a){return{restrict:"E",templateUrl:"js/angular/core/directives/graphql-playground/templates/graphql-playground.html",scope:{configuration:"="},link:(i,l,s)=>{const g=(0,o.service)(o.ThemeService);i.getGraphQLPlaygroundComponent=()=>new n.a(d()[0]),i.abortQuery=n=>{const o=e.getActiveRepository(),i=n.detail.headers["X-GraphDB-Track-Alias"];a.info(t.instant("graphql.playground.message.abort_query")),r.deleteQuery(i,o)};const d=()=>l.find("graphql-playground-component");i.configuration.editorsThemeName||(i.configuration.editorsThemeName=g.getCodeEditorThemeName())}}}angular.module("graphdb.framework.core.directives.graphql-playground",[]).directive("graphqlPlayground",a),a.$inject=["$repositories","$translate","MonitoringRestService","toastr"]},81837(e,t,r){r.d(t,{A:()=>o});const n=r(304).I.logger;class o{static getGraphqlPlaygroundDirectiveController(e){const t=angular.element(document.querySelector(e));return angular.element(t).isolateScope()}static getGraphqlPlaygroundComponent=e=>{const t=o.getGraphqlPlaygroundDirectiveController(e);if(t)return t.getGraphQLPlaygroundComponent()};static getGraphqlPlaygroundComponentAsync=(e,t=1)=>new Promise((r,a)=>{let i=o.getGraphqlPlaygroundComponent(e);i&&r(i);let l=1e3*t|1e3;const s=setInterval(()=>{i=o.getGraphqlPlaygroundComponent(e),i?(clearInterval(s),r(i)):(l-=100,l<0&&(clearInterval(s),n.info("GraphQL Playground component is not found",e),a(new Error("Element is not found: "+e))))},100)})}}};
//# sourceMappingURL=10376.732fde8c56b8beab4f20.bundle.js.map