Commit 1b919d60 authored by yangxiaodong's avatar yangxiaodong

modify published pages.

parent dc9250ca
...@@ -8,20 +8,22 @@ namespace DotNetCore.CAP.Dashboard ...@@ -8,20 +8,22 @@ namespace DotNetCore.CAP.Dashboard
{ {
private static readonly string[] Javascripts = private static readonly string[] Javascripts =
{ {
"jquery-2.1.4.min.js", "jquery-2.1.4.min.js",
"bootstrap.min.js", "bootstrap.min.js",
"moment.min.js", "moment.min.js",
"moment-with-locales.min.js", "moment-with-locales.min.js",
"d3.min.js", "d3.min.js",
"d3.layout.min.js", "d3.layout.min.js",
"rickshaw.min.js", "rickshaw.min.js",
"jsonview.min.js",
"cap.js" "cap.js"
}; };
private static readonly string[] Stylesheets = private static readonly string[] Stylesheets =
{ {
"bootstrap.min.css", "bootstrap.min.css",
"rickshaw.min.css", "rickshaw.min.css",
"jsonview.min.css",
"cap.css" "cap.css"
}; };
...@@ -30,7 +32,7 @@ namespace DotNetCore.CAP.Dashboard ...@@ -30,7 +32,7 @@ namespace DotNetCore.CAP.Dashboard
Routes = new RouteCollection(); Routes = new RouteCollection();
Routes.AddRazorPage("/", x => new HomePage()); Routes.AddRazorPage("/", x => new HomePage());
Routes.Add("/stats", new JsonStats()); Routes.Add("/stats", new JsonStats());
#region Embedded static content #region Embedded static content
Routes.Add("/js[0-9]+", new CombinedResourceDispatcher( Routes.Add("/js[0-9]+", new CombinedResourceDispatcher(
...@@ -74,6 +76,14 @@ namespace DotNetCore.CAP.Dashboard ...@@ -74,6 +76,14 @@ namespace DotNetCore.CAP.Dashboard
#region Razor pages and commands #region Razor pages and commands
Routes.AddJsonResult("/publishd/message/(?<Id>.+)", x =>
{
var id = int.Parse(x.UriMatch.Groups["Id"].Value);
var message = x.Storage.GetConnection().GetPublishedMessageAsync(id).GetAwaiter().GetResult();
return message;
});
//Routes.AddRazorPage("/jobs/enqueued", x => new QueuesPage()); //Routes.AddRazorPage("/jobs/enqueued", x => new QueuesPage());
//Routes.AddRazorPage( //Routes.AddRazorPage(
// "/jobs/enqueued/fetched/(?<Queue>.+)", // "/jobs/enqueued/fetched/(?<Queue>.+)",
...@@ -106,15 +116,16 @@ namespace DotNetCore.CAP.Dashboard ...@@ -106,15 +116,16 @@ namespace DotNetCore.CAP.Dashboard
// (client, jobId) => client.ChangeState(jobId, CreateDeletedState(), ScheduledState.StateName)); // (client, jobId) => client.ChangeState(jobId, CreateDeletedState(), ScheduledState.StateName));
Routes.AddRazorPage( Routes.AddRazorPage(
"/published/(?<StatusName>.+)", "/published/(?<StatusName>.+)",
x => new PublishedPage(x.Groups["StatusName"].Value)); x => new PublishedPage(x.Groups["StatusName"].Value));
//Routes.AddPublishBatchCommand(
// "/published/succeeded/requeue",
// (client, jobId) => client.ChangeState(jobId, CreateEnqueuedState(), SucceededState.StateName));
Routes.AddRazorPage( Routes.AddRazorPage(
"/received/(?<StatusName>.+)", "/received/(?<StatusName>.+)",
x => new ReceivedPage(x.Groups["StatusName"].Value)); x => new ReceivedPage(x.Groups["StatusName"].Value));
//Routes.AddClientBatchCommand(
// "/jobs/succeeded/requeue",
// (client, jobId) => client.ChangeState(jobId, CreateEnqueuedState(), SucceededState.StateName));
//Routes.AddRazorPage("/jobs/failed", x => new FailedJobsPage()); //Routes.AddRazorPage("/jobs/failed", x => new FailedJobsPage());
...@@ -175,7 +186,7 @@ namespace DotNetCore.CAP.Dashboard ...@@ -175,7 +186,7 @@ namespace DotNetCore.CAP.Dashboard
internal static string GetContentFolderNamespace(string contentFolder) internal static string GetContentFolderNamespace(string contentFolder)
{ {
return $"{typeof (DashboardRoutes).Namespace}.Content.{contentFolder}"; return $"{typeof(DashboardRoutes).Namespace}.Content.{contentFolder}";
} }
internal static string GetContentResourceName(string contentFolder, string resourceName) internal static string GetContentResourceName(string contentFolder, string resourceName)
...@@ -195,7 +206,7 @@ namespace DotNetCore.CAP.Dashboard ...@@ -195,7 +206,7 @@ namespace DotNetCore.CAP.Dashboard
private static Assembly GetExecutingAssembly() private static Assembly GetExecutingAssembly()
{ {
return typeof (DashboardRoutes).GetTypeInfo().Assembly; return typeof(DashboardRoutes).GetTypeInfo().Assembly;
} }
} }
} }
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
Name = name, Name = name,
Content = content, Content = content,
StatusName = StatusName, StatusName = StatusName,
CurrentPage = pager.CurrentPage - 1, CurrentPage = pager.CurrentPage - 1,
PageSize = pager.RecordsPerPage PageSize = pager.RecordsPerPage
}; };
var succeededMessages = monitor.Messages(queryDto); var succeededMessages = monitor.Messages(queryDto);
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
<th style="width:60px;"> <th style="width:60px;">
<input type="checkbox" class="js-jobs-list-select-all" /> <input type="checkbox" class="js-jobs-list-select-all" />
</th> </th>
<th>编号</th>
<th>名称</th> <th>名称</th>
<th>内容</th> <th>内容</th>
<th class="min-width">重试次数</th> <th class="min-width">重试次数</th>
...@@ -94,10 +95,10 @@ ...@@ -94,10 +95,10 @@
<input type="checkbox" class="js-jobs-list-checkbox" name="jobs[]" value="@message.Id" /> <input type="checkbox" class="js-jobs-list-checkbox" name="jobs[]" value="@message.Id" />
</td> </td>
<td class="word-break"> <td class="word-break">
@message.Name <a href="javascript:;" data-id="@message.Id" class="openModal">@message.Id</a>
</td> </td>
<td> <td>
@message.Content @message.Name
</td> </td>
<td> <td>
@message.Retries @message.Retries
...@@ -116,6 +117,63 @@ ...@@ -116,6 +117,63 @@
</div> </div>
@Html.Paginator(pager) @Html.Paginator(pager)
</div> </div>
<div>
<div class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Modal title</h4>
</div>
<div id="jsonContent" style="max-height:500px;overflow-y:auto;" class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-sm btn-primary" id="formatBtn" onclick="">格式化</button>
<button type="button" class="btn btn-sm btn-primary" id="rawBtn" onclick="">原生</button>
<button type="button" class="btn btn-sm btn-primary" id="expandBtn" onclick="">展开</button>
<button type="button" class="btn btn-sm btn-primary" id="collapseBtn" onclick="">收缩</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
} }
</div> </div>
</div> </div>
\ No newline at end of file
<script>
(function () {
var json = null;
$(".openModal").click(function () {
var id = $(this).data("id");
$.ajax({
url: @Url("/published/message/")+id,
dataType: "json",
success: function (data) {
json = data;
$("#formatBtn").click();
$(".modal").modal("show");
}
});
});
$("#formatBtn").click(function () {
$('#jsonContent').JSONView(json);
});
$("#rawBtn").click(function () {
$('#jsonContent').text(JSON.stringify(json));
});
$("#expandBtn").click(function () {
$('#jsonContent').JSONView('expand');
});
$("#collapseBtn").click(function () {
$('#jsonContent').JSONView('collapse');
});
})();
</script>
\ No newline at end of file
...@@ -357,6 +357,35 @@ WriteLiteral("\r\n </div>\r\n"); ...@@ -357,6 +357,35 @@ WriteLiteral("\r\n </div>\r\n");
#line 119 "..\..\Dashboard\Pages\PublishedPage.cshtml" #line 119 "..\..\Dashboard\Pages\PublishedPage.cshtml"
#line default
#line hidden
WriteLiteral(@" <div>
<div class=""modal fade"" tabindex=""-1"" role=""dialog"">
<div class=""modal-dialog"" role=""document"">
<div class=""modal-content"">
<div class=""modal-header"">
<button type=""button"" class=""close"" data-dismiss=""modal"" aria-label=""Close""><span aria-hidden=""true"">&times;</span></button>
<h4 class=""modal-title"">Modal title</h4>
</div>
<div class=""modal-body"">
<p>One fine body&hellip;</p>
</div>
<div class=""modal-footer"">
<button type=""button"" class=""btn btn-default"" data-dismiss=""modal"">Close</button>
<button type=""button"" class=""btn btn-primary"">Save changes</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
");
#line 139 "..\..\Dashboard\Pages\PublishedPage.cshtml"
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment