From 8f18dbf77028981b2cc455e3e58f58320390f1f1 Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Fri, 6 Sep 2019 12:44:45 +0800 Subject: [PATCH] update Former-commit-id: 6e682c0a26c5b5d61823c4b73ca8281892a2cfbb --- .../Infrastructure/BaseClientService.cs | 5 ++++ .../IoTCenter/Controllers/AppController.cs | 4 +-- .../IoTCenter/Services/HealthCheckService.cs | 2 +- projects/IoTCenter/Services/PageHub.cs | 2 +- .../StreamingAssets/wwwroot/css/app.css | 3 +++ .../Assets/StreamingAssets/wwwroot/index.html | 26 +++++++++---------- 6 files changed, 25 insertions(+), 17 deletions(-) diff --git a/projects/IoT/IoT.Shared/Infrastructure/BaseClientService.cs b/projects/IoT/IoT.Shared/Infrastructure/BaseClientService.cs index 1c886cfc..c76b99dc 100644 --- a/projects/IoT/IoT.Shared/Infrastructure/BaseClientService.cs +++ b/projects/IoT/IoT.Shared/Infrastructure/BaseClientService.cs @@ -129,6 +129,11 @@ namespace IoT.Shared.Infrastructure { } + public void ServerToClient(string method, string message, string fromConnectionId) + { + this.OnServerToClient(method, method, fromConnectionId); + } + public void ClientToServer(string method, string message, string fromConnectionId = null) { Task.Run(() => diff --git a/projects/IoTCenter/Controllers/AppController.cs b/projects/IoTCenter/Controllers/AppController.cs index a9425d43..18e81e1b 100644 --- a/projects/IoTCenter/Controllers/AppController.cs +++ b/projects/IoTCenter/Controllers/AppController.cs @@ -82,7 +82,7 @@ namespace IoTCenter.Controllers { try { - var device = this._deviceRepo.ReadOnlyTable().FirstOrDefault(o => o.Number == request.Number); + var device = this._deviceRepo.ReadOnlyTable().Include(o => o.Node).FirstOrDefault(o => o.Number == request.Number); if (device != null) { var query = string.Empty; @@ -91,7 +91,7 @@ namespace IoTCenter.Controllers query = query.SetParam(item.Key, item.Value); } var message = $"{request.Method}{query}"; - this._pageHubContext.Clients.Group(device.ConnectId).SendAsync(Methods.ServerToClient, Methods.CallApi, message, request.ConnectionId); + this._pageHubContext.Clients.Group(device.Node.Number).SendAsync(Methods.ServerToClient, Methods.CallApi, message, request.ConnectionId); } return Json(ApiResponse.AsyncSuccess()); } diff --git a/projects/IoTCenter/Services/HealthCheckService.cs b/projects/IoTCenter/Services/HealthCheckService.cs index d5c74eaa..d0b860ff 100644 --- a/projects/IoTCenter/Services/HealthCheckService.cs +++ b/projects/IoTCenter/Services/HealthCheckService.cs @@ -56,7 +56,7 @@ namespace IoTCenter.Services { try { - pageHubContext.Clients.Group(node.Number).SendAsync(Methods.ServerToClient, "HealthCheckRequest", "", null); + pageHubContext.Clients.Group(node.Number).SendAsync(Methods.ServerToClient, Methods.HealthCheckRequest, "", null); } catch (Exception ex) { diff --git a/projects/IoTCenter/Services/PageHub.cs b/projects/IoTCenter/Services/PageHub.cs index f269d87a..f7b42317 100644 --- a/projects/IoTCenter/Services/PageHub.cs +++ b/projects/IoTCenter/Services/PageHub.cs @@ -25,7 +25,7 @@ namespace IoTCenter.Services public override void ClientToServer(string method, string message, string connectionId) { - if (method == "HealthCheckResponse") + if (method == Methods.HealthCheckResponse) { using (var scope = this._applicationService.CreateScope()) { diff --git a/projects/IoTClient/Assets/StreamingAssets/wwwroot/css/app.css b/projects/IoTClient/Assets/StreamingAssets/wwwroot/css/app.css index 908d555f..f250c13e 100644 --- a/projects/IoTClient/Assets/StreamingAssets/wwwroot/css/app.css +++ b/projects/IoTClient/Assets/StreamingAssets/wwwroot/css/app.css @@ -117,3 +117,6 @@ input[type=range] { input[type=range]:focus::-webkit-slider-runnable-track { background: #ccc; } +img.offline { + filter: grayscale(100%); +} \ No newline at end of file diff --git a/projects/IoTClient/Assets/StreamingAssets/wwwroot/index.html b/projects/IoTClient/Assets/StreamingAssets/wwwroot/index.html index 6d5203da..dea4d70b 100644 --- a/projects/IoTClient/Assets/StreamingAssets/wwwroot/index.html +++ b/projects/IoTClient/Assets/StreamingAssets/wwwroot/index.html @@ -182,7 +182,7 @@
  • -
    +
    {{device.DisplayName||device.Name}}
    @@ -208,7 +208,7 @@
  • -
    +
    {{device.DisplayName||device.Name}}
    @@ -238,7 +238,7 @@
  • -
    +
    {{device.DisplayName||device.Name}}
    @@ -265,7 +265,7 @@
  • -
    +
    {{device.DisplayName||device.Name}}
    @@ -291,7 +291,7 @@
  • -
    +
    {{device.DisplayName||device.Name}}
    @@ -317,7 +317,7 @@
  • -
    +
    {{device.DisplayName||device.Name}}
    {{getData(device,"状态")}}
    @@ -346,7 +346,7 @@
  • -
    +
    {{device.DisplayName||device.Name}}
    @@ -377,7 +377,7 @@
  • -
    +
    {{device.DisplayName||device.Name}}
    @@ -407,7 +407,7 @@
  • -
    +
    {{device.DisplayName||device.Name}}
    @@ -444,7 +444,7 @@
  • -
    +
    {{device.DisplayName||device.Name}}
    @@ -484,7 +484,7 @@
  • -
    +
    {{device.DisplayName||device.Name}}
    {{getData(device,"状态")}}
    @@ -592,7 +592,7 @@
  • -
    +
    {{device.DisplayName||device.Name}}
    @@ -680,7 +680,7 @@
  • -
    +
    {{device.DisplayName||device.Name}}