Skip to content

Commit

Permalink
feat(ui): display time ago on every datetime
Browse files Browse the repository at this point in the history
close #314
  • Loading branch information
tchiotludo committed Oct 24, 2021
1 parent 2983e61 commit d734316
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 11 deletions.
11 changes: 9 additions & 2 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"react-helmet": "^6.0.0",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.1",
"react-timeago": "^6.2.1",
"react-toastify": "^6.0.6",
"reactstrap": "^8.4.0"
},
Expand Down
3 changes: 2 additions & 1 deletion client/src/containers/Tail/Tail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'ace-builds/webpack-resolver';
import 'ace-builds/src-noconflict/mode-json';
import 'ace-builds/src-noconflict/theme-merbivore_soft';
import Root from '../../components/Root';
import TimeAgo from 'react-timeago';

const STATUS = {
STOPPED: 'STOPPED',
Expand Down Expand Up @@ -404,7 +405,7 @@ class Tail extends Root {
colName: 'Date',
type: 'text',
cell: obj => {
return <div className="tail-headers">{obj.timestamp}</div>;
return (<div className="tail-headers"><TimeAgo date={Date.parse(obj.timestamp)} title={obj.timestamp}/></div>);
}
},
{
Expand Down
13 changes: 7 additions & 6 deletions client/src/containers/Topic/Topic/TopicData/TopicData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {
uriTopicData,
uriTopicDataDelete,
uriTopicDataSearch, uriTopicDataSingleRecord,
uriTopicsPartitions
uriTopicsPartitions,
basePath
} from '../../../../utils/endpoints';
import Pagination from '../../../../components/Pagination/Pagination';
import moment from 'moment';
Expand All @@ -25,9 +26,9 @@ import 'ace-builds/src-noconflict/theme-dracula';
import { toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import Root from '../../../../components/Root';
import { basePath } from '../../../../utils/endpoints';
import {capitalizeTxt, getClusterUIOptions} from "../../../../utils/functions";
import Select from "../../../../components/Form/Select";
import {capitalizeTxt, getClusterUIOptions} from '../../../../utils/functions';
import Select from '../../../../components/Form/Select';
import TimeAgo from 'react-timeago'

class TopicData extends Root {
state = {
Expand Down Expand Up @@ -116,7 +117,7 @@ class TopicData extends Root {
}
}
);
};
}

_buildSearchFromQueryString(query) {
const { search } = this.state;
Expand Down Expand Up @@ -886,7 +887,7 @@ class TopicData extends Root {
colName: 'Date',
type: 'text',
cell: (obj, col) => {
return obj[col.accessor];
return (<TimeAgo date={Date.parse(obj[col.accessor])} title={obj[col.accessor]}/>);
}
},
{
Expand Down
6 changes: 5 additions & 1 deletion client/src/containers/Topic/TopicList/TopicList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {Collapse} from 'react-bootstrap';
import Root from '../../../components/Root';
import {getClusterUIOptions} from "../../../utils/functions";
import {handlePageChange, getPageNumber} from "./../../../utils/pagination"
import TimeAgo from "react-timeago";

class TopicList extends Root {
state = {
Expand Down Expand Up @@ -304,7 +305,10 @@ class TopicList extends Root {
id: 'lastWrite',
accessor: 'lastWrite',
colName: 'Last Record',
type: 'text'
type: 'text',
cell: (obj, col) => {
return <TimeAgo date={Date.parse(obj[col.accessor])} title={obj[col.accessor]}/>;
}
});
}

Expand Down
1 change: 0 additions & 1 deletion client/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import App from './App';
import * as serviceWorker from './serviceWorker';
import prefix from './prefix';


let pathPrefix = prefix() + '/ui';

ReactDOM.render(<App pathPrefix={pathPrefix} />, document.getElementById('root'));
Expand Down

0 comments on commit d734316

Please sign in to comment.