From 96ebb0d91eea9ed9d0614663eca8644e86fcbc6b Mon Sep 17 00:00:00 2001
From: SurenNeware <sneware9@in.ibm.com>
Date: Tue, 8 Sep 2020 17:42:39 +0530
Subject: Update name of file of exported log files

- The name of exported event log file would be combination of event logs
  prefix and current date and time.

Signed-off-by: Suren Neware <sneware9@in.ibm.com>
Change-Id: Iaaf46fed5df1942e9cc2e4157dafa8e3e755ecf8
---
 src/views/Health/EventLogs/EventLogs.vue | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

(limited to 'src/views/Health/EventLogs/EventLogs.vue')

diff --git a/src/views/Health/EventLogs/EventLogs.vue b/src/views/Health/EventLogs/EventLogs.vue
index 0e8a5448..dcede596 100644
--- a/src/views/Health/EventLogs/EventLogs.vue
+++ b/src/views/Health/EventLogs/EventLogs.vue
@@ -34,7 +34,7 @@
           <template v-slot:export>
             <table-toolbar-export
               :data="batchExportData"
-              :file-name="$t('appPageTitle.eventLogs')"
+              :file-name="exportFileNameByDate()"
             />
           </template>
         </table-toolbar>
@@ -96,7 +96,7 @@
               :value="action.value"
               :title="action.title"
               :row-data="row.item"
-              :export-name="row.item.id"
+              :export-name="exportFileNameByDate()"
               :data-test-id="`eventLogs-button-deleteRow-${row.index}`"
               @click:tableAction="onTableRowAction($event, row.item)"
             >
@@ -345,6 +345,19 @@ export default {
     },
     onChangeSearchInput(searchValue) {
       this.searchFilter = searchValue;
+    },
+    // Create export file name based on date
+    exportFileNameByDate() {
+      let date = new Date();
+      date =
+        date.toISOString().slice(0, 10) +
+        '_' +
+        date
+          .toString()
+          .split(':')
+          .join('-')
+          .split(' ')[4];
+      return this.$t('pageEventLogs.exportFilePrefix') + date;
     }
   }
 };
-- 
cgit v1.2.3

