From c5eaaf8d454637c81113a0a5b868f3977a492c29 Mon Sep 17 00:00:00 2001
From: Norbi <37236152+KatunaNorbert@users.noreply.github.com>
Date: Wed, 4 Aug 2021 15:26:03 +0300
Subject: [PATCH] Show compute jobs history in asset detail page (#735)
* displayed compute jobs on asset detail page
* filter compute jobs by datatoken address
* lint error fix
* changed query name for selecting compute orders by datatoken
* renamed Transactions component and moved it outside Pool directory
* style compose path fix
* query just one subgraph based on ddo chainId
* fixed displayed columns, added Finished column, table scroll fix
* changed AssetActionsHistoryTable titles
* made tabel cell width smaller
---
...css => AssetActionHistoryTable.module.css} | 17 +++--
.../organisms/AssetActionHistoryTable.tsx | 36 +++++++++
.../organisms/AssetActions/Compute/index.tsx | 12 ++-
.../AssetActions/Pool/Transactions.tsx | 36 ---------
.../organisms/AssetActions/Pool/index.tsx | 9 ++-
.../pages/History/ComputeJobs/index.tsx | 75 ++++++++++++++-----
6 files changed, 121 insertions(+), 64 deletions(-)
rename src/components/organisms/{AssetActions/Pool/Transactions.module.css => AssetActionHistoryTable.module.css} (78%)
create mode 100644 src/components/organisms/AssetActionHistoryTable.tsx
delete mode 100644 src/components/organisms/AssetActions/Pool/Transactions.tsx
diff --git a/src/components/organisms/AssetActions/Pool/Transactions.module.css b/src/components/organisms/AssetActionHistoryTable.module.css
similarity index 78%
rename from src/components/organisms/AssetActions/Pool/Transactions.module.css
rename to src/components/organisms/AssetActionHistoryTable.module.css
index a9e4e1eb9..20f1fd78e 100644
--- a/src/components/organisms/AssetActions/Pool/Transactions.module.css
+++ b/src/components/organisms/AssetActionHistoryTable.module.css
@@ -1,5 +1,5 @@
-.transactions {
- composes: container from './index.module.css';
+.actions {
+ composes: container from './AssetActions/Pool/index.module.css';
border-top: 1px solid var(--border-color);
margin-top: calc(var(--spacer) / 1.5);
padding: calc(var(--spacer) / 1.5);
@@ -7,12 +7,12 @@
margin-bottom: -2rem;
}
-.transactions [class*='rdt_Pagination'] {
+.actions [class*='rdt_Pagination'] {
margin-bottom: -1rem;
}
.title {
- composes: title from './index.module.css';
+ composes: title from './AssetActions/Pool/index.module.css';
margin-bottom: 0;
display: flex;
align-items: center;
@@ -44,7 +44,7 @@
transform: rotate(180deg);
}
-.transactions [class*='Table-module--table'] {
+.actions [class*='Table-module--table'] {
/*
react-data-table-component sets a default width: 100%
which often leads to unneccessary overflows. Following lines make
@@ -52,6 +52,9 @@
when enough space is available. But it also destroys overflow table on narrow
viewports.
*/
- width: fit-content !important;
- min-width: 100%;
+ width: 100%;
+}
+
+.actions [class*='TableCell'] {
+ width: 140px;
}
diff --git a/src/components/organisms/AssetActionHistoryTable.tsx b/src/components/organisms/AssetActionHistoryTable.tsx
new file mode 100644
index 000000000..5e3a86b83
--- /dev/null
+++ b/src/components/organisms/AssetActionHistoryTable.tsx
@@ -0,0 +1,36 @@
+import React, { ReactElement, useState } from 'react'
+import Button from '../atoms/Button'
+import styles from './AssetActionHistoryTable.module.css'
+import { ReactComponent as Caret } from '../../images/caret.svg'
+import { ReactNode } from 'react-markdown'
+
+export default function AssetActionHistoryTable({
+ title,
+ children
+}: {
+ title: string
+ children: ReactNode
+}): ReactElement {
+ const [open, setOpen] = useState(false)
+ function handleClick() {
+ setOpen(!open)
+ }
+
+ return (
+
+ {/* TODO: onClick on h3 is nasty but we're in a hurry */}
+
+ {`${title} `}
+
+
+ {open === true && children}
+
+ )
+}
diff --git a/src/components/organisms/AssetActions/Compute/index.tsx b/src/components/organisms/AssetActions/Compute/index.tsx
index ec32d2acf..f8bb95943 100644
--- a/src/components/organisms/AssetActions/Compute/index.tsx
+++ b/src/components/organisms/AssetActions/Compute/index.tsx
@@ -38,7 +38,8 @@ import { secondsToString } from '../../../../utils/metadata'
import { AssetSelectionAsset } from '../../../molecules/FormFields/AssetSelection'
import AlgorithmDatasetsListForCompute from '../../AssetContent/AlgorithmDatasetsListForCompute'
import { getPreviousOrders, getPrice } from '../../../../utils/subgraph'
-import { chainIds } from '../../../../../app.config'
+import AssetActionHistoryTable from '../../AssetActionHistoryTable'
+import ComputeJobs from '../../../pages/History/ComputeJobs'
const SuccessAction = () => (