File size: 6,807 Bytes
960a64d
1
"use strict";(self.webpackChunkviewer=self.webpackChunkviewer||[]).push([[111],{8111:(R,p,n)=>{n.r(p),n.d(p,{ConfigComponent:()=>U});var _=n(177),u=n(1626),i=n(9417),g=n(5558),d=n(8141),f=n(9437),h=n(7673),O=n(5964),a=n(4119),E=n(5717),l=n(7161),t=n(4438),M=n(8472),C=n(2168);function b(r,m){1&r&&t.nrm(0,"div",13)}function I(r,m){1&r&&(t.j41(0,"div",14),t.EFF(1,"\u2713"),t.k0s())}function v(r,m){1&r&&(t.j41(0,"div",15),t.EFF(1,"\u2717"),t.k0s())}function P(r,m){if(1&r&&(t.j41(0,"div",16),t.EFF(1),t.k0s()),2&r){const c=t.XpG();t.R7$(),t.JRh(c.errorMessage)}}let U=(()=>{class r{constructor(c,o,s,e){this.formBuilder=c,this.http=o,this.authGuard=s,this.router=e,this.isLoading=!1,this.testResult=null,this.errorMessage=""}ngOnInit(){this.dicomForm=this.formBuilder.group({endpointUrl:[a.c.IMAGE_DICOM_STORE_BASE_URL||"",[i.k0.required,i.k0.pattern(/./)]],annotationsUrl:[a.c.ANNOTATIONS_DICOM_STORE_BASE_URL||""]})}copyEndpointToAnnotations(){const c=this.dicomForm.get("endpointUrl").value;this.dicomForm.get("annotationsUrl").setValue(c.replace(/dicomWeb.*/i,"dicomWeb"))}onSubmit(){if(this.dicomForm.valid){this.isLoading=!0,this.testResult=null,this.errorMessage="";const c=this.dicomForm.value.endpointUrl.replaceAll("%2F","/"),o=(0,l.LG)(c);if(!o.baseUrl)return this.errorMessage="Failed to parse URL.",this.isLoading=!1,void(this.testResult="error");(o.baseUrl.startsWith("/project")||o.baseUrl.startsWith("project"))&&(o.baseUrl="https://healthcare.googleapis.com/v1/"+o.baseUrl,o.baseUrl.endsWith("/dicomWeb")||(o.baseUrl+="/dicomWeb"));const s=(0,l.rH)(o);this.authGuard.getOAuthToken().pipe((0,g.n)(e=>this.http.get(`${s}/instances`,{responseType:"json",params:{limit:1},...e&&{headers:new u.Lr({Authorization:`Bearer ${e}`})}})),(0,d.M)(()=>{this.testResult="success",a.c.IMAGE_DICOM_STORE_BASE_URL=o.baseUrl,a.c.ENABLE_SERVER_INTERPOLATION=!a.c.IMAGE_DICOM_STORE_BASE_URL.includes("healthcare.googleapis.com/v1")}),(0,f.W)(e=>{console.log(e);const T=e?.error?.[0]?.error?.message??e?.message??e?.statusText??e;return this.testResult="error",this.errorMessage=`${T} ${e?.status}`,0===e.status&&!e.message&&(this.errorMessage="CORS or other HTTP error"),(0,h.of)(null)}),(0,O.p)(e=>null!==e),(0,d.M)(()=>{if(a.c.ENABLE_ANNOTATION_WRITING=!1,!this.dicomForm.value.annotationsUrl)return;const e=(0,l.LG)(this.dicomForm.value.annotationsUrl).baseUrl;e&&(a.c.ANNOTATIONS_DICOM_STORE_BASE_URL=e,a.c.ANNOTATIONS_DICOM_STORE_PARENT="",a.c.ENABLE_ANNOTATION_WRITING=!0)}),(0,d.M)(()=>{if((0,E._l)(),o.path.seriesUID){const e={series:(0,l.rH)(o)};this.router.navigate(["/viewer"],{queryParams:e})}else this.router.navigate(["/search"])})).subscribe({complete:()=>this.isLoading=!1})}}static{this.\u0275fac=function(o){return new(o||r)(t.rXU(i.ok),t.rXU(u.Qq),t.rXU(M.u),t.rXU(C.Ix))}}static{this.\u0275cmp=t.VBU({type:r,selectors:[["app-dicom-endpoint-form"]],decls:29,vars:6,consts:[[1,"container"],[1,"form-wrapper"],[3,"ngSubmit","formGroup"],[1,"input-group"],["href","https://docs.google.com/document/d/184kEwQeIOBwWxsG02SESFfrxOsF11kQWX2bM_KZ7fgY/edit?usp=sharing&resourcekey=0-BOAD2fPB3RV0VLMHneZLHA","target","_blank"],["type","text","id","endpointUrl","formControlName","endpointUrl","placeholder","DICOM store pathway or DICOMweb URL"],["class","spinner",4,"ngIf"],["class","checkmark",4,"ngIf"],["class","crossmark",4,"ngIf"],["class","error-message",4,"ngIf"],["type","button",1,"example-url",3,"click"],["type","text","id","annotationsUrl","formControlName","annotationsUrl","placeholder","DICOM store pathway or DICOMweb URL for annotations"],["type","submit",3,"disabled"],[1,"spinner"],[1,"checkmark"],[1,"crossmark"],[1,"error-message"]],template:function(o,s){1&o&&(t.j41(0,"div",0)(1,"div",1)(2,"h2"),t.EFF(3,"Welcome to the Pathology Image Viewer"),t.k0s(),t.j41(4,"form",2),t.bIt("ngSubmit",function(){return s.onSubmit()}),t.j41(5,"div",3)(6,"p"),t.EFF(7,"Enter the pathway for your DICOM store ("),t.j41(8,"a",4),t.EFF(9,"show me how to find this"),t.k0s(),t.EFF(10,"):"),t.k0s(),t.j41(11,"p"),t.EFF(12,"Or provide a full URL your DICOMWeb endpoint (may include path to series UID)"),t.k0s(),t.nrm(13,"input",5),t.DNE(14,b,1,0,"div",6)(15,I,2,0,"div",7)(16,v,2,0,"div",8)(17,P,2,1,"div",9),t.j41(18,"p"),t.EFF(19,"If you wish to create annotations, enter the DICOM store path or DICOMweb endpoint corresponding to the store used to write annotations. This may be the same store as above:"),t.k0s(),t.j41(20,"p"),t.EFF(21,"The logged in user must have read and write permissions to write permissions to this store."),t.k0s(),t.j41(22,"p"),t.EFF(23,"(Note that the user must have read and write permissions for this store.)"),t.k0s(),t.j41(24,"button",10),t.bIt("click",function(){return s.copyEndpointToAnnotations()}),t.EFF(25,"Copy from above"),t.k0s(),t.nrm(26,"input",11),t.k0s(),t.j41(27,"button",12),t.EFF(28,"Open Image"),t.k0s()()()()),2&o&&(t.R7$(4),t.Y8G("formGroup",s.dicomForm),t.R7$(10),t.Y8G("ngIf",s.isLoading),t.R7$(),t.Y8G("ngIf","success"===s.testResult),t.R7$(),t.Y8G("ngIf","error"===s.testResult),t.R7$(),t.Y8G("ngIf",s.errorMessage),t.R7$(10),t.Y8G("disabled",!s.dicomForm.valid))},dependencies:[_.MD,_.bT,i.X1,i.qT,i.me,i.BC,i.cb,i.j4,i.JD],styles:[".container[_ngcontent-%COMP%]{display:grid;place-items:center;min-height:100vh;background-color:#f4f4f4}.form-wrapper[_ngcontent-%COMP%]{background:linear-gradient(135deg,#2980b9,#6dd5fa);padding:40px;border-radius:20px;box-shadow:0 8px 16px #0003;text-align:center;max-width:50%}.form-wrapper[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%], .form-wrapper[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{color:#fff}.example-url[_ngcontent-%COMP%]{font-size:.9em;color:#777;margin-bottom:15px;font-style:italic}.input-group[_ngcontent-%COMP%]{margin-bottom:20px}input[type=text][_ngcontent-%COMP%]{width:100%;padding:12px;border:1px solid #ccc;border-radius:5px;box-sizing:border-box;font-size:1em}input[type=text][_ngcontent-%COMP%]:focus{outline:none;border-color:#007bff;box-shadow:0 0 5px #007bff80}button[type=submit][_ngcontent-%COMP%]{background-color:#007bff;color:#fff;padding:12px 20px;border:none;border-radius:5px;cursor:pointer;font-size:1em;transition:background-color .3s ease}button[type=submit][_ngcontent-%COMP%]:hover{background-color:#0056b3}button[type=submit][_ngcontent-%COMP%]:disabled{background-color:#ccc;cursor:not-allowed}.error-message[_ngcontent-%COMP%]{color:#dc3545;font-size:.9em;margin-top:5px;margin-left:8px}.spinner[_ngcontent-%COMP%]{display:inline-block;width:16px;height:16px;border:2px solid #ccc;border-radius:50%;border-top-color:#007bff;animation:_ngcontent-%COMP%_spin 1s ease-in-out infinite;margin-left:8px}.checkmark[_ngcontent-%COMP%], .crossmark[_ngcontent-%COMP%]{margin-left:8px}@keyframes _ngcontent-%COMP%_spin{to{transform:rotate(360deg)}}"]})}}return r})()}}]);