From 8d39333e7d3c394f37b709aa26647a66c656a7c3 Mon Sep 17 00:00:00 2001 From: Anisha Swain Date: Mon, 1 Feb 2021 13:20:21 +0530 Subject: [PATCH] adds mock values --- mock/overview.js | 50 +++++++++++++++++++----------------- src/pages/Overview/index.js | 51 ++++++++++++++++++++----------------- 2 files changed, 54 insertions(+), 47 deletions(-) diff --git a/mock/overview.js b/mock/overview.js index f9c846cd7..94728bfa5 100644 --- a/mock/overview.js +++ b/mock/overview.js @@ -1,72 +1,76 @@ -export const expirationLimit = 20; +export const expirationLimit = 30; // P.S: the key needs to be unique for this object export const resultData = [ { key: 1, - result: ['mock result -1', ' virtual506.virt.lab.eng.bos.redhat.com'], + result: ['mock result -1', 'example.lab.eng.com'], end: '2020-09-10T 11:52:34.552478', + deletion: '2020-10-10T11:52:34.552478', seen: false, description: 'More content can be added here', }, { key: 2, - result: ['mock result -2', ' virtual506.virt.lab.eng.bos.redhat.com'], - end: '2020-09-10T11:52:34.552478', + result: ['mock result -2', ' example.lab.eng.com'], + end: '2020-10-10T11:52:34.552478', + deletion: '2020-11-10T11:52:34.552478', seen: false, description: 'More content can be added here', }, { key: 3, - result: ['mock result -3', ' virtual506.virt.lab.eng.bos.redhat.com'], - end: '2020-09-10T11:52:34.552478', + result: ['mock result -3', ' example.lab.eng.com'], + end: '2020-11-10T11:52:34.552478', + deletion: '2020-12-10T11:52:34.552478', seen: false, description: 'More content can be added here', }, { key: 4, - result: ['mock result -4', ' virtual506.virt.lab.eng.bos.redhat.com'], - end: '2020-09-10T11:52:34.552478', + result: ['mock result -4', ' example.lab.eng.com'], + end: '2020-11-10T11:52:34.552478', + deletion: '2020-12-13T11:52:34.552478', seen: false, description: 'More content can be added here', }, { key: 5, - result: ['mock result -5', 'virtual506.virt.lab.eng.bos.redhat.com'], - end: '2020-11-13T11:52:34.552478', - deletion: '2020-11-13T11:52:34.552478', + result: ['mock result -5', 'example.lab.eng.com'], + end: '2020-12-10T11:52:34.552478', + deletion: '2021-01-10T11:52:34.552478', seen: true, description: 'More content can be added here', }, { key: 6, - result: ['mock result -6', ' virtual506.virt.lab.eng.bos.redhat.com'], - end: '2020-11-20T11:52:34.552478', - deletion: '2020-11-20T11:52:34.552478', + result: ['mock result -6', ' example.lab.eng.com'], + end: '2020-12-10T11:52:34.552478', + deletion: '2021-01-10T11:52:34.552478', seen: true, description: 'More content can be added here', }, { key: 7, - result: ['mock result -7', ' virtual506.virt.lab.eng.bos.redhat.com'], - end: '2020-11-15T11:52:34.552478', - deletion: '2020-11-15T11:52:34.552478', + result: ['mock result -7', ' example.lab.eng.com'], + end: '2021-01-10T11:52:34.552478', + deletion: '2021-02-10T11:52:34.552478', seen: true, description: 'More content can be added here', }, { key: 8, - result: ['mock result -8', ' virtual506.virt.lab.eng.bos.redhat.com'], - end: '2020-11-25T11:52:34.552478', - deletion: '2020-11-25T11:52:34.552478', + result: ['mock result -8', ' example.lab.eng.com'], + end: '2021-01-10T11:52:34.552478', + deletion: '2021-02-10T11:52:34.552478', seen: true, description: 'More content can be added here', }, { key: 9, - result: ['mock result -9', ' virtual506.virt.lab.eng.bos.redhat.com'], - end: '2020-11-25T11:52:34.552478', - deletion: '2020-11-25T11:52:34.552478', + result: ['mock result -9', ' example.lab.eng.com'], + end: '2021-01-20T11:52:34.552478', + deletion: '2021-02-20T11:52:34.552478', seen: true, description: 'More content can be added here', }, diff --git a/src/pages/Overview/index.js b/src/pages/Overview/index.js index b0df77d3b..2de7ef43f 100644 --- a/src/pages/Overview/index.js +++ b/src/pages/Overview/index.js @@ -129,17 +129,19 @@ class Overview extends React.Component { title: 'Result', dataIndex: 'result', key: 'result', - render: text => ( -
- -
- - {text[1]} - -
- ), + render: text => { + return ( +
+ +
+ + {text[1]} + +
+ ); + }, }, { title: 'End Time', @@ -206,10 +208,11 @@ class Overview extends React.Component { dataIndex: 'deletion', key: 'deletion', render: text => { - const startDate = moment(new Date(Date.parse(text))); + const deleteDate = moment(new Date(Date.parse(text))); const currDate = moment(new Date()); - const currDays = currDate.diff(startDate, 'days'); - if (currDays < expirationLimit) { + const remainingDays = currDate.diff(deleteDate, 'days'); + console.log(remainingDays, expirationLimit); + if (remainingDays < 0) { return ( {moment(text) @@ -308,7 +311,7 @@ class Overview extends React.Component {
2020-09-10T @@ -321,7 +324,7 @@ class Overview extends React.Component {
2020-09-10T @@ -334,7 +337,7 @@ class Overview extends React.Component {
2020-09-10T @@ -347,7 +350,7 @@ class Overview extends React.Component {
2020-09-10T @@ -360,7 +363,7 @@ class Overview extends React.Component {
2020-09-10T @@ -373,7 +376,7 @@ class Overview extends React.Component {
2020-09-10T @@ -386,7 +389,7 @@ class Overview extends React.Component {
2020-09-10T @@ -399,7 +402,7 @@ class Overview extends React.Component {
2020-09-10T @@ -412,7 +415,7 @@ class Overview extends React.Component {
2020-09-10T @@ -426,7 +429,7 @@ class Overview extends React.Component {
2020-09-10T