From a2d2737fa4ec1a57f5288ed72eb44a2be4588ee8 Mon Sep 17 00:00:00 2001 From: Sam Wilkins Date: Fri, 13 Dec 2019 14:25:35 -0500 Subject: pdf path parsing fix in pdfviewer --- src/client/views/pdf/PDFViewer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/client/views/pdf') diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx index 3aa5d1d2c..d16fe2edd 100644 --- a/src/client/views/pdf/PDFViewer.tsx +++ b/src/client/views/pdf/PDFViewer.tsx @@ -125,7 +125,7 @@ export class PDFViewer extends DocAnnotatableComponent this._showWaiting = this._showCover = true); this.props.startupLive && this.setupPdfJsViewer(); -- cgit v1.2.3-70-g09d2 From f49cf16cb4af2851aaa98bb2c6fce81271042fea Mon Sep 17 00:00:00 2001 From: Sam Wilkins Date: Fri, 13 Dec 2019 15:12:04 -0500 Subject: path rosemary server fix --- solr-8.3.1/server/logs/solr_gc.log.0.current | 29 +++++++++++++++++++++++++++- src/client/views/pdf/PDFViewer.tsx | 11 +++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) (limited to 'src/client/views/pdf') diff --git a/solr-8.3.1/server/logs/solr_gc.log.0.current b/solr-8.3.1/server/logs/solr_gc.log.0.current index 4b5cdd721..e45ebc49d 100644 --- a/solr-8.3.1/server/logs/solr_gc.log.0.current +++ b/solr-8.3.1/server/logs/solr_gc.log.0.current @@ -295,4 +295,31 @@ Heap after GC invocations=4 (full 0): 2019-12-13T14:20:31.796-0500: 65.642: Total time for which application threads were stopped: 0.0000504 seconds, Stopping threads took: 0.0000174 seconds 2019-12-13T14:20:31.796-0500: 65.642: Total time for which application threads were stopped: 0.0000489 seconds, Stopping threads took: 0.0000240 seconds 2019-12-13T14:20:31.804-0500: 65.649: Total time for which application threads were stopped: 0.0000811 seconds, Stopping threads took: 0.0000239 seconds -2019-12-13T14:20:31.804-0500: 65.649: Total time for which application \ No newline at end of file +2019-12-13T14:20:31.804-0500: 65.649: Total time for which application threads were stopped: 0.0000578 seconds, Stopping threads took: 0.0000174 seconds +2019-12-13T14:20:31.806-0500: 65.651: Total time for which application threads were stopped: 0.0000609 seconds, Stopping threads took: 0.0000206 seconds +2019-12-13T14:20:31.806-0500: 65.651: Total time for which application threads were stopped: 0.0000415 seconds, Stopping threads took: 0.0000167 seconds +2019-12-13T14:20:31.807-0500: 65.652: Total time for which application threads were stopped: 0.0000417 seconds, Stopping threads took: 0.0000152 seconds +2019-12-13T14:20:31.807-0500: 65.652: Total time for which application threads were stopped: 0.0001659 seconds, Stopping threads took: 0.0001210 seconds +2019-12-13T14:20:31.809-0500: 65.655: Total time for which application threads were stopped: 0.0001285 seconds, Stopping threads took: 0.0000161 seconds +2019-12-13T14:20:31.848-0500: 65.694: Total time for which application threads were stopped: 0.0002375 seconds, Stopping threads took: 0.0000963 seconds +2019-12-13T14:20:32.849-0500: 66.694: Total time for which application threads were stopped: 0.0000762 seconds, Stopping threads took: 0.0000226 seconds +2019-12-13T14:20:33.221-0500: 67.066: Total time for which application threads were stopped: 0.0002122 seconds, Stopping threads took: 0.0000344 seconds +2019-12-13T14:20:33.355-0500: 67.200: Total time for which application threads were stopped: 0.0010525 seconds, Stopping threads took: 0.0009766 seconds +2019-12-13T14:20:33.380-0500: 67.226: Total time for which application threads were stopped: 0.0001911 seconds, Stopping threads took: 0.0001312 seconds +2019-12-13T14:20:34.380-0500: 68.226: Total time for which application threads were stopped: 0.0001102 seconds, Stopping threads took: 0.0000259 seconds +2019-12-13T14:21:22.760-0500: 116.604: Total time for which application threads were stopped: 0.0000779 seconds, Stopping threads took: 0.0000232 seconds +2019-12-13T14:21:23.760-0500: 117.604: Total time for which application threads were stopped: 0.0000733 seconds, Stopping threads took: 0.0000271 seconds +2019-12-13T14:21:30.763-0500: 124.606: Total time for which application threads were stopped: 0.0000739 seconds, Stopping threads took: 0.0000263 seconds +2019-12-13T14:21:31.763-0500: 125.606: Total time for which application threads were stopped: 0.0000665 seconds, Stopping threads took: 0.0000222 seconds +2019-12-13T14:22:01.781-0500: 155.623: Total time for which application threads were stopped: 0.0000777 seconds, Stopping threads took: 0.0000250 seconds +2019-12-13T14:22:25.795-0500: 179.636: Total time for which application threads were stopped: 0.0000737 seconds, Stopping threads took: 0.0000255 seconds +2019-12-13T14:22:30.798-0500: 184.639: Total time for which application threads were stopped: 0.0000908 seconds, Stopping threads took: 0.0000229 seconds +2019-12-13T14:23:30.828-0500: 244.667: Total time for which application threads were stopped: 0.0000805 seconds, Stopping threads took: 0.0000293 seconds +2019-12-13T14:24:30.864-0500: 304.700: Total time for which application threads were stopped: 0.0000739 seconds, Stopping threads took: 0.0000250 seconds +2019-12-13T14:25:30.899-0500: 364.733: Total time for which application threads were stopped: 0.0000832 seconds, Stopping threads took: 0.0000266 seconds +2019-12-13T14:27:30.954-0500: 484.784: Total time for which application threads were stopped: 0.0002355 seconds, Stopping threads took: 0.0001565 seconds +2019-12-13T14:28:01.968-0500: 515.796: Total time for which application threads were stopped: 0.0000752 seconds, Stopping threads took: 0.0000252 seconds +2019-12-13T14:28:30.983-0500: 544.810: Total time for which application threads were stopped: 0.0000737 seconds, Stopping threads took: 0.0000252 seconds +2019-12-13T14:29:31.010-0500: 604.836: Total time for which application threads were stopped: 0.0000722 seconds, Stopping threads took: 0.0000242 seconds +2019-12-13T14:30:31.042-0500: 664.865: Total time for which application threads were stopped: 0.0000756 seconds, Stopping threads took: 0.0000251 seconds +2019-12-13T14:31:31.0 \ No newline at end of file diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx index a1f710617..4716e9d66 100644 --- a/src/client/views/pdf/PDFViewer.tsx +++ b/src/client/views/pdf/PDFViewer.tsx @@ -30,6 +30,7 @@ import { DocumentDecorations } from "../DocumentDecorations"; import { InkingControl } from "../InkingControl"; import { InkTool } from "../../../new_fields/InkField"; import { TraceMobx } from "../../../new_fields/util"; +import { PdfField } from "../../../new_fields/URLField"; const PDFJSViewer = require("pdfjs-dist/web/pdf_viewer"); const pdfjsLib = require("pdfjs-dist"); @@ -125,6 +126,16 @@ export class PDFViewer extends DocAnnotatableComponent this._showWaiting = this._showCover = true); -- cgit v1.2.3-70-g09d2 From d4f793d73070594086c72cf67a8b2b0a60b2af77 Mon Sep 17 00:00:00 2001 From: Sam Wilkins Date: Fri, 13 Dec 2019 15:36:16 -0500 Subject: write to data doc + console logs for pdf fix --- src/client/views/pdf/PDFViewer.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/client/views/pdf') diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx index 4716e9d66..253968443 100644 --- a/src/client/views/pdf/PDFViewer.tsx +++ b/src/client/views/pdf/PDFViewer.tsx @@ -126,15 +126,24 @@ export class PDFViewer extends DocAnnotatableComponent Date: Fri, 13 Dec 2019 15:48:13 -0500 Subject: absolute pathname to pdfbox, improved check --- src/client/views/nodes/PDFBox.tsx | 2 +- src/client/views/pdf/PDFViewer.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/client/views/pdf') diff --git a/src/client/views/nodes/PDFBox.tsx b/src/client/views/nodes/PDFBox.tsx index 0f5cc0fa9..af996b3d8 100644 --- a/src/client/views/nodes/PDFBox.tsx +++ b/src/client/views/nodes/PDFBox.tsx @@ -57,7 +57,7 @@ export class PDFBox extends DocAnnotatableComponent componentDidMount() { const pdfUrl = Cast(this.dataDoc[this.props.fieldKey], PdfField); if (pdfUrl instanceof PdfField) { - Pdfjs.getDocument(pdfUrl.url.pathname).promise.then(pdf => runInAction(() => this._pdf = pdf)); + Pdfjs.getDocument(pdfUrl.url.href).promise.then(pdf => runInAction(() => this._pdf = pdf)); } this._selectReactionDisposer = reaction(() => this.props.isSelected(), () => { diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx index 253968443..41825cda7 100644 --- a/src/client/views/pdf/PDFViewer.tsx +++ b/src/client/views/pdf/PDFViewer.tsx @@ -137,7 +137,7 @@ export class PDFViewer extends DocAnnotatableComponent Date: Fri, 13 Dec 2019 16:49:10 -0500 Subject: server pdf stability improvements --- solr-8.3.1/server/logs/solr.log | 4 + solr-8.3.1/server/logs/solr_gc.log.0.current | 166 ++++++++++++++++++++++++++- src/client/views/pdf/PDFViewer.tsx | 9 +- src/server/ApiManagers/PDFManager.ts | 37 +++--- 4 files changed, 196 insertions(+), 20 deletions(-) (limited to 'src/client/views/pdf') diff --git a/solr-8.3.1/server/logs/solr.log b/solr-8.3.1/server/logs/solr.log index 25c8bae75..10ed06cb3 100644 --- a/solr-8.3.1/server/logs/solr.log +++ b/solr-8.3.1/server/logs/solr.log @@ -31,3 +31,7 @@ 2019-12-13 19:19:30.793 INFO (main) [ ] o.e.j.s.AbstractConnector Started ServerConnector@8297b3a{HTTP/1.1,[http/1.1, h2c]}{0.0.0.0:8983} 2019-12-13 19:19:30.793 INFO (main) [ ] o.e.j.s.Server Started @4641ms 2019-12-13 19:19:31.371 INFO (qtp1664439369-23) [ ] o.a.s.s.HttpSolrCall [admin] webapp=null path=/admin/info/system params={wt=json} status=0 QTime=51 +2019-12-13 20:58:25.058 INFO (qtp1664439369-19) [ ] o.a.s.s.HttpSolrCall [admin] webapp=null path=/admin/info/system params={wt=json} status=0 QTime=42 +2019-12-13 20:58:36.863 INFO (qtp1664439369-22) [ ] o.a.s.s.HttpSolrCall [admin] webapp=null path=/admin/cores params={indexInfo=false&wt=json&_=1576270716757} status=0 QTime=6 +2019-12-13 20:58:36.894 INFO (qtp1664439369-18) [ ] o.a.s.s.HttpSolrCall [admin] webapp=null path=/admin/info/system params={wt=json&_=1576270716757} status=0 QTime=36 +2019-12-13 20:58:36.921 INFO (qtp1664439369-40) [ ] o.a.s.s.HttpSolrCall [admin] webapp=null path=/admin/info/system params={wt=json&_=1576270716757} status=0 QTime=24 diff --git a/solr-8.3.1/server/logs/solr_gc.log.0.current b/solr-8.3.1/server/logs/solr_gc.log.0.current index e45ebc49d..687372454 100644 --- a/solr-8.3.1/server/logs/solr_gc.log.0.current +++ b/solr-8.3.1/server/logs/solr_gc.log.0.current @@ -322,4 +322,168 @@ Heap after GC invocations=4 (full 0): 2019-12-13T14:28:30.983-0500: 544.810: Total time for which application threads were stopped: 0.0000737 seconds, Stopping threads took: 0.0000252 seconds 2019-12-13T14:29:31.010-0500: 604.836: Total time for which application threads were stopped: 0.0000722 seconds, Stopping threads took: 0.0000242 seconds 2019-12-13T14:30:31.042-0500: 664.865: Total time for which application threads were stopped: 0.0000756 seconds, Stopping threads took: 0.0000251 seconds -2019-12-13T14:31:31.0 \ No newline at end of file +2019-12-13T14:31:31.081-0500: 724.901: Total time for which application threads were stopped: 0.0002465 seconds, Stopping threads took: 0.0001502 seconds +2019-12-13T14:36:31.227-0500: 1025.037: Total time for which application threads were stopped: 0.0000861 seconds, Stopping threads took: 0.0000258 seconds +2019-12-13T14:36:55.239-0500: 1049.048: Total time for which application threads were stopped: 0.0000796 seconds, Stopping threads took: 0.0000297 seconds +2019-12-13T14:37:31.260-0500: 1085.068: Total time for which application threads were stopped: 0.0000800 seconds, Stopping threads took: 0.0000252 seconds +2019-12-13T14:39:31.321-0500: 1205.125: Total time for which application threads were stopped: 0.0000985 seconds, Stopping threads took: 0.0000317 seconds +2019-12-13T14:41:31.380-0500: 1325.180: Total time for which application threads were stopped: 0.0000677 seconds, Stopping threads took: 0.0000185 seconds +2019-12-13T14:42:31.415-0500: 1385.213: Total time for which application threads were stopped: 0.0000780 seconds, Stopping threads took: 0.0000247 seconds +2019-12-13T14:43:31.443-0500: 1445.239: Total time for which application threads were stopped: 0.0000742 seconds, Stopping threads took: 0.0000250 seconds +2019-12-13T14:44:31.467-0500: 1505.261: Total time for which application threads were stopped: 0.0000927 seconds, Stopping threads took: 0.0000250 seconds +2019-12-13T14:45:31.500-0500: 1565.292: Total time for which application threads were stopped: 0.0000861 seconds, Stopping threads took: 0.0000298 seconds +2019-12-13T14:46:31.532-0500: 1625.322: Total time for which application threads were stopped: 0.0000926 seconds, Stopping threads took: 0.0000288 seconds +2019-12-13T14:51:31.682-0500: 1925.463: Total time for which application threads were stopped: 0.0000831 seconds, Stopping threads took: 0.0000269 seconds +2019-12-13T14:52:29.711-0500: 1983.489: Total time for which application threads were stopped: 0.0000811 seconds, Stopping threads took: 0.0000264 seconds +2019-12-13T14:57:30.858-0500: 2284.628: Total time for which application threads were stopped: 0.0000834 seconds, Stopping threads took: 0.0000264 seconds +2019-12-13T15:17:31.465-0500: 3485.201: Total time for which application threads were stopped: 0.0001128 seconds, Stopping threads took: 0.0000462 seconds +2019-12-13T15:19:31.533-0500: 3605.266: Total time for which application threads were stopped: 0.0000927 seconds, Stopping threads took: 0.0000303 seconds +2019-12-13T15:23:31.655-0500: 3845.381: Total time for which application threads were stopped: 0.0000822 seconds, Stopping threads took: 0.0000273 seconds +2019-12-13T15:40:32.169-0500: 4865.871: Total time for which application threads were stopped: 0.0000997 seconds, Stopping threads took: 0.0000339 seconds +2019-12-13T15:41:32.197-0500: 4925.897: Total time for which application threads were stopped: 0.0000729 seconds, Stopping threads took: 0.0000235 seconds +2019-12-13T15:47:32.371-0500: 5286.063: Total time for which application threads were stopped: 0.0001041 seconds, Stopping threads took: 0.0000327 seconds +2019-12-13T15:51:32.487-0500: 5526.174: Total time for which application threads were stopped: 0.0000795 seconds, Stopping threads took: 0.0000253 seconds +2019-12-13T15:55:15.598-0500: 5749.280: Total time for which application threads were stopped: 0.0001565 seconds, Stopping threads took: 0.0000314 seconds +2019-12-13T15:56:32.638-0500: 5826.319: Total time for which application threads were stopped: 0.0000771 seconds, Stopping threads took: 0.0000240 seconds +2019-12-13T15:58:09.684-0500: 5923.363: Total time for which application threads were stopped: 0.0000708 seconds, Stopping threads took: 0.0000216 seconds +2019-12-13T15:58:25.054-0500: 5938.734: Total time for which application threads were stopped: 0.0003699 seconds, Stopping threads took: 0.0000196 seconds +2019-12-13T15:58:25.054-0500: 5938.734: Total time for which application threads were stopped: 0.0000675 seconds, Stopping threads took: 0.0000113 seconds +2019-12-13T15:58:25.054-0500: 5938.734: Total time for which application threads were stopped: 0.0000413 seconds, Stopping threads took: 0.0000101 seconds +2019-12-13T15:58:26.056-0500: 5939.735: Total time for which application threads were stopped: 0.0001509 seconds, Stopping threads took: 0.0000193 seconds +2019-12-13T15:58:35.718-0500: 5949.397: Total time for which application threads were stopped: 0.0001277 seconds, Stopping threads took: 0.0000247 seconds +2019-12-13T15:58:35.719-0500: 5949.398: Total time for which application threads were stopped: 0.0000785 seconds, Stopping threads took: 0.0000151 seconds +2019-12-13T15:58:35.762-0500: 5949.441: Total time for which application threads were stopped: 0.0000840 seconds, Stopping threads took: 0.0000249 seconds +2019-12-13T15:58:35.762-0500: 5949.441: Total time for which application threads were stopped: 0.0000521 seconds, Stopping threads took: 0.0000146 seconds +2019-12-13T15:58:35.762-0500: 5949.441: Total time for which application threads were stopped: 0.0000387 seconds, Stopping threads took: 0.0000131 seconds +2019-12-13T15:58:35.790-0500: 5949.469: Total time for which application threads were stopped: 0.0000792 seconds, Stopping threads took: 0.0000227 seconds +2019-12-13T15:58:35.825-0500: 5949.505: Total time for which application threads were stopped: 0.0018974 seconds, Stopping threads took: 0.0009431 seconds +2019-12-13T15:58:35.845-0500: 5949.524: Total time for which application threads were stopped: 0.0038627 seconds, Stopping threads took: 0.0037713 seconds +2019-12-13T15:58:35.845-0500: 5949.525: Total time for which application threads were stopped: 0.0003415 seconds, Stopping threads took: 0.0002770 seconds +2019-12-13T15:58:35.856-0500: 5949.535: Total time for which application threads were stopped: 0.0001537 seconds, Stopping threads took: 0.0000599 seconds +2019-12-13T15:58:35.856-0500: 5949.535: Total time for which application threads were stopped: 0.0001040 seconds, Stopping threads took: 0.0000346 seconds +2019-12-13T15:58:35.861-0500: 5949.540: Total time for which application threads were stopped: 0.0001447 seconds, Stopping threads took: 0.0000367 seconds +2019-12-13T15:58:35.871-0500: 5949.551: Total time for which application threads were stopped: 0.0001568 seconds, Stopping threads took: 0.0000513 seconds +2019-12-13T15:58:35.876-0500: 5949.555: Total time for which application threads were stopped: 0.0002530 seconds, Stopping threads took: 0.0000532 seconds +2019-12-13T15:58:35.885-0500: 5949.564: Total time for which application threads were stopped: 0.0015837 seconds, Stopping threads took: 0.0014686 seconds +2019-12-13T15:58:35.897-0500: 5949.576: Total time for which application threads were stopped: 0.0001451 seconds, Stopping threads took: 0.0000412 seconds +2019-12-13T15:58:35.897-0500: 5949.577: Total time for which application threads were stopped: 0.0001025 seconds, Stopping threads took: 0.0000230 seconds +2019-12-13T15:58:35.897-0500: 5949.577: Total time for which application threads were stopped: 0.0000632 seconds, Stopping threads took: 0.0000166 seconds +2019-12-13T15:58:35.897-0500: 5949.577: Total time for which application threads were stopped: 0.0000689 seconds, Stopping threads took: 0.0000172 seconds +2019-12-13T15:58:35.897-0500: 5949.577: Total time for which application threads were stopped: 0.0000850 seconds, Stopping threads took: 0.0000176 seconds +2019-12-13T15:58:35.898-0500: 5949.577: Total time for which application threads were stopped: 0.0001922 seconds, Stopping threads took: 0.0001196 seconds +2019-12-13T15:58:35.898-0500: 5949.577: Total time for which application threads were stopped: 0.0000606 seconds, Stopping threads took: 0.0000168 seconds +2019-12-13T15:58:35.898-0500: 5949.577: Total time for which application threads were stopped: 0.0000555 seconds, Stopping threads took: 0.0000159 seconds +2019-12-13T15:58:35.898-0500: 5949.577: Total time for which application threads were stopped: 0.0000564 seconds, Stopping threads took: 0.0000160 seconds +2019-12-13T15:58:35.898-0500: 5949.577: Total time for which application threads were stopped: 0.0000587 seconds, Stopping threads took: 0.0000161 seconds +2019-12-13T15:58:35.927-0500: 5949.607: Total time for which application threads were stopped: 0.0001109 seconds, Stopping threads took: 0.0000534 seconds +2019-12-13T15:58:36.856-0500: 5950.535: Total time for which application threads were stopped: 0.0001815 seconds, Stopping threads took: 0.0000219 seconds +2019-12-13T15:58:37.856-0500: 5951.535: Total time for which application threads were stopped: 0.0000822 seconds, Stopping threads took: 0.0000206 seconds +2019-12-13T15:58:46.860-0500: 5960.539: Total time for which application threads were stopped: 0.0000913 seconds, Stopping threads took: 0.0000300 seconds +2019-12-13T15:58:59.867-0500: 5973.545: Total time for which application threads were stopped: 0.0000974 seconds, Stopping threads took: 0.0000263 seconds +2019-12-13T15:59:31.882-0500: 6005.560: Total time for which application threads were stopped: 0.0001038 seconds, Stopping threads took: 0.0000309 seconds +2019-12-13T16:00:35.912-0500: 6069.588: Total time for which application threads were stopped: 0.0000783 seconds, Stopping threads took: 0.0000223 seconds +2019-12-13T16:02:55.980-0500: 6209.653: Total time for which application threads were stopped: 0.0000870 seconds, Stopping threads took: 0.0000270 seconds +2019-12-13T16:07:01.094-0500: 6454.762: Total time for which application threads were stopped: 0.0001021 seconds, Stopping threads took: 0.0000318 seconds +2019-12-13T16:07:51.119-0500: 6504.786: Total time for which application threads were stopped: 0.0000833 seconds, Stopping threads took: 0.0000264 seconds +2019-12-13T16:09:42.175-0500: 6615.841: Total time for which application threads were stopped: 0.0001578 seconds, Stopping threads took: 0.0001029 seconds +2019-12-13T16:09:47.178-0500: 6620.843: Total time for which application threads were stopped: 0.0000833 seconds, Stopping threads took: 0.0000343 seconds +2019-12-13T16:09:52.181-0500: 6625.847: Total time for which application threads were stopped: 0.0000839 seconds, Stopping threads took: 0.0000264 seconds +2019-12-13T16:09:54.183-0500: 6627.848: Total time for which application threads were stopped: 0.0000903 seconds, Stopping threads took: 0.0000231 seconds +2019-12-13T16:09:55.183-0500: 6628.848: Total time for which application threads were stopped: 0.0000877 seconds, Stopping threads took: 0.0000241 seconds +2019-12-13T16:09:56.184-0500: 6629.849: Total time for which application threads were stopped: 0.0001001 seconds, Stopping threads took: 0.0000234 seconds +2019-12-13T16:10:02.186-0500: 6635.851: Total time for which application threads were stopped: 0.0000840 seconds, Stopping threads took: 0.0000265 seconds +2019-12-13T16:10:04.187-0500: 6637.852: Total time for which application threads were stopped: 0.0001204 seconds, Stopping threads took: 0.0000261 seconds +2019-12-13T16:10:21.197-0500: 6654.861: Total time for which application threads were stopped: 0.0000971 seconds, Stopping threads took: 0.0000267 seconds +2019-12-13T16:10:22.197-0500: 6655.862: Total time for which application threads were stopped: 0.0000808 seconds, Stopping threads took: 0.0000242 seconds +2019-12-13T16:10:23.198-0500: 6656.862: Total time for which application threads were stopped: 0.0000840 seconds, Stopping threads took: 0.0000238 seconds +2019-12-13T16:10:24.198-0500: 6657.863: Total time for which application threads were stopped: 0.0000868 seconds, Stopping threads took: 0.0000266 seconds +2019-12-13T16:10:25.199-0500: 6658.864: Total time for which application threads were stopped: 0.0000835 seconds, Stopping threads took: 0.0000269 seconds +2019-12-13T16:12:13.248-0500: 6766.911: Total time for which application threads were stopped: 0.0001228 seconds, Stopping threads took: 0.0000299 seconds +2019-12-13T16:12:56.273-0500: 6809.935: Total time for which application threads were stopped: 0.0001019 seconds, Stopping threads took: 0.0000298 seconds +2019-12-13T16:13:04.277-0500: 6817.939: Total time for which application threads were stopped: 0.0000859 seconds, Stopping threads took: 0.0000274 seconds +2019-12-13T16:14:31.319-0500: 6904.979: Total time for which application threads were stopped: 0.0001123 seconds, Stopping threads took: 0.0000309 seconds +2019-12-13T16:14:32.319-0500: 6905.979: Total time for which application threads were stopped: 0.0001097 seconds, Stopping threads took: 0.0000280 seconds +2019-12-13T16:16:32.379-0500: 7026.037: Total time for which application threads were stopped: 0.0000783 seconds, Stopping threads took: 0.0000233 seconds +2019-12-13T16:17:31.409-0500: 7085.066: Total time for which application threads were stopped: 0.0000940 seconds, Stopping threads took: 0.0000354 seconds +2019-12-13T16:18:36.447-0500: 7150.103: Total time for which application threads were stopped: 0.0000948 seconds, Stopping threads took: 0.0000364 seconds +2019-12-13T16:19:01.459-0500: 7175.114: Total time for which application threads were stopped: 0.0000938 seconds, Stopping threads took: 0.0000270 seconds +2019-12-13T16:19:31.474-0500: 7205.129: Total time for which application threads were stopped: 0.0000943 seconds, Stopping threads took: 0.0000283 seconds +2019-12-13T16:19:32.474-0500: 7206.129: Total time for which application threads were stopped: 0.0000866 seconds, Stopping threads took: 0.0000244 seconds +2019-12-13T16:21:26.529-0500: 7320.182: Total time for which application threads were stopped: 0.0000850 seconds, Stopping threads took: 0.0000263 seconds +2019-12-13T16:21:32.532-0500: 7326.184: Total time for which application threads were stopped: 0.0000867 seconds, Stopping threads took: 0.0000260 seconds +2019-12-13T16:22:32.557-0500: 7386.209: Total time for which application threads were stopped: 0.0000828 seconds, Stopping threads took: 0.0000258 seconds +2019-12-13T16:23:09.578-0500: 7423.228: Total time for which application threads were stopped: 0.0000867 seconds, Stopping threads took: 0.0000266 seconds +2019-12-13T16:23:12.579-0500: 7426.230: Total time for which application threads were stopped: 0.0000878 seconds, Stopping threads took: 0.0000262 seconds +2019-12-13T16:23:13.579-0500: 7427.230: Total time for which application threads were stopped: 0.0001116 seconds, Stopping threads took: 0.0000279 seconds +2019-12-13T16:23:14.580-0500: 7428.231: Total time for which application threads were stopped: 0.0000861 seconds, Stopping threads took: 0.0000273 seconds +2019-12-13T16:23:18.581-0500: 7432.232: Total time for which application threads were stopped: 0.0000899 seconds, Stopping threads took: 0.0000285 seconds +2019-12-13T16:23:31.589-0500: 7445.240: Total time for which application threads were stopped: 0.0000942 seconds, Stopping threads took: 0.0000286 seconds +2019-12-13T16:23:39.593-0500: 7453.243: Total time for which application threads were stopped: 0.0001319 seconds, Stopping threads took: 0.0000374 seconds +2019-12-13T16:23:41.594-0500: 7455.244: Total time for which application threads were stopped: 0.0000986 seconds, Stopping threads took: 0.0000269 seconds +2019-12-13T16:23:44.596-0500: 7458.246: Total time for which application threads were stopped: 0.0000753 seconds, Stopping threads took: 0.0000196 seconds +2019-12-13T16:23:45.597-0500: 7459.247: Total time for which application threads were stopped: 0.0000923 seconds, Stopping threads took: 0.0000269 seconds +2019-12-13T16:23:50.598-0500: 7464.248: Total time for which application threads were stopped: 0.0000901 seconds, Stopping threads took: 0.0000260 seconds +2019-12-13T16:24:02.603-0500: 7476.253: Total time for which application threads were stopped: 0.0000879 seconds, Stopping threads took: 0.0000266 seconds +2019-12-13T16:24:03.603-0500: 7477.253: Total time for which application threads were stopped: 0.0000809 seconds, Stopping threads took: 0.0000256 seconds +2019-12-13T16:24:05.604-0500: 7479.254: Total time for which application threads were stopped: 0.0000870 seconds, Stopping threads took: 0.0000265 seconds +2019-12-13T16:24:07.605-0500: 7481.255: Total time for which application threads were stopped: 0.0000906 seconds, Stopping threads took: 0.0000275 seconds +2019-12-13T16:24:09.606-0500: 7483.256: Total time for which application threads were stopped: 0.0000833 seconds, Stopping threads took: 0.0000252 seconds +2019-12-13T16:24:10.606-0500: 7484.256: Total time for which application threads were stopped: 0.0000848 seconds, Stopping threads took: 0.0000252 seconds +2019-12-13T16:24:11.606-0500: 7485.256: Total time for which application threads were stopped: 0.0000895 seconds, Stopping threads took: 0.0000260 seconds +2019-12-13T16:24:12.607-0500: 7486.257: Total time for which application threads were stopped: 0.0000837 seconds, Stopping threads took: 0.0000257 seconds +2019-12-13T16:24:14.608-0500: 7488.258: Total time for which application threads were stopped: 0.0000851 seconds, Stopping threads took: 0.0000265 seconds +2019-12-13T16:24:16.609-0500: 7490.259: Total time for which application threads were stopped: 0.0000911 seconds, Stopping threads took: 0.0000254 seconds +2019-12-13T16:24:24.612-0500: 7498.261: Total time for which application threads were stopped: 0.0001183 seconds, Stopping threads took: 0.0000294 seconds +2019-12-13T16:24:25.612-0500: 7499.262: Total time for which application threads were stopped: 0.0002358 seconds, Stopping threads took: 0.0001474 seconds +2019-12-13T16:24:50.625-0500: 7524.274: Total time for which application threads were stopped: 0.0000804 seconds, Stopping threads took: 0.0000241 seconds +2019-12-13T16:30:42.805-0500: 7876.448: Total time for which application threads were stopped: 0.0002015 seconds, Stopping threads took: 0.0000382 seconds +2019-12-13T16:36:07.971-0500: 8201.609: Total time for which application threads were stopped: 0.0001098 seconds, Stopping threads took: 0.0000310 seconds +2019-12-13T16:36:16.975-0500: 8210.612: Total time for which application threads were stopped: 0.0000827 seconds, Stopping threads took: 0.0000270 seconds +2019-12-13T16:36:31.982-0500: 8225.619: Total time for which application threads were stopped: 0.0000675 seconds, Stopping threads took: 0.0000229 seconds +2019-12-13T16:36:32.982-0500: 8226.620: Total time for which application threads were stopped: 0.0000745 seconds, Stopping threads took: 0.0000217 seconds +2019-12-13T16:44:33.635-0500: 8707.266: Total time for which application threads were stopped: 0.0007029 seconds, Stopping threads took: 0.0003845 seconds +2019-12-13T16:44:34.637-0500: 8708.267: Total time for which application threads were stopped: 0.0001147 seconds, Stopping threads took: 0.0000310 seconds +2019-12-13T16:45:15.662-0500: 8749.291: Total time for which application threads were stopped: 0.0001041 seconds, Stopping threads took: 0.0000289 seconds +2019-12-13T16:45:26.667-0500: 8760.296: Total time for which application threads were stopped: 0.0001035 seconds, Stopping threads took: 0.0000324 seconds +{Heap before GC invocations=5 (full 0): + garbage-first heap total 524288K, used 330659K [0x00000000e0000000, 0x00000000e0101000, 0x0000000100000000) + region size 1024K, 307 young (314368K), 4 survivors (4096K) + Metaspace used 32005K, capacity 33082K, committed 33408K, reserved 1079296K + class space used 3875K, capacity 4129K, committed 4224K, reserved 1048576K +2019-12-13T16:45:41.460-0500: 8775.090: [GC pause (G1 Evacuation Pause) (young) +Desired survivor size 20447232 bytes, new threshold 15 (max 15) +- age 1: 394704 bytes, 394704 total +- age 2: 1186424 bytes, 1581128 total +, 0.1129248 secs] + [Parallel Time: 99.7 ms, GC Workers: 8] + [GC Worker Start (ms): Min: 8775094.0, Avg: 8775094.9, Max: 8775095.4, Diff: 1.5] + [Ext Root Scanning (ms): Min: 1.3, Avg: 12.0, Max: 70.9, Diff: 69.6, Sum: 95.9] + [Update RS (ms): Min: 0.0, Avg: 5.9, Max: 14.2, Diff: 14.2, Sum: 47.5] + [Processed Buffers: Min: 0, Avg: 3.6, Max: 10, Diff: 10, Sum: 29] + [Scan RS (ms): Min: 0.0, Avg: 0.0, Max: 0.1, Diff: 0.1, Sum: 0.3] + [Code Root Scanning (ms): Min: 0.0, Avg: 0.9, Max: 2.1, Diff: 2.1, Sum: 6.9] + [Object Copy (ms): Min: 12.1, Avg: 58.2, Max: 74.6, Diff: 62.6, Sum: 465.7] + [Termination (ms): Min: 15.1, Avg: 21.2, Max: 25.9, Diff: 10.8, Sum: 170.0] + [Termination Attempts: Min: 145, Avg: 171.0, Max: 187, Diff: 42, Sum: 1368] + [GC Worker Other (ms): Min: 0.0, Avg: 0.0, Max: 0.1, Diff: 0.1, Sum: 0.3] + [GC Worker Total (ms): Min: 97.8, Avg: 98.3, Max: 99.2, Diff: 1.5, Sum: 786.5] + [GC Worker End (ms): Min: 8775193.2, Avg: 8775193.2, Max: 8775193.2, Diff: 0.0] + [Code Root Fixup: 0.4 ms] + [Code Root Purge: 0.8 ms] + [Clear CT: 0.5 ms] + [Other: 11.6 ms] + [Choose CSet: 0.0 ms] + [Ref Proc: 6.1 ms] + [Ref Enq: 0.1 ms] + [Redirty Cards: 0.2 ms] + [Humongous Register: 0.6 ms] + [Humongous Reclaim: 0.0 ms] + [Free CSet: 0.8 ms] + [Eden: 303.0M(303.0M)->0.0B(289.0M) Survivors: 4096.0K->18.0M Heap: 322.9M(512.0M)->33.2M(512.0M)] +Heap after GC invocations=6 (full 0): + garbage-first heap total 524288K, used 34032K [0x00000000e0000000, 0x00000000e0101000, 0x0000000100000000) + region size 1024K, 18 young (18432K), 18 survivors (18432K) + Metaspace used 32005K, capacity 33082K, committed 33408K, reserved 1079296K + class space used 3875K, capacity 4129K, committed 4224K, reserved 1048576K +} + [Times: user=0.20 sys=0.20, real=0.11 secs] diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx index 41825cda7..450add208 100644 --- a/src/client/views/pdf/PDFViewer.tsx +++ b/src/client/views/pdf/PDFViewer.tsx @@ -136,16 +136,18 @@ export class PDFViewer extends DocAnnotatableComponent this._showWaiting = this._showCover = true); this.props.startupLive && this.setupPdfJsViewer(); @@ -623,7 +625,8 @@ export class PDFViewer extends DocAnnotatableComponent this._coverPath.path = "http://www.cs.brown.edu/~bcz/face.gif")} onLoad={action(() => this._showWaiting = false)} + const resolved = Utils.prepend(this._coverPath.path); + return this._coverPath.path = "http://www.cs.brown.edu/~bcz/face.gif")} onLoad={action(() => this._showWaiting = false)} style={{ position: "absolute", display: "inline-block", top: 0, left: 0, width: `${nativeWidth}px`, height: `${nativeHeight}px` }} />; } diff --git a/src/server/ApiManagers/PDFManager.ts b/src/server/ApiManagers/PDFManager.ts index a190ab0cb..30fadfebd 100644 --- a/src/server/ApiManagers/PDFManager.ts +++ b/src/server/ApiManagers/PDFManager.ts @@ -24,6 +24,14 @@ export default class PDFManager extends ApiManager { } +function dispatchThumbnail(res: express.Response, { width, height }: Pdfjs.PDFPageViewport, thumbnailName: string) { + res.send({ + path: clientPathToFile(Directory.pdf_thumbnails, thumbnailName), + width, + height + }); +} + function getOrCreateThumbnail(thumbnailName: string, res: express.Response) { const noExtension = thumbnailName.substring(0, thumbnailName.length - ".png".length); const pageString = noExtension.split('-')[1]; @@ -33,17 +41,13 @@ function getOrCreateThumbnail(thumbnailName: string, res: express.Response) { exists(path, (exists: boolean) => { if (exists) { const existingThumbnail = createReadStream(path); - imageSize(existingThumbnail, (err: any, { width, height }: any) => { + imageSize(existingThumbnail, (err: any, viewport: any) => { if (err) { console.log(red(`In PDF thumbnail response, unable to determine dimensions of ${thumbnailName}:`)); console.log(err); return; } - res.send({ - path: clientPathToFile(Directory.pdf_thumbnails, thumbnailName), - width, - height - }); + dispatchThumbnail(res, viewport, thumbnailName); }); } else { const offset = thumbnailName.length - pageString.length - 5; @@ -70,19 +74,20 @@ async function CreateThumbnail(file: string, pageNumber: number, res: express.Re await page.render(renderContext).promise; const pngStream = canvas.createPNGStream(); const filenames = path.basename(file).split("."); - const pngFile = serverPathToFile(Directory.pdf_thumbnails, `${filenames[0]}-${pageNumber}.png`); + const thumbnailName = `${filenames[0]}-${pageNumber}.png`; + const pngFile = serverPathToFile(Directory.pdf_thumbnails, thumbnailName); const out = createWriteStream(pngFile); pngStream.pipe(out); - out.on("finish", () => { - res.send({ - path: pngFile, - width: viewport.width, - height: viewport.height + return new Promise((resolve, reject) => { + out.on("finish", () => { + dispatchThumbnail(res, viewport, thumbnailName); + resolve(); + }); + out.on("error", error => { + console.log(red(`In PDF thumbnail creation, encountered the following error when piping ${pngFile}:`)); + console.log(error); + reject(); }); - }); - out.on("error", error => { - console.log(red(`In PDF thumbnail creation, encountered the following error when piping ${pngFile}:`)); - console.log(error); }); } -- cgit v1.2.3-70-g09d2 From 6e6c4f7fd6b36cae11b9dc5089e672f457d5944f Mon Sep 17 00:00:00 2001 From: Sam Wilkins Date: Fri, 13 Dec 2019 17:04:23 -0500 Subject: added re-write check to constructor --- src/client/views/pdf/PDFViewer.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/client/views/pdf') diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx index 450add208..648522cd9 100644 --- a/src/client/views/pdf/PDFViewer.tsx +++ b/src/client/views/pdf/PDFViewer.tsx @@ -121,11 +121,8 @@ export class PDFViewer extends DocAnnotatableComponent this._script.run({ this: anno }, console.log, true).result); } - _lastSearch: string = ""; - componentDidMount = async () => { - !this.props.Document.lockedTransform && (this.props.Document.lockedTransform = true); - // change the address to be the file address of the PNG version of each page - // file address of the pdf + constructor(props: any) { + super(props); const backup = "oldPath"; const { url, Document } = this.props; const pathCorrectionTest = /upload\_[a-z0-9]{32}.(.*)/g; @@ -147,6 +144,13 @@ export class PDFViewer extends DocAnnotatableComponent { + !this.props.Document.lockedTransform && (this.props.Document.lockedTransform = true); + // change the address to be the file address of the PNG version of each page + // file address of the pdf const path = Utils.prepend(`/thumbnail${this.props.url.substring("files/pdfs/".length, this.props.url.length - ".pdf".length)}-${(this.Document.curPage || 1)}.png`); this._coverPath = JSON.parse(await rp.get(path)); runInAction(() => this._showWaiting = this._showCover = true); -- cgit v1.2.3-70-g09d2 From 4a0cd5a75d6f77067ee5d119012c489d73ffb649 Mon Sep 17 00:00:00 2001 From: Sam Wilkins Date: Fri, 13 Dec 2019 17:31:21 -0500 Subject: wrong constructor dammit --- src/client/views/nodes/PDFBox.tsx | 27 +++++++++++++++++++++++++-- src/client/views/pdf/PDFViewer.tsx | 25 ------------------------- 2 files changed, 25 insertions(+), 27 deletions(-) (limited to 'src/client/views/pdf') diff --git a/src/client/views/nodes/PDFBox.tsx b/src/client/views/nodes/PDFBox.tsx index af996b3d8..9f67f3eab 100644 --- a/src/client/views/nodes/PDFBox.tsx +++ b/src/client/views/nodes/PDFBox.tsx @@ -6,8 +6,8 @@ import "pdfjs-dist/web/pdf_viewer.css"; import { Opt, WidthSym, Doc } from "../../../new_fields/Doc"; import { makeInterface } from "../../../new_fields/Schema"; import { ScriptField } from '../../../new_fields/ScriptField'; -import { Cast, NumCast } from "../../../new_fields/Types"; -import { PdfField } from "../../../new_fields/URLField"; +import { Cast, NumCast, StrCast } from "../../../new_fields/Types"; +import { PdfField, URLField } from "../../../new_fields/URLField"; import { Utils } from '../../../Utils'; import { KeyCodes } from '../../northstar/utils/KeyCodes'; import { undoBatch } from '../../util/UndoManager'; @@ -49,6 +49,29 @@ export class PDFBox extends DocAnnotatableComponent constructor(props: any) { super(props); this._initialScale = this.props.ScreenToLocalTransform().Scale; + + const backup = "oldPath"; + const { Document } = this.props; + const { url: { href } } = Cast(Document[this.props.fieldKey], PdfField)!; + const pathCorrectionTest = /upload\_[a-z0-9]{32}.(.*)/g; + const matches = pathCorrectionTest.exec(href); + console.log("\nHere's the { url } being fed into the outer regex:"); + console.log(href); + console.log("And here's the 'properPath' build from the captured filename:\n"); + if (matches !== null) { + const properPath = Utils.prepend(`/files/pdfs/${matches[0]}`); + console.log(properPath); + if (!properPath.includes(href)) { + console.log(`The two (url and proper path) were not equal`); + const proto = Doc.GetProto(Document); + proto[this.props.fieldKey] = new PdfField(properPath); + proto[backup] = href; + } else { + console.log(`The two (url and proper path) were equal`); + } + } else { + console.log("Outer matches was null!"); + } } componentWillUnmount() { diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx index 648522cd9..e34d353f4 100644 --- a/src/client/views/pdf/PDFViewer.tsx +++ b/src/client/views/pdf/PDFViewer.tsx @@ -121,31 +121,6 @@ export class PDFViewer extends DocAnnotatableComponent this._script.run({ this: anno }, console.log, true).result); } - constructor(props: any) { - super(props); - const backup = "oldPath"; - const { url, Document } = this.props; - const pathCorrectionTest = /upload\_[a-z0-9]{32}.(.*)/g; - const matches = pathCorrectionTest.exec(url); - console.log("\nHere's the { url } being fed into the outer regex:"); - console.log(url); - console.log("And here's the 'properPath' build from the captured filename:\n"); - if (matches !== null) { - const properPath = Utils.prepend(`/files/pdfs/${matches[0]}`); - console.log(properPath); - if (!properPath.includes(url)) { - console.log(`The two (url and proper path) were not equal`); - const proto = Doc.GetProto(Document); - proto[this.props.fieldKey] = new PdfField(properPath); - proto[backup] = url; - } else { - console.log(`The two (url and proper path) were equal`); - } - } else { - console.log("Outer matches was null!"); - } - } - _lastSearch: string = ""; componentDidMount = async () => { !this.props.Document.lockedTransform && (this.props.Document.lockedTransform = true); -- cgit v1.2.3-70-g09d2 From 56e384f2d97d2c399adf21fcf58143773fe3fd53 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Sat, 14 Dec 2019 01:51:13 -0500 Subject: fixes to make nativewidth/height more robust for PDFs. fixes for search - filter out extension docs. --- src/client/documents/Documents.ts | 11 ++++--- src/client/util/DragManager.ts | 23 ++++++++------ .../util/Import & Export/DirectoryImportBox.tsx | 7 +---- src/client/util/SearchUtil.ts | 4 +-- src/client/views/DocComponent.tsx | 1 + src/client/views/collections/CollectionSubView.tsx | 4 +-- .../views/collections/ParentDocumentSelector.tsx | 2 +- src/client/views/nodes/PDFBox.tsx | 34 ++++++++++++-------- src/client/views/pdf/PDFMenu.tsx | 36 ++-------------------- src/client/views/pdf/PDFViewer.tsx | 4 +-- src/client/views/search/SearchBox.tsx | 5 ++- src/new_fields/Doc.ts | 11 +++++-- 12 files changed, 61 insertions(+), 81 deletions(-) (limited to 'src/client/views/pdf') diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 7df08c7e6..4ba45ac30 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -112,7 +112,7 @@ export interface DocumentOptions { dropConverter?: ScriptField; // script to run when documents are dropped on this Document. strokeWidth?: number; color?: string; - limitHeight?:number; // maximum height for newly created (eg, from pasting) text documents + limitHeight?: number; // maximum height for newly created (eg, from pasting) text documents // [key: string]: Opt; } @@ -181,7 +181,7 @@ export namespace Docs { }], [DocumentType.PDF, { layout: { view: PDFBox, dataField: data }, - options: { nativeWidth: 1200, curPage: 1 } + options: { curPage: 1 } }], [DocumentType.ICON, { layout: { view: IconBox, dataField: data }, @@ -644,17 +644,20 @@ export namespace Docs { let ctor: ((path: string, options: DocumentOptions) => (Doc | Promise)) | undefined = undefined; if (type.indexOf("image") !== -1) { ctor = Docs.Create.ImageDocument; + if (!options.width) options.width = 300; } if (type.indexOf("video") !== -1) { ctor = Docs.Create.VideoDocument; + if (!options.width) options.width = 600; + if (!options.height) options.height = options.width * 2 / 3; } if (type.indexOf("audio") !== -1) { ctor = Docs.Create.AudioDocument; } if (type.indexOf("pdf") !== -1) { ctor = Docs.Create.PdfDocument; - options.nativeWidth = 927; - options.nativeHeight = 1200; + if (!options.width) options.width = 400; + if (!options.height) options.height = options.width * 1200 / 927; } if (type.indexOf("excel") !== -1) { ctor = Docs.Create.DBDocument; diff --git a/src/client/util/DragManager.ts b/src/client/util/DragManager.ts index 326262895..2631a1e3c 100644 --- a/src/client/util/DragManager.ts +++ b/src/client/util/DragManager.ts @@ -18,7 +18,7 @@ import { convertDropDataToButtons } from "./DropConverter"; export type dropActionType = "alias" | "copy" | undefined; export function SetupDrag( _reference: React.RefObject, - docFunc: () => Doc | Promise, + docFunc: () => Doc | Promise | undefined, moveFunc?: DragManager.MoveFunction, dropAction?: dropActionType, treeViewId?: string, @@ -32,13 +32,15 @@ export function SetupDrag( document.removeEventListener("pointermove", onRowMove); document.removeEventListener('pointerup', onRowUp); const doc = await docFunc(); - const dragData = new DragManager.DocumentDragData([doc]); - dragData.dropAction = dropAction; - dragData.moveDocument = moveFunc; - dragData.treeViewId = treeViewId; - dragData.dontHideOnDrop = dontHideOnDrop; - DragManager.StartDocumentDrag([_reference.current!], dragData, e.x, e.y); - dragStarted && dragStarted(); + if (doc) { + const dragData = new DragManager.DocumentDragData([doc]); + dragData.dropAction = dropAction; + dragData.moveDocument = moveFunc; + dragData.treeViewId = treeViewId; + dragData.dontHideOnDrop = dontHideOnDrop; + DragManager.StartDocumentDrag([_reference.current!], dragData, e.x, e.y); + dragStarted && dragStarted(); + } }; const onRowUp = (): void => { document.removeEventListener("pointermove", onRowMove); @@ -49,12 +51,13 @@ export function SetupDrag( e.stopPropagation(); if (e.shiftKey && CollectionDockingView.Instance) { e.persist(); - CollectionDockingView.Instance.StartOtherDrag({ + let dragDoc = await docFunc(); + dragDoc && CollectionDockingView.Instance.StartOtherDrag({ pageX: e.pageX, pageY: e.pageY, preventDefault: emptyFunction, button: 0 - }, [await docFunc()]); + }, [dragDoc]); } else { document.addEventListener("pointermove", onRowMove); document.addEventListener("pointerup", onRowUp); diff --git a/src/client/util/Import & Export/DirectoryImportBox.tsx b/src/client/util/Import & Export/DirectoryImportBox.tsx index e6a215b2c..5b5bffd8c 100644 --- a/src/client/util/Import & Export/DirectoryImportBox.tsx +++ b/src/client/util/Import & Export/DirectoryImportBox.tsx @@ -122,12 +122,7 @@ export default class DirectoryImportBox extends React.Component await Promise.all(uploads.map(async ({ name, type, clientAccessPath, exifData }) => { const path = Utils.prepend(clientAccessPath); - const options = { - nativeWidth: 300, - width: 300, - title: name - }; - const document = await Docs.Get.DocumentFromType(type, path, options); + const document = await Docs.Get.DocumentFromType(type, path, { width: 300, title: name }); const { data, error } = exifData; if (document) { Doc.GetProto(document).exif = error || Docs.Get.DocumentHierarchyFromJson(data); diff --git a/src/client/util/SearchUtil.ts b/src/client/util/SearchUtil.ts index 7a9176bec..1fda82880 100644 --- a/src/client/util/SearchUtil.ts +++ b/src/client/util/SearchUtil.ts @@ -64,7 +64,7 @@ export namespace SearchUtil { const textDocs = newIds.map((id: string) => textDocMap[id]).map(doc => doc as Doc); for (let i = 0; i < textDocs.length; i++) { const testDoc = textDocs[i]; - if (testDoc instanceof Doc && testDoc.type !== DocumentType.KVP && theDocs.findIndex(d => Doc.AreProtosEqual(d, testDoc)) === -1) { + if (testDoc instanceof Doc && testDoc.type !== DocumentType.KVP && testDoc.type !== DocumentType.EXTENSION && theDocs.findIndex(d => Doc.AreProtosEqual(d, testDoc)) === -1) { theDocs.push(Doc.GetProto(testDoc)); theLines.push(newLines[i].map(line => line.replace(query, query.toUpperCase()))); } @@ -74,7 +74,7 @@ export namespace SearchUtil { const docs = ids.map((id: string) => docMap[id]).map(doc => doc as Doc); for (let i = 0; i < ids.length; i++) { const testDoc = docs[i]; - if (testDoc instanceof Doc && testDoc.type !== DocumentType.KVP && (options.allowAliases || theDocs.findIndex(d => Doc.AreProtosEqual(d, testDoc)) === -1)) { + if (testDoc instanceof Doc && testDoc.type !== DocumentType.KVP && testDoc.type !== DocumentType.EXTENSION && (options.allowAliases || theDocs.findIndex(d => Doc.AreProtosEqual(d, testDoc)) === -1)) { theDocs.push(testDoc); theLines.push([]); } diff --git a/src/client/views/DocComponent.tsx b/src/client/views/DocComponent.tsx index c7ddee7ea..7fbad4638 100644 --- a/src/client/views/DocComponent.tsx +++ b/src/client/views/DocComponent.tsx @@ -59,6 +59,7 @@ export function DocAnnotatableComponent

(schema @computed get layoutDoc() { return Doc.Layout(this.props.Document); } @computed get dataDoc() { return (this.props.DataDoc && this.props.Document.isTemplateField ? this.props.DataDoc : Doc.GetProto(this.props.Document)) as Doc; } @computed get extensionDoc() { return Doc.fieldExtensionDoc(this.dataDoc, this.props.fieldKey); } + @computed get extensionDocSync() { return Doc.fieldExtensionDocSync(this.dataDoc, this.props.fieldKey); } @computed get annotationsKey() { return "annotations"; } @action.bound diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx index 5c7794cc0..062521690 100644 --- a/src/client/views/collections/CollectionSubView.tsx +++ b/src/client/views/collections/CollectionSubView.tsx @@ -262,7 +262,7 @@ export function CollectionSubView(schemaCtor: (doc: Doc) => T) { .then(result => { const type = result["content-type"]; if (type) { - Docs.Get.DocumentFromType(type, str, { ...options, width: 300, nativeWidth: type.indexOf("video") !== -1 ? 600 : 300 }) + Docs.Get.DocumentFromType(type, str, options) .then(doc => doc && this.props.addDocument(doc)); } }); @@ -281,7 +281,7 @@ export function CollectionSubView(schemaCtor: (doc: Doc) => T) { const dropFileName = file ? file.name : "-empty-"; promises.push(Networking.PostFormDataToServer("/upload", formData).then(results => { results.map(action(({ clientAccessPath }: any) => { - const full = { ...options, nativeWidth: type.indexOf("video") !== -1 ? 600 : 300, width: 300, title: dropFileName }; + const full = { ...options, width: 300, title: dropFileName }; const pathname = Utils.prepend(clientAccessPath); Docs.Get.DocumentFromType(type, pathname, full).then(doc => { doc && (Doc.GetProto(doc).fileUpload = basename(pathname).replace("upload_", "").replace(/\.[a-z0-9]*$/, "")); diff --git a/src/client/views/collections/ParentDocumentSelector.tsx b/src/client/views/collections/ParentDocumentSelector.tsx index 5208f65c4..31f19d42d 100644 --- a/src/client/views/collections/ParentDocumentSelector.tsx +++ b/src/client/views/collections/ParentDocumentSelector.tsx @@ -81,7 +81,7 @@ export class SelectorContextMenu extends React.Component { @observer export class ParentDocSelector extends React.Component { render() { - let flyout = ( + const flyout = (

diff --git a/src/client/views/nodes/PDFBox.tsx b/src/client/views/nodes/PDFBox.tsx index 9f67f3eab..2f1e1832e 100644 --- a/src/client/views/nodes/PDFBox.tsx +++ b/src/client/views/nodes/PDFBox.tsx @@ -3,7 +3,7 @@ import { action, observable, runInAction, reaction, IReactionDisposer, trace, un import { observer } from "mobx-react"; import * as Pdfjs from "pdfjs-dist"; import "pdfjs-dist/web/pdf_viewer.css"; -import { Opt, WidthSym, Doc } from "../../../new_fields/Doc"; +import { Opt, WidthSym, Doc, HeightSym } from "../../../new_fields/Doc"; import { makeInterface } from "../../../new_fields/Schema"; import { ScriptField } from '../../../new_fields/ScriptField'; import { Cast, NumCast, StrCast } from "../../../new_fields/Types"; @@ -49,6 +49,9 @@ export class PDFBox extends DocAnnotatableComponent constructor(props: any) { super(props); this._initialScale = this.props.ScreenToLocalTransform().Scale; + const nw = this.Document.nativeWidth = NumCast(this.extensionDocSync.nativeWidth, NumCast(this.Document.nativeWidth, 927)); + const nh = this.Document.nativeHeight = NumCast(this.extensionDocSync.nativeHeight, NumCast(this.Document.nativeHeight, 1200)); + !this.Document.fitWidth && !this.Document.ignoreAspect && (this.Document.height = this.Document[WidthSym]() * (nh / nw)); const backup = "oldPath"; const { Document } = this.props; @@ -78,10 +81,6 @@ export class PDFBox extends DocAnnotatableComponent this._selectReactionDisposer && this._selectReactionDisposer(); } componentDidMount() { - const pdfUrl = Cast(this.dataDoc[this.props.fieldKey], PdfField); - if (pdfUrl instanceof PdfField) { - Pdfjs.getDocument(pdfUrl.url.href).promise.then(pdf => runInAction(() => this._pdf = pdf)); - } this._selectReactionDisposer = reaction(() => this.props.isSelected(), () => { document.removeEventListener("keydown", this.onKeyDown); @@ -90,9 +89,9 @@ export class PDFBox extends DocAnnotatableComponent } loaded = (nw: number, nh: number, np: number) => { - this.dataDoc.numPages = np; - this.Document.nativeWidth = nw * 96 / 72; - this.Document.nativeHeight = nh * 96 / 72; + this.extensionDocSync.numPages = np; + this.extensionDocSync.nativeWidth = this.Document.nativeWidth = nw * 96 / 72; + this.extensionDocSync.nativeHeight = this.Document.nativeHeight = nh * 96 / 72; !this.Document.fitWidth && !this.Document.ignoreAspect && (this.Document.height = this.Document[WidthSym]() * (nh / nw)); } @@ -220,9 +219,9 @@ export class PDFBox extends DocAnnotatableComponent @computed get renderTitleBox() { const classname = "pdfBox" + (this.active() ? "-interactive" : ""); return
{this.props.Document.title} @@ -248,10 +247,19 @@ export class PDFBox extends DocAnnotatableComponent
; } + _pdfjsRequested = false; render() { const pdfUrl = Cast(this.dataDoc[this.props.fieldKey], PdfField, null); if (this.props.isSelected() || this.props.Document.scrollY !== undefined) this._everActive = true; - return !pdfUrl || !this._pdf || !this.extensionDoc || (!this._everActive && this.props.ScreenToLocalTransform().Scale > 2.5) ? - this.renderTitleBox : this.renderPdfView; + if (pdfUrl && this.extensionDoc && (this._everActive || (this.extensionDoc.nativeWidth && this.props.ScreenToLocalTransform().Scale < 2.5))) { + if (pdfUrl instanceof PdfField && this._pdf) { + return this.renderPdfView; + } + if (!this._pdfjsRequested) { + this._pdfjsRequested = true; + Pdfjs.getDocument(pdfUrl.url.href).promise.then(pdf => runInAction(() => this._pdf = pdf)); + } + } + return this.renderTitleBox; } } \ No newline at end of file diff --git a/src/client/views/pdf/PDFMenu.tsx b/src/client/views/pdf/PDFMenu.tsx index 38e10e99a..503696ae9 100644 --- a/src/client/views/pdf/PDFMenu.tsx +++ b/src/client/views/pdf/PDFMenu.tsx @@ -12,19 +12,17 @@ export default class PDFMenu extends AntimodeMenu { static Instance: PDFMenu; private _commentCont = React.createRef(); - private _snippetButton: React.RefObject = React.createRef(); @observable private _keyValue: string = ""; @observable private _valueValue: string = ""; @observable private _added: boolean = false; @observable public Highlighting: boolean = false; - @observable public Status: "pdf" | "annotation" | "snippet" | "" = ""; + @observable public Status: "pdf" | "annotation" | "" = ""; public StartDrag: (e: PointerEvent, ele: HTMLElement) => void = unimplementedFunction; public Highlight: (color: string) => Opt = (color: string) => undefined; public Delete: () => void = unimplementedFunction; - public Snippet: (marquee: { left: number, top: number, width: number, height: number }) => void = unimplementedFunction; public AddTag: (key: string, value: string) => boolean = returnFalse; public PinToPres: () => void = unimplementedFunction; public Marquee: { left: number; top: number; width: number; height: number; } | undefined; @@ -80,34 +78,6 @@ export default class PDFMenu extends AntimodeMenu { this.Delete(); } - snippetStart = (e: React.PointerEvent) => { - document.removeEventListener("pointermove", this.snippetDrag); - document.addEventListener("pointermove", this.snippetDrag); - document.removeEventListener("pointerup", this.snippetEnd); - document.addEventListener("pointerup", this.snippetEnd); - - e.stopPropagation(); - e.preventDefault(); - } - - snippetDrag = (e: PointerEvent) => { - e.stopPropagation(); - e.preventDefault(); - if (!this._dragging) { - this._dragging = true; - - this.Marquee && this.Snippet(this.Marquee); - } - } - - snippetEnd = (e: PointerEvent) => { - this._dragging = false; - document.removeEventListener("pointermove", this.snippetDrag); - document.removeEventListener("pointerup", this.snippetEnd); - e.stopPropagation(); - e.preventDefault(); - } - @action keyChanged = (e: React.ChangeEvent) => { this._keyValue = e.currentTarget.value; @@ -128,14 +98,12 @@ export default class PDFMenu extends AntimodeMenu { } render() { - const buttons = this.Status === "pdf" || this.Status === "snippet" ? + const buttons = this.Status === "pdf" ? [ , , - , ] : [ diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx index e34d353f4..1a09991d2 100644 --- a/src/client/views/pdf/PDFViewer.tsx +++ b/src/client/views/pdf/PDFViewer.tsx @@ -417,7 +417,6 @@ export class PDFViewer extends DocAnnotatableComponent v.forEach(a => a.remove())); @@ -515,7 +514,6 @@ export class PDFViewer extends DocAnnotatableComponent { this.Document.height = this.Document[WidthSym]() * this._coverPath.height / this._coverPath.width; - this.Document.nativeHeight = nativeWidth * this._coverPath.height / this._coverPath.width; + this.Document.nativeHeight = (this.Document.nativeWidth || 0) * this._coverPath.height / this._coverPath.width; }).bind(this), 0); } const nativeWidth = (this.Document.nativeWidth || 0); diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index b80c3bb54..2f28ebf76 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -234,8 +234,7 @@ export class SearchBox extends React.Component { y += 300; } } - return Docs.Create.FreeformDocument(docs, { width: 400, height: 400, panX: 175, panY: 175, backgroundColor: "grey", title: `Search Docs: "${this._searchString}"` }); - + return Docs.Create.TreeDocument(docs, { width: 200, height: 400, backgroundColor: "grey", title: `Search Docs: "${this._searchString}"` }); } @action.bound @@ -341,7 +340,7 @@ export class SearchBox extends React.Component { return (
{ e.stopPropagation(); e.preventDefault(); }}>
- + this._searchString ? this.startDragCollection() : undefined)} ref={this.collectionRef} title="Drag Results as Collection"> CreateDocumentExtensionForField(doc, fieldKey), 0); - return extension ? extension : undefined; + const extension = doc[fieldKey + "_ext"]; + if (extension === undefined) { + setTimeout(() => CreateDocumentExtensionForField(doc, fieldKey), 0); + } + return extension ? extension as Doc : undefined; + } + export function fieldExtensionDocSync(doc: Doc, fieldKey: string) { + return (doc[fieldKey + "_ext"] as Doc) || CreateDocumentExtensionForField(doc, fieldKey); } export function CreateDocumentExtensionForField(doc: Doc, fieldKey: string) { -- cgit v1.2.3-70-g09d2