Skip to content

Commit

Permalink
Merge branch 'recently-used'
Browse files Browse the repository at this point in the history
* recently-used:
  Only show "recently used" section if there are more than 10 records
  Show most recently used records on top
  Update lastUsed property on record when record is selected or a value copied from list view
  Add lastUsed property to Record object
  • Loading branch information
MaKleSoft committed Nov 1, 2017
2 parents a66409e + 5a02238 commit 33d03f6
Show file tree
Hide file tree
Showing 5 changed files with 847 additions and 944 deletions.
10 changes: 7 additions & 3 deletions app/src/core/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,24 @@ export class Record {
uuid: string;
updated: Date;
removed: boolean;
lastUsed?: Date;

constructor(name = "", fields?: Array<Field>, category?: string,
id?: string, updated?: Date, removed = false) {
id?: string, updated?: Date, removed = false, lastUsed?: Date) {
this.name = name;
this.fields = fields || new Array<Field>();
this.category = category || "";
this.uuid = id || uuid();
this.updated = updated || new Date();
this.removed = removed;
this.lastUsed = lastUsed;
}

static fromRaw(obj: any): Record {
let fields = obj.fields && <Array<Field>>obj.fields;
let updated = obj.updated && (obj.updated instanceof Date ? obj.updated : new Date(obj.updated));
return new Record(obj.name, fields, obj.category, obj.uuid, updated, obj.removed);
let lastUsed = obj.lastUsed && (obj.lastUsed instanceof Date ? obj.lastUsed : new Date(obj.lastUsed));
return new Record(obj.name, fields, obj.category, obj.uuid, updated, obj.removed, lastUsed);
}

static compare(a: Record, b: Record): number {
Expand All @@ -63,7 +66,8 @@ export class Record {
category: this.category,
uuid: this.uuid,
updated: this.updated,
removed: this.removed
removed: this.removed,
lastUsed: this.lastUsed
};
}

Expand Down

0 comments on commit 33d03f6

Please sign in to comment.