From 9acbbe20a4d5b448728543ec1ca48bd4fae3d935 Mon Sep 17 00:00:00 2001 From: Savorboard Date: Fri, 29 Sep 2017 15:06:43 +0800 Subject: [PATCH] rename reference class. --- .../MySqlStorageConnection.cs | 9 ++------ .../Dashboard/DashboardRoutes.cs | 22 ++++++++++--------- .../Dashboard/Pages/PublishedPage.cs | 5 ++--- .../Dashboard/Pages/ReceivedPage.cs | 5 ++--- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/src/DotNetCore.CAP.MySql/MySqlStorageConnection.cs b/src/DotNetCore.CAP.MySql/MySqlStorageConnection.cs index 4d129e9..19ae559 100644 --- a/src/DotNetCore.CAP.MySql/MySqlStorageConnection.cs +++ b/src/DotNetCore.CAP.MySql/MySqlStorageConnection.cs @@ -151,17 +151,12 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);"; return new MySqlFetchedMessage(fetchedMessage.MessageId, fetchedMessage.MessageType, connection, transaction); } - public List GetRangeFromSet(string key, int startingFrom, int endingAt) + public bool ChangePublishedState(int messageId, string state) { throw new NotImplementedException(); } - public bool ChangePublishedState(int messageId, IState state) - { - throw new NotImplementedException(); - } - - public bool ChangeReceivedState(int messageId, IState state) + public bool ChangeReceivedState(int messageId, string state) { throw new NotImplementedException(); } diff --git a/src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs b/src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs index dee7850..30e2689 100644 --- a/src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs +++ b/src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs @@ -1,6 +1,6 @@ using System.Reflection; using DotNetCore.CAP.Dashboard.Pages; -using DotNetCore.CAP.Processor.States; +using DotNetCore.CAP.Infrastructure; namespace DotNetCore.CAP.Dashboard { @@ -32,7 +32,7 @@ namespace DotNetCore.CAP.Dashboard Routes = new RouteCollection(); Routes.AddRazorPage("/", x => new HomePage()); Routes.Add("/stats", new JsonStats()); - Routes.Add("/health",new OkStats()); + Routes.Add("/health", new OkStats()); #region Embedded static content @@ -88,23 +88,25 @@ namespace DotNetCore.CAP.Dashboard var id = int.Parse(x.UriMatch.Groups["Id"].Value); var message = x.Storage.GetConnection().GetReceivedMessageAsync(id).GetAwaiter().GetResult(); return message.Content; - }); + }); Routes.AddPublishBatchCommand( - "/published/requeue", - (client, messageId) => client.Storage.GetConnection().ChangePublishedState(messageId, new ScheduledState())); + "/published/requeue", + (client, messageId) => + client.Storage.GetConnection().ChangePublishedState(messageId, StatusName.Scheduled)); Routes.AddPublishBatchCommand( - "/received/requeue", - (client, messageId) => client.Storage.GetConnection().ChangeReceivedState(messageId, new ScheduledState())); + "/received/requeue", + (client, messageId) => + client.Storage.GetConnection().ChangeReceivedState(messageId, StatusName.Scheduled)); Routes.AddRazorPage( "/published/(?.+)", - x => new PublishedPage(x.Groups["StatusName"].Value)); + x => new PublishedPage(x.Groups["StatusName"].Value)); Routes.AddRazorPage( - "/received/(?.+)", + "/received/(?.+)", x => new ReceivedPage(x.Groups["StatusName"].Value)); - Routes.AddRazorPage("/subscribers", x => new SubscriberPage()); + Routes.AddRazorPage("/subscribers", x => new SubscriberPage()); Routes.AddRazorPage("/nodes", x => new NodePage()); diff --git a/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cs b/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cs index 5b743f9..6082b05 100644 --- a/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cs +++ b/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cs @@ -1,5 +1,4 @@ using System; -using DotNetCore.CAP.Processor.States; namespace DotNetCore.CAP.Dashboard.Pages { @@ -14,11 +13,11 @@ namespace DotNetCore.CAP.Dashboard.Pages public int GetTotal(IMonitoringApi api) { - if (string.Equals(StatusName, SucceededState.StateName, StringComparison.CurrentCultureIgnoreCase)) + if (string.Equals(StatusName, Infrastructure.StatusName.Succeeded, StringComparison.CurrentCultureIgnoreCase)) { return api.PublishedSucceededCount(); } - if (string.Equals(StatusName, ProcessingState.StateName, StringComparison.CurrentCultureIgnoreCase)) + if (string.Equals(StatusName, Infrastructure.StatusName.Processing, StringComparison.CurrentCultureIgnoreCase)) { return api.PublishedProcessingCount(); } diff --git a/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cs b/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cs index 7a39157..173dd68 100644 --- a/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cs +++ b/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cs @@ -1,5 +1,4 @@ using System; -using DotNetCore.CAP.Processor.States; namespace DotNetCore.CAP.Dashboard.Pages { @@ -14,11 +13,11 @@ namespace DotNetCore.CAP.Dashboard.Pages public int GetTotal(IMonitoringApi api) { - if (string.Equals(StatusName, SucceededState.StateName, StringComparison.CurrentCultureIgnoreCase)) + if (string.Equals(StatusName, Infrastructure.StatusName.Succeeded, StringComparison.CurrentCultureIgnoreCase)) { return api.ReceivedSucceededCount(); } - if (string.Equals(StatusName, ProcessingState.StateName, StringComparison.CurrentCultureIgnoreCase)) + if (string.Equals(StatusName, Infrastructure.StatusName.Processing, StringComparison.CurrentCultureIgnoreCase)) { return api.ReceivedProcessingCount(); }