From 146d5dba8543533ee2131d613d28ca8e7fa54cdc Mon Sep 17 00:00:00 2001 From: DmitryAstafyev Date: Fri, 15 Nov 2024 09:28:30 +0100 Subject: [PATCH 1/3] Show recently added filters after import (close #2148) --- .../client/src/app/service/history/collections.ts | 6 +++++- .../client/src/app/service/history/session.ts | 4 ++++ .../app/service/history/storage.collections.ts | 4 ++++ .../src/app/ui/views/toolbar/history/state.ts | 15 +++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/application/client/src/app/service/history/collections.ts b/application/client/src/app/service/history/collections.ts index d5756f9181..ac6c092b19 100644 --- a/application/client/src/app/service/history/collections.ts +++ b/application/client/src/app/service/history/collections.ts @@ -112,7 +112,7 @@ export class Collections implements EntryConvertable, Equal, Empty static fromMinifiedStr(src: { [key: string]: number | string }): ICollection { return { name: obj.getAsNotEmptyString(src, 'n'), - created: obj.getAsValidNumber(src, 'c'), + created: Date.now(), used: obj.getAsValidNumber(src, 'u'), last: obj.getAsValidNumber(src, 'l'), preset: obj.getAsBool(src, 'p'), @@ -264,6 +264,10 @@ export class Collections implements EntryConvertable, Equal, Empty return this.name !== '' && this.name !== '-'; } + public filterByDateTime(tm: number): boolean { + return this.created > tm; + } + public isSame(collections: Collections): boolean { return ( this.collections.filters.isSame(collections.collections.filters) && diff --git a/application/client/src/app/service/history/session.ts b/application/client/src/app/service/history/session.ts index d583b4f0e3..cef3e929e8 100644 --- a/application/client/src/app/service/history/session.ts +++ b/application/client/src/app/service/history/session.ts @@ -173,6 +173,7 @@ export class HistorySession extends Subscriber { suitable(): Suitable; all(): Collections[]; named(): Collections[]; + byTimeStamp(tm: number): Collections[]; } { return { related: (): Collections | undefined => { @@ -189,6 +190,9 @@ export class HistorySession extends Subscriber { named: (): Collections[] => { return this.storage.collections.find().named(); }, + byTimeStamp: (tm: number): Collections[] => { + return this.storage.collections.find().byTimeStamp(tm); + }, }; } diff --git a/application/client/src/app/service/history/storage.collections.ts b/application/client/src/app/service/history/storage.collections.ts index 1ac4d516b8..d630884cb0 100644 --- a/application/client/src/app/service/history/storage.collections.ts +++ b/application/client/src/app/service/history/storage.collections.ts @@ -112,6 +112,7 @@ export class StorageCollections { suitable(): Suitable; named(): Collections[]; all(): Collections[]; + byTimeStamp(tm: number): Collections[]; } { return { related: (): Collections[] => { @@ -146,6 +147,9 @@ export class StorageCollections { all: (): Collections[] => { return Array.from(this.collections.values()); }, + byTimeStamp: (tm: number): Collections[] => { + return Array.from(this.collections.values()).filter((c) => c.filterByDateTime(tm)); + }, }; } diff --git a/application/client/src/app/ui/views/toolbar/history/state.ts b/application/client/src/app/ui/views/toolbar/history/state.ts index cf4c632547..b45053b275 100644 --- a/application/client/src/app/ui/views/toolbar/history/state.ts +++ b/application/client/src/app/ui/views/toolbar/history/state.ts @@ -15,6 +15,7 @@ export interface Selection { export class State { protected parent!: IlcInterface & ChangesDetector; + protected recentImport: number | undefined = undefined; public history!: HistorySession; public groups: SuitableGroup[] = []; @@ -104,10 +105,12 @@ export class State { if (files.length !== 1) { return; } + this.recentImport = Date.now(); this.parent .ilc() .services.system.history.import(files[0].filename) .then(() => { + this.filtered = -4; this.list().update(); this.parent.detectChanges(); }) @@ -139,6 +142,17 @@ export class State { public update(): State { const groups: SuitableGroup[] = (() => { switch (this.filtered) { + case -4: + return [ + { + caption: 'Recently Added', + rank: 0, + collections: + this.recentImport !== undefined + ? this.history.find().byTimeStamp(this.recentImport) + : this.history.find().all(), + }, + ]; case -3: return [{ caption: 'All', rank: 0, collections: this.history.find().all() }]; case -2: @@ -185,6 +199,7 @@ export class State { const suitable = this.history.find().suitable(); const groups = suitable.asGroups(); this.filters = [ + ...(this.recentImport === undefined ? [] : [{ caption: 'Recently Added', value: -4 }]), { caption: 'All', value: -3 }, { caption: 'All Suitable', value: -2 }, { caption: 'Named Presets', value: -1 }, From 703e766c60ccd62951e00928649b6d3ad5152284 Mon Sep 17 00:00:00 2001 From: DmitryAstafyev Date: Fri, 15 Nov 2024 09:30:08 +0100 Subject: [PATCH 2/3] Up to 3.14.3 --- application/client/package.json | 2 +- application/holder/package.json | 2 +- changelog.md | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/application/client/package.json b/application/client/package.json index 282e54b342..586bf708ed 100644 --- a/application/client/package.json +++ b/application/client/package.json @@ -1,6 +1,6 @@ { "name": "chipmunk", - "version": "3.14.2", + "version": "3.14.3", "description": "Logs analyzer tool", "author": "Dmitry Astafyev", "scripts": { diff --git a/application/holder/package.json b/application/holder/package.json index 2a80e8cb98..08dfe75473 100644 --- a/application/holder/package.json +++ b/application/holder/package.json @@ -1,6 +1,6 @@ { "name": "chipmunk", - "version": "3.14.2", + "version": "3.14.3", "chipmunk": { "versions": {} }, diff --git a/changelog.md b/changelog.md index ee792535a3..fe2e7614f4 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +# 3.14.3 (15.11.2024) + +## Corrections +- show recently added filters after importing + # 3.14.2 (08.11.2024) ## Corrections From b7cae644ad3f8b552e5c10b591c240d73f3a5327 Mon Sep 17 00:00:00 2001 From: DmitryAstafyev Date: Fri, 15 Nov 2024 09:32:10 +0100 Subject: [PATCH 3/3] Update changelog --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index fe2e7614f4..21328e6247 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,7 @@ ## Corrections - show recently added filters after importing +- add parsing of DLT payload's network prefix # 3.14.2 (08.11.2024)