From 93359426794b146037e845a7893af136f8b677c1 Mon Sep 17 00:00:00 2001 From: Nicola Carminati Date: Tue, 14 May 2019 15:09:36 +0200 Subject: [PATCH 01/12] First commit --- Client/Browser_Tools/BrowserJSObject.cs | 118 +++++- Client/Browser_Tools/Models/InfoFile.cs | 3 +- Client/View/NcWindow.cs | 8 +- Step/Controllers/WebApi/NcFileController.cs | 124 +++++- Step/wwwroot/assets/styles/base/modals.less | 16 + Step/wwwroot/assets/styles/style.css | 18 + .../base-components/modal-load-program.ts | 60 ++- .../base-components/modal-load-program.vue | 378 +++++++++++------- Step/wwwroot/src/services/fileService.ts | 10 + 9 files changed, 551 insertions(+), 184 deletions(-) diff --git a/Client/Browser_Tools/BrowserJSObject.cs b/Client/Browser_Tools/BrowserJSObject.cs index 6b4f1b11..30223b39 100644 --- a/Client/Browser_Tools/BrowserJSObject.cs +++ b/Client/Browser_Tools/BrowserJSObject.cs @@ -20,17 +20,30 @@ using System.Threading; using System.Windows.Forms; using static Client.Utils.Constants; using System.Management; +using Chromium.Remote; namespace Active_Client.Browser_Tools { public class BrowserJSObject : JSObject { + private struct editorVar + { + public CfrV8Value func; + public CfrV8Context context; + public String file; + } // The first letter of All PUBLIC Variables and Methods must be Lower-Case (CEF Settings) private MainForm mainForm; - private static readonly string[] _validExtensions = { "", ".txt", ".cnc", ".cn", ".cno", ".ini", ".mpf", ".spf", /*".job", ".zip"*/ }; + private static readonly string[] _validExtensions = { "", ".txt", ".cnc", ".cn", ".cno", ".ini", ".mpf", ".spf", ".tap", ".anc", /*".job", ".zip"*/ }; private static readonly string[] _validImages = { ".jpg", ".jpeg", ".png" }; + private static readonly string editorPath = @"C:\Windows\System32\notepad.exe"; + private static readonly int editorX = 56; + private static readonly int editorY = 108; + private static readonly int editorW = 1808; + private static readonly int editorH = 873; private static string jobPath = ""; + private static Dictionary editorOpened = new Dictionary(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -61,6 +74,7 @@ namespace Active_Client.Browser_Tools AddFunction("getOSdriveList").Execute += getOSdriveList; AddFunction("getFileList").Execute += getFileList; AddFunction("getProgramInfo").Execute += getProgramInfo; + AddFunction("editProgram").Execute += editProgram; AddFunction("uploadAndActivateProgram").Execute += uploadAndActivateProgram; AddFunction("uploadAndAddToQueue").Execute += uploadAndAddToQueue; @@ -291,7 +305,7 @@ namespace Active_Client.Browser_Tools Process[] p = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(sft.path)).OrderByDescending(X => X.StartTime).ToArray(); if (p.Count() > 0 && p[0].MainWindowHandle != IntPtr.Zero) - NcWindow.ForceExtFocus(p[0].MainWindowHandle); + NcWindow.ForceExtFocus(p[0].MainWindowHandle,0,0,0,0); else { ProcessStartInfo PS = new ProcessStartInfo(sft.path, sft.arguments); @@ -349,18 +363,7 @@ namespace Active_Client.Browser_Tools Path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\", Type = "SPFO" }); - - //PartPRG Folder - if (Directory.Exists(PART_PRG_FOLDER)) - { - drivelist.Add(new Drive() - { - Name = ElaborateName("PartPrg", "", DriveType.Unknown), - Path = PART_PRG_FOLDER + "\\", - Type = "SPFO" - }); - } - + //Network Folders var searcher = new ManagementObjectSearcher("select * from Win32_MappedLogicalDisk"); foreach (ManagementObject queryObj in searcher.Get()) @@ -621,6 +624,7 @@ namespace Active_Client.Browser_Tools file.CreationDate = f.CreationTime; file.LastModDate = f.LastAccessTime; file.AbsolutePath = p; + file.CanEdit = !f.IsReadOnly; imagePath = Path.GetFileNameWithoutExtension(p); imageDirectory = Path.GetDirectoryName(p); @@ -651,6 +655,67 @@ namespace Active_Client.Browser_Tools e.SetReturnValue(JsonConvert.SerializeObject(file)); } + // launch FIle editor + public void editProgram(object sender, CfrV8HandlerExecuteEventArgs e) + { + + if (e.Arguments.Count() < 2) + { + e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("error_arguments_not_ok"))); + return; + } + + String p = e.Arguments[0].StringValue; + if (!System.IO.File.Exists(p)) + { + e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("file_not_found"))); + return; + } + + editorVar ev = new editorVar(); + ev.context = CfrV8Context.GetCurrentContext(); + ev.func = e.Arguments[1]; + ev.file = p; + + IntPtr handleFound; + if (editorOpened.TryGetValue(p,out handleFound)) + NcWindow.ForceExtFocus(handleFound,0,0,0,0); + else + { + Thread t = new Thread(new ParameterizedThreadStart(startNewEditor)); + t.Start(ev); + } + + } + + public void startNewEditor(object obj) + { + //Setup editor Variable + editorVar ev = (editorVar)obj; + + //Start Ext editor + ProcessStartInfo PS = new ProcessStartInfo(editorPath, ev.file); + PS.WorkingDirectory = new FileInfo(editorPath).Directory.FullName; + Process proc = Process.Start(PS); + proc.WaitForInputIdle(); + NcWindow.ForceExtFocus(proc.MainWindowHandle, editorX, editorY, editorW, editorH); + + //Add it to dictionary + editorOpened.Add(ev.file, proc.MainWindowHandle); + + //Wait for Editor Exit + proc.WaitForExit(); + + //Remove from dictionary + editorOpened.Remove(ev.file); + + //Force Focus Active + NcWindow.ForceStepFocus(); + + //call JS return function + callJSFunction(ev.func, null, ev.context); + } + // Private functions private String ElaborateName(String name, String letter, DriveType type) { @@ -688,7 +753,32 @@ namespace Active_Client.Browser_Tools } #endregion FILESYSTEM_METHODS + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + #region RECALL_METHOD + + private void callJSFunction(CfrV8Value functionIstance,String arguments, CfrV8Context context) + { + //Create & enter function context + var rpcContext = functionIstance.CreateRemoteCallContext(); + rpcContext.Enter(); + //Task to execute + var task = new CfrTask(); + task.Execute += (s, e) => + { + context.Enter(); + var args = new CfrV8Value[] { arguments }; + functionIstance.ExecuteFunction(null, args); //execute callback, nothing happens here + context.Exit(); + }; + //Start it + CfrTaskRunner.GetForThread(CfxThreadId.Renderer).PostTask(task); + + //Exit + rpcContext.Exit(); + } + + #endregion RECALL_METHOD /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region JOB_METHODS diff --git a/Client/Browser_Tools/Models/InfoFile.cs b/Client/Browser_Tools/Models/InfoFile.cs index 0f4e30ac..c1503813 100644 --- a/Client/Browser_Tools/Models/InfoFile.cs +++ b/Client/Browser_Tools/Models/InfoFile.cs @@ -12,7 +12,8 @@ namespace Active_Client.Browser_Tools.Models public String AbsolutePath; public DateTime CreationDate; public DateTime LastModDate; - public List Content; + public List Content; + public Boolean CanEdit; public string PreviewBase64; } } diff --git a/Client/View/NcWindow.cs b/Client/View/NcWindow.cs index 3a875bd0..70fee18d 100644 --- a/Client/View/NcWindow.cs +++ b/Client/View/NcWindow.cs @@ -567,11 +567,13 @@ namespace Active_Client.View //Force Focus External app - public static void ForceExtFocus(IntPtr Handle) + public static void ForceExtFocus(IntPtr Handle, int X, int Y, int width, int height) { if (Handle != IntPtr.Zero) - ForceFocus(Handle); - + ForceFocus(Handle); + + if (width > 0 && height > 0) + MoveWindow(Handle, X, Y, width, height, true); } diff --git a/Step/Controllers/WebApi/NcFileController.cs b/Step/Controllers/WebApi/NcFileController.cs index d67df01f..e38eda90 100644 --- a/Step/Controllers/WebApi/NcFileController.cs +++ b/Step/Controllers/WebApi/NcFileController.cs @@ -1,6 +1,7 @@ using CMS_CORE_Library.Models; using Step.Model.DTOModels; using Step.NC; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -98,6 +99,7 @@ namespace Step.Controllers.WebApi bool imageUploaded = false; string mainPPName = ""; + List programs = new List(); if (!Request.Content.IsMimeMultipartContent()) { @@ -109,22 +111,23 @@ namespace Step.Controllers.WebApi { ncFileHandler.Connect(); - if(NcConfig.NcVendor == NC_VENDOR.OSAI) + if (NcConfig.NcVendor == NC_VENDOR.OSAI) { // Clean upload folder only OSAI CmsError cmsError = ncFileHandler.CleanUploadFolder(); - if (cmsError.IsError() && cmsError.errorCode != CMS_ERROR_CODES.FILE_NOT_FOUND) + if (cmsError.IsError() && cmsError.errorCode != CMS_ERROR_CODES.FILE_NOT_FOUND) return BadRequest(cmsError.localizationKey); } - foreach (FormItem item in formItems) + foreach (FormItem item in formItems) { if (item.IsAFile) { if (item.ParameterName == "main") { - File.WriteAllBytes(TEMP_PP_FOLDER + item.FileName, item.Data); + File.WriteAllBytes(TEMP_PP_FOLDER + item.FileName, item.Data); mainPPName = item.FileName; + programs.Add(item.FileName); // Upload main program CmsError cmsError = ncFileHandler.UploadPartProgramAndActivate(TEMP_PP_FOLDER, item.FileName, out ActiveProgramDataModel programData); @@ -134,6 +137,8 @@ namespace Step.Controllers.WebApi else if (item.ParameterName == "file") { File.WriteAllBytes(TEMP_PP_FOLDER + item.FileName, item.Data); + programs.Add(item.FileName); + // Upload files CmsError cmsError = ncFileHandler.UploadPartProgram(TEMP_PP_FOLDER, item.FileName, out string programPath); if (cmsError.IsError()) @@ -151,23 +156,124 @@ namespace Step.Controllers.WebApi if (!imageUploaded) { mainPPName = Path.GetFileNameWithoutExtension(mainPPName); - string [] imgFiles = Directory.GetFiles(PART_PRG_IMAGES); - foreach(string f in imgFiles) + string[] imgFiles = Directory.GetFiles(PART_PRG_IMAGES); + foreach (string f in imgFiles) { - if(Path.GetFileNameWithoutExtension(f) == mainPPName) + if (Path.GetFileNameWithoutExtension(f) == mainPPName) File.Delete(f); } - } + + if (NcConfig.NcVendor != NC_VENDOR.OSAI) { + + List lines = new List(); + string outputFileName = NcConfig.SharedPath + "activePP.list"; + + foreach (string prog in programs) + { + FileInfo fi = new FileInfo(NcConfig.SharedPath + prog); + if (fi.Exists) + { + lines.Add(prog + "|" + fi.CreationTime + "|" + fi.LastWriteTime); + } + } + // Write file + File.WriteAllLines(outputFileName, lines.ToArray()); + } + + } return Ok(); } + [Route("shared_folder_ok"), HttpGet] + public IHttpActionResult IsSharedFolderOK() + { + if (NcConfig.NcVendor == NC_VENDOR.OSAI) + return Ok(true); + else + { + string fileName = NcConfig.SharedPath + "activePP.list"; + int count = Directory.GetFiles(NcConfig.SharedPath).Length; + + if (!File.Exists(fileName) && count == 0) + return Ok(true); + + if (File.Exists(fileName) && count == 1) + return Ok(false); + + if (File.Exists(fileName) && count > 1) + { + // Write file + string[] lines = File.ReadAllLines(fileName); + foreach (string line in lines) + { + if (!string.IsNullOrWhiteSpace(line)) + { + string[] linesplitted = line.Split('|'); + if (linesplitted.Length != 3) + return Ok(false); + FileInfo fi = new FileInfo(NcConfig.SharedPath + linesplitted[0]); + if (!fi.Exists) + return Ok(false); + if (fi.CreationTime.ToString() != linesplitted[1]) + return Ok(false); + if (fi.LastWriteTime.ToString() != linesplitted[2]) + return Ok(false); + } + } + return Ok(true); + } + return Ok(false); + } + } + + [Route("clean_shared_folder"), HttpPut] + public IHttpActionResult cleanSharedFolder() + { + if (NcConfig.NcVendor == NC_VENDOR.OSAI) + return Ok(true); + else + { + foreach(string filename in Directory.GetFiles(NcConfig.SharedPath)) + { + File.Delete(filename); + } + } + return Ok(false); + } + + [Route("backup_shared_folder"), HttpPut] + public IHttpActionResult backupSharedFolder() + { + if (NcConfig.NcVendor == NC_VENDOR.OSAI) + return Ok(true); + else + { + string newFolder = "C:\\Backup_" + new DirectoryInfo(NcConfig.SharedPath).Name + "\\" + DateTime.Now.ToString("dd-MM-yyyy_HH-mm-ss") + "\\"; + + File.Delete(NcConfig.SharedPath + "activePP.list"); + Directory.CreateDirectory(newFolder); + foreach (string filename in Directory.GetFiles(NcConfig.SharedPath)) + { + try + { + File.Move(filename, newFolder + Path.GetFileName(filename)); + } + catch + { + return InternalServerError(); + } + } + return Ok(true); + } + } + [Route("shared_files"), HttpGet] public IHttpActionResult GetSharedFolderFileList(string sharedPath) - { + { List filelist = new List(); // NC - PC shared folder path string sharedFullPath = NcConfig.SharedPath + sharedPath; diff --git a/Step/wwwroot/assets/styles/base/modals.less b/Step/wwwroot/assets/styles/base/modals.less index 1ed4f203..e1a7e13c 100644 --- a/Step/wwwroot/assets/styles/base/modals.less +++ b/Step/wwwroot/assets/styles/base/modals.less @@ -1322,6 +1322,22 @@ display: flex; position: relative; flex-flow: row; + .cleanTempFolder{ + top: 0; + left: 0; + position: absolute; + width: 100%; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + font-weight: bold; + font-size: 2em; + line-height: 3em; + flex-flow: column; + background-color: rgba(217, 217, 217, 0.5); + } + hr { width: 5%; } diff --git a/Step/wwwroot/assets/styles/style.css b/Step/wwwroot/assets/styles/style.css index 23115b8f..8430094b 100644 --- a/Step/wwwroot/assets/styles/style.css +++ b/Step/wwwroot/assets/styles/style.css @@ -1268,6 +1268,24 @@ position: relative; flex-flow: row; } +.modal.modal-load-program .modal-load-program-body .cleanTempFolder, +.modal.modal-add-element-queue .modal-load-program-body .cleanTempFolder, +.modal.modal-load-program .modal-add-element-queue-body .cleanTempFolder, +.modal.modal-add-element-queue .modal-add-element-queue-body .cleanTempFolder { + top: 0; + left: 0; + position: absolute; + width: 100%; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + font-weight: bold; + font-size: 2em; + line-height: 3em; + flex-flow: column; + background-color: rgba(217, 217, 217, 0.5); +} .modal.modal-load-program .modal-load-program-body hr, .modal.modal-add-element-queue .modal-load-program-body hr, .modal.modal-load-program .modal-add-element-queue-body hr, diff --git a/Step/wwwroot/src/modules/base-components/modal-load-program.ts b/Step/wwwroot/src/modules/base-components/modal-load-program.ts index dfe13879..42fc4f21 100644 --- a/Step/wwwroot/src/modules/base-components/modal-load-program.ts +++ b/Step/wwwroot/src/modules/base-components/modal-load-program.ts @@ -15,9 +15,6 @@ import ZoomImage from './zoom-image.vue' declare var cmsClient: any; - - - interface PathInfo { Name: string; AbsolutePath: string; @@ -32,6 +29,7 @@ interface FileInfo { LastModDate: string; Content: Array; PreviewBase64: any; + CanEdit: boolean; IsJob: boolean; } @@ -67,15 +65,17 @@ export default class ModalLoadProgram extends Vue { navigationDepth: number = 0; selectedNumberImage: number = 0; showZoomedImage: boolean = false; + mustCLeanPProgram: boolean = false; + externalEditorOpened: boolean = false; uploadAllFileInFolder: boolean = false; onLabel: string = "On"; offLabel: string = "Off"; - mounted() { + async mounted() { if (typeof cmsClient != "undefined") { this.driveList = JSON.parse(cmsClient.getOSdriveList()); - } + } } async navigateTo( @@ -133,6 +133,9 @@ export default class ModalLoadProgram extends Vue { } } + get machineInfo() { + return this.$store.state.machineInfo; + } async getFilesForPath(absolutePath: string, path: string, local: boolean): Promise> { this.isLocalNavigation = local; var result = null; @@ -200,7 +203,8 @@ export default class ModalLoadProgram extends Vue { LastModDate: data.lastModDate || data.LastModDate, Name: data.name || data.Name, PreviewBase64: data.previewBase64 || data.PreviewBase64, - IsJob: data.isJob || data.IsJob + IsJob: data.isJob || data.IsJob, + CanEdit: data.canEdit || data.CanEdit } as FileInfo; } @@ -248,6 +252,11 @@ export default class ModalLoadProgram extends Vue { Factory.Get(MessageService).subscribeToChannel("esc_pressed", args => { this.close(); }); + if(!this.machineInfo.isOsai){ + awaiter (fileService.isTempFolderOK().then(response => { + this.mustCLeanPProgram = !response; + })); + } } beforeDestroy() { Factory.Get(MessageService).deleteChannel("esc_pressed"); @@ -315,4 +324,43 @@ export default class ModalLoadProgram extends Vue { this.uploadAllFileInFolder = !this.uploadAllFileInFolder; } + + + async cleanTempfolder(){ + await awaiter(fileService.cleanTempFolder()); + await awaiter (fileService.isTempFolderOK().then(response => { + this.mustCLeanPProgram = !response; + })); + } + + async backupTempfolder(){ + await awaiter(fileService.backupTempFolder()); + await awaiter (fileService.isTempFolderOK().then(response => { + this.mustCLeanPProgram = !response; + })); + } + + editprogram(){ + + var res = cmsClient.editProgram(this.selectedFile.AbsolutePath,this.endEditor); + if (res) { + var obj = JSON.parse(res); + if (obj.error){ + (iziToast as any).error({ + title: "error", + message: obj.error, + theme: "dark", + timeout: 10000, + class: "t-error", + transitionOut: "fadeOut", + }) + } + } + else + this.externalEditorOpened = true; + } + + endEditor(){ + this.externalEditorOpened = false; + } } diff --git a/Step/wwwroot/src/modules/base-components/modal-load-program.vue b/Step/wwwroot/src/modules/base-components/modal-load-program.vue index f3077a6e..8be5e027 100644 --- a/Step/wwwroot/src/modules/base-components/modal-load-program.vue +++ b/Step/wwwroot/src/modules/base-components/modal-load-program.vue @@ -1,163 +1,239 @@ diff --git a/Step/wwwroot/src/services/fileService.ts b/Step/wwwroot/src/services/fileService.ts index c52ce859..401c0857 100644 --- a/Step/wwwroot/src/services/fileService.ts +++ b/Step/wwwroot/src/services/fileService.ts @@ -31,6 +31,16 @@ export class FileService extends baseRestService { return result; } + async isTempFolderOK() { + return await this.Get(this.BASE_URL + "shared_folder_ok", null); + } + async cleanTempFolder() { + return await this.Put(this.BASE_URL + "clean_shared_folder", null); + } + async backupTempFolder() { + return await this.Put(this.BASE_URL + "backup_shared_folder", null); + } + async activateProgram(path: string) { return await this.Put(this.BASE_URL + "file/active?filePath=" + path, null); } From 3eefee40a95b67315052a83cf93a5b09e4eb0796 Mon Sep 17 00:00:00 2001 From: Lucio Maranta Date: Wed, 17 Jul 2019 09:33:31 +0200 Subject: [PATCH 02/12] Fix scada --- .../components/card-axes-production.vue | 16 ++++++++++++---- .../src/app_modules/scada/components/scada.ts | 7 +++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Step/wwwroot/src/app_modules/production/components/card-axes-production.vue b/Step/wwwroot/src/app_modules/production/components/card-axes-production.vue index 630b2f9a..aa1363dd 100644 --- a/Step/wwwroot/src/app_modules/production/components/card-axes-production.vue +++ b/Step/wwwroot/src/app_modules/production/components/card-axes-production.vue @@ -49,7 +49,7 @@ {{a.name}}
- {{a.value.toFixed(3)}} + {{a.value.toFixed(GetRoundNumber())}} {{a.umeas}}
@@ -60,7 +60,7 @@ {{a.name}}
- {{a.value.toFixed(3)}} + {{a.value.toFixed(GetRoundNumber())}} {{a.umeas}}
@@ -71,7 +71,7 @@ {{a.name}}
- {{a.value.toFixed(3)}} + {{a.value.toFixed(GetRoundNumber())}} {{a.umeas}}
@@ -82,7 +82,7 @@ {{a.name}}
- {{a.value.toFixed(3)}} + {{a.value.toFixed(GetRoundNumber())}} {{a.umeas}}
@@ -215,6 +215,14 @@ export default { else return "--"; } + }, + GetRoundNumber(){ + if(this.CNCumeas == "In"){ + return 4; + } + else { + return 3; + } } } }; diff --git a/Step/wwwroot/src/app_modules/scada/components/scada.ts b/Step/wwwroot/src/app_modules/scada/components/scada.ts index 531eee5b..3fc0a14b 100644 --- a/Step/wwwroot/src/app_modules/scada/components/scada.ts +++ b/Step/wwwroot/src/app_modules/scada/components/scada.ts @@ -67,7 +67,10 @@ export default class Scada extends Vue { } get layers() { - return (this.$store.state as AppModel).scada.layers[this.currentScadaId]; + if((this.$store.state as AppModel).scada.layers[this.currentScadaId] && (this.$store.state as AppModel).scada.layers[this.currentScadaId][0]) + return (this.$store.state as AppModel).scada.layers[this.currentScadaId][0]; + else + return [] } buttons(layerid: number) { @@ -76,7 +79,7 @@ export default class Scada extends Vue { inputs(layerid: number) { return this.items(layerid).filter(i => i.type == "inputControl"); - } + } images(layerid: number) { return this.items(layerid).filter(i => i.type == "imageControl"); From 55169b7174698dfd4bd7687b6992008e7d177966 Mon Sep 17 00:00:00 2001 From: Lucio Maranta Date: Wed, 17 Jul 2019 09:34:04 +0200 Subject: [PATCH 03/12] Revert "Fix scada" This reverts commit 3eefee40a95b67315052a83cf93a5b09e4eb0796. --- .../components/card-axes-production.vue | 16 ++++------------ .../src/app_modules/scada/components/scada.ts | 7 ++----- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/Step/wwwroot/src/app_modules/production/components/card-axes-production.vue b/Step/wwwroot/src/app_modules/production/components/card-axes-production.vue index aa1363dd..630b2f9a 100644 --- a/Step/wwwroot/src/app_modules/production/components/card-axes-production.vue +++ b/Step/wwwroot/src/app_modules/production/components/card-axes-production.vue @@ -49,7 +49,7 @@ {{a.name}}
- {{a.value.toFixed(GetRoundNumber())}} + {{a.value.toFixed(3)}} {{a.umeas}}
@@ -60,7 +60,7 @@ {{a.name}}
- {{a.value.toFixed(GetRoundNumber())}} + {{a.value.toFixed(3)}} {{a.umeas}}
@@ -71,7 +71,7 @@ {{a.name}}
- {{a.value.toFixed(GetRoundNumber())}} + {{a.value.toFixed(3)}} {{a.umeas}}
@@ -82,7 +82,7 @@ {{a.name}}
- {{a.value.toFixed(GetRoundNumber())}} + {{a.value.toFixed(3)}} {{a.umeas}}
@@ -215,14 +215,6 @@ export default { else return "--"; } - }, - GetRoundNumber(){ - if(this.CNCumeas == "In"){ - return 4; - } - else { - return 3; - } } } }; diff --git a/Step/wwwroot/src/app_modules/scada/components/scada.ts b/Step/wwwroot/src/app_modules/scada/components/scada.ts index 3fc0a14b..531eee5b 100644 --- a/Step/wwwroot/src/app_modules/scada/components/scada.ts +++ b/Step/wwwroot/src/app_modules/scada/components/scada.ts @@ -67,10 +67,7 @@ export default class Scada extends Vue { } get layers() { - if((this.$store.state as AppModel).scada.layers[this.currentScadaId] && (this.$store.state as AppModel).scada.layers[this.currentScadaId][0]) - return (this.$store.state as AppModel).scada.layers[this.currentScadaId][0]; - else - return [] + return (this.$store.state as AppModel).scada.layers[this.currentScadaId]; } buttons(layerid: number) { @@ -79,7 +76,7 @@ export default class Scada extends Vue { inputs(layerid: number) { return this.items(layerid).filter(i => i.type == "inputControl"); - } + } images(layerid: number) { return this.items(layerid).filter(i => i.type == "imageControl"); From fd9e08a0d2359093b610ed9f27d9719ee9b8fdb8 Mon Sep 17 00:00:00 2001 From: Lucio Maranta Date: Tue, 20 Aug 2019 16:40:15 +0200 Subject: [PATCH 04/12] WIP file editor --- Client.Config/Config.cs | 1 + Client.Config/SubModels/ServerConfigModel.cs | 2 + Client/Browser_Tools/BrowserJSObject.cs | 69 +++++++++++-------- Client/View/OpeningForm.cs | 6 +- Step.Config/Config/serverConfig.xml | 1 + Step.Config/Config/serverConfigValidator.xsd | 1 + Step.Config/ServerConfigController.cs | 1 + Step.Model/ConfigModels/ServerConfigModel.cs | 4 +- .../DTOModels/DTOClientConfigurationModel.cs | 1 + .../WebApi/ConfigurationController.cs | 1 + .../base-components/modal-load-program.ts | 3 +- 11 files changed, 56 insertions(+), 34 deletions(-) diff --git a/Client.Config/Config.cs b/Client.Config/Config.cs index 7a40da5b..4ba4f35d 100644 --- a/Client.Config/Config.cs +++ b/Client.Config/Config.cs @@ -14,6 +14,7 @@ namespace Client.Config public static SubModels.Connection ConnectionConfig; public static SubModels.VendorHmi VendorHmiConfig; public static SubModels.ProdSoftware ProdSoftwareConfig { get; set; } + public static string TextEditorPath { get; set; } public static SubModels.Software[] ExtSoftwaresConfig { get; set; } } diff --git a/Client.Config/SubModels/ServerConfigModel.cs b/Client.Config/SubModels/ServerConfigModel.cs index 09b28e2f..b95597e2 100644 --- a/Client.Config/SubModels/ServerConfigModel.cs +++ b/Client.Config/SubModels/ServerConfigModel.cs @@ -15,6 +15,8 @@ namespace Client.Config.SubModels public string ProdEnabled { get; set; } public string ProdPath { get; set; } public string Autorun { get; set; } + public string EditorPath { get; set; } + public List ExtSoftwares { get; set; } } } diff --git a/Client/Browser_Tools/BrowserJSObject.cs b/Client/Browser_Tools/BrowserJSObject.cs index da2d9bd7..82b812ef 100644 --- a/Client/Browser_Tools/BrowserJSObject.cs +++ b/Client/Browser_Tools/BrowserJSObject.cs @@ -26,7 +26,7 @@ namespace Active_Client.Browser_Tools { public class BrowserJSObject : JSObject { - private struct editorVar + private struct EditorVar { public CfrV8Value func; public CfrV8Context context; @@ -45,6 +45,7 @@ namespace Active_Client.Browser_Tools private static readonly int editorH = 873; private static string jobPath = ""; private static Dictionary editorOpened = new Dictionary(); + private static EditorVar CurrentEditorObject = new EditorVar(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -659,62 +660,72 @@ namespace Active_Client.Browser_Tools // launch FIle editor public void editProgram(object sender, CfrV8HandlerExecuteEventArgs e) { - if (e.Arguments.Count() < 2) { e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("error_arguments_not_ok"))); return; } - String p = e.Arguments[0].StringValue; + string p = e.Arguments[0].StringValue; if (!System.IO.File.Exists(p)) { e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("file_not_found"))); return; } - - editorVar ev = new editorVar(); - ev.context = CfrV8Context.GetCurrentContext(); - ev.func = e.Arguments[1]; - ev.file = p; - IntPtr handleFound; - if (editorOpened.TryGetValue(p,out handleFound)) - NcWindow.ForceExtFocus(handleFound,0,0,0,0); + if(!System.IO.File.Exists(Config.TextEditorPath)) + { + e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("editor_not_configured"))); + return; + } + + CurrentEditorObject = new EditorVar + { + context = CfrV8Context.GetCurrentContext(), + func = e.Arguments[1], + file = p + }; + + if (editorOpened.TryGetValue(p, out IntPtr handleFound)) + NcWindow.ForceExtFocus(handleFound, 0, 0, 0, 0); else { - Thread t = new Thread(new ParameterizedThreadStart(startNewEditor)); - t.Start(ev); + Thread t = new Thread(startNewEditor); + t.Start(); } } - public void startNewEditor(object obj) + public void startNewEditor() { - //Setup editor Variable - editorVar ev = (editorVar)obj; + Process proc = new Process + { + StartInfo = new ProcessStartInfo() + { + FileName = Config.TextEditorPath, + Arguments = CurrentEditorObject.file + } + }; + + proc.Start(); - //Start Ext editor - ProcessStartInfo PS = new ProcessStartInfo(editorPath, ev.file); - PS.WorkingDirectory = new FileInfo(editorPath).Directory.FullName; - Process proc = Process.Start(PS); proc.WaitForInputIdle(); NcWindow.ForceExtFocus(proc.MainWindowHandle, editorX, editorY, editorW, editorH); - //Add it to dictionary - editorOpened.Add(ev.file, proc.MainWindowHandle); + // Add it to dictionary + editorOpened.Add(CurrentEditorObject.file, proc.MainWindowHandle); - //Wait for Editor Exit + // Wait for Editor Exit proc.WaitForExit(); + + // Remove from dictionary + editorOpened.Remove(CurrentEditorObject.file); - //Remove from dictionary - editorOpened.Remove(ev.file); - - //Force Focus Active + // Force Focus Active NcWindow.ForceStepFocus(); - //call JS return function - callJSFunction(ev.func, null, ev.context); + // Call JS return function + callJSFunction(CurrentEditorObject.func, null, CurrentEditorObject.context); } // Private functions diff --git a/Client/View/OpeningForm.cs b/Client/View/OpeningForm.cs index a609e501..9fa1a0f3 100644 --- a/Client/View/OpeningForm.cs +++ b/Client/View/OpeningForm.cs @@ -283,11 +283,13 @@ namespace Active_Client.View else Config.ProdSoftwareConfig.Enabled = false; + // Paths Config.ProdSoftwareConfig.Path = ProdPath; + Config.TextEditorPath = ConfigResponse.EditorPath; - if(ConfigResponse.ExtSoftwares != null) + if (ConfigResponse.ExtSoftwares != null) Config.ExtSoftwaresConfig = ConfigResponse.ExtSoftwares.ToArray(); - + return true; } diff --git a/Step.Config/Config/serverConfig.xml b/Step.Config/Config/serverConfig.xml index 2ae275c9..ba99af4a 100644 --- a/Step.Config/Config/serverConfig.xml +++ b/Step.Config/Config/serverConfig.xml @@ -22,6 +22,7 @@ true localhost false + C:\Windows\System32\notepad.exe C:\CMS\MTC\ADAPTER\ SCMA true diff --git a/Step.Config/Config/serverConfigValidator.xsd b/Step.Config/Config/serverConfigValidator.xsd index bb2e14ef..ad613015 100644 --- a/Step.Config/Config/serverConfigValidator.xsd +++ b/Step.Config/Config/serverConfigValidator.xsd @@ -35,6 +35,7 @@ + diff --git a/Step.Config/ServerConfigController.cs b/Step.Config/ServerConfigController.cs index 34cd2e42..63369e0e 100644 --- a/Step.Config/ServerConfigController.cs +++ b/Step.Config/ServerConfigController.cs @@ -304,6 +304,7 @@ namespace Step.Config EnableDirectoryBrowsing = Convert.ToBoolean(x.Element("enableDirectoryBrowsing").Value), DatabaseAddress = x.Element("databaseAddress").Value, AutoOpenCmsClient = Convert.ToBoolean(x.Element("autoOpenCmsClient").Value), + TextEditorPath = x.Element("textEditorPath").Value, MTCFolderPath = x.Element("MTCFolderPath").Value, MTCApplicationName = x.Element("MTCApplicationName").Value, MaxAlarmsRows = Convert.ToInt32(x.Element("maxAlarmsRows").Value), diff --git a/Step.Model/ConfigModels/ServerConfigModel.cs b/Step.Model/ConfigModels/ServerConfigModel.cs index a2f5dbb7..9a567482 100644 --- a/Step.Model/ConfigModels/ServerConfigModel.cs +++ b/Step.Model/ConfigModels/ServerConfigModel.cs @@ -15,12 +15,12 @@ namespace Step.Model.ConfigModels public bool EnableDirectoryBrowsing { get; set; } public string DatabaseAddress { get; set; } public bool AutoOpenCmsClient { get; set; } + public string TextEditorPath { get; set; } public string MTCFolderPath { get; set; } public string MTCApplicationName { get; set; } - public Boolean CMSConnectReady { get; set; } + public bool CMSConnectReady { get; set; } public int MaxAlarmsRows { get; set; } public int AlarmToDelete { get; set; } - } } \ No newline at end of file diff --git a/Step.Model/DTOModels/DTOClientConfigurationModel.cs b/Step.Model/DTOModels/DTOClientConfigurationModel.cs index ec11a196..7fddd062 100644 --- a/Step.Model/DTOModels/DTOClientConfigurationModel.cs +++ b/Step.Model/DTOModels/DTOClientConfigurationModel.cs @@ -13,6 +13,7 @@ namespace Step.Model.DTOModels public ushort NcPort { get; set; } public bool ProdEnabled { get; set; } public string ProdPath { get; set; } + public string EditorPath { get; set; } public bool Autorun { get; set; } public bool MgiOption { get; set; } public List ExtSoftwares { get; set; } diff --git a/Step/Controllers/WebApi/ConfigurationController.cs b/Step/Controllers/WebApi/ConfigurationController.cs index 84644f68..473065b8 100644 --- a/Step/Controllers/WebApi/ConfigurationController.cs +++ b/Step/Controllers/WebApi/ConfigurationController.cs @@ -46,6 +46,7 @@ namespace Step.Controllers.WebApi ProdPath = SoftwareProdConfig.Path, ExtSoftwares = ExtSoftwaresConfig, Autorun = ServerStartupConfig.AutoOpenCmsClient, + EditorPath = ServerStartupConfig.TextEditorPath, MgiOption = NcConfig.MgiOption }; diff --git a/Step/wwwroot/src/modules/base-components/modal-load-program.ts b/Step/wwwroot/src/modules/base-components/modal-load-program.ts index 303876ca..13159735 100644 --- a/Step/wwwroot/src/modules/base-components/modal-load-program.ts +++ b/Step/wwwroot/src/modules/base-components/modal-load-program.ts @@ -356,8 +356,9 @@ export default class ModalLoadProgram extends Vue { }) } } - else + else { this.externalEditorOpened = true; + } } endEditor(){ From a216bff6212ab0c56bda53e41b535ce7c6c3947c Mon Sep 17 00:00:00 2001 From: Lucio Maranta Date: Wed, 21 Aug 2019 15:06:38 +0200 Subject: [PATCH 05/12] Added reload file after changes Fix modal style & translations --- Client/Browser_Tools/BrowserJSObject.cs | 164 +++++++++++------- Step.Config/ServerConfigController.cs | 2 +- Step.Utils/Step.Utils.csproj | 2 +- Step.Utils/languages/IT.xml | 27 ++- Step.Utils/languages/de.xml | 29 ++-- Step.Utils/languages/en.xml | 27 ++- Step.Utils/languages/fr.xml | 27 ++- Step.Utils/languages/hr.xml | 29 ++-- Step.Utils/languages/ro.xml | 27 ++- Step/wwwroot/assets/styles/base/modals.less | 37 ++-- Step/wwwroot/assets/styles/style.css | 31 +++- .../base-components/modal-load-program.ts | 30 ++-- .../base-components/modal-load-program.vue | 42 ++--- 13 files changed, 301 insertions(+), 173 deletions(-) diff --git a/Client/Browser_Tools/BrowserJSObject.cs b/Client/Browser_Tools/BrowserJSObject.cs index 82b812ef..f9c92116 100644 --- a/Client/Browser_Tools/BrowserJSObject.cs +++ b/Client/Browser_Tools/BrowserJSObject.cs @@ -30,7 +30,7 @@ namespace Active_Client.Browser_Tools { public CfrV8Value func; public CfrV8Context context; - public String file; + public string file; } // The first letter of All PUBLIC Variables and Methods must be Lower-Case (CEF Settings) @@ -60,7 +60,7 @@ namespace Active_Client.Browser_Tools AddFunction("maximizeForm").Execute += maximizeForm; AddFunction("closeForm").Execute += closeForm; AddFunction("forceStepFocus").Execute += forceStepFocus; - AddFunction("forceNcFocus").Execute += forceNcFocus; + AddFunction("forceNcFocus").Execute += forceNcFocus; AddFunction("reloadBrokenPage").Execute += reloadBrokenPage; AddFunction("setNcWindowState").Execute += setNcWindowState; @@ -90,11 +90,12 @@ namespace Active_Client.Browser_Tools AddFunction("delImageFromJob").Execute += delImageFromJob; AddFunction("addPPToJob").Execute += addPPToJob; AddFunction("delPPFromJob").Execute += delPPFromJob; - AddFunction("readJobMetadata").Execute += readJobMetadata; + AddFunction("readJobMetadata").Execute += readJobMetadata; AddFunction("updateJobMetadata").Execute += updateJobMetadata; AddFunction("isHMIenabled").Execute += isHMIenabled; AddFunction("isPRODenabled").Execute += isPRODenabled; AddFunction("isSCMVisualStyle").Execute += isSCMVisualStyle; + AddFunction("cleanFileWatcher").Execute += cleanFileWatcher; } #endregion CONSTRUCTOR_METHOD @@ -139,7 +140,7 @@ namespace Active_Client.Browser_Tools //If the mainform is disposed do nothing if (mainForm.IsDisposed) return; - + //Invoke method if is needed or call the method in STD mode if (mainForm.InvokeRequired) mainForm.Invoke((MethodInvoker)delegate () @@ -174,7 +175,7 @@ namespace Active_Client.Browser_Tools if (NcWindow.State == NcState.SHOW) mainForm.ShowNCWindow(); - else if(NcWindow.State == NcState.SHOWPROD) + else if (NcWindow.State == NcState.SHOWPROD) mainForm.ShowProdWindow(); else mainForm.HideAUXWindow(); @@ -237,28 +238,28 @@ namespace Active_Client.Browser_Tools // Get the option of virtual Keyb configured private void isVirtualKeybConfigured(object sender, CfrV8HandlerExecuteEventArgs e) { - e.SetReturnValue((Boolean)Config.ClientConfig.ShowVirtualKeyboard); + e.SetReturnValue((bool)Config.ClientConfig.ShowVirtualKeyboard); } // Get the option of virtual Keyb configured private void isHMIenabled(object sender, CfrV8HandlerExecuteEventArgs e) { - e.SetReturnValue((Boolean)Config.VendorHmiConfig.Enabled); + e.SetReturnValue((bool)Config.VendorHmiConfig.Enabled); } // Get the option of PROD Enabled private void isPRODenabled(object sender, CfrV8HandlerExecuteEventArgs e) { - e.SetReturnValue((Boolean)Config.ProdSoftwareConfig.Enabled); + e.SetReturnValue((bool)Config.ProdSoftwareConfig.Enabled); } // Get the SCM option private void isSCMVisualStyle(object sender, CfrV8HandlerExecuteEventArgs e) { - e.SetReturnValue((Boolean)Config.ClientConfig.IsSCM); + e.SetReturnValue((bool)Config.ClientConfig.IsSCM); } - + #endregion STEP_METHODS /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -282,7 +283,7 @@ namespace Active_Client.Browser_Tools { if (e.Arguments.Count() == 0) return; - + Thread t = new Thread(new ParameterizedThreadStart(OpenNew)); t.Start(e.Arguments[0].StringValue); } @@ -307,7 +308,7 @@ namespace Active_Client.Browser_Tools Process[] p = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(sft.path)).OrderByDescending(X => X.StartTime).ToArray(); if (p.Count() > 0 && p[0].MainWindowHandle != IntPtr.Zero) - NcWindow.ForceExtFocus(p[0].MainWindowHandle,0,0,0,0); + NcWindow.ForceExtFocus(p[0].MainWindowHandle, 0, 0, 0, 0); else { ProcessStartInfo PS = new ProcessStartInfo(sft.path, sft.arguments); @@ -346,7 +347,7 @@ namespace Active_Client.Browser_Tools if (drive.IsReady) { //Filter NC Address - if(drive.DriveType != DriveType.Network) + if (drive.DriveType != DriveType.Network) { drivelist.Add(new Drive() { @@ -365,7 +366,7 @@ namespace Active_Client.Browser_Tools Path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\", Type = "SPFO" }); - + //Network Folders var searcher = new ManagementObjectSearcher("select * from Win32_MappedLogicalDisk"); foreach (ManagementObject queryObj in searcher.Get()) @@ -379,7 +380,7 @@ namespace Active_Client.Browser_Tools Path = queryObj["Name"].ToString(), Type = ElaborateType(DriveType.Network) }); - } + } } e.SetReturnValue(JsonConvert.SerializeObject(drivelist)); @@ -395,7 +396,7 @@ namespace Active_Client.Browser_Tools return; } - String p = e.Arguments[0].StringValue; + string p = e.Arguments[0].StringValue; if (!Directory.Exists(p)) { e.SetReturnValue(JsonConvert.SerializeObject(new List())); @@ -404,7 +405,7 @@ namespace Active_Client.Browser_Tools try { - foreach (String item in Directory.GetDirectories(p)) + foreach (string item in Directory.GetDirectories(p)) { filelist.Add(new Models.File { @@ -420,7 +421,7 @@ namespace Active_Client.Browser_Tools } try { - foreach (String item in Directory.GetFiles(p)) + foreach (string item in Directory.GetFiles(p)) { if (_validExtensions.Contains(Path.GetExtension(item).ToLower())) { @@ -446,14 +447,14 @@ namespace Active_Client.Browser_Tools // Upload and activate the program public async void uploadAndActivateProgram(object sender, CfrV8HandlerExecuteEventArgs e) { - String fileToUpload = ""; - Boolean uploadAllFiles = false; - Byte[] filecontent = null, imagecontent = null; - String fileNameNoExt; - String imageName = ""; - String fileName; - String imageDirectory; - String dirName; + string fileToUpload = ""; + bool uploadAllFiles = false; + byte[] filecontent = null, imagecontent = null; + string fileNameNoExt; + string imageName = ""; + string fileName; + string imageDirectory; + string dirName; //Check the arguments numbers if (e.Arguments.Length < 2 || e.Arguments[0] == null || e.Arguments[1] == null) @@ -505,7 +506,7 @@ namespace Active_Client.Browser_Tools string[] fileEntries = Directory.GetFiles(dirName); foreach (string subfileName in fileEntries) { - if(fileToUpload.ToLower() != subfileName.ToLower() && _validExtensions.Contains(Path.GetExtension(subfileName).ToLower())) + if (fileToUpload.ToLower() != subfileName.ToLower() && _validExtensions.Contains(Path.GetExtension(subfileName).ToLower())) { form.Add(new ByteArrayContent(System.IO.File.ReadAllBytes(subfileName)), "file", Path.GetFileName(subfileName)); } @@ -532,7 +533,7 @@ namespace Active_Client.Browser_Tools public async void uploadAndAddToQueue(object sender, CfrV8HandlerExecuteEventArgs e) { string fileToUpload = ""; - Byte[] filecontent = null, imagecontent = null; + byte[] filecontent = null, imagecontent = null; string fileNameNoExt; string imageName = ""; string fileName; @@ -614,7 +615,7 @@ namespace Active_Client.Browser_Tools return; } - String p = e.Arguments[0].StringValue; + string p = e.Arguments[0].StringValue; if (!System.IO.File.Exists(p)) { e.SetReturnValue(JsonConvert.SerializeObject(new InfoFile())); @@ -661,11 +662,11 @@ namespace Active_Client.Browser_Tools public void editProgram(object sender, CfrV8HandlerExecuteEventArgs e) { if (e.Arguments.Count() < 2) - { + { e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("error_arguments_not_ok"))); return; } - + // Get path string p = e.Arguments[0].StringValue; if (!System.IO.File.Exists(p)) { @@ -673,7 +674,8 @@ namespace Active_Client.Browser_Tools return; } - if(!System.IO.File.Exists(Config.TextEditorPath)) + // Check if editor exist + if (!System.IO.File.Exists(Config.TextEditorPath)) { e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("editor_not_configured"))); return; @@ -685,19 +687,13 @@ namespace Active_Client.Browser_Tools func = e.Arguments[1], file = p }; - - if (editorOpened.TryGetValue(p, out IntPtr handleFound)) - NcWindow.ForceExtFocus(handleFound, 0, 0, 0, 0); - else - { - Thread t = new Thread(startNewEditor); - t.Start(); - } - + + Thread t = new Thread(startNewEditor); + t.Start(); } public void startNewEditor() - { + { Process proc = new Process { StartInfo = new ProcessStartInfo() @@ -707,33 +703,69 @@ namespace Active_Client.Browser_Tools } }; + // Start editor process proc.Start(); + // Start watcher + WatchFile(); + } - proc.WaitForInputIdle(); - NcWindow.ForceExtFocus(proc.MainWindowHandle, editorX, editorY, editorW, editorH); + public void cleanFileWatcher(object sender, CfrV8HandlerExecuteEventArgs e) + { + if(watcher != null) + { + watcher.EnableRaisingEvents = false; - // Add it to dictionary - editorOpened.Add(CurrentEditorObject.file, proc.MainWindowHandle); + watcher = null; + } + } - // Wait for Editor Exit - proc.WaitForExit(); - - // Remove from dictionary - editorOpened.Remove(CurrentEditorObject.file); - // Force Focus Active - NcWindow.ForceStepFocus(); + public static FileSystemWatcher watcher = null; + public static DateTime _lastTimeFileWatcherEventRaised = DateTime.Now; - // Call JS return function - callJSFunction(CurrentEditorObject.func, null, CurrentEditorObject.context); + public static void WatchFile() + { + if (watcher == null) + { + watcher = new FileSystemWatcher + { + // Watch for changes in LastWrite times + NotifyFilter = NotifyFilters.LastWrite + }; + // Set event handler + watcher.Changed += OnChanged; + } + + // Set filter in order to watch only selected files + watcher.Filter = Path.GetFileName(CurrentEditorObject.file); + // Set directory path + watcher.Path = Path.GetDirectoryName(CurrentEditorObject.file); + + // Add event handlers + if (!watcher.EnableRaisingEvents) + watcher.EnableRaisingEvents = true; + } + + // Define the event handlers. + private static void OnChanged(object source, FileSystemEventArgs e) + { + // FileSystemWatcher has a bug which fires twice the onChange event + // Avoid duplicated events + if (DateTime.Now.Subtract(_lastTimeFileWatcherEventRaised).TotalMilliseconds < 500) + return; + // Update last event time + _lastTimeFileWatcherEventRaised = DateTime.Now; + + //// Call JS return function + CallJSFunction(CurrentEditorObject.func, null, CurrentEditorObject.context); } // Private functions - private String ElaborateName(String name, String letter, DriveType type) + private string ElaborateName(string name, string letter, DriveType type) { var retName = ""; - if (!String.IsNullOrWhiteSpace(name)) + if (!string.IsNullOrWhiteSpace(name)) retName = name; else { @@ -747,13 +779,13 @@ namespace Active_Client.Browser_Tools } - if (!String.IsNullOrWhiteSpace(letter)) + if (!string.IsNullOrWhiteSpace(letter)) retName = retName + " (" + letter + ")"; return retName; } - private String ElaborateType(DriveType type) + private string ElaborateType(DriveType type) { switch (type) { @@ -768,7 +800,7 @@ namespace Active_Client.Browser_Tools /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region RECALL_METHOD - private void callJSFunction(CfrV8Value functionIstance,String arguments, CfrV8Context context) + private static void CallJSFunction(CfrV8Value functionIstance, string arguments, CfrV8Context context) { //Create & enter function context var rpcContext = functionIstance.CreateRemoteCallContext(); @@ -1107,7 +1139,7 @@ namespace Active_Client.Browser_Tools //check the arguments if (e.Arguments.Count() == 0) return; - if (String.IsNullOrEmpty(jobPath)) + if (string.IsNullOrEmpty(jobPath)) { jobSaveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); jobSaveFileDialog.FileName = job.name; @@ -1122,7 +1154,7 @@ namespace Active_Client.Browser_Tools } } - if (!String.IsNullOrEmpty(jobPath)) + if (!string.IsNullOrEmpty(jobPath)) { //Metadata metafile.description = job.metadata.generics.description; @@ -1172,7 +1204,7 @@ namespace Active_Client.Browser_Tools imageOpenFileDialog.Multiselect = false; if (imageOpenFileDialog.ShowDialog() == DialogResult.OK) { - String newImagePath = JOB_OPENING_PATH + Path.GetFileName(imageOpenFileDialog.FileName); + string newImagePath = JOB_OPENING_PATH + Path.GetFileName(imageOpenFileDialog.FileName); //If exixts send error if (System.IO.File.Exists(newImagePath)) @@ -1204,7 +1236,7 @@ namespace Active_Client.Browser_Tools return; //Get the file Path - String imagePath = JOB_OPENING_PATH + e.Arguments[0].StringValue; + string imagePath = JOB_OPENING_PATH + e.Arguments[0].StringValue; //If not exixts Error! if (!System.IO.File.Exists(imagePath)) @@ -1234,7 +1266,7 @@ namespace Active_Client.Browser_Tools return; } - String newPPPath = JOB_OPENING_PATH + Path.GetFileName(PPOpenFileDialog.FileName); + string newPPPath = JOB_OPENING_PATH + Path.GetFileName(PPOpenFileDialog.FileName); //If exixts delete old file and save the new one if (System.IO.File.Exists(newPPPath)) @@ -1262,7 +1294,7 @@ namespace Active_Client.Browser_Tools return; //Get the file Path - String ppPath = JOB_OPENING_PATH + e.Arguments[0].StringValue; + string ppPath = JOB_OPENING_PATH + e.Arguments[0].StringValue; //If not exixts Error! if (!System.IO.File.Exists(ppPath)) diff --git a/Step.Config/ServerConfigController.cs b/Step.Config/ServerConfigController.cs index 63369e0e..f9e34976 100644 --- a/Step.Config/ServerConfigController.cs +++ b/Step.Config/ServerConfigController.cs @@ -288,7 +288,7 @@ namespace Step.Config .Descendants(PROD_SFT_CONFIG_KEY) .Select(x => new SoftwareProdConfigModel() { - Enabled = Convert.ToBoolean(x.Element("enabled").Value), + Enabled = Convert.ToBoolean(x.Element("enabled").Value), Path = x.Element("path").Value }).FirstOrDefault(); diff --git a/Step.Utils/Step.Utils.csproj b/Step.Utils/Step.Utils.csproj index 15ec31a2..9d543c60 100644 --- a/Step.Utils/Step.Utils.csproj +++ b/Step.Utils/Step.Utils.csproj @@ -100,7 +100,7 @@ PreserveNewest - + PreserveNewest diff --git a/Step.Utils/languages/IT.xml b/Step.Utils/languages/IT.xml index 28463eaa..acbdcd47 100644 --- a/Step.Utils/languages/IT.xml +++ b/Step.Utils/languages/IT.xml @@ -1,5 +1,5 @@ - + Italiano Effettuare manutenzione @@ -222,11 +222,13 @@ Famiglia: Stato Utensile: Refrigerante: + Gamma Inverter: Magazzino: Mandrino: Vita: Geometria: Generali: + Parametri CMS: Stato Codolo: Stato Multitool: Magazzino: @@ -292,7 +294,7 @@ Vita Residua Ut. disabilitato Ut. rotto - Ut. misurato + Ut. Misurato Rotazione Oraria Rotazione Antioraria Id Offset 1 @@ -316,6 +318,7 @@ Nome Id Famiglia Tipo Ut. + Tipo Ut. CMS Dimensione Sinistra Dimensione Destra Gamma Inverter @@ -323,6 +326,7 @@ Id Tabella-Tcp associata Velocità massima Carico Massimo + Carico Massimo Carico Minimo Carico Massimo Coefficiente Usura utensile @@ -361,8 +365,8 @@ Vettore 2 Vettore 3 Raggio Esterno - Angolo Utensile - Larghezza + Angolo Utensile + Larghezza Angolo Cono Angolo Punta Passo @@ -372,9 +376,8 @@ Usura Lunghezza 1 Usura Lunghezza 2 Usura Lunghezza 3 - Usura Diametro - Usura Larghezza Gola - Usura Eccedenza + Usura Larghezza Gola + Usura Eccedenza Angolo di Correzione Lunghezza Braccio Raggio Sfera @@ -432,6 +435,7 @@ Posizione di trasferimento Stazione di carico Punto di carico + Rinvio Angolare Disco Coltellino 50%% Coltellino 70%% @@ -569,6 +573,8 @@ Data di ult. mod: Preview non disponibile Carica tutti i file nella cartella selezionata + Ricarica + Il file è stato modificato NC PLC Gestore Storico Allarmi @@ -617,8 +623,8 @@ Apre/Chiude area sotto-il-cofano Job Editor User Manager - Chiudi CMS-Step - Minimizza CMS-Step + Chiudi CMS-Active + Minimizza CMS-Active Visualizza Help macchina Visualizza Informazioni macchina Visualizza Informazioni utente @@ -660,4 +666,7 @@ Ritardo Origine Fine Programma + Sei sicuro di voler scaricare l'utensile? + Azzeramento assi + Azzeramento assi in corso... diff --git a/Step.Utils/languages/de.xml b/Step.Utils/languages/de.xml index 77d1b0f3..452c27f0 100644 --- a/Step.Utils/languages/de.xml +++ b/Step.Utils/languages/de.xml @@ -1,5 +1,5 @@ - + Deutsch Wartung ausführen @@ -222,11 +222,13 @@ Familie: Werkzeugstatus: Kältemittel: + Inverter Palette: Magazin: Spindel: Lebensdauer: Geometrie: Allg. Param.: + CMS parameter: Status Schaft: Status Multitool: Magazin: @@ -292,7 +294,7 @@ Restlebensdauer Werk. deaktiviert Werk. gestört - Werk. gemessen + Werkz. Gemessen Drehung im Uhrzeigersinn Drehung gegen den Uhrzeigersinn Offset-ID 1 @@ -316,6 +318,7 @@ Name Familien-ID Werk.-Art + CMS Werk.-Art Abmessung links Abmessung rechts Inverter Palette @@ -323,6 +326,7 @@ ID Tabelle - zugeordnete TCP Maximalgeschwindigkeit Maximallast + Maximallast Minimallast Maximallast Verschleißkoeffizient Werkzeug @@ -361,8 +365,8 @@ Vektor 2 Vektor 3 Außenradius - Werkzeugwinkel - Breite + Werkzeugwinkel + Breite Kegelwinkel Spitzenwinkel Schritt @@ -372,9 +376,8 @@ Verschleiß Länge 1 Verschleiß Länge 2 Verschleiß Länge 3 - Verschleiß Durchmesser - Verschleiß Rillenbreite - Verschleiß Überschuss + Verschleiß Rillenbreite + Verschleiß Überschuss Korrekturwinkel Armlänge Kugelradius @@ -432,7 +435,8 @@ Transferposition Lade-/Entladestation Lade-/Entladepunkt - Scheibe + Scheibe + Winkelübertragung Kl. Messer 50%% Kl. Messer 70%% Kl. Messer 80%% @@ -569,6 +573,8 @@ Datum der letzten Änderung: Vorschau nicht verfügbar Alle Dateien des ausgewählten Ordners laden + Neu laden + Datei wurde bearbeitet NC PLC Verwalter Alarmhistorie @@ -617,8 +623,8 @@ Bereich Unterschicht öffnen/schließen Job-Editor Benutzer-Manager - CMS-Schritt schließen - CMS-Schritt minimieren + CMS-Active schließen + CMS-Active minimieren Help der Maschine anzeigen Informationen der Maschine anzeigen Informationen des Benutzers anzeigen @@ -660,4 +666,7 @@ Verzögerung Ursprung Programmende + Möchten Sie das Tool wirklich entladen? + Achsennullung + Achsennullung läuft diff --git a/Step.Utils/languages/en.xml b/Step.Utils/languages/en.xml index 5f60607b..1cd324b2 100644 --- a/Step.Utils/languages/en.xml +++ b/Step.Utils/languages/en.xml @@ -1,5 +1,5 @@ - + English Maintenance request @@ -222,11 +222,13 @@ Family: Tool Status: Coolants: + Inverter Dataset: Magazine: Spindle: Life: Geometry: Generics: + CMS Parameters: Shank Status: Multitool Status: Magazine: @@ -292,7 +294,7 @@ Residual Life Tool Disabled Tool Broken - Tool measured + Tool Measured Clockwise Rotation Counterclockwise Rotation Offset 1 Id @@ -316,6 +318,7 @@ Name Family Id Tool Type + CMS Tool Type Left Size Right Size Inverter Dataset @@ -323,6 +326,7 @@ Associated Tcp-Table Id Max Speed Max Load + Max Load Min Load Max Load Tool Wear Coefficient @@ -361,8 +365,8 @@ Vector 2 Vector 3 Outside Radius - Tool Angle - Width + Tool Angle + Width Taper Angle Tip Angle Pitch @@ -372,9 +376,8 @@ Geometry Wear Lenght 1 Geometry Wear Lenght 2 Geometry Wear Lenght 3 - Diameter Wear - Slot Width Wear - Geometry Wear Projection + Slot Width Wear + Geometry Wear Projection Angle Correction Boom Lenght Ball Radius @@ -432,6 +435,7 @@ Transfer Position Loading Station Loading Point + Angular Transmission Disk Cutter 50%% Cutter 70%% @@ -569,6 +573,8 @@ Last change Date: Preview not available Upload all files in selected folder + Reload + File has been edited NC PLC Alarm history manager @@ -617,8 +623,8 @@ Open/Close Under-the-hood Area Job Editor Users Manager - Close CMS-Step - Minimize CMS-Step + Close CMS-Active + Minimize CMS-Active Show machine help Show machine info Show user info @@ -660,4 +666,7 @@ Delay Origin End Program + Are you sure you want to unload the tool? + Axes zeroing + Axes zeroing in progress... diff --git a/Step.Utils/languages/fr.xml b/Step.Utils/languages/fr.xml index 8177cff3..8795231e 100644 --- a/Step.Utils/languages/fr.xml +++ b/Step.Utils/languages/fr.xml @@ -1,5 +1,5 @@ - + Français Procéder à la maintenance @@ -222,11 +222,13 @@ Famille : État Outil : Réfrigérant : + Gamme onduleurs : Magasin : Broche : Vie : Géométrie : Généraux : + paramètres CMS : État Queue : État Outil multifonctionnel : Magasin : @@ -292,7 +294,7 @@ Vie Résiduelle Out. invalidé Out. brisé - Out. mesuré + Out. Mesuré Rotation Horaire Rotation Antihoraire Id Offset 1 @@ -316,6 +318,7 @@ Nom Id Famille Type Out. + CMS Type Out. Dimension Gauche Dimension Droite Gamme Onduleurs @@ -323,6 +326,7 @@ Id Tableau-TCP associé Vitesse maximale Charge Maximale + Charge Maximale Charge Minimale Charge Maximale Coefficient Usure outil @@ -361,8 +365,8 @@ Vecteur 2 Vecteur 3 Rayon Extérieur - Angle Outil - Largeur + Angle Outil + Largeur Angle Cône Angle Pointe Pas @@ -372,9 +376,8 @@ Usure Longueur 1 Usure Longueur 2 Usure Longueur 3 - Usure Diamètre - Usure Largeur Gorge - Usure Surplus + Usure Largeur Gorge + Usure Surplus Angle de Correction Longueur Bras Rayon Sphère @@ -432,6 +435,7 @@ Position de transfert Station de chargement Point de chargement + Transmission angulaire Disque Couteau 50%% Couteau 70%% @@ -569,6 +573,8 @@ Date de la dern.modif. : Aperçu non disponible Charger tous les fichiers dans le dossier sélectionné + Recharger + Le fichier a été édité NC PLC Gestionnaire Historique Alarmes @@ -617,8 +623,8 @@ Ouvrir/Fermer zone sous le capot Job Editor Gestionnaire Utilisateurs - Fermer CMS-Step - Minimiser CMS-Step + Fermer CMS-Active + Minimiser CMS-Active Afficher Aide machine Afficher Informations machine Afficher Informations utilisateur @@ -660,4 +666,7 @@ Retard Origine Fin de programme + Êtes-vous sûr de vouloir décharger l'outil? + Réinitialisation des axes + Réinitialisation des axes en cours ... diff --git a/Step.Utils/languages/hr.xml b/Step.Utils/languages/hr.xml index 572433a9..16880688 100644 --- a/Step.Utils/languages/hr.xml +++ b/Step.Utils/languages/hr.xml @@ -1,5 +1,5 @@ - + Hrvatski Izvršiti održavanje @@ -222,11 +222,13 @@ Familija: Stanje Alata: Rashladno sredstvo: + Gamma Inverter: Skladište: Stazna glava: Život: Geometrija: Opći: + CMS parametri: Stanje Drška: Stanje Multitoola: Skladište: @@ -292,7 +294,7 @@ Ostatak Života Alat onesposobljen Alat slomljen - Alat izmjeren + Alat Izmjeren Rotacija u Smjeru kazaljke na satu Rotacija Suprotnom smjeru kazaljke na satu Id Offset 1 @@ -316,6 +318,7 @@ Ime Id Familije Tip Al. + CMS Tip Al. Dimenzija Lijevo Dimenzija Desno Gamma Inverter @@ -323,6 +326,7 @@ Id Tabela-Tcp pridružena Maksimalna brzina Maksimalno krcanje + Maksimalno krcanje Minimalno krcanje Maksimalno krcanje Koeficijent Istrošenosti alata @@ -361,8 +365,8 @@ Vektor 2 Vektor 3 Vanjski Radijus - Kut Alata - Širina + Kut Alata + Širina Kut Konusa Kut Vrha Korak @@ -372,9 +376,8 @@ Istrošenost Dužine 1 Istrošenost Dužine 2 Istrošenost Dužine 3 - Istrošenost Promjera - Istrošenost Širine Utora - Istrošenost Viška + Istrošenost Širine Utora + Istrošenost Viška Kut Korekcije Dužina Kraka Radijus Kugle @@ -432,7 +435,8 @@ Prijenosni položaj Ukrcajna postaja Točka ukrcaja - Disk + Disk + Kutni prijenos Nožić 50%% Nožić 70%% Nožić 80%% @@ -568,6 +572,8 @@ Datum zadnje izmjene: Preview nije raspoloživ Pošalji sve datoteke u odabranu mapu + Ponovno učitati + Datoteka je uređena NC PLC Upravljač Povijesti Alarma @@ -616,8 +622,8 @@ Otvara/zatvara prostor ispod haube Job Editor User Manager - Zatvori CMS-Step - Minimiziraj CMS-Step + Zatvori CMS-Active + Minimiziraj CMS-Active Predoči Help stroja Predoči Informacije o Stroju Predoči Informacije o korisniku @@ -659,4 +665,7 @@ Kašnjenje Originalno Kraj Programa + Möchten Sie das Tool wirklich entladen? + Osi svesti na ništicu + Osi svesti na ništicu... diff --git a/Step.Utils/languages/ro.xml b/Step.Utils/languages/ro.xml index 9c682c00..a712613a 100644 --- a/Step.Utils/languages/ro.xml +++ b/Step.Utils/languages/ro.xml @@ -1,5 +1,5 @@ - + Română Efectuați întreținerea @@ -222,11 +222,13 @@ Familie: Starea Uneltei: Agent frigorific: + Gamă Invertor Depozit: Mandrină: Viață: Geometrie: General: + Parametrii cms: Stare Mâner: Stare Multitool: Depozit: @@ -292,7 +294,7 @@ Viața Reziduală Unealtă invalidă Unealtă stricată - Unealtă măsurată + Unealtă Măsurată Rotire în sensul acelor de ceasornic Rotire în sens invers acelor de ceasornic Id Offset 1 @@ -316,6 +318,7 @@ Nume Id Familie Tip Ut. + Tip Ut. CMS Dimensiune Stânga Dimensiune Dreapta Gamă Invertor @@ -323,6 +326,7 @@ ID Tabel-Tcp asociat Viteza maximă Încărcare Maximă + Încărcare Maximă Încărcare Minimă Încărcare Maximă Coeficient de Uzură al uneltei @@ -361,8 +365,8 @@ Vector 2 Vector 3 Raza externă - Unghi Unealtă - Lățime + Unghi Unealtă + Lățime Unghi Con Unghi Vârf Pas @@ -372,9 +376,8 @@ Uzură Lungime 1 Uzură Lungime 2 Uzură Lungime 3 - Uzură Diametru - Uzură Lățime Gât - Uzură Excedent + Uzură Lățime Gât + Uzură Excedent Unghi de Corecție Lungime Braț Raza Sferei @@ -432,6 +435,7 @@ Poziție de transfer Stație de încărcare Punct de încărcare + Transmisie unghiulară Disc Cuțitaș 50 %% Cuțitaș 70 %% @@ -569,6 +573,8 @@ Data unealtă modif: Previzualizarea nu este disponibilă Încărcați toate fișierele în dosarul selectat + Reîncarcă + Fișierul a fost editat NC PLC Manager Istoric Alarme @@ -617,8 +623,8 @@ Deschide / Închide zona sub capotă Job Editor User Manager - Închideți CMS-Step - Minimizați CMS-Step + Închideți CMS-Active + Minimizați CMS-Active Vizualizați Ajutor mașină Vizualizați informațiile despre mașină Vizualizați Informațiile utilizator @@ -660,4 +666,7 @@ Întârziere Început Sfârșitul Programului + Sigur doriți să descărcați instrumentul? + Axe zero + Axe zero la desfășurare... diff --git a/Step/wwwroot/assets/styles/base/modals.less b/Step/wwwroot/assets/styles/base/modals.less index e085985f..da98a032 100644 --- a/Step/wwwroot/assets/styles/base/modals.less +++ b/Step/wwwroot/assets/styles/base/modals.less @@ -1317,7 +1317,7 @@ } } .modal-load-program-header, .modal-add-element-queue-header { - height: 80px; + height: 70px; width: 100%; display: flex; flex-flow: column; @@ -1328,7 +1328,7 @@ // } .box-search { width: 100%; - height: 80px; + height: 70px; display: flex; flex-flow: row; align-items: center; @@ -1370,7 +1370,8 @@ display: flex; position: relative; flex-flow: row; - .cleanTempFolder{ + + .cleanTempFolder { top: 0; left: 0; position: absolute; @@ -1385,7 +1386,23 @@ flex-flow: column; background-color: rgba(217, 217, 217, 0.5); } - + + .fileIsChanged { + top: 0; + left: 1112px; + position: absolute; + width: 696px; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + font-weight: bold; + font-size: 2em; + line-height: 3em; + flex-flow: column; + background-color: rgba(217, 217, 217, 0.5); + } + hr { width: 5%; } @@ -1510,7 +1527,7 @@ display: flex; flex-flow: column; justify-content: flex-end; - padding: 0 16px 0 22px; + padding: 0 16px 0 22px; .selected-item-header { height: 78px; width: 100%; @@ -1567,7 +1584,7 @@ width: 100%; // margin: auto margin-top: 10px; - height: 336px; + height: 331px; align-items: center; .container{ margin: auto; @@ -1576,7 +1593,7 @@ cursor: pointer; img { display: block; - max-height: 336px; + max-height: 331px; max-width: 567px; box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.4); } @@ -1605,12 +1622,13 @@ .selected-item-body-description { display: flex; width: 100%; - margin-top: 10px; + margin-top: 8px; overflow-x: hidden; - height: calc(~"100% - 380px"); + height: calc(~"100% - 360px"); flex-flow: column; .row{ + width: 99%; font-family: monospace; white-space:pre; height: 32px; @@ -1633,7 +1651,6 @@ .row:nth-child(even){ background-color: @color-white4; } - } } .notselecteditem { diff --git a/Step/wwwroot/assets/styles/style.css b/Step/wwwroot/assets/styles/style.css index b87cc31c..a448e263 100644 --- a/Step/wwwroot/assets/styles/style.css +++ b/Step/wwwroot/assets/styles/style.css @@ -1240,7 +1240,7 @@ .modal.modal-add-element-queue .modal-load-program-header, .modal.modal-load-program .modal-add-element-queue-header, .modal.modal-add-element-queue .modal-add-element-queue-header { - height: 80px; + height: 70px; width: 100%; display: flex; flex-flow: column; @@ -1250,7 +1250,7 @@ .modal.modal-load-program .modal-add-element-queue-header .box-search, .modal.modal-add-element-queue .modal-add-element-queue-header .box-search { width: 100%; - height: 80px; + height: 70px; display: flex; flex-flow: row; align-items: center; @@ -1331,6 +1331,24 @@ flex-flow: column; background-color: rgba(217, 217, 217, 0.5); } +.modal.modal-load-program .modal-load-program-body .fileIsChanged, +.modal.modal-add-element-queue .modal-load-program-body .fileIsChanged, +.modal.modal-load-program .modal-add-element-queue-body .fileIsChanged, +.modal.modal-add-element-queue .modal-add-element-queue-body .fileIsChanged { + top: 0; + left: 1112px; + position: absolute; + width: 696px; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + font-weight: bold; + font-size: 2em; + line-height: 3em; + flex-flow: column; + background-color: rgba(217, 217, 217, 0.5); +} .modal.modal-load-program .modal-load-program-body hr, .modal.modal-add-element-queue .modal-load-program-body hr, .modal.modal-load-program .modal-add-element-queue-body hr, @@ -1602,7 +1620,7 @@ display: flex; width: 100%; margin-top: 10px; - height: 336px; + height: 331px; align-items: center; } .modal.modal-load-program .modal-load-program-body .selected-item .selected-item-body .selected-item-body-image .container, @@ -1619,7 +1637,7 @@ .modal.modal-load-program .modal-add-element-queue-body .selected-item .selected-item-body .selected-item-body-image .container img, .modal.modal-add-element-queue .modal-add-element-queue-body .selected-item .selected-item-body .selected-item-body-image .container img { display: block; - max-height: 336px; + max-height: 331px; max-width: 567px; box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.4); } @@ -1654,15 +1672,16 @@ .modal.modal-add-element-queue .modal-add-element-queue-body .selected-item .selected-item-body .selected-item-body-description { display: flex; width: 100%; - margin-top: 10px; + margin-top: 8px; overflow-x: hidden; - height: calc(100% - 380px); + height: calc(100% - 360px); flex-flow: column; } .modal.modal-load-program .modal-load-program-body .selected-item .selected-item-body .selected-item-body-description .row, .modal.modal-add-element-queue .modal-load-program-body .selected-item .selected-item-body .selected-item-body-description .row, .modal.modal-load-program .modal-add-element-queue-body .selected-item .selected-item-body .selected-item-body-description .row, .modal.modal-add-element-queue .modal-add-element-queue-body .selected-item .selected-item-body .selected-item-body-description .row { + width: 99%; font-family: monospace; white-space: pre; height: 32px; diff --git a/Step/wwwroot/src/modules/base-components/modal-load-program.ts b/Step/wwwroot/src/modules/base-components/modal-load-program.ts index 13159735..03d2b7ce 100644 --- a/Step/wwwroot/src/modules/base-components/modal-load-program.ts +++ b/Step/wwwroot/src/modules/base-components/modal-load-program.ts @@ -66,7 +66,7 @@ export default class ModalLoadProgram extends Vue { selectedNumberImage: number = 0; showZoomedImage: boolean = false; mustCLeanPProgram: boolean = false; - externalEditorOpened: boolean = false; + fileIsChanged: boolean = false; uploadAllFileInFolder: boolean = false; onLabel: string = "On"; @@ -208,7 +208,7 @@ export default class ModalLoadProgram extends Vue { } as FileInfo; } - async fileInfo(str,isJob, fromdepth: number) { + async fileInfo(str, isJob, fromdepth: number) { this.lastClickPath = str; if (fromdepth == 1) this.secondColumnData.splice(0, this.secondColumnData.length); @@ -239,7 +239,6 @@ export default class ModalLoadProgram extends Vue { } } - if (!this.isLocalNavigation) this.selectedFile = this.toUpperCaseFileModel( await awaiter(fileService.getFileInfo(str))); @@ -262,6 +261,7 @@ export default class ModalLoadProgram extends Vue { messageService.deleteChannel("esc_pressed"); } close() { + this.cleanFileWatcher() messageService.deleteChannel("esc_pressed"); ModalHelper.HideModal(); } @@ -274,7 +274,6 @@ export default class ModalLoadProgram extends Vue { } async load(item: FileInfo) { - if (item.IsJob) this.loadJob(item.AbsolutePath); else @@ -308,11 +307,7 @@ export default class ModalLoadProgram extends Vue { } async loadJob(path: string) { - var jobMetadata = cmsClient.readJobMetadata(path); - - // var result = await ModalHelper.ShowModalAsync(, jobMetadata); - } @@ -341,8 +336,7 @@ export default class ModalLoadProgram extends Vue { } editprogram(){ - - var res = cmsClient.editProgram(this.selectedFile.AbsolutePath,this.endEditor); + var res = cmsClient.editProgram(this.selectedFile.AbsolutePath, this.fileChanged); if (res) { var obj = JSON.parse(res); if (obj.error){ @@ -357,11 +351,21 @@ export default class ModalLoadProgram extends Vue { } } else { - this.externalEditorOpened = true; + this.fileIsChanged = false; } } - endEditor(){ - this.externalEditorOpened = false; + fileChanged(){ + this.fileIsChanged = true; + } + + reloadProgram(){ + this.fileInfo(this.selectedFile.AbsolutePath, this.selectedFile.IsJob, this.navigationDepth) + this.fileIsChanged = false; + } + + cleanFileWatcher(){ + this.fileIsChanged = false; + cmsClient.cleanFileWatcher() } } diff --git a/Step/wwwroot/src/modules/base-components/modal-load-program.vue b/Step/wwwroot/src/modules/base-components/modal-load-program.vue index 8be5e027..4ab978bb 100644 --- a/Step/wwwroot/src/modules/base-components/modal-load-program.vue +++ b/Step/wwwroot/src/modules/base-components/modal-load-program.vue @@ -32,7 +32,7 @@