Merge branch 'integratedFileEditor' into develop
# Conflicts: # Libs/CMS_CORE_Library.dll # Step.Utils/languages/IT.xml # Step.Utils/languages/de.xml # Step.Utils/languages/en.xml # Step.Utils/languages/fr.xml # Step.Utils/languages/hr.xml # Step.Utils/languages/ro.xml
This commit is contained in:
@@ -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; }
|
||||
|
||||
}
|
||||
|
||||
@@ -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<Software> ExtSoftwares { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
+12
-12
@@ -10,17 +10,17 @@ namespace Client.Utils
|
||||
{
|
||||
|
||||
//Folders
|
||||
public static String BASE_PATH = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\";
|
||||
public static String BROWSER_CACHE_FOLDER = BASE_PATH + "LocalStorage";
|
||||
public static String STARTUP_CONFIG_SCHEMA_PATH = BASE_PATH + "ClientValidator.xsd";
|
||||
public static String STARTUP_CONFIG_PATH = BASE_PATH + "Config.xml";
|
||||
public static String CEF_PATH = BASE_PATH + "CEF";
|
||||
public static String CEF_X86_PATH = BASE_PATH + "CEF\\Release_X86";
|
||||
public static String CEF_X64_PATH = BASE_PATH + "CEF\\Release_X64";
|
||||
public static String CEF_LOCALES_PATH = BASE_PATH + "CEF\\Resources\\locales";
|
||||
public static String CEF_EXCEPTIONLOG_PATH = BASE_PATH + "ExceptionLog";
|
||||
public static String errorPageFile = BASE_PATH + "error.pg";
|
||||
public static String JOB_OPENING_PATH = "C:\\CMS\\ACTIVE\\TMP\\clientTmpJob\\";
|
||||
public static string BASE_PATH = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\";
|
||||
public static string BROWSER_CACHE_FOLDER = BASE_PATH + "LocalStorage";
|
||||
public static string STARTUP_CONFIG_SCHEMA_PATH = BASE_PATH + "ClientValidator.xsd";
|
||||
public static string STARTUP_CONFIG_PATH = BASE_PATH + "Config.xml";
|
||||
public static string CEF_PATH = BASE_PATH + "CEF";
|
||||
public static string CEF_X86_PATH = BASE_PATH + "CEF\\Release_X86";
|
||||
public static string CEF_X64_PATH = BASE_PATH + "CEF\\Release_X64";
|
||||
public static string CEF_LOCALES_PATH = BASE_PATH + "CEF\\Resources\\locales";
|
||||
public static string CEF_EXCEPTIONLOG_PATH = BASE_PATH + "ExceptionLog";
|
||||
public static string errorPageFile = BASE_PATH + "error.pg";
|
||||
public static string JOB_OPENING_PATH = "C:\\CMS\\ACTIVE\\TMP\\clientTmpJob\\";
|
||||
public static string PART_PRG_FOLDER = "C:\\PartPrg";
|
||||
|
||||
//Config Names
|
||||
@@ -37,7 +37,7 @@ namespace Client.Utils
|
||||
|
||||
|
||||
//BROWSER OBJECT NAME -> The first letter must be Lower-Case (CEF Settings)
|
||||
public const String BROWSER_JS_OBJ_NAME = "cmsClient";
|
||||
public const string BROWSER_JS_OBJ_NAME = "cmsClient";
|
||||
|
||||
//Nc States
|
||||
public enum NcState { HIDE = 0, SHOW = 1, SHOWPROD = 2 };
|
||||
|
||||
@@ -20,17 +20,32 @@ using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using static Client.Utils.Constants;
|
||||
using System.Management;
|
||||
using Chromium.Remote;
|
||||
using System.Text;
|
||||
|
||||
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", ".iso" /*".job", ".zip"*/ };
|
||||
|
||||
private static readonly string[] _validExtensions = { "", ".txt", ".cnc", ".cn", ".cno", ".ini", ".mpf", ".spf", ".tap", ".anc", ".iso", /*".job", ".zip"*/ };
|
||||
private static readonly string[] _validImages = { ".jpg", ".jpeg", ".png" };
|
||||
private static string jobPath = "";
|
||||
private static Dictionary<string, IntPtr> _editorOpened = new Dictionary<string, IntPtr>();
|
||||
private static EditorVar _currentEditorObject = new EditorVar();
|
||||
public static string RECENT_FOLDER_KEY = "RECENT";
|
||||
|
||||
public static FileSystemWatcher watcher = null;
|
||||
public static DateTime _lastTimeFileWatcherEventRaised = DateTime.Now;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -41,11 +56,13 @@ namespace Active_Client.Browser_Tools
|
||||
{
|
||||
mainForm = f;
|
||||
|
||||
AddDynamicProperty("RECENT_FOLDER_KEY").PropertyGet += getProp;
|
||||
|
||||
AddFunction("minimizeForm").Execute += minimizeForm;
|
||||
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;
|
||||
@@ -61,6 +78,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;
|
||||
@@ -74,15 +92,22 @@ 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
|
||||
|
||||
public void getProp(object sender, CfrV8AccessorGetEventArgs e)
|
||||
{
|
||||
e.Retval = RECENT_FOLDER_KEY;
|
||||
e.SetReturnValue(true);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region FORM_BEHAVIOUR_METHODS
|
||||
@@ -123,7 +148,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 ()
|
||||
@@ -158,7 +183,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();
|
||||
@@ -221,28 +246,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
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -266,7 +291,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);
|
||||
}
|
||||
@@ -286,12 +311,12 @@ namespace Active_Client.Browser_Tools
|
||||
{
|
||||
Software sft = Config.ExtSoftwaresConfig.FirstOrDefault(X => X.id == (string)id);
|
||||
|
||||
if (sft != null && System.IO.File.Exists(sft.path))
|
||||
if (sft != null && File.Exists(sft.path))
|
||||
{
|
||||
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);
|
||||
@@ -324,13 +349,13 @@ namespace Active_Client.Browser_Tools
|
||||
{
|
||||
List<Drive> drivelist = new List<Drive>();
|
||||
|
||||
//USB & HD Drives
|
||||
// USB & HD Drives
|
||||
foreach (var drive in DriveInfo.GetDrives())
|
||||
{
|
||||
if (drive.IsReady)
|
||||
{
|
||||
//Filter NC Address
|
||||
if(drive.DriveType != DriveType.Network)
|
||||
if (drive.DriveType != DriveType.Network)
|
||||
{
|
||||
drivelist.Add(new Drive()
|
||||
{
|
||||
@@ -342,26 +367,15 @@ namespace Active_Client.Browser_Tools
|
||||
}
|
||||
}
|
||||
|
||||
//Desktop folder
|
||||
// Desktop folder
|
||||
drivelist.Add(new Drive()
|
||||
{
|
||||
Name = ElaborateName("Desktop", "", DriveType.Unknown),
|
||||
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
|
||||
|
||||
// Network Folders
|
||||
var searcher = new ManagementObjectSearcher("select * from Win32_MappedLogicalDisk");
|
||||
foreach (ManagementObject queryObj in searcher.Get())
|
||||
{
|
||||
@@ -374,7 +388,7 @@ namespace Active_Client.Browser_Tools
|
||||
Path = queryObj["Name"].ToString(),
|
||||
Type = ElaborateType(DriveType.Network)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
e.SetReturnValue(JsonConvert.SerializeObject(drivelist));
|
||||
@@ -383,57 +397,63 @@ namespace Active_Client.Browser_Tools
|
||||
// Read all files in directory
|
||||
public void getFileList(object sender, CfrV8HandlerExecuteEventArgs e)
|
||||
{
|
||||
List<Models.File> filelist = new List<Models.File>();
|
||||
List<FileModel> filelist = new List<FileModel>();
|
||||
if (e.Arguments.Count() == 0)
|
||||
{
|
||||
e.SetReturnValue(JsonConvert.SerializeObject(new List<Models.File>()));
|
||||
e.SetReturnValue(JsonConvert.SerializeObject(new List<FileModel>()));
|
||||
return;
|
||||
}
|
||||
|
||||
String p = e.Arguments[0].StringValue;
|
||||
if (!Directory.Exists(p))
|
||||
string p = e.Arguments[0].StringValue;
|
||||
if (p != RECENT_FOLDER_KEY && !Directory.Exists(p))
|
||||
{
|
||||
e.SetReturnValue(JsonConvert.SerializeObject(new List<Models.File>()));
|
||||
e.SetReturnValue(JsonConvert.SerializeObject(new List<FileModel>()));
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
foreach (String item in Directory.GetDirectories(p))
|
||||
if(p == RECENT_FOLDER_KEY)
|
||||
{
|
||||
filelist.Add(new Models.File
|
||||
{
|
||||
Name = Path.GetFileName(item),
|
||||
AbsolutePath = Path.GetFullPath(item),
|
||||
Path = Path.GetFullPath(item),
|
||||
IsDirectory = true
|
||||
});
|
||||
filelist = GetLastUploadedFiles();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
try
|
||||
{
|
||||
foreach (String item in Directory.GetFiles(p))
|
||||
else
|
||||
{
|
||||
if (_validExtensions.Contains(Path.GetExtension(item).ToLower()))
|
||||
// Add directories
|
||||
foreach (string item in Directory.GetDirectories(p))
|
||||
{
|
||||
bool isJob = JOB_EXTENSIONS.Contains(Path.GetExtension(item));
|
||||
filelist.Add(new Models.File
|
||||
filelist.Add(new FileModel
|
||||
{
|
||||
Name = Path.GetFileName(item),
|
||||
AbsolutePath = Path.GetFullPath(item),
|
||||
Path = Path.GetFullPath(item),
|
||||
IsDirectory = false,
|
||||
IsJob = isJob
|
||||
IsDirectory = true,
|
||||
FileExist = true,
|
||||
IsMain = false
|
||||
});
|
||||
}
|
||||
|
||||
// Add files
|
||||
foreach (string item in Directory.GetFiles(p))
|
||||
{
|
||||
if (_validExtensions.Contains(Path.GetExtension(item).ToLower()))
|
||||
{
|
||||
bool isJob = JOB_EXTENSIONS.Contains(Path.GetExtension(item));
|
||||
filelist.Add(new FileModel
|
||||
{
|
||||
Name = Path.GetFileName(item),
|
||||
AbsolutePath = Path.GetFullPath(item),
|
||||
Path = Path.GetFullPath(item),
|
||||
IsDirectory = false,
|
||||
IsJob = isJob,
|
||||
IsMain = false,
|
||||
FileExist = true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
catch { }
|
||||
|
||||
e.SetReturnValue(JsonConvert.SerializeObject(filelist));
|
||||
}
|
||||
@@ -441,79 +461,102 @@ 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 = "";
|
||||
byte[] filecontent = null, imagecontent = null;
|
||||
string fileNameNoExt;
|
||||
string imageName = "";
|
||||
string fileName;
|
||||
string imageDirectory;
|
||||
string dirName;
|
||||
|
||||
//Check the arguments numbers
|
||||
// Check the arguments numbers
|
||||
if (e.Arguments.Length < 2 || e.Arguments[0] == null || e.Arguments[1] == null)
|
||||
{
|
||||
e.SetReturnValue(UPLOAD_PAGE + ";INVALID_ARGUMENTS");
|
||||
return;
|
||||
}
|
||||
|
||||
//Check if the file exists
|
||||
// Check if the file exists
|
||||
fileToUpload = e.Arguments[0].StringValue;
|
||||
if (!System.IO.File.Exists(fileToUpload))
|
||||
if (!File.Exists(fileToUpload))
|
||||
{
|
||||
e.SetReturnValue(UPLOAD_PAGE + ";FILE_NOT_FOUND");
|
||||
return;
|
||||
}
|
||||
|
||||
//Check if must be uploaded all files
|
||||
uploadAllFiles = e.Arguments[1].BoolValue;
|
||||
// Check if must be uploaded all files
|
||||
bool uploadAllFiles = e.Arguments[1].BoolValue;
|
||||
// Check if recent files are selected
|
||||
bool recentDriveSelected = e.Arguments[2].BoolValue;
|
||||
|
||||
//Get names and content of the file
|
||||
// Get names and content of the file
|
||||
fileNameNoExt = Path.GetFileNameWithoutExtension(fileToUpload);
|
||||
fileName = Path.GetFileName(fileToUpload);
|
||||
filecontent = System.IO.File.ReadAllBytes(fileToUpload);
|
||||
filecontent = File.ReadAllBytes(fileToUpload);
|
||||
|
||||
//Get all bytes of the image (if exists)
|
||||
// Get all bytes of the image (if exists)
|
||||
imageDirectory = Path.GetDirectoryName(fileToUpload);
|
||||
foreach (string ext in _validImages)
|
||||
{
|
||||
if (System.IO.File.Exists(imageDirectory + "/" + fileNameNoExt + ext))
|
||||
if (File.Exists(imageDirectory + "/" + fileNameNoExt + ext))
|
||||
{
|
||||
imageName = fileNameNoExt + ext;
|
||||
imagecontent = System.IO.File.ReadAllBytes(imageDirectory + "/" + fileNameNoExt + ext);
|
||||
imagecontent = File.ReadAllBytes(imageDirectory + "/" + fileNameNoExt + ext);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Send all to the server
|
||||
// Send all to the server
|
||||
using (HttpClient httpClient = new HttpClient())
|
||||
{
|
||||
//Create the new FORM
|
||||
// Create the new FORM
|
||||
MultipartFormDataContent form = new MultipartFormDataContent
|
||||
{
|
||||
//Add the content to the form
|
||||
// Add the main program to the form
|
||||
{ new ByteArrayContent(filecontent), "main", fileName }
|
||||
};
|
||||
if (uploadAllFiles)
|
||||
|
||||
List<FileModel> files = GetFileToUpload(fileToUpload, uploadAllFiles, recentDriveSelected);
|
||||
|
||||
//if (recentDriveSelected)
|
||||
//{
|
||||
// List<FileModel> files = GetLastUploadedFiles();
|
||||
|
||||
// foreach(FileModel file in files)
|
||||
// {
|
||||
// if(file.FileExist && !file.IsMain)
|
||||
// form.Add(new ByteArrayContent(File.ReadAllBytes(file.AbsolutePath)), "file", file.Name);
|
||||
// }
|
||||
//}
|
||||
//else if (uploadAllFiles)
|
||||
//{
|
||||
// // Load all the programs in the selected folder
|
||||
// dirName = Path.GetDirectoryName(fileToUpload);
|
||||
// string[] fileEntries = Directory.GetFiles(dirName);
|
||||
// foreach (string subfileName in fileEntries)
|
||||
// {
|
||||
// if (fileToUpload.ToLower() != subfileName.ToLower() && _validExtensions.Contains(Path.GetExtension(subfileName).ToLower()))
|
||||
// form.Add(new ByteArrayContent(File.ReadAllBytes(subfileName)), "file", Path.GetFileName(subfileName));
|
||||
// }
|
||||
//}
|
||||
|
||||
foreach(FileModel file in files)
|
||||
{
|
||||
dirName = Path.GetDirectoryName(fileToUpload);
|
||||
string[] fileEntries = Directory.GetFiles(dirName);
|
||||
foreach (string subfileName in fileEntries)
|
||||
{
|
||||
if(fileToUpload.ToLower() != subfileName.ToLower() && _validExtensions.Contains(Path.GetExtension(subfileName).ToLower()))
|
||||
{
|
||||
form.Add(new ByteArrayContent(System.IO.File.ReadAllBytes(subfileName)), "file", Path.GetFileName(subfileName));
|
||||
}
|
||||
}
|
||||
if(!file.IsMain)
|
||||
form.Add(new ByteArrayContent(File.ReadAllBytes(file.AbsolutePath)), "file", Path.GetFileName(file.AbsolutePath));
|
||||
}
|
||||
|
||||
if (imagecontent != null)
|
||||
form.Add(new ByteArrayContent(imagecontent), "image", imageName);
|
||||
|
||||
//Send them
|
||||
HttpResponseMessage response = httpClient.PostAsync(
|
||||
"http://" + Config.ConnectionConfig.ServerUrl + ":" + Config.ConnectionConfig.ServerPort + "/" + Constants.UPLOAD_PAGE,
|
||||
form).Result;
|
||||
//Wait the answer
|
||||
// Send them
|
||||
HttpResponseMessage response = httpClient
|
||||
.PostAsync("http://" + Config.ConnectionConfig.ServerUrl + ":" + Config.ConnectionConfig.ServerPort + "/" + UPLOAD_PAGE, form)
|
||||
.Result;
|
||||
|
||||
WriteLastUploadedFile(files);
|
||||
|
||||
// Wait the answer
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.BadRequest)
|
||||
e.SetReturnValue(UPLOAD_PAGE + ";" + await response.Content.ReadAsStringAsync());
|
||||
else if (response.StatusCode != System.Net.HttpStatusCode.OK)
|
||||
@@ -527,14 +570,14 @@ 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;
|
||||
string imageDirectory;
|
||||
int reps = 0;
|
||||
|
||||
//Check the arguments numbers
|
||||
// Check the arguments numbers
|
||||
if (e.Arguments.Length < 1 || e.Arguments[0] == null)
|
||||
{
|
||||
e.SetReturnValue(UPLOAD_ADD_QUEUE + "INVALID_ARGUMENTS");
|
||||
@@ -545,37 +588,39 @@ namespace Active_Client.Browser_Tools
|
||||
fileToUpload = e.Arguments[0].StringValue;
|
||||
reps = e.Arguments[1].IntValue;
|
||||
|
||||
if (!System.IO.File.Exists(fileToUpload))
|
||||
if (!File.Exists(fileToUpload))
|
||||
{
|
||||
e.SetReturnValue(UPLOAD_ADD_QUEUE + ";FILE_NOT_FOUND");
|
||||
return;
|
||||
}
|
||||
|
||||
//Get names and content of the file
|
||||
// Get names and content of the file
|
||||
fileNameNoExt = Path.GetFileNameWithoutExtension(fileToUpload);
|
||||
fileName = Path.GetFileName(fileToUpload); ;
|
||||
filecontent = System.IO.File.ReadAllBytes(fileToUpload);
|
||||
filecontent = File.ReadAllBytes(fileToUpload);
|
||||
|
||||
//Get all bytes of the image (if exists)
|
||||
// Get all bytes of the image (if exists)
|
||||
imageDirectory = Path.GetDirectoryName(fileToUpload);
|
||||
foreach (string ext in _validImages)
|
||||
{
|
||||
if (System.IO.File.Exists(imageDirectory + "/" + fileNameNoExt + ext))
|
||||
if (File.Exists(imageDirectory + "/" + fileNameNoExt + ext))
|
||||
{
|
||||
imageName = fileNameNoExt + ext;
|
||||
imagecontent = System.IO.File.ReadAllBytes(imageDirectory + "/" + fileNameNoExt + ext);
|
||||
imagecontent = File.ReadAllBytes(imageDirectory + "/" + fileNameNoExt + ext);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Send all to the server
|
||||
// Send all to the server
|
||||
using (HttpClient httpClient = new HttpClient())
|
||||
{
|
||||
//Create the new FORM
|
||||
MultipartFormDataContent form = new MultipartFormDataContent();
|
||||
MultipartFormDataContent form = new MultipartFormDataContent
|
||||
{
|
||||
|
||||
//Add the content to the form
|
||||
form.Add(new ByteArrayContent(filecontent), "file", fileName);
|
||||
//Add the content to the form
|
||||
{ new ByteArrayContent(filecontent), "file", fileName }
|
||||
};
|
||||
if (imagecontent != null)
|
||||
form.Add(new ByteArrayContent(imagecontent), "image", imageName);
|
||||
// Add reps to the form-data
|
||||
@@ -599,7 +644,6 @@ namespace Active_Client.Browser_Tools
|
||||
// Read info of a file
|
||||
public void getProgramInfo(object sender, CfrV8HandlerExecuteEventArgs e)
|
||||
{
|
||||
InfoFile file = new InfoFile();
|
||||
string line, imagePath, imageDirectory;
|
||||
int counter = 0;
|
||||
|
||||
@@ -609,18 +653,23 @@ namespace Active_Client.Browser_Tools
|
||||
return;
|
||||
}
|
||||
|
||||
String p = e.Arguments[0].StringValue;
|
||||
if (!System.IO.File.Exists(p))
|
||||
string p = e.Arguments[0].StringValue;
|
||||
if (!File.Exists(p))
|
||||
{
|
||||
e.SetReturnValue(JsonConvert.SerializeObject(new InfoFile()));
|
||||
return;
|
||||
}
|
||||
|
||||
FileInfo f = new FileInfo(p);
|
||||
file.Name = f.Name;
|
||||
file.CreationDate = f.CreationTime;
|
||||
file.LastModDate = f.LastAccessTime;
|
||||
file.AbsolutePath = p;
|
||||
InfoFile file = new InfoFile
|
||||
{
|
||||
Name = f.Name,
|
||||
CreationDate = f.CreationTime,
|
||||
LastModDate = f.LastAccessTime,
|
||||
AbsolutePath = p,
|
||||
CanEdit = !f.IsReadOnly
|
||||
};
|
||||
|
||||
imagePath = Path.GetFileNameWithoutExtension(p);
|
||||
imageDirectory = Path.GetDirectoryName(p);
|
||||
|
||||
@@ -637,9 +686,9 @@ namespace Active_Client.Browser_Tools
|
||||
|
||||
foreach (string ext in _validImages)
|
||||
{
|
||||
if (System.IO.File.Exists(imageDirectory + "/" + imagePath + ext))
|
||||
if (File.Exists(imageDirectory + "/" + imagePath + ext))
|
||||
{
|
||||
file.PreviewBase64 = "data:image/" + ext + ";base64," + Convert.ToBase64String(System.IO.File.ReadAllBytes(imageDirectory + "/" + imagePath + ext));
|
||||
file.PreviewBase64 = "data:image/" + ext + ";base64," + Convert.ToBase64String(File.ReadAllBytes(imageDirectory + "/" + imagePath + ext));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -651,32 +700,210 @@ namespace Active_Client.Browser_Tools
|
||||
e.SetReturnValue(JsonConvert.SerializeObject(file));
|
||||
}
|
||||
|
||||
// Private functions
|
||||
private String ElaborateName(String name, String letter, DriveType type)
|
||||
// Launch file editor
|
||||
public void editProgram(object sender, CfrV8HandlerExecuteEventArgs e)
|
||||
{
|
||||
var retName = "";
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(name))
|
||||
retName = name;
|
||||
else
|
||||
if (e.Arguments.Count() < 2)
|
||||
{
|
||||
switch (type)
|
||||
e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("error_arguments_not_ok")));
|
||||
return;
|
||||
}
|
||||
// Get path
|
||||
string p = e.Arguments[0].StringValue;
|
||||
if (!File.Exists(p))
|
||||
{
|
||||
e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("file_not_found")));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if editor exist
|
||||
if (!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
|
||||
};
|
||||
|
||||
Thread t = new Thread(startNewEditor);
|
||||
t.Start();
|
||||
}
|
||||
|
||||
public void startNewEditor()
|
||||
{
|
||||
Process proc = new Process
|
||||
{
|
||||
StartInfo = new ProcessStartInfo()
|
||||
{
|
||||
case DriveType.Fixed: retName = "Hard_Disk";break;
|
||||
case DriveType.Removable: retName = "Usb_Disk"; break;
|
||||
case DriveType.Network: retName = "Netword_Disk"; break;
|
||||
default: retName = "Undefined"; break;
|
||||
FileName = Config.TextEditorPath,
|
||||
Arguments = _currentEditorObject.file
|
||||
}
|
||||
};
|
||||
|
||||
// Start editor process
|
||||
proc.Start();
|
||||
// Start watcher
|
||||
WatchFile();
|
||||
}
|
||||
|
||||
public void cleanFileWatcher(object sender, CfrV8HandlerExecuteEventArgs e)
|
||||
{
|
||||
if(watcher != null)
|
||||
{
|
||||
watcher.EnableRaisingEvents = false;
|
||||
|
||||
watcher = null;
|
||||
}
|
||||
}
|
||||
|
||||
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 void WriteLastUploadedFile(List<FileModel> files)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
bool isFirst = true;
|
||||
foreach (FileModel file in files)
|
||||
{
|
||||
string stringVal = "";
|
||||
if (!file.IsMain)
|
||||
stringVal = file.AbsolutePath + ";false";
|
||||
else
|
||||
stringVal = file.AbsolutePath + ";true";
|
||||
|
||||
if (!isFirst)
|
||||
stringVal = Environment.NewLine + stringVal;
|
||||
else
|
||||
isFirst = false;
|
||||
|
||||
stringBuilder.Append(stringVal);
|
||||
}
|
||||
|
||||
File.WriteAllLines(".active.list", stringBuilder.ToString()
|
||||
.Split(
|
||||
new[] { Environment.NewLine },
|
||||
StringSplitOptions.None
|
||||
));
|
||||
}
|
||||
|
||||
private List<FileModel> GetFileToUpload(string main, bool uploadAllFiles, bool recentDriveSelected)
|
||||
{
|
||||
// Add main to list
|
||||
List<FileModel> files = new List<FileModel>()
|
||||
{
|
||||
new FileModel(){
|
||||
AbsolutePath = main,
|
||||
Name = Path.GetFileName(main),
|
||||
Path = main, FileExist = File.Exists(main),
|
||||
IsDirectory = false,
|
||||
IsMain = true
|
||||
}
|
||||
};
|
||||
|
||||
// Check recent files
|
||||
if (recentDriveSelected)
|
||||
{
|
||||
List<FileModel> recentFiles = GetLastUploadedFiles();
|
||||
|
||||
foreach (FileModel file in recentFiles)
|
||||
{
|
||||
if (file.FileExist && !file.IsMain)
|
||||
files.Add(file);
|
||||
|
||||
}
|
||||
}
|
||||
// Check if software need to upload all the files
|
||||
else if (uploadAllFiles)
|
||||
{
|
||||
string dirName = Path.GetDirectoryName(main);
|
||||
string[] fileEntries = Directory.GetFiles(dirName);
|
||||
foreach (string subfileName in fileEntries)
|
||||
{
|
||||
if (main.ToLower() != subfileName.ToLower() && _validExtensions.Contains(Path.GetExtension(subfileName).ToLower()))
|
||||
{
|
||||
// Add file
|
||||
files.Add(new FileModel()
|
||||
{
|
||||
AbsolutePath = subfileName,
|
||||
FileExist = true,
|
||||
IsDirectory = false,
|
||||
IsMain = false,
|
||||
Name = Path.GetFileName(subfileName),
|
||||
Path = subfileName
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(letter))
|
||||
retName = retName + " (" + letter + ")";
|
||||
|
||||
return retName;
|
||||
return files;
|
||||
}
|
||||
|
||||
private String ElaborateType(DriveType type)
|
||||
private List<FileModel> GetLastUploadedFiles()
|
||||
{
|
||||
if (!File.Exists(".active.list"))
|
||||
return new List<FileModel>();
|
||||
|
||||
string[] fileEntries = File.ReadAllLines(".active.list");
|
||||
|
||||
List<FileModel> files = new List<FileModel>();
|
||||
foreach (string row in fileEntries)
|
||||
{
|
||||
string[] rowData = row.Split(';');
|
||||
files.Add(new FileModel
|
||||
{
|
||||
Name = Path.GetFileName(rowData[0]),
|
||||
AbsolutePath = Path.GetFullPath(rowData[0]),
|
||||
Path = Path.GetFullPath(rowData[0]),
|
||||
IsDirectory = false,
|
||||
IsMain = Convert.ToBoolean(rowData[1]),
|
||||
FileExist = File.Exists(rowData[0])
|
||||
});
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
private string ElaborateType(DriveType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -687,8 +914,59 @@ namespace Active_Client.Browser_Tools
|
||||
return "SPFO";
|
||||
}
|
||||
|
||||
#endregion FILESYSTEM_METHODS
|
||||
// Private functions
|
||||
private string ElaborateName(string name, string letter, DriveType type)
|
||||
{
|
||||
var retName = "";
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(name))
|
||||
retName = name;
|
||||
else
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DriveType.Fixed: retName = "Hard_Disk"; break;
|
||||
case DriveType.Removable: retName = "Usb_Disk"; break;
|
||||
case DriveType.Network: retName = "Netword_Disk"; break;
|
||||
default: retName = "Undefined"; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(letter))
|
||||
retName = retName + " (" + letter + ")";
|
||||
|
||||
return retName;
|
||||
}
|
||||
|
||||
#endregion FILESYSTEM_METHODS
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region RECALL_METHOD
|
||||
|
||||
private static 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
|
||||
@@ -958,7 +1236,7 @@ namespace Active_Client.Browser_Tools
|
||||
metafile.tools = job.metadata.tools;
|
||||
metafile.customs = job.metadata.customs;
|
||||
|
||||
using (StreamWriter file = System.IO.File.CreateText(JOB_OPENING_PATH + JOB_METADATA_FILENAME))
|
||||
using (StreamWriter file = File.CreateText(JOB_OPENING_PATH + JOB_METADATA_FILENAME))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer
|
||||
{
|
||||
@@ -968,11 +1246,11 @@ namespace Active_Client.Browser_Tools
|
||||
}
|
||||
|
||||
//Main Program
|
||||
System.IO.File.WriteAllText(JOB_OPENING_PATH + JOB_MAIN_FILENAME, job.isoMainProgram);
|
||||
File.WriteAllText(JOB_OPENING_PATH + JOB_MAIN_FILENAME, job.isoMainProgram);
|
||||
|
||||
//delete Zip File if exists
|
||||
if (System.IO.File.Exists(jobSaveFileDialog.FileName))
|
||||
System.IO.File.Delete(jobSaveFileDialog.FileName);
|
||||
if (File.Exists(jobSaveFileDialog.FileName))
|
||||
File.Delete(jobSaveFileDialog.FileName);
|
||||
|
||||
//Create Zip File
|
||||
ZipFile.CreateFromDirectory(JOB_OPENING_PATH, jobSaveFileDialog.FileName);
|
||||
@@ -1005,7 +1283,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;
|
||||
@@ -1020,14 +1298,14 @@ namespace Active_Client.Browser_Tools
|
||||
}
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(jobPath))
|
||||
if (!string.IsNullOrEmpty(jobPath))
|
||||
{
|
||||
//Metadata
|
||||
metafile.description = job.metadata.generics.description;
|
||||
metafile.executionTime = job.metadata.generics.executionTime;
|
||||
metafile.tools = job.metadata.tools;
|
||||
metafile.customs = job.metadata.customs;
|
||||
using (StreamWriter file = System.IO.File.CreateText(JOB_OPENING_PATH + JOB_METADATA_FILENAME))
|
||||
using (StreamWriter file = File.CreateText(JOB_OPENING_PATH + JOB_METADATA_FILENAME))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer
|
||||
{
|
||||
@@ -1037,11 +1315,11 @@ namespace Active_Client.Browser_Tools
|
||||
}
|
||||
|
||||
//Main Program
|
||||
System.IO.File.WriteAllText(JOB_OPENING_PATH + JOB_MAIN_FILENAME, job.isoMainProgram);
|
||||
File.WriteAllText(JOB_OPENING_PATH + JOB_MAIN_FILENAME, job.isoMainProgram);
|
||||
|
||||
//delete Zip File if exists
|
||||
if (System.IO.File.Exists(jobPath))
|
||||
System.IO.File.Delete(jobPath);
|
||||
if (File.Exists(jobPath))
|
||||
File.Delete(jobPath);
|
||||
|
||||
//Create Zip File
|
||||
try
|
||||
@@ -1070,23 +1348,23 @@ 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))
|
||||
if (File.Exists(newImagePath))
|
||||
{
|
||||
e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("file_esists")));
|
||||
return;
|
||||
}
|
||||
|
||||
//Copy the file
|
||||
System.IO.File.Copy(imageOpenFileDialog.FileName, newImagePath);
|
||||
File.Copy(imageOpenFileDialog.FileName, newImagePath);
|
||||
|
||||
//Send to Step
|
||||
e.SetReturnValue(JsonConvert.SerializeObject(new ImageParam()
|
||||
{
|
||||
name = Path.GetFileName(imageOpenFileDialog.FileName),
|
||||
base64 = "data:image/" + Path.GetExtension(newImagePath).ToLower().TrimStart('.') + ";base64," + Convert.ToBase64String(System.IO.File.ReadAllBytes(newImagePath))
|
||||
base64 = "data:image/" + Path.GetExtension(newImagePath).ToLower().TrimStart('.') + ";base64," + Convert.ToBase64String(File.ReadAllBytes(newImagePath))
|
||||
}));
|
||||
return;
|
||||
}
|
||||
@@ -1102,17 +1380,17 @@ 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))
|
||||
if (!File.Exists(imagePath))
|
||||
{
|
||||
e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("file_not_esists")));
|
||||
return;
|
||||
}
|
||||
|
||||
//delete it
|
||||
System.IO.File.Delete(imagePath);
|
||||
File.Delete(imagePath);
|
||||
|
||||
e.SetReturnValue(null);
|
||||
return;
|
||||
@@ -1132,17 +1410,17 @@ 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))
|
||||
if (File.Exists(newPPPath))
|
||||
{
|
||||
e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("file_esists")));
|
||||
return;
|
||||
}
|
||||
|
||||
//Copy the file
|
||||
System.IO.File.Copy(PPOpenFileDialog.FileName, newPPPath);
|
||||
File.Copy(PPOpenFileDialog.FileName, newPPPath);
|
||||
|
||||
//Send to Step
|
||||
e.SetReturnValue(JsonConvert.SerializeObject(new PPContainer(Path.GetFileName(PPOpenFileDialog.FileName))));
|
||||
@@ -1160,17 +1438,17 @@ 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))
|
||||
if (!File.Exists(ppPath))
|
||||
{
|
||||
e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("file_not_esists")));
|
||||
return;
|
||||
}
|
||||
|
||||
//delete it
|
||||
System.IO.File.Delete(ppPath);
|
||||
File.Delete(ppPath);
|
||||
|
||||
e.SetReturnValue(null);
|
||||
return;
|
||||
@@ -1203,7 +1481,7 @@ namespace Active_Client.Browser_Tools
|
||||
private static ErrorContainer ValidateZip(string filePath)
|
||||
{
|
||||
ErrorContainer result = null;
|
||||
if (!System.IO.File.Exists(filePath))
|
||||
if (!File.Exists(filePath))
|
||||
return new ErrorContainer("error_file_not_found");
|
||||
|
||||
try
|
||||
|
||||
@@ -6,12 +6,14 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Active_Client.Browser_Tools.Models
|
||||
{
|
||||
public class File
|
||||
public class FileModel
|
||||
{
|
||||
public string Name;
|
||||
public string AbsolutePath;
|
||||
public string Path;
|
||||
public bool IsDirectory;
|
||||
public bool IsJob;
|
||||
public bool IsMain;
|
||||
public bool FileExist;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ namespace Active_Client.Browser_Tools.Models
|
||||
public String AbsolutePath;
|
||||
public DateTime CreationDate;
|
||||
public DateTime LastModDate;
|
||||
public List<String> Content;
|
||||
public List<String> Content;
|
||||
public Boolean CanEdit;
|
||||
public string PreviewBase64;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -572,11 +572,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);
|
||||
|
||||
if (width > 0 && height > 0)
|
||||
MoveWindow(Handle, X, Y, width, height, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -20,14 +20,4 @@
|
||||
<warningLimit>55</warningLimit>
|
||||
<alarmLimit>80</alarmLimit>
|
||||
</head>
|
||||
<head>
|
||||
<localizedNames>
|
||||
<lang langKey="it">Testa WJ C</lang>
|
||||
<lang langKey="en">Head WJ C</lang>
|
||||
</localizedNames>
|
||||
<type>WJ</type>
|
||||
<fixedHead>false</fixedHead>
|
||||
<warningLimit>55</warningLimit>
|
||||
<alarmLimit>80</alarmLimit>
|
||||
</head>
|
||||
</heads>
|
||||
@@ -22,6 +22,7 @@
|
||||
<enableDirectoryBrowsing>true</enableDirectoryBrowsing>
|
||||
<databaseAddress>localhost</databaseAddress>
|
||||
<autoOpenCmsClient>false</autoOpenCmsClient>
|
||||
<textEditorPath>C:\Windows\System32\notepad.exe</textEditorPath>
|
||||
<MTCFolderPath>C:\CMS\MTC\ADAPTER\</MTCFolderPath>
|
||||
<MTCApplicationName>SCMA</MTCApplicationName>
|
||||
<CMSConnectReady>true</CMSConnectReady>
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
<xs:element name="enableDirectoryBrowsing" type="xs:boolean" default="false"/>
|
||||
<xs:element name="databaseAddress" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="autoOpenCmsClient" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="textEditorPath" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="MTCFolderPath" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="MTCApplicationName" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="CMSConnectReady" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<root>
|
||||
<toolManagerConfig>
|
||||
<toolMetricType>RADIUS</toolMetricType> <!-- RADIUS/DIAMETER -->
|
||||
<toolMetricType>DIAMETER</toolMetricType> <!-- RADIUS/DIAMETER -->
|
||||
<familyOpt>true</familyOpt>
|
||||
<shankOpt>false</shankOpt>
|
||||
<magPositionOpt>true</magPositionOpt>
|
||||
<offsetOpt>false</offsetOpt>
|
||||
<offsetOpt>true</offsetOpt>
|
||||
<reviveOpt>true</reviveOpt>
|
||||
<gammaOpt>true</gammaOpt>
|
||||
<lifeOpt>true</lifeOpt>
|
||||
@@ -61,7 +61,7 @@
|
||||
</magazine>
|
||||
<magazine>
|
||||
<id>2</id>
|
||||
<assistedTooling>true</assistedTooling>
|
||||
<assistedTooling>false</assistedTooling>
|
||||
<localizedNames>
|
||||
<lang langKey="en">Magazine 2</lang>
|
||||
<lang langKey="it">Magazzino 2</lang>
|
||||
@@ -69,7 +69,7 @@
|
||||
</magazine>
|
||||
<magazine>
|
||||
<id>3</id>
|
||||
<assistedTooling>true</assistedTooling>
|
||||
<assistedTooling>false</assistedTooling>
|
||||
<localizedNames>
|
||||
<lang langKey="en">Magazine 3</lang>
|
||||
<lang langKey="it">Magazzino 3</lang>
|
||||
|
||||
@@ -287,7 +287,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();
|
||||
|
||||
@@ -303,6 +303,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),
|
||||
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<ExtSoftwareModel> ExtSoftwares { get; set; }
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
<Content Include="languages\hr.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="languages\IT.xml">
|
||||
<Content Include="languages\it.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="languages\ro.xml">
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace Step.Controllers.WebApi
|
||||
ProdPath = SoftwareProdConfig.Path,
|
||||
ExtSoftwares = ExtSoftwaresConfig,
|
||||
Autorun = ServerStartupConfig.AutoOpenCmsClient,
|
||||
EditorPath = ServerStartupConfig.TextEditorPath,
|
||||
MgiOption = NcConfig.MgiOption
|
||||
};
|
||||
|
||||
|
||||
@@ -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<string> programs = new List<string>();
|
||||
|
||||
if (!Request.Content.IsMimeMultipartContent())
|
||||
{
|
||||
@@ -109,13 +111,14 @@ 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);
|
||||
}
|
||||
|
||||
ActiveProgramDataModel programData = new ActiveProgramDataModel();
|
||||
foreach (FormItem item in formItems)
|
||||
{
|
||||
@@ -123,8 +126,9 @@ namespace Step.Controllers.WebApi
|
||||
{
|
||||
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 programData);
|
||||
@@ -134,6 +138,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 +157,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<string> lines = new List<string>();
|
||||
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<object> filelist = new List<object>();
|
||||
// NC - PC shared folder path
|
||||
string sharedFullPath = NcConfig.SharedPath + sharedPath;
|
||||
|
||||
@@ -1916,13 +1916,16 @@
|
||||
background-color: @color-clear-blue-30;
|
||||
color: #002680;
|
||||
|
||||
// color: @color-white;
|
||||
.not-exist{
|
||||
color: #d0021b !important;
|
||||
}
|
||||
|
||||
&.dark {
|
||||
background-color: rgba(23, 145, 255, 0.75);
|
||||
color: #fff;
|
||||
|
||||
* {
|
||||
color: #fff !important;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,6 +1370,40 @@
|
||||
display: flex;
|
||||
position: relative;
|
||||
flex-flow: row;
|
||||
|
||||
.ask-confirm,
|
||||
.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);
|
||||
}
|
||||
|
||||
.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%;
|
||||
}
|
||||
@@ -1488,13 +1522,19 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.selected-item-blur {
|
||||
filter: blur(10px);
|
||||
padding: 10px !important;
|
||||
}
|
||||
|
||||
.selected-item {
|
||||
width: 660px;
|
||||
height: 100%;
|
||||
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%;
|
||||
@@ -1551,7 +1591,7 @@
|
||||
width: 100%;
|
||||
// margin: auto
|
||||
margin-top: 10px;
|
||||
height: 336px;
|
||||
height: 331px;
|
||||
align-items: center;
|
||||
.container{
|
||||
margin: auto;
|
||||
@@ -1560,7 +1600,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);
|
||||
}
|
||||
@@ -1589,12 +1629,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;
|
||||
@@ -1617,7 +1658,6 @@
|
||||
.row:nth-child(even){
|
||||
background-color: @color-white4;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
.notselecteditem {
|
||||
|
||||
@@ -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;
|
||||
@@ -1313,6 +1313,46 @@
|
||||
position: relative;
|
||||
flex-flow: row;
|
||||
}
|
||||
.modal.modal-load-program .modal-load-program-body .ask-confirm,
|
||||
.modal.modal-add-element-queue .modal-load-program-body .ask-confirm,
|
||||
.modal.modal-load-program .modal-add-element-queue-body .ask-confirm,
|
||||
.modal.modal-add-element-queue .modal-add-element-queue-body .ask-confirm,
|
||||
.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 .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,
|
||||
@@ -1491,6 +1531,13 @@
|
||||
margin-top: 4px;
|
||||
color: #002680;
|
||||
}
|
||||
.modal.modal-load-program .modal-load-program-body .selected-item-blur,
|
||||
.modal.modal-add-element-queue .modal-load-program-body .selected-item-blur,
|
||||
.modal.modal-load-program .modal-add-element-queue-body .selected-item-blur,
|
||||
.modal.modal-add-element-queue .modal-add-element-queue-body .selected-item-blur {
|
||||
filter: blur(10px);
|
||||
padding: 10px !important;
|
||||
}
|
||||
.modal.modal-load-program .modal-load-program-body .selected-item,
|
||||
.modal.modal-add-element-queue .modal-load-program-body .selected-item,
|
||||
.modal.modal-load-program .modal-add-element-queue-body .selected-item,
|
||||
@@ -1584,7 +1631,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,
|
||||
@@ -1601,7 +1648,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);
|
||||
}
|
||||
@@ -1636,15 +1683,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;
|
||||
@@ -8804,12 +8852,15 @@ footer .container button.big:before {
|
||||
background-color: rgba(23, 145, 255, 0.3);
|
||||
color: #002680;
|
||||
}
|
||||
.selected-path-drive .not-exist {
|
||||
color: #d0021b !important;
|
||||
}
|
||||
.selected-path-drive.dark {
|
||||
background-color: rgba(23, 145, 255, 0.75);
|
||||
color: #fff;
|
||||
}
|
||||
.selected-path-drive.dark * {
|
||||
color: #fff !important;
|
||||
color: #fff;
|
||||
}
|
||||
.objects-job {
|
||||
margin: 8px;
|
||||
|
||||
@@ -31,6 +31,7 @@ export default class CardProductionCms extends Vue {
|
||||
get currentProgram() {
|
||||
return this.$store.state.process.currentProgram;
|
||||
}
|
||||
|
||||
get loadPrgVisible() {
|
||||
if (
|
||||
!this.queue &&
|
||||
@@ -41,6 +42,7 @@ export default class CardProductionCms extends Vue {
|
||||
return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
get infoPrgVisible() {
|
||||
if (
|
||||
(this.currentProgram &&
|
||||
@@ -52,6 +54,10 @@ export default class CardProductionCms extends Vue {
|
||||
else return false;
|
||||
}
|
||||
|
||||
get canLoadProgram() {
|
||||
return this.$store.state.process.canLoadProgram;
|
||||
}
|
||||
|
||||
openModal() {
|
||||
ModalHelper.ShowModal(modalLoadProgram);
|
||||
}
|
||||
|
||||
@@ -10,10 +10,9 @@
|
||||
<div v-if="loadPrgVisible" class="load-container" >
|
||||
<div class="center-container">
|
||||
<div class="labelLoadPrg">{{'production_label_select_prg' | localize('Seleziona un programma')}}</div>
|
||||
<button class="btn btn-success" @click="openModal()" :disabled="!isCnReady()"><i class="fa fa-plus"></i></button>
|
||||
<button class="btn btn-success" @click="openModal()" :disabled="!isCnReady() || !canLoadProgram"><i class="fa fa-plus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="overlay-noauto" v-if="!isSoftkeyKeySelected(1)">
|
||||
<div class="messsage">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<!-- <div class="test-container"> -->
|
||||
<div class="card-folder-path" @click="onClick" :class="{'disabled':disabled, 'selected-path-drive': selected}">
|
||||
<div class="card-folder-path" @click="onClick" :class="{'disabled': disabled, 'selected-path-drive': selected}">
|
||||
<div class="card-folder-path-icon">
|
||||
<i v-if="iconType=='FOLDER'" class="fa fa-folder" aria-hidden="true"></i>
|
||||
<i v-if="iconType=='FILE'" class="fa fa-file-o" aria-hidden="true"></i>
|
||||
@@ -11,7 +11,7 @@
|
||||
<i v-if="iconType=='SPFO'" class="fa fa-star" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="card-folder-path-name">
|
||||
<label>{{name}}</label>
|
||||
<label :class="{'not-exist': !fileExist}">{{name}}</label>
|
||||
</div>
|
||||
<div class="card-folder-path-arrow" v-if="withArrow">
|
||||
<i class="fa fa-caret-right"></i>
|
||||
@@ -27,7 +27,8 @@ export default {
|
||||
withArrow: {default: true},
|
||||
iconType: {default: "FOLDER"},
|
||||
disabled: {default: false},
|
||||
selected: {default: false}
|
||||
selected: {default: false},
|
||||
fileExist: {default: true}
|
||||
},
|
||||
methods:{
|
||||
onClick(){
|
||||
|
||||
@@ -15,14 +15,13 @@ import ZoomImage from './zoom-image.vue'
|
||||
|
||||
declare var cmsClient: any;
|
||||
|
||||
|
||||
|
||||
|
||||
interface PathInfo {
|
||||
Name: string;
|
||||
AbsolutePath: string;
|
||||
Path: string;
|
||||
IsDirectory: boolean;
|
||||
IsMain: boolean;
|
||||
FileExist: boolean;
|
||||
}
|
||||
|
||||
interface FileInfo {
|
||||
@@ -32,6 +31,7 @@ interface FileInfo {
|
||||
LastModDate: string;
|
||||
Content: Array<any>;
|
||||
PreviewBase64: any;
|
||||
CanEdit: boolean;
|
||||
IsJob: boolean;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ interface FileInfo {
|
||||
|
||||
export default class ModalLoadProgram extends Vue {
|
||||
|
||||
|
||||
driveList: Array<PathInfo> = [];
|
||||
currentPath: string = "";
|
||||
currentDrive: string = null;
|
||||
@@ -67,32 +66,42 @@ export default class ModalLoadProgram extends Vue {
|
||||
navigationDepth: number = 0;
|
||||
selectedNumberImage: number = 0;
|
||||
showZoomedImage: boolean = false;
|
||||
mustCLeanPProgram: boolean = false;
|
||||
fileIsChanged: boolean = false;
|
||||
|
||||
uploadAllFileInFolder: boolean = false;
|
||||
onLabel: string = "On";
|
||||
offLabel: string = "Off";
|
||||
recentPath: string = ""
|
||||
thereAreFileEliminated: boolean = false
|
||||
askConfirmLayer: boolean = false
|
||||
loadClicked: boolean = false
|
||||
recentDriveSelected: boolean = false
|
||||
|
||||
mounted() {
|
||||
if (typeof cmsClient != "undefined") {
|
||||
this.driveList = JSON.parse(cmsClient.getOSdriveList());
|
||||
}
|
||||
get machineInfo() {
|
||||
return this.$store.state.machineInfo;
|
||||
}
|
||||
|
||||
async navigateTo(
|
||||
path: string,
|
||||
absolutePath: string,
|
||||
local: boolean,
|
||||
todepth: number,
|
||||
fromdepth: number
|
||||
) {
|
||||
get canLoadProgram() {
|
||||
return this.$store.state.process.canLoadProgram;
|
||||
}
|
||||
|
||||
async mounted() {
|
||||
if (typeof cmsClient != "undefined") {
|
||||
this.driveList = JSON.parse(cmsClient.getOSdriveList());
|
||||
this.recentPath = cmsClient.RECENT_FOLDER_KEY
|
||||
}
|
||||
|
||||
this.loadClicked = false
|
||||
}
|
||||
|
||||
async navigateTo(path: string, absolutePath: string, local: boolean, todepth: number, fromdepth: number) {
|
||||
this.currentPath = absolutePath;
|
||||
this.lastClickPath = absolutePath;
|
||||
this.checkChangeNavigationType(local);
|
||||
this.selectedFile = null;
|
||||
this.selectedFileMetadata = null;
|
||||
var files = await this.getFilesForPath(absolutePath, path, local);
|
||||
|
||||
|
||||
// controlla se impostare il currentDrive
|
||||
if (fromdepth == 0) this.currentDrive = absolutePath;
|
||||
|
||||
@@ -102,6 +111,7 @@ export default class ModalLoadProgram extends Vue {
|
||||
}
|
||||
|
||||
this.navigationDepth = todepth;
|
||||
// Check destination depth
|
||||
if (todepth == 1) {
|
||||
this.fillArray(this.firstColumnData, files);
|
||||
this.secondColumnData.splice(0, this.secondColumnData.length);
|
||||
@@ -112,7 +122,35 @@ export default class ModalLoadProgram extends Vue {
|
||||
this.fillArray(this.secondColumnData, files);
|
||||
this.currentFilterSecond = "";
|
||||
}
|
||||
|
||||
// Recent column
|
||||
if(path == this.recentPath) {
|
||||
var main = null;
|
||||
// Parse files
|
||||
files.forEach((element) => {
|
||||
// Check if there is a deleted file
|
||||
if(element.FileExist == false)
|
||||
this.thereAreFileEliminated = true
|
||||
// Return only the main program
|
||||
if(element.IsMain == true)
|
||||
main = element
|
||||
})
|
||||
|
||||
// If there is a main program
|
||||
if(main != null) {
|
||||
this.fileInfo(main.AbsolutePath, false, 1)
|
||||
this.uploadAllFileInFolder = true;
|
||||
this.recentDriveSelected = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.uploadAllFileInFolder = false;
|
||||
this.thereAreFileEliminated = false;
|
||||
this.recentDriveSelected = false;
|
||||
}
|
||||
|
||||
this.calcBreadCrumb(absolutePath);
|
||||
this.cleanFileWatcher();
|
||||
}
|
||||
|
||||
fillArray(destinationArray: Array<any>, sourceArray: Array<any>) {
|
||||
@@ -137,8 +175,11 @@ export default class ModalLoadProgram extends Vue {
|
||||
this.isLocalNavigation = local;
|
||||
var result = null;
|
||||
|
||||
if (local) result = JSON.parse(cmsClient.getFileList(absolutePath));
|
||||
else result = await awaiter(fileService.getFiles(path));
|
||||
if (local)
|
||||
result = JSON.parse(cmsClient.getFileList(absolutePath));
|
||||
else
|
||||
result = await awaiter(fileService.getFiles(path));
|
||||
|
||||
return this.toUpperCaseModel(result).sort(this.compareDirectoriesFirst);
|
||||
}
|
||||
|
||||
@@ -147,14 +188,15 @@ export default class ModalLoadProgram extends Vue {
|
||||
}
|
||||
|
||||
toUpperCaseModel(data: Array<any>): Array<PathInfo> {
|
||||
|
||||
return data.map(i => {
|
||||
return {
|
||||
Name: i.name || i.Name,
|
||||
AbsolutePath: i.absolutePath || i.AbsolutePath,
|
||||
Path: i.path || i.Path,
|
||||
IsDirectory: (i.isDirectory != null && i.isDirectory) || (i.IsDirectory != null && i.IsDirectory),
|
||||
IsJob: i.isJob || i.IsJob
|
||||
IsJob: i.isJob,
|
||||
IsMain: i.IsMain,
|
||||
FileExist: i.FileExist
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -167,6 +209,7 @@ export default class ModalLoadProgram extends Vue {
|
||||
path: "\\\\"
|
||||
});
|
||||
}
|
||||
|
||||
if (path) {
|
||||
var fragments = path.split("\\");
|
||||
var __p = "";
|
||||
@@ -181,7 +224,6 @@ export default class ModalLoadProgram extends Vue {
|
||||
}
|
||||
|
||||
isInPath(path,isDirectory) {
|
||||
|
||||
if (this.currentPath) {
|
||||
if(!this.uploadAllFileInFolder || !this.isLocalNavigation)
|
||||
return path == this.currentPath;
|
||||
@@ -200,22 +242,25 @@ 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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (this.isLocalNavigation && typeof cmsClient != "undefined"){
|
||||
// Select file
|
||||
this.selectedFile = this.toUpperCaseFileModel(
|
||||
JSON.parse(cmsClient.getProgramInfo(str))
|
||||
);
|
||||
|
||||
// Check if the file it's a job and get data
|
||||
this.selectedFile.IsJob = isJob;
|
||||
if(isJob){
|
||||
|
||||
var resp = JSON.parse(cmsClient.readJobMetadata(str));
|
||||
if(resp.error)
|
||||
{
|
||||
@@ -234,28 +279,35 @@ export default class ModalLoadProgram extends Vue {
|
||||
this.selectedNumberImage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!this.isLocalNavigation)
|
||||
this.selectedFile = this.toUpperCaseFileModel(
|
||||
await awaiter(fileService.getFileInfo(str)));
|
||||
|
||||
this.currentPath = this.selectedFile.AbsolutePath.substring(0,this.selectedFile.AbsolutePath.lastIndexOf("\\"));
|
||||
|
||||
|
||||
this.currentPath = this.selectedFile.AbsolutePath.substring(0, this.selectedFile.AbsolutePath.lastIndexOf("\\"));
|
||||
this.cleanFileWatcher();
|
||||
}
|
||||
|
||||
beforeMount() {
|
||||
messageService.subscribeToChannel("esc_pressed", args => {
|
||||
this.close();
|
||||
});
|
||||
if(!this.machineInfo.isOsai) {
|
||||
awaiter (fileService.isTempFolderOK().then(response => {
|
||||
this.mustCLeanPProgram = !response;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
beforeDestroy() {
|
||||
messageService.deleteChannel("esc_pressed");
|
||||
}
|
||||
|
||||
close() {
|
||||
this.cleanFileWatcher()
|
||||
messageService.deleteChannel("esc_pressed");
|
||||
ModalHelper.HideModal();
|
||||
}
|
||||
|
||||
reload() {
|
||||
this.driveList = JSON.parse(cmsClient.getOSdriveList());
|
||||
}
|
||||
@@ -265,16 +317,25 @@ export default class ModalLoadProgram extends Vue {
|
||||
}
|
||||
|
||||
async load(item: FileInfo) {
|
||||
if(!this.thereAreFileEliminated || this.askConfirmLayer) {
|
||||
this.loadClicked = true
|
||||
|
||||
if (item.IsJob)
|
||||
this.loadJob(item.AbsolutePath);
|
||||
else
|
||||
this.loadProgram(item.AbsolutePath);
|
||||
if (item.IsJob)
|
||||
this.loadJob(item.AbsolutePath);
|
||||
else
|
||||
this.loadProgram(item.AbsolutePath);
|
||||
|
||||
this.askConfirmLayer = false
|
||||
}
|
||||
else {
|
||||
this.askConfirmLayer = true
|
||||
}
|
||||
this.loadClicked = false
|
||||
}
|
||||
|
||||
async loadProgram(path: string) {
|
||||
async loadProgram (path: string) {
|
||||
if (this.isLocalNavigation && typeof cmsClient != "undefined") {
|
||||
var resp = cmsClient.uploadAndActivateProgram(path,this.uploadAllFileInFolder);
|
||||
var resp = cmsClient.uploadAndActivateProgram(path, this.uploadAllFileInFolder, this.recentDriveSelected);
|
||||
if (resp != "")
|
||||
(iziToast as any).error({
|
||||
title: resp.split(";")[0],
|
||||
@@ -299,20 +360,70 @@ export default class ModalLoadProgram extends Vue {
|
||||
}
|
||||
|
||||
async loadJob(path: string) {
|
||||
|
||||
var jobMetadata = cmsClient.readJobMetadata(path);
|
||||
|
||||
// var result = await ModalHelper.ShowModalAsync(, jobMetadata);
|
||||
|
||||
}
|
||||
|
||||
|
||||
ToggleShowZoomedImage(){
|
||||
ToggleShowZoomedImage() {
|
||||
this.showZoomedImage = !this.showZoomedImage;
|
||||
}
|
||||
|
||||
toggleUploadAllFileInFolder(){
|
||||
toggleUploadAllFileInFolder() {
|
||||
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.fileChanged);
|
||||
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.fileIsChanged = 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()
|
||||
}
|
||||
|
||||
askConfirmOkClick(){
|
||||
this.load(this.selectedFile)
|
||||
}
|
||||
|
||||
askConfirmCancelClick(){
|
||||
this.askConfirmLayer = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,163 +1,265 @@
|
||||
<template>
|
||||
<modal type="modal-load-program" :title="'modal_load_program_lbl_title_window' | localize('Selezione programma')">
|
||||
<button class="close" slot="header-buttons" @click="close()"><i class="fa fa-remove"></i></button>
|
||||
<div class="modal-load-program-header">
|
||||
<!-- <div class="title">
|
||||
<modal
|
||||
type="modal-load-program"
|
||||
:title="'modal_load_program_lbl_title_window' | localize('Selezione programma')"
|
||||
>
|
||||
<button class="close" slot="header-buttons" @click="close()">
|
||||
<i class="fa fa-remove"></i>
|
||||
</button>
|
||||
<div class="modal-load-program-header">
|
||||
<!-- <div class="title">
|
||||
<i class="fa fa-chevron-left"></i>
|
||||
Selezione programma da aggiungere in coda
|
||||
</div> -->
|
||||
<div class="box-search">
|
||||
<div class="path" v-if="!showZoomedImage">
|
||||
|
||||
<div class="child" v-for="(bread,key) in this.breadcrumbs" :key="key">
|
||||
<div v-if="bread.name && key!=0"><i class="fa fa-chevron-right"></i></div>
|
||||
<a href="#" @click="navigateTo(bread.path,bread.path,isLocalNavigation, 1,1)">{{bread.name}}</a>
|
||||
</div>
|
||||
<!-- <div class="root">PC</div>
|
||||
</div>-->
|
||||
<div class="box-search">
|
||||
<div class="path" v-if="!showZoomedImage">
|
||||
<div class="child" v-for="(bread,key) in this.breadcrumbs" :key="key">
|
||||
<div v-if="bread.name && key!=0">
|
||||
<i class="fa fa-chevron-right"></i>
|
||||
</div>
|
||||
<a
|
||||
href="#"
|
||||
@click="navigateTo(bread.path,bread.path,isLocalNavigation, 1,1)"
|
||||
>{{bread.name}}</a>
|
||||
</div>
|
||||
<!-- <div class="root">PC</div>
|
||||
<div v-if="true"><i class="fa fa-chevron-right"></i></div>
|
||||
<div class="child">Cliente A</div>
|
||||
<div v-if="true"><i class="fa fa-chevron-right"></i></div>
|
||||
<div class="child">Part Program 01</div> -->
|
||||
</div>
|
||||
<div class="path" v-if="showZoomedImage">{{selectedFile.AbsolutePath}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="child">Part Program 01</div>-->
|
||||
</div>
|
||||
<div class="path" v-if="showZoomedImage">{{selectedFile.AbsolutePath}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-load-program-body">
|
||||
<div class="first-column" :class="{blur:mustCLeanPProgram}">
|
||||
<card-folder-path
|
||||
name="CNC"
|
||||
:iconType="'DATABASE'"
|
||||
:selected="'\\\\' == currentDrive"
|
||||
:disabled="!isCnReady()"
|
||||
@click="navigateTo('\\\\','\\\\', false, 1,0)"
|
||||
></card-folder-path>
|
||||
<hr>
|
||||
<card-folder-path
|
||||
name="Recent"
|
||||
:iconType="'SPFO'"
|
||||
:selected="currentDrive == recentPath"
|
||||
@click="navigateTo(recentPath, recentPath, true, 1, 0)"
|
||||
></card-folder-path>
|
||||
<hr>
|
||||
<card-folder-path
|
||||
v-for="(val, key) in this.driveList"
|
||||
:key="key"
|
||||
:name="val.Name"
|
||||
:iconType="val.Type"
|
||||
:selected="val.Path == currentDrive"
|
||||
@click="navigateTo(val.Path, val.Path, true, 1,0)"
|
||||
></card-folder-path>
|
||||
</div>
|
||||
<div class="second-column" :class="{blur:mustCLeanPProgram}" v-if="navigationDepth <1"></div>
|
||||
<div class="second-column" :class="{blur:mustCLeanPProgram}" v-if="navigationDepth >=1">
|
||||
<div class="group-btn">
|
||||
<input
|
||||
type="text"
|
||||
v-model="currentFilterFirst"
|
||||
:placeholder="'modal_load_program_search_placeholder' | localize('Cerca un programma per nome')"
|
||||
>
|
||||
<i class="fa fa-2x fa-search"></i>
|
||||
</div>
|
||||
<div class="content scrollable">
|
||||
<card-folder-path
|
||||
v-for="(val,key) in this.firstColumnData.filter(t => t.Name.toLowerCase().indexOf(currentFilterFirst.toLowerCase()) >=0)"
|
||||
:key="key"
|
||||
:name="val.Name"
|
||||
:disabled="(!isCnReady() && !isLocalNavigation) || !val.FileExist"
|
||||
:class="{dark: val.AbsolutePath == lastClickPath}"
|
||||
:selected="isInPath(val.AbsolutePath,val.IsDirectory) || val.AbsolutePath == lastClickPath"
|
||||
:withArrow="val.IsDirectory == true"
|
||||
:iconType="val.IsDirectory? 'FOLDER':'FILE'"
|
||||
:fileExist="val.FileExist"
|
||||
@click="val.IsDirectory ? navigateTo(val.Path, val.AbsolutePath, isLocalNavigation, 2,1): fileInfo(val.AbsolutePath, val.IsJob, 1)"
|
||||
></card-folder-path>
|
||||
</div>
|
||||
</div>
|
||||
<div class="third-column" :class="{blur:mustCLeanPProgram}" v-if="navigationDepth <2"></div>
|
||||
<div class="third-column" :class="{blur:mustCLeanPProgram}" v-if="navigationDepth >=2">
|
||||
<!-- !(this.arrayViewList[1] ? this.arrayViewList[1].length < 1 : false) -->
|
||||
<div class="group-btn">
|
||||
<input
|
||||
type="text"
|
||||
v-model="currentFilterSecond"
|
||||
:placeholder="'modal_load_program_search_placeholder' | localize('Cerca un programma per nome')"
|
||||
>
|
||||
<i class="fa fa-2x fa-search"></i>
|
||||
</div>
|
||||
<div class="label-folder-empty" v-if="secondColumnData.length ==0">
|
||||
<label>{{'modal_load_program_empty_folder' | localize("Cartella vuota")}}</label>
|
||||
</div>
|
||||
<div class="content scrollable" v-if="secondColumnData.length >0">
|
||||
<card-folder-path
|
||||
v-for="val in (this.secondColumnData.filter(t => t.Name.toLowerCase().indexOf(currentFilterSecond.toLowerCase()) >=0))"
|
||||
:key="val.Name"
|
||||
:name="val.Name"
|
||||
:disabled="!isCnReady() && !isLocalNavigation"
|
||||
:class="{dark: val.AbsolutePath == lastClickPath}"
|
||||
:selected="isInPath(val.AbsolutePath,val.IsDirectory) || val.AbsolutePath == lastClickPath"
|
||||
:withArrow="val.IsDirectory == true"
|
||||
:iconType="val.IsDirectory? 'FOLDER':'FILE'"
|
||||
@click="val.IsDirectory? navigateTo(val.Path, val.AbsolutePath, isLocalNavigation, 2, 2) : fileInfo(val.AbsolutePath, val.IsJob, 2) "
|
||||
></card-folder-path>
|
||||
<!-- <card-folder-path name="Cliente A" @click="selectItem()" :with-arrow="false"></card-folder-path>-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="selected-item" :class="{blur: fileIsChanged}" v-if="selectedFile">
|
||||
<div class="selected-item-header" :class="{blur: fileIsChanged}">
|
||||
<div>
|
||||
<label class="selected-item-title">{{selectedFile.Name}}</label>
|
||||
<div class="subtitle">
|
||||
<label
|
||||
class="title"
|
||||
>{{'modal_load_program_creation_date' | localize("Creation Date:")}}</label>
|
||||
<label class="text">{{getDate(selectedFile.CreationDate)}}</label>
|
||||
<label
|
||||
class="title"
|
||||
>{{'modal_load_program_last_change_date' | localize("Last Change Date:")}}</label>
|
||||
<label class="text">{{getDate(selectedFile.LastModDate)}}</label>
|
||||
</div>
|
||||
<div class="modal-load-program-body">
|
||||
<div class="first-column">
|
||||
<card-folder-path name="CNC" :iconType="'DATABASE'"
|
||||
:selected="'\\\\' == currentDrive"
|
||||
:disabled="!isCnReady()"
|
||||
@click="navigateTo('\\\\','\\\\', false, 1,0)"></card-folder-path>
|
||||
<hr />
|
||||
<card-folder-path v-for="(val, key) in this.driveList" :key="key" :name="val.Name" :iconType="val.Type"
|
||||
:selected="val.Path == currentDrive" @click="navigateTo(val.Path,val.Path, true, 1,0)" ></card-folder-path>
|
||||
</div>
|
||||
<div class="second-column" v-if="navigationDepth <1"></div>
|
||||
<div class="second-column" v-if="navigationDepth >=1">
|
||||
<div class="group-btn">
|
||||
<input type="text" v-model="currentFilterFirst" :placeholder="'modal_load_program_search_placeholder' | localize('Cerca un programma per nome')">
|
||||
<i class="fa fa-2x fa-search"></i>
|
||||
</div>
|
||||
<div class="content scrollable">
|
||||
<card-folder-path v-for="(val,key) in this.firstColumnData.filter(t => t.Name.toLowerCase().indexOf(currentFilterFirst.toLowerCase()) >=0)"
|
||||
:key="key"
|
||||
:name="val.Name"
|
||||
:disabled="!isCnReady() && !isLocalNavigation"
|
||||
:class="{dark: val.AbsolutePath == lastClickPath}"
|
||||
:selected="isInPath(val.AbsolutePath,val.IsDirectory) || val.AbsolutePath == lastClickPath"
|
||||
:withArrow="val.IsDirectory == true"
|
||||
:iconType="val.IsDirectory? 'FOLDER':'FILE'"
|
||||
@click="val.IsDirectory ? navigateTo(val.Path, val.AbsolutePath, isLocalNavigation, 2,1): fileInfo(val.AbsolutePath,val.IsJob,1)"></card-folder-path>
|
||||
</div>
|
||||
</div>
|
||||
<div class="third-column" v-if="navigationDepth <2"></div>
|
||||
<div class="third-column" v-if="navigationDepth >=2">
|
||||
<!-- !(this.arrayViewList[1] ? this.arrayViewList[1].length < 1 : false) -->
|
||||
<div class="group-btn">
|
||||
<input type="text" v-model="currentFilterSecond" :placeholder="'modal_load_program_search_placeholder' | localize('Cerca un programma per nome')">
|
||||
<i class="fa fa-2x fa-search"></i>
|
||||
</div>
|
||||
<div class="label-folder-empty" v-if="secondColumnData.length ==0">
|
||||
<label>{{'modal_load_program_empty_folder' | localize("Cartella vuota")}}</label>
|
||||
</div>
|
||||
<div class="content scrollable" v-if="secondColumnData.length >0">
|
||||
<card-folder-path v-for="val in (this.secondColumnData.filter(t => t.Name.toLowerCase().indexOf(currentFilterSecond.toLowerCase()) >=0))"
|
||||
:key="val.Name"
|
||||
:name="val.Name"
|
||||
:disabled="!isCnReady() && !isLocalNavigation"
|
||||
:class="{dark: val.AbsolutePath == lastClickPath}"
|
||||
:selected="isInPath(val.AbsolutePath,val.IsDirectory) || val.AbsolutePath == lastClickPath"
|
||||
:withArrow="val.IsDirectory == true"
|
||||
:iconType="val.IsDirectory? 'FOLDER':'FILE'"
|
||||
@click="val.IsDirectory? navigateTo(val.Path, val.AbsolutePath, isLocalNavigation, 2,2):fileInfo(val.AbsolutePath,val.IsJob,2) "></card-folder-path>
|
||||
<!-- <card-folder-path name="Cliente A" @click="selectItem()" :with-arrow="false"></card-folder-path>-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="selected-item" v-if="selectedFile">
|
||||
<div class="selected-item-header">
|
||||
<div>
|
||||
<label class="selected-item-title">{{selectedFile.Name}}</label>
|
||||
|
||||
<div class="subtitle">
|
||||
<label class="title">{{'modal_load_program_creation_date' | localize("Creation Date:")}}</label>
|
||||
<label class="text">{{getDate(selectedFile.CreationDate)}}</label>
|
||||
<label class="title">{{'modal_load_program_last_change_date' | localize("Last Change Date:")}}</label>
|
||||
<label class="text">{{getDate(selectedFile.LastModDate)}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="group-button">
|
||||
<button class="btn" v-if="false"><i class="fa fa-clone"></i></button>
|
||||
<button class="btn" disabled><i class="fa fa-pencil-square-o"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="selected-item-body" v-if="!selectedFile.IsJob">
|
||||
<div class="selected-item-body-image">
|
||||
<div v-if="selectedFile.PreviewBase64" class="container" @click="ToggleShowZoomedImage">
|
||||
<img :src="selectedFile.PreviewBase64">
|
||||
<div class="eye"><i class="fa fa-eye" aria-hidden="true"></i></div>
|
||||
</div>
|
||||
<div v-else class="noimage">
|
||||
{{'modal_load_program_lbl_img_not_found' | localize('Preview non disponibile')}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="selected-item-body-description scrollable">
|
||||
<div class="row" v-for="(item,index) in selectedFile.Content" :key="'line' + index">
|
||||
<label>{{item}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="selected-item-body" v-if="selectedFile && selectedFile.IsJob">
|
||||
<div class="box-image" v-if="selectedFileMetadata.generics.images.length > 0">
|
||||
<div class="box-image-container">
|
||||
<img :src="selectedFileMetadata.generics.images[selectedNumberImage].base64">
|
||||
</div>
|
||||
<div class="linenumber">
|
||||
<div v-for="(n,i) in selectedFileMetadata.generics.images" :key="i"><button :class="{'target': i == selectedNumberImage}" @click="selectNumberImage(i)">{{i+1}}</button></div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="selected-item-body-image">
|
||||
<div class="noimage">
|
||||
{{'modal_load_program_lbl_img_not_found' | localize('Preview non disponibile')}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-description" v-if="selectedFileMetadata.generics.description">
|
||||
{{selectedFileMetadata.generics.description}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="selected-item" v-if="!selectedFile">
|
||||
<div class="notselecteditem">
|
||||
<label>{{'modal_load_program_lbl_box_select_program' | localize('Seleziona programma')}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<zoom-image v-if="showZoomedImage && selectedFile && selectedFile.PreviewBase64"
|
||||
@close="ToggleShowZoomedImage"
|
||||
:imageSrc="selectedFile.PreviewBase64"
|
||||
/>
|
||||
</div>
|
||||
<div class="modal-load-program-footer">
|
||||
|
||||
<div class="togglebutton" v-if="this.isLocalNavigation">
|
||||
<label>{{'modal_load_program_lbl_upload_all_files' | localize('Upload all files in selected folder')}}
|
||||
<input type="checkbox" :checked="uploadAllFileInFolder" @click='toggleUploadAllFileInFolder()'>
|
||||
<span class="toggle">{{uploadAllFileInFolder?onLabel:offLabel}}</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="group-button">
|
||||
<button class="btn" v-if="false">
|
||||
<i class="fa fa-clone"></i>
|
||||
</button>
|
||||
<button class="btn" :disabled="!selectedFile.CanEdit" @click="editprogram">
|
||||
<i class="fa fa-pencil-square-o"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="selected-item-body" v-if="!selectedFile.IsJob" :class="{blur:fileIsChanged}">
|
||||
<div class="selected-item-body-image">
|
||||
<div v-if="selectedFile.PreviewBase64" class="container" @click="ToggleShowZoomedImage">
|
||||
<img :src="selectedFile.PreviewBase64">
|
||||
<div class="eye">
|
||||
<i class="fa fa-eye" aria-hidden="true"></i>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-success"
|
||||
:disabled="!selectedFile || !isCnReady()"
|
||||
v-if="!this.isLocalNavigation"
|
||||
@click="load(selectedFile)">
|
||||
{{'modal_load_program_btn_load_program' | localize('Attiva programma')}}
|
||||
</button>
|
||||
<button class="btn btn-success"
|
||||
:disabled="!selectedFile || !isCnReady()"
|
||||
v-if="this.isLocalNavigation"
|
||||
@click="load(selectedFile)">
|
||||
{{'modal_load_program_btn_upload_program' | localize('Carica e attiva programma')}}
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="noimage"
|
||||
>{{'modal_load_program_lbl_img_not_found' | localize('Preview non disponibile')}}</div>
|
||||
</div>
|
||||
<div class="selected-item-body-description scrollable">
|
||||
<div class="row" v-for="(item,index) in selectedFile.Content" :key="'line' + index">
|
||||
<label>{{item}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="selected-item-body" v-if="selectedFile && selectedFile.IsJob" :class="{blur:fileIsChanged}">
|
||||
<div class="box-image" v-if="selectedFileMetadata.generics.images.length > 0">
|
||||
<div class="box-image-container">
|
||||
<img :src="selectedFileMetadata.generics.images[selectedNumberImage].base64">
|
||||
</div>
|
||||
<div class="linenumber">
|
||||
<div v-for="(n,i) in selectedFileMetadata.generics.images" :key="i">
|
||||
<button
|
||||
:class="{'target': i == selectedNumberImage}"
|
||||
@click="selectNumberImage(i)"
|
||||
>{{i+1}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="selected-item-body-image">
|
||||
<div
|
||||
class="noimage"
|
||||
>{{'modal_load_program_lbl_img_not_found' | localize('Preview non disponibile')}}</div>
|
||||
</div>
|
||||
<div
|
||||
class="box-description"
|
||||
v-if="selectedFileMetadata.generics.description"
|
||||
>{{selectedFileMetadata.generics.description}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="{'selected-item-blur': mustCLeanPProgram}" class="selected-item" v-if="!selectedFile">
|
||||
<div class="notselecteditem">
|
||||
<label>{{'modal_load_program_lbl_box_select_program' | localize('Seleziona programma')}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<zoom-image
|
||||
v-if="showZoomedImage && selectedFile && selectedFile.PreviewBase64" :class="{blur:mustCLeanPProgram}"
|
||||
@close="ToggleShowZoomedImage"
|
||||
:imageSrc="selectedFile.PreviewBase64"
|
||||
/>
|
||||
|
||||
<div class="fileIsChanged" v-if="fileIsChanged">
|
||||
{{'modal_load_program_lbl_file_is_changed' | localize('Il file è stato modificato')}}
|
||||
<div>
|
||||
<button
|
||||
class="btn"
|
||||
@click="reloadProgram()"
|
||||
>{{'modal_load_program_btn_reload_file' | localize('Ricarica')}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cleanTempFolder" v-if="mustCLeanPProgram">
|
||||
{{'modal_load_program_lbl_tempfolder_not_ok' | localize('La cartella temporanea di CMS Active è stata modificata da altri software')}}
|
||||
<div>
|
||||
<button
|
||||
class="btn"
|
||||
@click="cleanTempfolder()"
|
||||
>{{'modal_load_program_btn_delete_all_files' | localize('Elimina tutti i file nella cartella')}}
|
||||
</button>
|
||||
<button
|
||||
class="btn"
|
||||
@click="backupTempfolder()"
|
||||
>{{'modal_load_program_btn_Backup_all_files' | localize('Backup dei file e pulizia della cartella')}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ask-confirm" v-if="askConfirmLayer">
|
||||
{{'modal_load_program_lbl_ask_confirm' | localize('Ci sono dei file che sono stati spostati o eliminati, caricare comunque?')}}
|
||||
<div>
|
||||
<button
|
||||
class="btn"
|
||||
@click="askConfirmCancelClick()"
|
||||
>{{'userinfo_btn_cancel' | localize('Annulla')}}
|
||||
</button>
|
||||
<button
|
||||
class="btn"
|
||||
@click="askConfirmOkClick()"
|
||||
>{{'modal_load_program_btn_upload_program' | localize('Carica e attiva programma')}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-load-program-footer">
|
||||
<div class="togglebutton" v-if="this.isLocalNavigation && !recentDriveSelected">
|
||||
<label>
|
||||
{{'modal_load_program_lbl_upload_all_files' | localize('Upload all files in selected folder')}}
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="uploadAllFileInFolder"
|
||||
@click="toggleUploadAllFileInFolder()"
|
||||
>
|
||||
<span class="toggle">{{uploadAllFileInFolder? onLabel : offLabel}}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<button
|
||||
class="btn btn-success"
|
||||
:disabled="!selectedFile || !isCnReady() || loadClicked"
|
||||
v-if="!this.isLocalNavigation"
|
||||
@click="load(selectedFile)"
|
||||
>{{'modal_load_program_btn_load_program' | localize('Attiva programma')}}</button>
|
||||
<button
|
||||
class="btn btn-success"
|
||||
:disabled="!selectedFile || !isCnReady() || fileIsChanged || !canLoadProgram || loadClicked"
|
||||
v-if="this.isLocalNavigation"
|
||||
@click="load(selectedFile)"
|
||||
>{{'modal_load_program_btn_upload_program' | localize('Carica e attiva programma')}}</button>
|
||||
</div>
|
||||
</modal>
|
||||
</template>
|
||||
<script src="./modal-load-program.ts" lang="ts"></script>
|
||||
|
||||
@@ -6,9 +6,17 @@ export class FileService extends baseRestService {
|
||||
BASE_URL = "api/file_manager/";
|
||||
|
||||
async getFiles(path: string): Promise<Array<any>> {
|
||||
return await this.Get<any>(this.BASE_URL + "files", true, {
|
||||
var result = await this.Get<any>(this.BASE_URL + "files", true, {
|
||||
filePath: path
|
||||
});
|
||||
|
||||
// Setup values
|
||||
result.forEach(element => {
|
||||
element.IsMain = false;
|
||||
element.FileExist = true;
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
async getFileInfo(path: string) {
|
||||
@@ -31,6 +39,16 @@ export class FileService extends baseRestService {
|
||||
return result;
|
||||
}
|
||||
|
||||
async isTempFolderOK() {
|
||||
return await this.Get<boolean>(this.BASE_URL + "shared_folder_ok", null);
|
||||
}
|
||||
async cleanTempFolder() {
|
||||
return await this.Put<boolean>(this.BASE_URL + "clean_shared_folder", null);
|
||||
}
|
||||
async backupTempFolder() {
|
||||
return await this.Put<boolean>(this.BASE_URL + "backup_shared_folder", null);
|
||||
}
|
||||
|
||||
async activateProgram(path: string) {
|
||||
return await this.Put<any>(this.BASE_URL + "file/active?filePath=" + path, null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user