mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(feeds): show next run (#1074)
This commit is contained in:
parent
6fd8626507
commit
a6d789ee44
4 changed files with 31 additions and 5 deletions
|
@ -52,6 +52,7 @@ type Feed struct {
|
|||
Indexerr FeedIndexer `json:"-"`
|
||||
LastRun time.Time `json:"last_run"`
|
||||
LastRunData string `json:"last_run_data"`
|
||||
NextRun time.Time `json:"next_run"`
|
||||
}
|
||||
|
||||
type FeedSettingsJSON struct {
|
||||
|
|
|
@ -91,7 +91,21 @@ func (s *service) FindByIndexerIdentifier(ctx context.Context, indexer string) (
|
|||
}
|
||||
|
||||
func (s *service) Find(ctx context.Context) ([]domain.Feed, error) {
|
||||
return s.repo.Find(ctx)
|
||||
feeds, err := s.repo.Find(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for i, feed := range feeds {
|
||||
t, err := s.scheduler.GetNextRun(feedKey{id: feed.ID}.ToString())
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
feed.NextRun = t
|
||||
feeds[i] = feed
|
||||
}
|
||||
|
||||
return feeds, nil
|
||||
}
|
||||
|
||||
func (s *service) GetCacheByID(ctx context.Context, feedId int) ([]domain.FeedCacheItem, error) {
|
||||
|
|
|
@ -118,7 +118,7 @@ function FeedSettings() {
|
|||
Enabled <span className="sort-indicator">{sortedFeeds.getSortIndicator("enabled")}</span>
|
||||
</div>
|
||||
<div
|
||||
className="col-span-6 pl-12 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider cursor-pointer"
|
||||
className="col-span-5 pl-12 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider cursor-pointer"
|
||||
onClick={() => sortedFeeds.requestSort("name")}>
|
||||
Name <span className="sort-indicator">{sortedFeeds.getSortIndicator("name")}</span>
|
||||
</div>
|
||||
|
@ -128,10 +128,15 @@ function FeedSettings() {
|
|||
Type <span className="sort-indicator">{sortedFeeds.getSortIndicator("type")}</span>
|
||||
</div>
|
||||
<div
|
||||
className="hidden md:flex col-span-3 px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider cursor-pointer"
|
||||
className="hidden md:flex col-span-2 px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider cursor-pointer"
|
||||
onClick={() => sortedFeeds.requestSort("last_run")}>
|
||||
Last run <span className="sort-indicator">{sortedFeeds.getSortIndicator("last_run")}</span>
|
||||
</div>
|
||||
<div
|
||||
className="hidden md:flex col-span-2 px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider cursor-pointer"
|
||||
onClick={() => sortedFeeds.requestSort("next_run")}>
|
||||
Next run <span className="sort-indicator">{sortedFeeds.getSortIndicator("next_run")}</span>
|
||||
</div>
|
||||
</li>
|
||||
{sortedFeeds.items.map((feed) => (
|
||||
<ListItem key={feed.id} feed={feed}/>
|
||||
|
@ -193,7 +198,7 @@ function ListItem({ feed }: ListItemProps) {
|
|||
/>
|
||||
</Switch>
|
||||
</div>
|
||||
<div className="col-span-8 sm:col-span-6 pl-12 py-3 flex flex-col text-sm font-medium text-gray-900 dark:text-white">
|
||||
<div className="col-span-8 sm:col-span-5 pl-12 py-3 flex flex-col text-sm font-medium text-gray-900 dark:text-white">
|
||||
<span>{feed.name}</span>
|
||||
<span className="text-gray-900 dark:text-gray-500 text-xs">
|
||||
{feed.indexer}
|
||||
|
@ -202,11 +207,16 @@ function ListItem({ feed }: ListItemProps) {
|
|||
<div className="hidden md:flex col-span-1 py-3 items-center">
|
||||
{ImplementationBadges[feed.type.toLowerCase()]}
|
||||
</div>
|
||||
<div className="hidden md:flex col-span-3 py-3 items-center sm:px-6 text-sm font-medium text-gray-900 dark:text-gray-500">
|
||||
<div className="hidden md:flex col-span-2 py-3 items-center sm:px-4 text-sm font-medium text-gray-900 dark:text-gray-500">
|
||||
<span title={simplifyDate(feed.last_run)}>
|
||||
{IsEmptyDate(feed.last_run)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="hidden md:flex col-span-2 py-3 items-center sm:px-4 text-sm font-medium text-gray-900 dark:text-gray-500">
|
||||
<span title={simplifyDate(feed.next_run)}>
|
||||
{IsEmptyDate(feed.next_run)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="col-span-1 flex justify-center items-center sm:px-6">
|
||||
<FeedItemDropdown
|
||||
feed={feed}
|
||||
|
|
1
web/src/types/Feed.d.ts
vendored
1
web/src/types/Feed.d.ts
vendored
|
@ -17,6 +17,7 @@ interface Feed {
|
|||
cookie: string;
|
||||
last_run: string;
|
||||
last_run_data: string;
|
||||
next_run: string;
|
||||
settings: FeedSettings;
|
||||
created_at: Date;
|
||||
updated_at: Date;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue