mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
* Bolds loaded workpad in workpad loader * Extracted helper function
This commit is contained in:
parent
222e805235
commit
e09a026ba3
1 changed files with 7 additions and 2 deletions
|
@ -30,6 +30,11 @@ import { uploadWorkpad } from './upload_workpad';
|
|||
|
||||
const formatDate = date => date && moment(date).format('MMM D, YYYY @ h:mma');
|
||||
|
||||
const getDisplayName = (name, workpad, loadedWorkpad) => {
|
||||
const workpadName = name.length ? name : <em>{workpad.id}</em>;
|
||||
return workpad.id === loadedWorkpad ? <strong>{workpadName}</strong> : workpadName;
|
||||
};
|
||||
|
||||
export class WorkpadLoader extends React.PureComponent {
|
||||
static propTypes = {
|
||||
workpadId: PropTypes.string.isRequired,
|
||||
|
@ -134,7 +139,7 @@ export class WorkpadLoader extends React.PureComponent {
|
|||
|
||||
renderWorkpadTable = ({ rows, pageNumber, totalPages, setPage }) => {
|
||||
const { sortField, sortDirection } = this.state;
|
||||
const { canUserWrite, createPending } = this.props;
|
||||
const { canUserWrite, createPending, workpadId: loadedWorkpad } = this.props;
|
||||
|
||||
const actions = [
|
||||
{
|
||||
|
@ -173,7 +178,7 @@ export class WorkpadLoader extends React.PureComponent {
|
|||
sortable: true,
|
||||
dataType: 'string',
|
||||
render: (name, workpad) => {
|
||||
const workpadName = workpad.name.length ? workpad.name : <em>{workpad.id}</em>;
|
||||
const workpadName = getDisplayName(name, workpad, loadedWorkpad);
|
||||
|
||||
return (
|
||||
<Link
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue