Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Up to 3.14.3 #2149

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion application/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chipmunk",
"version": "3.14.2",
"version": "3.14.3",
"description": "Logs analyzer tool",
"author": "Dmitry Astafyev",
"scripts": {
Expand Down
6 changes: 5 additions & 1 deletion application/client/src/app/service/history/collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class Collections implements EntryConvertable, Equal<Collections>, 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'),
Expand Down Expand Up @@ -264,6 +264,10 @@ export class Collections implements EntryConvertable, Equal<Collections>, 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) &&
Expand Down
4 changes: 4 additions & 0 deletions application/client/src/app/service/history/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ export class HistorySession extends Subscriber {
suitable(): Suitable;
all(): Collections[];
named(): Collections[];
byTimeStamp(tm: number): Collections[];
} {
return {
related: (): Collections | undefined => {
Expand All @@ -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);
},
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export class StorageCollections {
suitable(): Suitable;
named(): Collections[];
all(): Collections[];
byTimeStamp(tm: number): Collections[];
} {
return {
related: (): Collections[] => {
Expand Down Expand Up @@ -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));
},
};
}

Expand Down
15 changes: 15 additions & 0 deletions application/client/src/app/ui/views/toolbar/history/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [];
Expand Down Expand Up @@ -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();
})
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 },
Expand Down
2 changes: 1 addition & 1 deletion application/holder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chipmunk",
"version": "3.14.2",
"version": "3.14.3",
"chipmunk": {
"versions": {}
},
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 3.14.3 (15.11.2024)

## Corrections
- show recently added filters after importing
- add parsing of DLT payload's network prefix

# 3.14.2 (08.11.2024)

## Corrections
Expand Down
Loading