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

1625 delete succeeded selected jobs #1957

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions src/Hangfire.Core/Dashboard/DashboardRoutes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ static DashboardRoutes()
Routes.AddClientBatchCommand(
"/jobs/succeeded/requeue",
(client, jobId) => client.ChangeState(jobId, CreateEnqueuedState(), SucceededState.StateName));
Routes.AddClientBatchCommand(
"/jobs/succeeded/delete",
(client, jobId) => client.ChangeState(jobId, CreateDeletedState(), SucceededState.StateName));

Routes.AddRazorPage("/jobs/failed", x => new FailedJobsPage());

Expand Down
10 changes: 10 additions & 0 deletions src/Hangfire.Core/Dashboard/Pages/SucceededJobs.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@
@Strings.Common_RequeueJobs
</button>
}
@if (!IsReadOnly)
{
<button class="js-jobs-list-command btn btn-sm btn-default"
data-url="@Url.To("/jobs/succeeded/delete")"
data-loading-text="@Strings.Common_Deleting"
data-confirm="@Strings.Common_DeleteConfirm">
<span class="glyphicon glyphicon-remove"></span>
@Strings.Common_Delete
</button>
}
@Html.PerPageSelector(pager)
</div>

Expand Down
127 changes: 94 additions & 33 deletions src/Hangfire.Core/Dashboard/Pages/SucceededJobs.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,74 @@ public override void Execute()
}


#line default
#line hidden


#line 48 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
if (!IsReadOnly)
{


#line default
#line hidden
WriteLiteral(" <button class=\"js-jobs-list-command btn btn-sm btn-defaul" +
"t\"\r\n data-url=\"");



#line 51 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(Url.To("/jobs/succeeded/delete"));


#line default
#line hidden
WriteLiteral("\"\r\n data-loading-text=\"");



#line 52 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(Strings.Common_Deleting);


#line default
#line hidden
WriteLiteral("\"\r\n data-confirm=\"");



#line 53 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(Strings.Common_DeleteConfirm);


#line default
#line hidden
WriteLiteral("\">\r\n <span class=\"glyphicon glyphicon-remove\"></span>\r" +
"\n ");



#line 55 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(Strings.Common_Delete);


#line default
#line hidden
WriteLiteral("\r\n </button>\r\n");



#line 57 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
}


#line default
#line hidden
WriteLiteral(" ");



#line 48 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 58 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(Html.PerPageSelector(pager));


Expand All @@ -205,7 +266,7 @@ public override void Execute()



#line 55 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 65 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
if (!IsReadOnly)
{

Expand All @@ -218,7 +279,7 @@ public override void Execute()



#line 60 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 70 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
}


Expand All @@ -228,7 +289,7 @@ public override void Execute()



#line 61 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 71 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(Strings.Common_Id);


Expand All @@ -238,7 +299,7 @@ public override void Execute()



#line 62 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 72 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(Strings.Common_Job);


Expand All @@ -248,7 +309,7 @@ public override void Execute()



#line 63 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 73 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(Strings.SucceededJobsPage_Table_TotalDuration);


Expand All @@ -258,7 +319,7 @@ public override void Execute()



#line 64 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 74 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(Strings.SucceededJobsPage_Table_Succeeded);


Expand All @@ -269,7 +330,7 @@ public override void Execute()



#line 68 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 78 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
foreach (var job in succeededJobs)
{

Expand All @@ -280,7 +341,7 @@ public override void Execute()



#line 70 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 80 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(job.Value == null || !job.Value.InSucceededState ? "obsolete-data" : null);


Expand All @@ -290,7 +351,7 @@ public override void Execute()



#line 70 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 80 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(job.Value != null && job.Value.InSucceededState ? "hover" : null);


Expand All @@ -300,7 +361,7 @@ public override void Execute()



#line 71 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 81 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
if (!IsReadOnly)
{

Expand All @@ -311,7 +372,7 @@ public override void Execute()



#line 74 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 84 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
if (job.Value == null || job.Value.InSucceededState)
{

Expand All @@ -323,7 +384,7 @@ public override void Execute()



#line 76 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 86 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(job.Key);


Expand All @@ -333,7 +394,7 @@ public override void Execute()



#line 77 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 87 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
}


Expand All @@ -343,7 +404,7 @@ public override void Execute()



#line 79 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 89 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
}


Expand All @@ -354,7 +415,7 @@ public override void Execute()



#line 81 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 91 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(Html.JobIdLink(job.Key));


Expand All @@ -364,7 +425,7 @@ public override void Execute()



#line 82 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 92 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
if (job.Value != null && !job.Value.InSucceededState)
{

Expand All @@ -375,7 +436,7 @@ public override void Execute()



#line 84 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 94 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(Strings.Common_JobStateChanged_Text);


Expand All @@ -385,7 +446,7 @@ public override void Execute()



#line 85 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 95 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
}


Expand All @@ -395,7 +456,7 @@ public override void Execute()



#line 88 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 98 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
if (job.Value == null)
{

Expand All @@ -407,7 +468,7 @@ public override void Execute()



#line 91 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 101 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(Strings.Common_JobExpired);


Expand All @@ -417,7 +478,7 @@ public override void Execute()



#line 93 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 103 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
}
else
{
Expand All @@ -430,7 +491,7 @@ public override void Execute()



#line 97 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 107 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(Html.JobNameLink(job.Key, job.Value.Job));


Expand All @@ -444,22 +505,22 @@ public override void Execute()



#line 100 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 110 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
if (job.Value.TotalDuration.HasValue)
{


#line default
#line hidden

#line 102 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 112 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(Html.ToHumanDuration(TimeSpan.FromMilliseconds(job.Value.TotalDuration.Value), false));


#line default
#line hidden

#line 102 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 112 "..\..\Dashboard\Pages\SucceededJobs.cshtml"

}

Expand All @@ -474,22 +535,22 @@ public override void Execute()



#line 106 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 116 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
if (job.Value.SucceededAt.HasValue)
{


#line default
#line hidden

#line 108 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 118 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(Html.RelativeTime(job.Value.SucceededAt.Value));


#line default
#line hidden

#line 108 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 118 "..\..\Dashboard\Pages\SucceededJobs.cshtml"

}

Expand All @@ -500,7 +561,7 @@ public override void Execute()



#line 111 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 121 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
}


Expand All @@ -510,7 +571,7 @@ public override void Execute()



#line 113 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 123 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
}


Expand All @@ -521,7 +582,7 @@ public override void Execute()



#line 118 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 128 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
Write(Html.Paginator(pager));


Expand All @@ -531,7 +592,7 @@ public override void Execute()



#line 120 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
#line 130 "..\..\Dashboard\Pages\SucceededJobs.cshtml"
}


Expand Down