From 6d2d78ec216ddbf4664f3fe5831f96489af450ff Mon Sep 17 00:00:00 2001 From: ElonH Date: Fri, 29 May 2020 16:11:31 +0800 Subject: [PATCH] fix(list-view): turn modified time to time ago --- .../fileMode/listView/listView.component.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/app/pages/manager/fileMode/listView/listView.component.ts b/src/app/pages/manager/fileMode/listView/listView.component.ts index fb08a7a..077ff43 100644 --- a/src/app/pages/manager/fileMode/listView/listView.component.ts +++ b/src/app/pages/manager/fileMode/listView/listView.component.ts @@ -13,6 +13,7 @@ import { Subscription } from 'rxjs'; import { NavigationFlowOutNode } from 'src/app/@dataflow/extra'; import { API, APIDefinition } from 'ngx-easy-table'; import { FormatBytes } from 'src/app/utils/format-bytes'; +import * as moment from 'moment'; @Component({ selector: 'manager-listView', @@ -46,7 +47,7 @@ import { FormatBytes } from 'src/app/utils/format-bytes'; {{ row.Name }} {{ row.SizeHumanReadable }} - {{ row.ModTime }} + {{ row.ModTimeHumanReadable }} {{ row.MimeType }} @@ -70,11 +71,14 @@ export class ListViewComponent implements OnInit, OnDestroy { { key: 'manipulation', title: '', width: '3%', searchEnabled: false, orderEnabled: false }, { key: 'Name', title: 'Name', width: '50%' }, { key: 'SizeHumanReadable', title: 'Size', width: '10%' }, - { key: 'ModTime', title: 'Modified Time', width: '20%' }, + { key: 'ModTimeHumanReadable', title: 'Modified Time', width: '20%' }, { key: 'MimeType', title: 'MIME Type', width: '17%' }, ]; - public data: (OperationsListFlowOutItemNode & { SizeHumanReadable: string })[]; + public data: (OperationsListFlowOutItemNode & { + SizeHumanReadable: string; + ModTimeHumanReadable: string; + })[]; public check: boolean[]; public checkAll = false; public checAllInteral = false; @@ -134,7 +138,10 @@ export class ListViewComponent implements OnInit, OnDestroy { this.checkAll = false; } this.data = x[0].list as any; - this.data.forEach((x) => (x.SizeHumanReadable = FormatBytes(x.Size))); + this.data.forEach((x) => { + x.SizeHumanReadable = FormatBytes(x.Size); + x.ModTimeHumanReadable = moment(x.ModTime).fromNow(); + }); this.check = x[0].list.map(() => false); this.checkAll = false; this.remote = x[0].remote;