diff --git a/src/mqueryfront/src/App.css b/src/mqueryfront/src/App.css index 1d67e328..361a8bc4 100644 --- a/src/mqueryfront/src/App.css +++ b/src/mqueryfront/src/App.css @@ -87,3 +87,20 @@ .cursor-pointer { cursor: pointer; } + +.modal-container { + position: fixed; + display: flex; + justify-content: center; + align-items: center; +} + +.modal-block { + position: relative; +} + +.modal-table { + max-height: 40vh; + max-width: 50vw; + overflow: scroll; +} diff --git a/src/mqueryfront/src/components/ActionShowMatchContext.js b/src/mqueryfront/src/components/ActionShowMatchContext.js new file mode 100644 index 00000000..3b2953eb --- /dev/null +++ b/src/mqueryfront/src/components/ActionShowMatchContext.js @@ -0,0 +1,78 @@ +import React, { useState } from "react"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { faLightbulb } from "@fortawesome/free-solid-svg-icons"; + +const ActionShowMatchContext = (props) => { + const [showModal, setShowModal] = useState(false); + + const modalHeader = ( +
+
Match context
+ +
+ ); + + const tableRows = Object.entries(props.context).map( + (contextItem, index) => ( + + + + {contextItem[0]} + + + {contextItem[1]} + + ) + ); + + const modalBody = ( +
+ {!props.context ? ( + "No context available" + ) : ( + + {tableRows} +
+ )} +
+ ); + + return ( + <> + +
+
+
+
+ {modalHeader} + {modalBody} +
+
+
+
+ + ); +}; + +export default ActionShowMatchContext; diff --git a/src/mqueryfront/src/query/QueryMatchesItem.js b/src/mqueryfront/src/query/QueryMatchesItem.js index 1cbf4525..1f03ed37 100644 --- a/src/mqueryfront/src/query/QueryMatchesItem.js +++ b/src/mqueryfront/src/query/QueryMatchesItem.js @@ -2,10 +2,22 @@ import React from "react"; import path from "path-browserify"; import ActionDownload from "../components/ActionDownload"; import ActionCopyToClipboard from "../components/ActionCopyToClipboard"; +import ActionShowMatchContext from "../components/ActionShowMatchContext"; const QueryMatchesItem = (props) => { const { match, download_url } = props; - const { matches, meta, file } = match; + const { matches, meta, file, context } = match; // NOTE: presuming new field in Match schema context which would be dict with 'matches' as keys + + const stubContext = context + ? context + : { + key1: + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", + key2: + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", + key3: + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", + }; const fileBasename = path.basename(file); @@ -68,6 +80,12 @@ const QueryMatchesItem = (props) => { tooltipMessage="Copy file name to clipboard" /> + + + {matchBadges} {metadataBadges}