瀏覽代碼

modify published pages.

master
yangxiaodong 7 年之前
父節點
當前提交
1b919d6010
共有 3 個文件被更改,包括 115 次插入17 次删除
  1. +24
    -13
      src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs
  2. +62
    -4
      src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cshtml
  3. +29
    -0
      src/DotNetCore.CAP/Dashboard/Pages/PublishedPage1.generated.cs

+ 24
- 13
src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs 查看文件

@@ -8,20 +8,22 @@ namespace DotNetCore.CAP.Dashboard
{
private static readonly string[] Javascripts =
{
"jquery-2.1.4.min.js",
"jquery-2.1.4.min.js",
"bootstrap.min.js",
"moment.min.js",
"moment-with-locales.min.js",
"d3.min.js",
"d3.layout.min.js",
"rickshaw.min.js",
"d3.min.js",
"d3.layout.min.js",
"rickshaw.min.js",
"jsonview.min.js",
"cap.js"
};

private static readonly string[] Stylesheets =
{
"bootstrap.min.css",
"rickshaw.min.css",
"bootstrap.min.css",
"rickshaw.min.css",
"jsonview.min.css",
"cap.css"
};

@@ -30,7 +32,7 @@ namespace DotNetCore.CAP.Dashboard
Routes = new RouteCollection();
Routes.AddRazorPage("/", x => new HomePage());
Routes.Add("/stats", new JsonStats());
#region Embedded static content

Routes.Add("/js[0-9]+", new CombinedResourceDispatcher(
@@ -74,6 +76,14 @@ namespace DotNetCore.CAP.Dashboard

#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/fetched/(?<Queue>.+)",
@@ -106,15 +116,16 @@ namespace DotNetCore.CAP.Dashboard
// (client, jobId) => client.ChangeState(jobId, CreateDeletedState(), ScheduledState.StateName));

Routes.AddRazorPage(
"/published/(?<StatusName>.+)",
"/published/(?<StatusName>.+)",
x => new PublishedPage(x.Groups["StatusName"].Value));

//Routes.AddPublishBatchCommand(
// "/published/succeeded/requeue",
// (client, jobId) => client.ChangeState(jobId, CreateEnqueuedState(), SucceededState.StateName));

Routes.AddRazorPage(
"/received/(?<StatusName>.+)",
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());

@@ -175,7 +186,7 @@ namespace DotNetCore.CAP.Dashboard

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)
@@ -195,7 +206,7 @@ namespace DotNetCore.CAP.Dashboard

private static Assembly GetExecutingAssembly()
{
return typeof (DashboardRoutes).GetTypeInfo().Assembly;
return typeof(DashboardRoutes).GetTypeInfo().Assembly;
}
}
}

+ 62
- 4
src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cshtml 查看文件

@@ -24,7 +24,7 @@
Name = name,
Content = content,
StatusName = StatusName,
CurrentPage = pager.CurrentPage - 1,
CurrentPage = pager.CurrentPage - 1,
PageSize = pager.RecordsPerPage
};
var succeededMessages = monitor.Messages(queryDto);
@@ -80,6 +80,7 @@
<th style="width:60px;">
<input type="checkbox" class="js-jobs-list-select-all" />
</th>
<th>编号</th>
<th>名称</th>
<th>内容</th>
<th class="min-width">重试次数</th>
@@ -94,10 +95,10 @@
<input type="checkbox" class="js-jobs-list-checkbox" name="jobs[]" value="@message.Id" />
</td>
<td class="word-break">
@message.Name
<a href="javascript:;" data-id="@message.Id" class="openModal">@message.Id</a>
</td>
<td>
@message.Content
@message.Name
</td>
<td>
@message.Retries
@@ -116,6 +117,63 @@
</div>
@Html.Paginator(pager)
</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>

<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>

+ 29
- 0
src/DotNetCore.CAP/Dashboard/Pages/PublishedPage1.generated.cs 查看文件

@@ -357,6 +357,35 @@ WriteLiteral("\r\n </div>\r\n");

#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"
}



Loading…
取消
儲存