ModifiedAt for items, use it by default
This commit is contained in:
@@ -23,10 +23,11 @@ public record SizeScanContainer : ISizeScanContainer
|
||||
public required NativePath? NativePath { get; init; }
|
||||
public required AbsolutePath? Parent { get; init; }
|
||||
public required IContentProvider Provider { get; init; }
|
||||
public required DateTime? CreatedAt { get; init; } = DateTime.Now;
|
||||
public required DateTime? ModifiedAt { get; init;} = DateTime.Now;
|
||||
public required SupportsDelete CanDelete { get; init; }
|
||||
public bool IsHidden => false;
|
||||
public bool IsExists => true;
|
||||
public DateTime? CreatedAt { get; } = DateTime.Now;
|
||||
public SupportsDelete CanDelete => SupportsDelete.True;
|
||||
public bool CanRename => false;
|
||||
public string? Attributes => null;
|
||||
public AbsolutePathType Type => AbsolutePathType.Container;
|
||||
|
||||
@@ -13,12 +13,13 @@ public record SizeScanElement : ISizeScanElement
|
||||
public required string DisplayName { get; init; }
|
||||
public required FullName FullName { get; init; }
|
||||
public required NativePath NativePath { get; init; }
|
||||
public AbsolutePath? Parent { get; init; }
|
||||
public required AbsolutePath? Parent { get; init; }
|
||||
public required DateTime? CreatedAt { get; init; }
|
||||
public required DateTime? ModifiedAt { get; init;}
|
||||
|
||||
public required IDeclarativeProperty<long> Size { get; init; }
|
||||
public bool IsHidden => false;
|
||||
public bool IsExists => true;
|
||||
public DateTime? CreatedAt { get; } = DateTime.Now;
|
||||
public SupportsDelete CanDelete => SupportsDelete.False;
|
||||
public bool CanRename => false;
|
||||
public string? Attributes => "";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using DeclarativeProperty;
|
||||
using FileTime.Core.Enums;
|
||||
using FileTime.Core.Models;
|
||||
using FileTime.Core.Models.Extensions;
|
||||
using FileTime.Core.Timeline;
|
||||
@@ -48,7 +49,10 @@ public class SizeScanTask : ISizeScanTask
|
||||
RealContainer = scanSizeOf,
|
||||
Provider = _containerSizeScanProvider,
|
||||
Status = _containerStatusDebounced,
|
||||
SizeScanTask = this
|
||||
SizeScanTask = this,
|
||||
CreatedAt = scanSizeOf.CreatedAt,
|
||||
ModifiedAt = scanSizeOf.ModifiedAt,
|
||||
CanDelete = SupportsDelete.True
|
||||
};
|
||||
}
|
||||
|
||||
@@ -114,7 +118,9 @@ public class SizeScanTask : ISizeScanTask
|
||||
NativePath = new NativePath(childName),
|
||||
Parent = new AbsolutePath(_timelessContentProvider, sizeScanContainer),
|
||||
Provider = _containerSizeScanProvider,
|
||||
Size = sizeProperty
|
||||
Size = sizeProperty,
|
||||
CreatedAt = element.CreatedAt,
|
||||
ModifiedAt = element.ModifiedAt,
|
||||
};
|
||||
await sizeScanContainer.AddSizeChildAsync(childElement);
|
||||
|
||||
@@ -137,7 +143,10 @@ public class SizeScanTask : ISizeScanTask
|
||||
RealContainer = childContainer,
|
||||
Provider = _containerSizeScanProvider,
|
||||
Status = _containerStatusDebounced,
|
||||
SizeScanTask = this
|
||||
SizeScanTask = this,
|
||||
CreatedAt = childContainer.CreatedAt,
|
||||
ModifiedAt = childContainer.ModifiedAt,
|
||||
CanDelete = SupportsDelete.False
|
||||
};
|
||||
|
||||
await sizeScanContainer.AddSizeChildAsync(childSearchContainer);
|
||||
|
||||
@@ -4,6 +4,8 @@ public enum ItemOrdering
|
||||
{
|
||||
Name,
|
||||
NameDesc,
|
||||
CreationDate,
|
||||
CreationDateDesc,
|
||||
LastModifyDate,
|
||||
LastModifyDateDesc,
|
||||
}
|
||||
@@ -6,8 +6,10 @@ public sealed class SortItemsCommand : IIdentifiableUserCommand
|
||||
{
|
||||
public const string OrderByNameCommandName = "order_by_name";
|
||||
public const string OrderByNameDescCommandName = "order_by_name_desc";
|
||||
public const string OrderByDateCommandName = "order_by_date";
|
||||
public const string OrderByDateDescCommandName = "order_by_date_desc";
|
||||
public const string OrderByCreatedAtCommandName = "order_by_created_at";
|
||||
public const string OrderByCreatedAtDescCommandName = "order_by_created_at_desc";
|
||||
public const string OrderByModifiedAtCommandName = "order_by_modified_at";
|
||||
public const string OrderByModifiedAtDescCommandName = "order_by_modified_at_desc";
|
||||
|
||||
public static readonly SortItemsCommand OrderByNameCommand =
|
||||
new(OrderByNameCommandName, ItemOrdering.Name, "Order by name");
|
||||
@@ -15,11 +17,17 @@ public sealed class SortItemsCommand : IIdentifiableUserCommand
|
||||
public static readonly SortItemsCommand OrderByNameDescCommand =
|
||||
new(OrderByNameDescCommandName, ItemOrdering.NameDesc, "Order by name (descending)");
|
||||
|
||||
public static readonly SortItemsCommand OrderByDateCommand =
|
||||
new(OrderByDateCommandName, ItemOrdering.LastModifyDate, "Order by date");
|
||||
public static readonly SortItemsCommand OrderByCreatedAtCommand =
|
||||
new(OrderByCreatedAtCommandName, ItemOrdering.CreationDate, "Order by created");
|
||||
|
||||
public static readonly SortItemsCommand OrderByDateDescCommand =
|
||||
new(OrderByDateDescCommandName, ItemOrdering.LastModifyDateDesc, "Order by date (descending)");
|
||||
public static readonly SortItemsCommand OrderByCreatedAtDescCommand =
|
||||
new(OrderByCreatedAtDescCommandName, ItemOrdering.CreationDateDesc, "Order by created (descending)");
|
||||
|
||||
public static readonly SortItemsCommand OrderByLastModifiedCommand =
|
||||
new(OrderByModifiedAtCommandName, ItemOrdering.LastModifyDate, "Order by last modified");
|
||||
|
||||
public static readonly SortItemsCommand OrderByLastModifiedDescCommand =
|
||||
new(OrderByModifiedAtDescCommandName, ItemOrdering.LastModifyDateDesc, "Order by last modified (descending)");
|
||||
|
||||
private SortItemsCommand(string userCommandId, ItemOrdering ordering, string title)
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@ public interface IItemViewModel : IInitable<IItem, ITabViewModel, ItemViewModelT
|
||||
IDeclarativeProperty<bool> IsAlternative { get; }
|
||||
IDeclarativeProperty<ItemViewMode> ViewMode { get; set; }
|
||||
DateTime? CreatedAt { get; set; }
|
||||
DateTime? ModifiedAt { get; set; }
|
||||
string? Attributes { get; set; }
|
||||
bool EqualsTo(IItemViewModel? itemViewModel);
|
||||
}
|
||||
@@ -52,8 +52,10 @@ public class DefaultIdentifiableCommandHandlerRegister : IStartupHandler
|
||||
AddUserCommand(StartCommandSchedulerCommand.Instance);
|
||||
AddUserCommand(SortItemsCommand.OrderByNameCommand);
|
||||
AddUserCommand(SortItemsCommand.OrderByNameDescCommand);
|
||||
AddUserCommand(SortItemsCommand.OrderByDateCommand);
|
||||
AddUserCommand(SortItemsCommand.OrderByDateDescCommand);
|
||||
AddUserCommand(SortItemsCommand.OrderByCreatedAtCommand);
|
||||
AddUserCommand(SortItemsCommand.OrderByCreatedAtDescCommand);
|
||||
AddUserCommand(SortItemsCommand.OrderByLastModifiedCommand);
|
||||
AddUserCommand(SortItemsCommand.OrderByLastModifiedDescCommand);
|
||||
AddUserCommand(IdentifiableSearchCommand.SearchByNameContains);
|
||||
AddUserCommand(IdentifiableSearchCommand.SearchByRegex);
|
||||
AddUserCommand(SwitchToTabCommand.SwitchToLastTab);
|
||||
|
||||
@@ -31,6 +31,7 @@ public abstract partial class ItemViewModel : IItemViewModel
|
||||
[Property] private IDeclarativeProperty<ItemViewMode> _viewMode;
|
||||
|
||||
[Property] private DateTime? _createdAt;
|
||||
[Property] private DateTime? _modifiedAt;
|
||||
|
||||
[Property] private string? _attributes;
|
||||
|
||||
@@ -88,6 +89,7 @@ public abstract partial class ItemViewModel : IItemViewModel
|
||||
.Debounce(TimeSpan.FromMilliseconds(100));
|
||||
Attributes = item.Attributes;
|
||||
CreatedAt = item.CreatedAt;
|
||||
ModifiedAt = item.ModifiedAt;
|
||||
}
|
||||
|
||||
private Task<ItemViewMode> GenerateViewMode(bool isMarked, bool isSelected, bool isAlternative)
|
||||
|
||||
@@ -93,18 +93,24 @@ public partial class TabViewModel : ITabViewModel
|
||||
{
|
||||
ItemOrdering.Name =>
|
||||
items
|
||||
.Ordering(i => i.BaseItem.Type)
|
||||
.Ordering(i => i.BaseItem!.Type)
|
||||
.ThenOrdering(i => i.DisplayNameText),
|
||||
ItemOrdering.NameDesc =>
|
||||
items
|
||||
.Ordering(i => i.BaseItem.Type)
|
||||
.Ordering(i => i.BaseItem!.Type)
|
||||
.ThenOrdering(i => i.DisplayNameText, ListSortDirection.Descending),
|
||||
ItemOrdering.LastModifyDate =>
|
||||
ItemOrdering.CreationDate =>
|
||||
items
|
||||
.Ordering(i => i.CreatedAt),
|
||||
ItemOrdering.LastModifyDateDesc =>
|
||||
ItemOrdering.CreationDateDesc =>
|
||||
items
|
||||
.Ordering(i => i.CreatedAt, ListSortDirection.Descending),
|
||||
ItemOrdering.LastModifyDate =>
|
||||
items
|
||||
.Ordering(i => i.ModifiedAt),
|
||||
ItemOrdering.LastModifyDateDesc =>
|
||||
items
|
||||
.Ordering(i => i.ModifiedAt, ListSortDirection.Descending),
|
||||
_ => throw new NotImplementedException()
|
||||
};
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ public class SearchTask : ISearchTask
|
||||
false,
|
||||
true,
|
||||
null,
|
||||
null,
|
||||
SupportsDelete.False,
|
||||
false,
|
||||
null,
|
||||
|
||||
Reference in New Issue
Block a user