From f319091334659499ec5200fdaa01fd4065d4da96 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Mon, 12 Aug 2019 16:26:49 -0700 Subject: [PATCH 1/3] Sort using unix timestamp value --- .../logstash/public/components/pipeline_list/pipelines_table.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/legacy/plugins/logstash/public/components/pipeline_list/pipelines_table.js b/x-pack/legacy/plugins/logstash/public/components/pipeline_list/pipelines_table.js index ca10ae27535c6..233d9d2f17c72 100644 --- a/x-pack/legacy/plugins/logstash/public/components/pipeline_list/pipelines_table.js +++ b/x-pack/legacy/plugins/logstash/public/components/pipeline_list/pipelines_table.js @@ -58,7 +58,7 @@ function getColumns(openPipeline, clonePipeline) { /> ), render: lastModified => {lastModified}, - sortable: true, + sortable: ({ lastModified }) => lastModified.valueOf(), }, { field: 'username', From d9b2ae570e01d6cd85cb0d929575abc41b5feb9e Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Fri, 13 Sep 2019 09:28:32 -0400 Subject: [PATCH 2/3] Extract internationalization from react components to function calls. --- .../pipeline_list/pipelines_table.js | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/x-pack/legacy/plugins/logstash/public/components/pipeline_list/pipelines_table.js b/x-pack/legacy/plugins/logstash/public/components/pipeline_list/pipelines_table.js index 233d9d2f17c72..d77fc25f12986 100644 --- a/x-pack/legacy/plugins/logstash/public/components/pipeline_list/pipelines_table.js +++ b/x-pack/legacy/plugins/logstash/public/components/pipeline_list/pipelines_table.js @@ -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: ( - + 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: ( - + name: i18n.translate( + 'xpack.logstash.pipelinesTable.descriptionColumnLabel', + { defaultMessage: 'Description' } ), render: description => {description}, sortable: true, @@ -51,22 +48,18 @@ function getColumns(openPipeline, clonePipeline) { }, { field: 'lastModifiedHumanized', - name: ( - + name: i18n.translate( + 'xpack.logstash.pipelinesTable.lastModifiedColumnLabel', + { defaultMessage: 'Last modified' } ), render: lastModified => {lastModified}, sortable: ({ lastModified }) => lastModified.valueOf(), }, { field: 'username', - name: ( - + name: i18n.translate( + 'xpack.logstash.pipelinesTable.modifiedByColumnLabel', + { defaultMessage: 'Modified by' } ), render: username => {username}, sortable: true, From cba0e3b361598e121460d0ca8c581f61a72b475e Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Fri, 13 Sep 2019 07:40:19 -0700 Subject: [PATCH 3/3] Updating Jest snapshots for pipelines table component --- .../pipelines_table.test.js.snap | 26 ++++--------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/x-pack/legacy/plugins/logstash/public/components/pipeline_list/__snapshots__/pipelines_table.test.js.snap b/x-pack/legacy/plugins/logstash/public/components/pipeline_list/__snapshots__/pipelines_table.test.js.snap index eb1a7e54afe8b..a7432416537a6 100644 --- a/x-pack/legacy/plugins/logstash/public/components/pipeline_list/__snapshots__/pipelines_table.test.js.snap +++ b/x-pack/legacy/plugins/logstash/public/components/pipeline_list/__snapshots__/pipelines_table.test.js.snap @@ -6,42 +6,26 @@ exports[`PipelinesTable component renders component as expected 1`] = ` Array [ Object { "field": "id", - "name": , + "name": "Id", "render": [Function], "sortable": true, }, Object { "field": "description", - "name": , + "name": "Description", "render": [Function], "sortable": true, "truncateText": true, }, Object { "field": "lastModifiedHumanized", - "name": , + "name": "Last modified", "render": [Function], - "sortable": true, + "sortable": [Function], }, Object { "field": "username", - "name": , + "name": "Modified by", "render": [Function], "sortable": true, },