From fbbc50efc4361836480a552043ed0d800d37fd24 Mon Sep 17 00:00:00 2001 From: PiTrem Date: Fri, 8 Dec 2023 11:56:50 +0100 Subject: [PATCH] Unified attachment list #1608 Squashed commit of the following: commit dedc9e506896e179139246b9468878e35a9efc1b Author: mekkyz Date: Fri Dec 8 08:31:23 2023 +0000 Fix: rspec test commit b0d2c58f1c823f6f619f5e2ae5d3034182ac8720 Author: mekkyz Date: Fri Dec 8 07:34:50 2023 +0000 Fix: spec test commit d7b683b1443d5e60f647f813271313f4dc335963 Author: mekkyz Date: Fri Dec 8 07:08:38 2023 +0000 Fix: show full attachment name on hover commit b2ac3c33dab81108831574f205ead5406c0133ca Author: mekkyz Date: Fri Dec 8 06:47:44 2023 +0000 Enhance: hide sorting ui if no attachments commit 56b08b2a42aebe26a177906eac84b1502ed0c1dc Author: mekkyz Date: Fri Dec 8 06:41:41 2023 +0000 Fix: invalid date commit 659912143098ea3ec853748f972788d91f6dfad6 Author: mekkyz Date: Fri Dec 8 06:23:58 2023 +0000 Removed discard btn for 1.9.0 commit ae611445fa34bc12d619d284132d8ce31c693465 Author: mekkyz Date: Fri Dec 8 06:21:14 2023 +0000 Enhance: strike attachment name when deleted commit 8e532e175b0c46c5a7bd1ecfd1653bd58d7b844f Author: mekkyz Date: Fri Dec 8 06:06:33 2023 +0000 Fix: uploaded attachment not showing commit 8a391dec5f69bc620f11c00fc23661009f61c358 Author: mekkyz Date: Fri Dec 8 04:35:23 2023 +0000 Fix: issues adapting new attach ls to datasets commit 03624ae9c3b1c93211b1f12cab50c80520844cdd Author: mekkyz Date: Fri Dec 8 02:43:15 2023 +0000 Refactor: changing bad child name commit b69691c920283cd7d7b2416b0b06e4802db58b64 Author: mekkyz Date: Fri Dec 8 00:54:13 2023 +0000 Fix: eslint and Hyperlinks UI commit 7648505631cb7b1e86b852256dda9baad0430d93 Author: mekkyz Date: Fri Dec 8 00:29:03 2023 +0000 Fix: eslint commit 72fa89f9743c987dea5c1a12f0102ac45022ce12 Author: mekkyz Date: Thu Dec 7 11:37:08 2023 +0000 Applying feedback and adding dynamic tooltips commit bc90f9782a848cb0e0753b7ddd08b27bde7b8fec Author: mekkyz Date: Thu Nov 30 12:06:27 2023 +0000 Fix: rspec commit a5cab78ff95782bf38b04685e587027c35bdf4e6 Author: mekkyz Date: Thu Nov 30 11:27:16 2023 +0000 Fix: rspec commit 9e00dacc0042c4503ed12c1d544d844792c1a7b0 Author: mekkyz Date: Thu Nov 30 11:20:27 2023 +0000 Feat: applying new attachment list to Datasets commit 50379335ff6cdcfda127abd6f3c3d4e3cca26bda Author: mekkyz Date: Tue Nov 28 16:07:05 2023 +0000 Fix: instant update after dropping attachment commit d5c945a82cb51f37e8cbc7dd7b18b0ef59436ec0 Author: mekkyz Date: Tue Nov 28 13:08:07 2023 +0000 Fix: image warning css changes commit 39c2f6ab36b2048aa7c20bc793ef878ffa1e07d0 Author: mekkyz Date: Tue Nov 28 12:11:03 2023 +0000 Fix: annotating wellplate attachments commit d70934ac1daff9a6b07384ea993eff5540202a43 Author: mekkyz Date: Tue Nov 28 12:03:16 2023 +0000 Fix: eslint commit 92b3b18d089144afa0ac7f0d32ca5b14b846a8c9 Author: mekkyz Date: Mon Nov 27 14:39:02 2023 +0000 Refactor: renaming const for better readability commit cbcc809c3306a953f27c16c9fa208fa2abcaf802 Author: mekkyz Date: Mon Nov 27 01:14:51 2023 +0000 Fix: eslint commit ad1adbd8eb976a133ebfb1caf4e9db49f59c0986 Author: mekkyz Date: Tue Nov 21 15:03:18 2023 +0000 Fix: not importing as element data commit 7f6181ef1932d35b60d5a34bc318376cd2940069 Author: mekkyz Date: Fri Nov 17 18:54:15 2023 +0000 Fix: eslint commit 563696e1e0a6f4753eb0d13ef1ff2e052abcd15b Author: mekkyz Date: Fri Nov 17 17:27:30 2023 +0000 Fix: eslint commit d86a7de9c7cdb892820476e328831f3898a98a2c Author: mekkyz Date: Thu Nov 16 16:28:01 2023 +0000 Fix: adapting two tests and deleting obsolete test commit 03a2ef4adb78e896d337b2cb3228e237bb890701 Author: mekkyz Date: Thu Nov 16 16:16:28 2023 +0000 Refactor: wellplate to use the new attachment list commit 571e6d5694b248262f6b1d7b03784f2511bdb1ee Author: mekkyz Date: Thu Nov 16 11:15:16 2023 +0000 Fix: eslint commit 84719d99fbb8dfb19608cb0a2abb851c6d798d44 Author: mekkyz Date: Thu Nov 16 11:13:59 2023 +0000 Style: adjusting time format commit 40cf029f545263e39f5386e119c07836d0ac6ab4 Author: mekkyz Date: Wed Nov 15 22:51:14 2023 +0000 Enhancing UI commit 70bdf22a2cb62ab295986bd0d0986dfbdb228767 Author: mekkyz Date: Wed Nov 15 22:09:29 2023 +0000 Feat: adding option to sort by upload date commit 9a22083145c48a0ca87f42e28959732d7f3ac0ce Author: mekkyz Date: Wed Nov 15 22:03:38 2023 +0000 Fix: correct file sizes with correct units commit 99c7201448465c18aa679b7587765631780b1000 Author: mekkyz Date: Wed Nov 15 21:37:07 2023 +0000 Style: eslint fixes and css enhancements commit 844cfc027ba561d05b0df2e04836fb7f3ee2e268 Author: mekkyz Date: Wed Nov 15 20:18:11 2023 +0000 Refactor: introducing AttachmentList.js commit 437635b6fcf3c745a96bdaff174ac735d7d3d7fb Author: mekkyz Date: Wed Nov 15 20:17:12 2023 +0000 Fix: adjusting to the new file name commit 351bb336348274bb6b11f8b096cceba2158fc150 Author: mekkyz Date: Wed Nov 15 19:58:20 2023 +0000 Style: unifying edited image warning text commit 374772c4215135559a2f7d5073a8a14390903079 Author: mekkyz Date: Wed Nov 15 15:07:05 2023 +0000 Style: remove redundant name field commit c50c534b94fd9987ef6469a0b7e9c9e8d7d3437d Author: mekkyz Date: Wed Nov 15 15:06:34 2023 +0000 Fix: ensure consistent title name editing commit bf61de7cd9e4194661e4efa5390894a3685e0689 Author: mekkyz Date: Wed Nov 15 10:33:44 2023 +0000 Fix: eslint commit 0bc248ed64de332b89ec8bae967c98a5142b6ff6 Author: mekkyz Date: Wed Nov 15 10:16:20 2023 +0000 Style: converting inline styles to scss commit 4da8aef4641169296c7f8246e480849eea6a7903 Author: mekkyz Date: Wed Nov 15 09:18:02 2023 +0000 Fix: added on "date" commit 613b94fd0cdd780f508a10d2190884cd096456be Author: mekkyz Date: Wed Nov 15 08:59:51 2023 +0000 UI changes and minor eslint fixes commit 5494068f465883e68c54b678a6c100a463623efc Author: mekkyz Date: Thu Nov 9 15:31:15 2023 +0000 Fix: dataset modal discarding logic commit 94d708b8f2b608297a9e8fadef8cd91305c41050 Author: mekkyz Date: Thu Nov 9 11:34:45 2023 +0000 Style: cleaner code and linking to new css classes commit 8a69e5bc63ba563d303ccecf0a78089145bcc0e9 Author: mekkyz Date: Thu Nov 9 11:34:06 2023 +0000 Fix: enhance UI and linking to new css classes commit 3c84770036ee4a8a8eb85c07353c55ec6790b863 Author: mekkyz Date: Thu Nov 9 11:33:04 2023 +0000 Fix: better styling (Annotation & Attachments) commit 559d5c40016d0c4da02482034f1126075e2193f9 Author: mekkyz Date: Wed Nov 8 11:07:53 2023 +0000 Fix: ignore `.peak` when grouping commit ad26b9c505c27c1db85c9c1f79b3a42519e8f9ab Author: mekkyz Date: Mon Nov 6 14:09:51 2023 +0000 Feat: introducing attachment grouping commit 28d79f02fc8e1e6853cf8a84a16da429a92932a3 Author: mekkyz Date: Fri Nov 3 15:41:51 2023 +0000 Fix: test error commit e0b56fd0a8a0da3c26442b42d789862142a2ce8f Author: mekkyz Date: Fri Nov 3 15:29:39 2023 +0000 fix: discard and keep changes commit 6c3ef9c5d0deb1a98d741a5192ea500e4d013fbc Author: mekkyz Date: Fri Nov 3 06:56:54 2023 +0000 Feature: Dataset Modal Redesign commit 918d12944bd40526484e9caa8f0acbb62607a831 Author: mekkyz Date: Tue Oct 31 14:21:14 2023 +0000 Fix: eslint errors commit 764fbc1f1d3cf3471860bef9fae33dcb41129cf9 Author: mekkyz Date: Mon Oct 30 05:25:34 2023 +0000 UI: enhancing attachment list commit b914b9a070b7d799d9f4beffe5cbc627b4b4b459 Author: mekkyz Date: Mon Oct 30 05:24:53 2023 +0000 Style: enabling style prop on component commit b8cde5288c6829bce1f3accccf6d0f6dd8b8b1b1 Author: TasnimMehzabin Date: Thu Dec 7 08:46:27 2023 +0100 test: fix test with deviceBox sorting in inbox Co-authored-by: Tasnim Mehzabin Refs: #1657 , #1446 --- app/assets/stylesheets/attachment-list.scss | 137 ++++ app/assets/stylesheets/format-container.scss | 59 +- app/assets/stylesheets/research-plan.scss | 33 +- .../ImageAnnotationEditButton.js | 96 +-- .../researchPlans/ImageAnnotationModalSVG.js | 30 +- .../researchPlans/ResearchPlanDetails.js | 130 ++-- .../researchPlans/SaveEditedImageWarning.js | 28 + .../researchPlans/SaveResearchPlanWarning.js | 33 - .../ResearchPlanDetailsAttachments.js | 521 +++++-------- .../ResearchPlanDetailsFieldImage.js | 8 +- .../wellplatesTab/EmbeddedWellplate.js | 73 +- .../EmbeddedResearchPlanDetails.js | 235 +++--- .../details/wellplates/WellplateDetails.js | 136 ++-- .../WellplateDetailsAttachments.js | 620 ++++++++------- .../apps/mydb/elements/list/AttachmentList.js | 227 ++++++ .../components/common/HyperLinksSection.js | 107 ++- app/packs/src/components/common/ImageModal.js | 147 ++-- .../container/AttachmentDropzone.js | 72 +- .../container/ContainerComponent.js | 62 +- .../components/container/ContainerDataset.js | 566 -------------- .../container/ContainerDatasetField.js | 163 ++-- .../container/ContainerDatasetModal.js | 179 ++++- .../container/ContainerDatasetModalContent.js | 719 ++++++++++++++++++ .../components/container/ContainerDatasets.js | 168 ++-- app/packs/src/fetchers/BaseFetcher.js | 39 +- app/packs/src/fetchers/ReactionsFetcher.js | 38 +- .../src/fetchers/ResearchPlansFetcher.js | 31 +- app/packs/src/fetchers/SamplesFetcher.js | 69 +- app/packs/src/fetchers/WellplatesFetcher.js | 22 +- app/packs/src/models/Wellplate.js | 42 +- spec/api/chemotion/attachment_api_spec.rb | 6 +- spec/api/chemotion/sample_api_spec.rb | 6 +- .../ImageAnnotationEditButton.spec.js | 16 +- 33 files changed, 2847 insertions(+), 1971 deletions(-) create mode 100644 app/assets/stylesheets/attachment-list.scss create mode 100644 app/packs/src/apps/mydb/elements/details/researchPlans/SaveEditedImageWarning.js delete mode 100644 app/packs/src/apps/mydb/elements/details/researchPlans/SaveResearchPlanWarning.js create mode 100644 app/packs/src/apps/mydb/elements/list/AttachmentList.js delete mode 100644 app/packs/src/components/container/ContainerDataset.js create mode 100644 app/packs/src/components/container/ContainerDatasetModalContent.js diff --git a/app/assets/stylesheets/attachment-list.scss b/app/assets/stylesheets/attachment-list.scss new file mode 100644 index 0000000000..6adf6773c9 --- /dev/null +++ b/app/assets/stylesheets/attachment-list.scss @@ -0,0 +1,137 @@ +.attachment-dropzone { + width: 100%; + padding: 20px; + border: 4px dashed #cccccc; + text-align: center; + margin-bottom: 20px; + background-color: #ffffff; + border-radius: 10px; + box-shadow: 0px 2px 4px rgba(0,0,0,0.1); + transition: all 0.3s ease; +} + +.attachment-dropzone:hover { + border-color: #a0a0a0; + box-shadow: 0px 4px 8px rgba(0,0,0,0.15); +} + +.sorting-row-style { + padding: 5px; + border-radius: 5px; + border: 1px solid #ccc; + height: 35px; +} + +.sort-icon-style { + margin-left: 5px; + cursor: auto; + font-size: 20px !important; + color: #000; + border-radius: 50%; + padding: 5px; + display: flex; + align-items: center; + justify-content: center; + transition: background-color 0.3s; + background: none !important; + border: none !important; + outline: inherit !important; +} + +.sort-icon-style:focus { + box-shadow: none !important; +} + +.sort-icon-style:hover { + color: #797979 !important; + transform: scale(1.1); + transition: color 0.3s, transform 0.3s +} + +.attachment-row { + display: flex; + align-items: center; + justify-content: center; + margin-bottom: 5px; + padding: 5px; + border-radius: 5px; + box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1); + transition: box-shadow 0.3s ease, transform 0.2s ease-out; + transform-origin: center; + position: relative; +} + +.attachment-row:hover { + box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.5); +} + +.attachment-row-image { + flex: 0.1; + margin-left: 5px; + display: flex; + justify-content: center; + align-items: center; +} + +.attachment-row-text { + flex: 0.5; + margin-left: 20px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + color: #333; + font-size: 16px; + font-weight: bold; +} + +.attachment-row-subtext { + font-size: 12px; + color: #777; +} + +.attachment-row-size { + flex: 0.2; + display: flex; + align-items: center; + justify-content: center; + color: #777; + margin-left: 10px; +} + +.attachment-row-actions { + flex: 0.4; + display: flex; + margin-right: 5px; + justify-content: flex-end; +} + +.attachment-image-modal { + width: 50px; + height: 50px; + border-radius: 5px; + object-fit: cover; + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); + transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out; +} + +.attachment-button-size { + width: 30px !important; + height: 30px !important; +} + +.attachment-gray-button { + background-color: #c0c0c0 !important; + border-color: #c0c0c0 !important; +} + +.attachment-main-container { + padding: 20px; + background-color: #ffffff; + border-radius: 5px; +} + +.no-attachments-text { + text-align: center; + font-size: 16px; + color: #888; +} diff --git a/app/assets/stylesheets/format-container.scss b/app/assets/stylesheets/format-container.scss index ad1ae76e2b..f778e6739c 100644 --- a/app/assets/stylesheets/format-container.scss +++ b/app/assets/stylesheets/format-container.scss @@ -7,32 +7,59 @@ max-height: calc(100vh - 250px); } -.attachment-dataset-modal { +.attachment-annotation-modal { height: 95%; top: 52% !important; margin: unset !important; width: calc(80vw) !important; .modal-content { height: 95%; - .modal-header .modal-title .btn-toolbar { - float: right; + .modal-title{ + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; } .modal-body { height: 90%; overflow: auto; - .row { - height: 100%; - .col-base .desc { - min-height: 200px; - } - .col-full { - // height: 100%; - .list { - overflow: auto; - max-height: calc(100% - 70px) !important; - } - } - } + max-height: calc(100% - 130px) !important; } } } + +.attachment-modal { + top: 55% !important; + height: 90%; + margin: unset !important; + width: 50vw !important; + .modal-content { + height: 90%; + .modal-title{ + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + } + .modal-body { + height: 90%; + overflow: auto; + max-height: calc(100% - 170px) !important; + } + } +} + +.attachment-name-input-div { + display: flex; + flex-grow: 1; + align-items: center; +} + +.attachment-name-input { + font-weight: bold; + color: #495057; + width: 100%; + border: none; + border-bottom: 1px solid #ccc; + padding: 2px 0; +} diff --git a/app/assets/stylesheets/research-plan.scss b/app/assets/stylesheets/research-plan.scss index 481fb1fbb6..bcfbc7b71c 100644 --- a/app/assets/stylesheets/research-plan.scss +++ b/app/assets/stylesheets/research-plan.scss @@ -164,20 +164,33 @@ } } -.research-plan-attachments-annotation-download{ - button{ +.research-plan-attachments-annotation-download{ + button{ margin-right: 10px; - } -} + } +} .imageEditedWarning{ + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + z-index: 1000; + white-space: nowrap; + div{ - background-color: rgba(252, 252, 138, 0.952); - border-color: #d0d0d0; - color: rgba(102, 102, 60, 0.95); - margin-top: 3px; - } -} + background-color: #ffcc00; + border: 1px solid #d0d0d0; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + color: #333; + padding: 10px; + margin: 0; + border-radius: 4px; + transition: all 0.3s ease; + overflow: hidden; + text-overflow: ellipsis; + } +} .research-plan-table-grid.grid-with-collapsed-rows { .ag-body-viewport { diff --git a/app/packs/src/apps/mydb/elements/details/researchPlans/ImageAnnotationEditButton.js b/app/packs/src/apps/mydb/elements/details/researchPlans/ImageAnnotationEditButton.js index 59d6b990af..0c079a21fb 100644 --- a/app/packs/src/apps/mydb/elements/details/researchPlans/ImageAnnotationEditButton.js +++ b/app/packs/src/apps/mydb/elements/details/researchPlans/ImageAnnotationEditButton.js @@ -1,63 +1,36 @@ -/* eslint-disable react/prefer-stateless-function */ -import React, { Component } from "react"; -import PropTypes from "prop-types"; -import { Button, OverlayTrigger, Tooltip } from "react-bootstrap"; +/* eslint-disable react/destructuring-assignment */ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import { Button, OverlayTrigger, Tooltip } from 'react-bootstrap'; import Attachment from 'src/models/Attachment'; export default class ImageAnnotationEditButton extends Component { - allowedFileTypes = ['png', 'jpg', 'bmp', 'tif', 'svg', 'jpeg', 'tiff'] + allowedFileTypes = ['png', 'jpg', 'bmp', 'tif', 'svg', 'jpeg', 'tiff']; - constructor(props) { - super(props); - } - - renderActiveAnnotationButton() { + renderButton(isActive, tooltipText) { return ( Annotate image} + overlay={{tooltipText}} > -