From 8d3abf0fed29b2f2cf7e13533d510724fb445084 Mon Sep 17 00:00:00 2001 From: KharchenkoVV <vv.harchenko@autodrilling.ru> Date: Thu, 23 Sep 2021 16:07:23 +0500 Subject: [PATCH 1/3] New front --- AsbCloudWebApi/wwwroot/asset-manifest.json | 30 +++++++++++----------- AsbCloudWebApi/wwwroot/index.html | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/AsbCloudWebApi/wwwroot/asset-manifest.json b/AsbCloudWebApi/wwwroot/asset-manifest.json index f0d7b068..371e6018 100644 --- a/AsbCloudWebApi/wwwroot/asset-manifest.json +++ b/AsbCloudWebApi/wwwroot/asset-manifest.json @@ -1,23 +1,23 @@ { "files": { - "main.css": "/static/css/main.99536867.chunk.css", - "main.js": "/static/js/main.5222c3aa.chunk.js", - "main.js.map": "/static/js/main.5222c3aa.chunk.js.map", - "runtime-main.js": "/static/js/runtime-main.c0bb1130.js", - "runtime-main.js.map": "/static/js/runtime-main.c0bb1130.js.map", - "static/js/2.e07a64f5.chunk.js": "/static/js/2.e07a64f5.chunk.js", - "static/js/2.e07a64f5.chunk.js.map": "/static/js/2.e07a64f5.chunk.js.map", - "static/js/3.ffc36876.chunk.js": "/static/js/3.ffc36876.chunk.js", - "static/js/3.ffc36876.chunk.js.map": "/static/js/3.ffc36876.chunk.js.map", + "main.css": "/static/css/main.01936687.chunk.css", + "main.js": "/static/js/main.5913a560.chunk.js", + "main.js.map": "/static/js/main.5913a560.chunk.js.map", + "runtime-main.js": "/static/js/runtime-main.7bbed929.js", + "runtime-main.js.map": "/static/js/runtime-main.7bbed929.js.map", + "static/js/2.766da71c.chunk.js": "/static/js/2.766da71c.chunk.js", + "static/js/2.766da71c.chunk.js.map": "/static/js/2.766da71c.chunk.js.map", + "static/js/3.58b81d69.chunk.js": "/static/js/3.58b81d69.chunk.js", + "static/js/3.58b81d69.chunk.js.map": "/static/js/3.58b81d69.chunk.js.map", "index.html": "/index.html", - "static/css/main.99536867.chunk.css.map": "/static/css/main.99536867.chunk.css.map", - "static/js/2.e07a64f5.chunk.js.LICENSE.txt": "/static/js/2.e07a64f5.chunk.js.LICENSE.txt", + "static/css/main.01936687.chunk.css.map": "/static/css/main.01936687.chunk.css.map", + "static/js/2.766da71c.chunk.js.LICENSE.txt": "/static/js/2.766da71c.chunk.js.LICENSE.txt", "static/media/pointer.e8df778c.svg": "/static/media/pointer.e8df778c.svg" }, "entrypoints": [ - "static/js/runtime-main.c0bb1130.js", - "static/js/2.e07a64f5.chunk.js", - "static/css/main.99536867.chunk.css", - "static/js/main.5222c3aa.chunk.js" + "static/js/runtime-main.7bbed929.js", + "static/js/2.766da71c.chunk.js", + "static/css/main.01936687.chunk.css", + "static/js/main.5913a560.chunk.js" ] } \ No newline at end of file diff --git a/AsbCloudWebApi/wwwroot/index.html b/AsbCloudWebApi/wwwroot/index.html index aaf46e19..1d847144 100644 --- a/AsbCloudWebApi/wwwroot/index.html +++ b/AsbCloudWebApi/wwwroot/index.html @@ -1 +1 @@ -<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="manifest" href="/manifest.json"/><title>АСБ Vision</title><link href="/static/css/main.99536867.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,a,i=r[0],c=r[1],l=r[2],s=0,p=[];s<i.length;s++)a=i[s],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&p.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);p.length;)p.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var c=t[i];0!==o[c]&&(n=!1)}n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={1:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+"static/js/"+({}[e]||e)+"."+{3:"ffc36876"}[e]+".chunk.js"}(e);var c=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:i})}),12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,function(r){return e[r]}.bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="/",a.oe=function(e){throw console.error(e),e};var i=this.webpackJsonpasb_cloud_front_react=this.webpackJsonpasb_cloud_front_react||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var l=0;l<i.length;l++)r(i[l]);var f=c;t()}([])</script><script src="/static/js/2.e07a64f5.chunk.js"></script><script src="/static/js/main.5222c3aa.chunk.js"></script></body></html> \ No newline at end of file +<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="manifest" href="/manifest.json"/><title>АСБ Vision</title><link href="/static/css/main.01936687.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,a,i=r[0],c=r[1],l=r[2],s=0,p=[];s<i.length;s++)a=i[s],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&p.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);p.length;)p.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var c=t[i];0!==o[c]&&(n=!1)}n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={1:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+"static/js/"+({}[e]||e)+"."+{3:"58b81d69"}[e]+".chunk.js"}(e);var c=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:i})}),12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,function(r){return e[r]}.bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="/",a.oe=function(e){throw console.error(e),e};var i=this.webpackJsonpasb_cloud_front_react=this.webpackJsonpasb_cloud_front_react||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var l=0;l<i.length;l++)r(i[l]);var f=c;t()}([])</script><script src="/static/js/2.766da71c.chunk.js"></script><script src="/static/js/main.5913a560.chunk.js"></script></body></html> \ No newline at end of file From dc156154b0311adec6c3adcf26bef7c74d15d68d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= <nikita.grigorevich@gmail.com> Date: Mon, 27 Sep 2021 16:47:16 +0500 Subject: [PATCH 2/3] hotfix telemetryService get Id. UDO this when cache table done --- .../Services/TelemetryService.cs | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/AsbCloudInfrastructure/Services/TelemetryService.cs b/AsbCloudInfrastructure/Services/TelemetryService.cs index 93c85cb3..bdb720cd 100644 --- a/AsbCloudInfrastructure/Services/TelemetryService.cs +++ b/AsbCloudInfrastructure/Services/TelemetryService.cs @@ -3,6 +3,7 @@ using AsbCloudApp.Services; using AsbCloudDb.Model; using AsbCloudInfrastructure.Services.Cache; using Mapster; +using System.Linq; namespace AsbCloudInfrastructure.Services { @@ -10,11 +11,13 @@ namespace AsbCloudInfrastructure.Services { private readonly CacheTable<Telemetry> cacheTelemetry; private readonly CacheTable<Well> cacheWells; + private readonly IAsbCloudDbContext db; public TelemetryService(IAsbCloudDbContext db, CacheDb cacheDb) { cacheTelemetry = cacheDb.GetCachedTable<Telemetry>((AsbCloudDbContext)db); cacheWells = cacheDb.GetCachedTable<Well>((AsbCloudDbContext)db); + this.db = db; } public int GetOrCreateTemetryIdByUid(string uid) @@ -51,9 +54,25 @@ namespace AsbCloudInfrastructure.Services return cacheWells.FirstOrDefault(w => w?.IdTelemetry == tele.Id); } - private Telemetry GetOrCreateTelemetryByUid(string uid) - => cacheTelemetry.FirstOrDefault(t => t.RemoteUid == uid) - ?? cacheTelemetry.Insert(new Telemetry { RemoteUid = uid, }); + // TODO: fix cacheTable before uncomment next + //private Telemetry GetOrCreateTelemetryByUid(string uid) + // => cacheTelemetry.FirstOrDefault(t => t.RemoteUid == uid) + // ?? cacheTelemetry.Insert(new Telemetry { RemoteUid = uid, }); + private Telemetry GetOrCreateTelemetryByUid(string uid) + { + var telemetry = cacheTelemetry.FirstOrDefault(t => t.RemoteUid == uid); + if (telemetry is not null) + return telemetry; + + telemetry = db.Telemetries.OrderBy(t=>t.Info).FirstOrDefault(t => t.RemoteUid == uid); + if (telemetry is not null) + return telemetry; + + var newTelemetryEntry = db.Telemetries.Add(new Telemetry { RemoteUid = uid }); + db.SaveChanges(); + cacheTelemetry.Refresh(); + return newTelemetryEntry.Entity; + } } } From eb3668a8ba690ecb1fee03ce4bdaaa8cb606aadb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= <nikita.grigorevich@gmail.com> Date: Mon, 27 Sep 2021 16:48:24 +0500 Subject: [PATCH 3/3] mark legacy as Obsolete. till panels full update. --- AsbCloudApp/Services/IDataService.cs | 2 ++ AsbCloudInfrastructure/Services/DataService.cs | 1 + AsbCloudWebApi/Controllers/ReportController.cs | 1 - AsbCloudWebApi/Controllers/TelemetryController.cs | 2 ++ AsbCloudWebApi/Controllers/TelemetryDataBaseController.cs | 2 +- 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/AsbCloudApp/Services/IDataService.cs b/AsbCloudApp/Services/IDataService.cs index 95605c38..c62f4678 100644 --- a/AsbCloudApp/Services/IDataService.cs +++ b/AsbCloudApp/Services/IDataService.cs @@ -6,6 +6,8 @@ using System.Threading.Tasks; namespace AsbCloudApp.Services { + + [Obsolete] public interface IDataService { Task<IEnumerable<TelemetryDataSaubDto>> GetAsync(int idWell, DateTime dateBegin = default, diff --git a/AsbCloudInfrastructure/Services/DataService.cs b/AsbCloudInfrastructure/Services/DataService.cs index 6af94f90..b5ab2d97 100644 --- a/AsbCloudInfrastructure/Services/DataService.cs +++ b/AsbCloudInfrastructure/Services/DataService.cs @@ -13,6 +13,7 @@ using System.Threading.Tasks; namespace AsbCloudInfrastructure.Services { //TODO: delete this + [Obsolete] public class DataService : IDataService { private readonly IAsbCloudDbContext db; diff --git a/AsbCloudWebApi/Controllers/ReportController.cs b/AsbCloudWebApi/Controllers/ReportController.cs index 180fb908..121739a5 100644 --- a/AsbCloudWebApi/Controllers/ReportController.cs +++ b/AsbCloudWebApi/Controllers/ReportController.cs @@ -35,7 +35,6 @@ namespace AsbCloudWebApi.Controllers /// Создает отчет по скважине с указанными параметрами /// </summary> /// <param name="idWell">id скважины</param> - /// <param name="idUser">id пользователя</param> /// <param name="stepSeconds">шаг интервала</param> /// <param name="format">формат отчета (0-PDF, 1-LAS)</param> /// <param name="begin">дата начала интервала</param> diff --git a/AsbCloudWebApi/Controllers/TelemetryController.cs b/AsbCloudWebApi/Controllers/TelemetryController.cs index a1767274..1b31df79 100644 --- a/AsbCloudWebApi/Controllers/TelemetryController.cs +++ b/AsbCloudWebApi/Controllers/TelemetryController.cs @@ -3,6 +3,7 @@ using AsbCloudApp.Services; using AsbCloudWebApi.SignalR; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.SignalR; +using System; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -67,6 +68,7 @@ namespace AsbCloudWebApi.Controllers /// <param name="token">Токен для отмены задачи</param> /// <returns></returns> [HttpPost] + [Obsolete] [Route("{uid}/data")] public async Task<IActionResult> PostDataAsync(string uid, [FromBody] IEnumerable<TelemetryDataSaubDto> dtos, CancellationToken token = default) diff --git a/AsbCloudWebApi/Controllers/TelemetryDataBaseController.cs b/AsbCloudWebApi/Controllers/TelemetryDataBaseController.cs index c33cf30a..75d19a05 100644 --- a/AsbCloudWebApi/Controllers/TelemetryDataBaseController.cs +++ b/AsbCloudWebApi/Controllers/TelemetryDataBaseController.cs @@ -53,9 +53,9 @@ namespace AsbCloudWebApi.Controllers public virtual async Task<IActionResult> PostDataAsync(string uid, [FromBody] IEnumerable<TDto> dtos, CancellationToken token = default) { - var idWell = telemetryService.GetidWellByTelemetryUid(uid); await telemetryDataService.UpdateDataAsync(uid, dtos, token).ConfigureAwait(false); + var idWell = telemetryService.GetidWellByTelemetryUid(uid); if (idWell != null && dtos.Any()) await Task.Run(() => telemetryHubContext.Clients.Group($"well_{idWell}") .SendAsync(SirnalRMethodGetDataName, dtos), token).ConfigureAwait(false);