@@ -22,6 +22,7 @@ import {
2222} from '@patternfly/react-charts' ;
2323import { Icon } from 'antd' ;
2424import { connect } from 'dva' ;
25+ import moment from 'moment' ;
2526import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' ;
2627import {
2728 OutlinedClockIcon ,
@@ -30,6 +31,7 @@ import {
3031 EllipsisVIcon ,
3132} from '@patternfly/react-icons' ;
3233import { faExclamationCircle } from '@fortawesome/free-solid-svg-icons' ;
34+ import { newData , seenData , expirationLimit } from '../../../mock/overview' ;
3335import Table from '@/components/Table' ;
3436// import { Table } from 'antd';
3537import styles from './index.less' ;
@@ -66,14 +68,19 @@ class Overview extends React.Component {
6668 } ) ;
6769 } ;
6870
69- showDrowpdown = ( ) => {
70- console . log ( 'here' ) ;
71+ showDrowpdown = id => {
72+ const dropdownElem = document . getElementById ( id ) ;
73+ if ( dropdownElem . style . display === 'none' ) {
74+ dropdownElem . style . display = 'block' ;
75+ } else {
76+ dropdownElem . style . display = 'none' ;
77+ }
7178 } ;
7279
7380 render ( ) {
7481 const { activeTabKey, barWidth } = this . state ;
7582
76- const columns = [
83+ const newDataColumns = [
7784 {
7885 title : 'Result' ,
7986 dataIndex : 'result' ,
@@ -105,43 +112,98 @@ class Overview extends React.Component {
105112 title : '' ,
106113 dataIndex : 'action' ,
107114 key : 'action' ,
108- render : ( ) => (
115+ render : ( value , row ) => {
116+ return (
117+ < div >
118+ < EllipsisVIcon
119+ onClick = { ( ) => this . showDrowpdown ( `newrun${ row . key } ` ) }
120+ className = "dropbtn"
121+ />
122+ < div className = { styles . dropdown } id = { `newrun${ row . key } ` } style = { { display : 'none' } } >
123+ < div className = { styles . dropdownContent } >
124+ < div className = { styles . dropdownLink } href = "#seen" >
125+ Mark as seen
126+ </ div >
127+ < div className = { styles . dropdownLink } href = "#delete" >
128+ Delete
129+ </ div >
130+ </ div >
131+ </ div >
132+ </ div >
133+ ) ;
134+ } ,
135+ } ,
136+ ] ;
137+
138+ const seenDataColumns = [
139+ {
140+ title : 'Result' ,
141+ dataIndex : 'result' ,
142+ key : 'result' ,
143+ render : text => (
109144 < div >
110- < EllipsisVIcon onClick = { ( ) => this . showDrowpdown ( ) } / >
111- { /* <div id="Dropdown" className="dropdownmenu-content">
112- <a href="#Java">Java</a >
113- <a href="#HTML">HTML</a >
114- <a href="#CSS">CSS</a >
115- <a href="#JS">JavaScript</a >
116- </div> */ }
145+ < Button variant = "link" isInline style = { { marginBottom : '8px' } } >
146+ { text [ 0 ] }
147+ </ Button >
148+ < br / >
149+ < Text component = { TextVariants . p } className = { styles . subText } >
150+ < span className = { styles . label } > { text [ 1 ] } </ span >
151+ </ Text >
117152 </ div >
118153 ) ,
119154 } ,
120- ] ;
121- const data = [
122155 {
123- key : 1 ,
124- result : [ 'fio_2020.09.10T12.42.11' , ' 2020-09-10T 11:52:34:552478' ] ,
125- end : '2020-09-10T 11:52:34:552478' ,
126- description : 'More content can be added here' ,
156+ title : 'End Time' ,
157+ dataIndex : 'end' ,
158+ key : 'end' ,
127159 } ,
128160 {
129- key : 2 ,
130- result : [ 'fio_2020.09.10T12.42.12' , ' 2020-09-10T 11:52:34:552478' ] ,
131- end : '2020-09-10T 11:52:34:552478' ,
132- description : 'More content can be added here' ,
161+ title : 'Scheduled for deletion on' ,
162+ dataIndex : 'deletion' ,
163+ key : 'deletion' ,
164+ render : text => {
165+ const startDate = moment ( new Date ( Date . parse ( text ) ) ) ;
166+ const currDate = moment ( new Date ( ) ) ;
167+ const currDays = currDate . diff ( startDate , 'days' ) ;
168+ if ( currDays < expirationLimit ) {
169+ return (
170+ < Text >
171+ { moment ( text )
172+ . add ( 7 , 'days' )
173+ . format ( 'YYYY-MM-DDTHH:mm:ss:SSSSSS' ) }
174+ </ Text >
175+ ) ;
176+ }
177+ return (
178+ < span >
179+ { moment ( text )
180+ . add ( 7 , 'days' )
181+ . format ( 'YYYY-MM-DDTHH:mm:ss:SSSSSS' ) }
182+ < FontAwesomeIcon
183+ style = { { paddingLeft : '5px' , width : '20px' } }
184+ icon = { faExclamationCircle }
185+ color = "red"
186+ className = { styles . icons }
187+ />
188+ </ span >
189+ ) ;
190+ } ,
133191 } ,
134192 {
135- key : 3 ,
136- result : [ 'fio_2020.09.10T12.42.13' , ' 2020-09-10T 11:52:34:552478' ] ,
137- end : '2020-09-10T 11:52:34:552478 ' ,
138- description : 'More content can be added here' ,
193+ title : '' ,
194+ dataIndex : 'fav' ,
195+ key : 'fav ' ,
196+ render : ( ) => < Icon type = "star" onClick = { ( ) => this . onFavourite ( ) } /> ,
139197 } ,
140198 {
141- key : 4 ,
142- result : [ 'fio_2020.09.10T12.42.14' , ' 2020-09-10T 11:52:34:552478' ] ,
143- end : '2020-09-10T 11:52:34:552478' ,
144- description : 'More content can be added here' ,
199+ title : '' ,
200+ dataIndex : 'action' ,
201+ key : 'action' ,
202+ render : ( ) => (
203+ < div >
204+ < EllipsisVIcon onClick = { ( ) => this . showDrowpdown ( ) } />
205+ </ div >
206+ ) ,
145207 } ,
146208 ] ;
147209
@@ -342,12 +404,12 @@ class Overview extends React.Component {
342404 </ div >
343405 < div >
344406 < Table
345- columns = { columns }
407+ columns = { newDataColumns }
346408 rowSelection = { rowSelection }
347409 expandedRowRender = { record => (
348410 < p style = { { margin : 0 } } > { record . description } </ p >
349411 ) }
350- dataSource = { data }
412+ dataSource = { newData }
351413 />
352414 </ div >
353415 </ Card >
@@ -364,12 +426,12 @@ class Overview extends React.Component {
364426 </ div >
365427 < div >
366428 < Table
367- columns = { columns }
429+ columns = { seenDataColumns }
368430 rowSelection = { rowSelection }
369431 expandedRowRender = { record => (
370432 < p style = { { margin : 0 } } > { record . description } </ p >
371433 ) }
372- dataSource = { data }
434+ dataSource = { seenData }
373435 />
374436 </ div >
375437 </ Card >
0 commit comments