Skip to content

Commit

Permalink
MDS-5737 Fixed opening of document viewer from action menu
Browse files Browse the repository at this point in the history
  • Loading branch information
simensma-fresh committed Jan 17, 2024
1 parent d3368a7 commit 393746a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion services/common/src/components/documents/DocumentTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export const DocumentTable: FC<DocumentTableProps> = ({
label: FileOperations.View,
icon: <FileOutlined />,
clickFunction: (_event, record: MineDocument) =>
dispatch(openDocument(record.document_manager_guid, record.mine_document_guid)),
dispatch(openDocument(record.document_manager_guid, record.document_name)),
},
{
key: "download",
Expand Down
2 changes: 1 addition & 1 deletion services/core-web/src/components/common/DocumentTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export const DocumentTable: FC<DocumentTableProps> = ({
label: FileOperations.View,
icon: <FileOutlined />,
clickFunction: (_event, record: MineDocument) =>
dispatch(openDocument(record.document_manager_guid, record.mine_document_guid)),
dispatch(openDocument(record.document_manager_guid, record.document_name)),
},
{
key: "download",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from flask import request, current_app

from app.extensions import db
from app.config import Config
from app.services.object_store_storage_service import ObjectStoreStorageService
from app.docman.models.document import Document
from app.docman.models.document_version import DocumentVersion
Expand Down Expand Up @@ -220,7 +219,9 @@ def complete_upload(cls, key, new_key, doc_guid, versions=None, version_guid=Non

# Copy the file to its new location
try:
oss.copy_file(source_key=key, key=new_key)
key_prefix = Config.S3_PREFIX[:-1] if Config.S3_PREFIX and Config.S3_PREFIX !='/' else ''

oss.copy_file(source_key=key, key=key_prefix + new_key)

if version_guid is not None and versions is None:
versions = oss.list_versions(new_key)['Versions']
Expand All @@ -237,6 +238,7 @@ def complete_upload(cls, key, new_key, doc_guid, versions=None, version_guid=Non
if doc.object_store_path != new_key:
doc.object_store_path = new_key
doc.update_user = 'mds'
doc.upload_completed_date = datetime.utcnow()

db.session.add(doc)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import PropTypes from "prop-types";
import { ENVIRONMENT } from "@mds/common";
import { createRequestHeader } from "@common/utils/RequestHeaders";
import { Modal, Skeleton } from "antd";
import { closeDocumentViewer, openDocumentViewer } from "@mds/common/redux/actions/documentViewerActions";
import {
closeDocumentViewer,
openDocumentViewer,
} from "@mds/common/redux/actions/documentViewerActions";
import {
getDocumentPath,
getDocumentName,
Expand Down Expand Up @@ -113,10 +116,10 @@ export class DocumentViewer extends Component {
>
<Suspense fallback={<Skeleton />}>
<PdfViewer
serviceUrl={this.pdfViewerServiceUrl}
pdfViewerServiceUrl={this.pdfViewerServiceUrl}
documentPath={this.props.documentPath}
ajaxRequestSettings={ajaxRequestSettings}>
</PdfViewer>
ajaxRequestSettings={ajaxRequestSettings}
></PdfViewer>
</Suspense>
</Modal>
</>
Expand Down

0 comments on commit 393746a

Please sign in to comment.