Sort using unix timestamp value (#43162) (#45934)

* Sort using unix timestamp value

* Extract internationalization from react components to function calls.

* Updating Jest snapshots for pipelines table component
This commit is contained in:
Shaunak Kashyap 2019-09-19 06:16:15 -07:00 committed by GitHub
parent dbf7c9dfd0
commit fb1d1fab75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 42 deletions

View file

@ -6,42 +6,26 @@ exports[`PipelinesTable component renders component as expected 1`] = `
Array [
Object {
"field": "id",
"name": <FormattedMessage
defaultMessage="Id"
id="xpack.logstash.pipelinesTable.idColumnLabel"
values={Object {}}
/>,
"name": "Id",
"render": [Function],
"sortable": true,
},
Object {
"field": "description",
"name": <FormattedMessage
defaultMessage="Description"
id="xpack.logstash.pipelinesTable.descriptionColumnLabel"
values={Object {}}
/>,
"name": "Description",
"render": [Function],
"sortable": true,
"truncateText": true,
},
Object {
"field": "lastModifiedHumanized",
"name": <FormattedMessage
defaultMessage="Last Modified"
id="xpack.logstash.pipelinesTable.lastModifiedColumnLabel"
values={Object {}}
/>,
"name": "Last modified",
"render": [Function],
"sortable": true,
"sortable": [Function],
},
Object {
"field": "username",
"name": <FormattedMessage
defaultMessage="Modified By"
id="xpack.logstash.pipelinesTable.modifiedByColumnLabel"
values={Object {}}
/>,
"name": "Modified by",
"render": [Function],
"sortable": true,
},

View file

@ -6,6 +6,7 @@
import React from 'react';
import { EuiButton, EuiButtonEmpty, EuiIconTip, EuiInMemoryTable, EuiLink } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
import { PIPELINE_LIST } from './constants';
@ -13,11 +14,9 @@ function getColumns(openPipeline, clonePipeline) {
return [
{
field: 'id',
name: (
<FormattedMessage
id="xpack.logstash.pipelinesTable.idColumnLabel"
defaultMessage="Id"
/>
name: i18n.translate(
'xpack.logstash.pipelinesTable.idColumnLabel',
{ defaultMessage: 'Id' }
),
sortable: true,
render: (id, { isCentrallyManaged }) => {
@ -39,11 +38,9 @@ function getColumns(openPipeline, clonePipeline) {
},
{
field: 'description',
name: (
<FormattedMessage
id="xpack.logstash.pipelinesTable.descriptionColumnLabel"
defaultMessage="Description"
/>
name: i18n.translate(
'xpack.logstash.pipelinesTable.descriptionColumnLabel',
{ defaultMessage: 'Description' }
),
render: description => <span data-test-subj="cellDescription">{description}</span>,
sortable: true,
@ -51,22 +48,18 @@ function getColumns(openPipeline, clonePipeline) {
},
{
field: 'lastModifiedHumanized',
name: (
<FormattedMessage
id="xpack.logstash.pipelinesTable.lastModifiedColumnLabel"
defaultMessage="Last Modified"
/>
name: i18n.translate(
'xpack.logstash.pipelinesTable.lastModifiedColumnLabel',
{ defaultMessage: 'Last modified' }
),
render: lastModified => <span data-test-subj="cellLastModified">{lastModified}</span>,
sortable: true,
sortable: ({ lastModified }) => lastModified.valueOf(),
},
{
field: 'username',
name: (
<FormattedMessage
id="xpack.logstash.pipelinesTable.modifiedByColumnLabel"
defaultMessage="Modified By"
/>
name: i18n.translate(
'xpack.logstash.pipelinesTable.modifiedByColumnLabel',
{ defaultMessage: 'Modified by' }
),
render: username => <span data-test-subj="cellUsername">{username}</span>,
sortable: true,