From: Vásáry Dániel Date: Thu, 30 Nov 2017 16:07:10 +0000 (+0000) Subject: git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube... X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=9a2d6dae5f48fe588f5701840edd92471fa1b916;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C30779 --- diff --git a/client/Maestro/Configuration/ACTIVE-configuration-nle.json b/client/Maestro/Configuration/ACTIVE-configuration-nle.json new file mode 100644 index 00000000..30ee7038 --- /dev/null +++ b/client/Maestro/Configuration/ACTIVE-configuration-nle.json @@ -0,0 +1,183 @@ +{ + "title": "NLE", + "active": true, + "startInTray": false, + "enableCustomMetadataId": true, + "defaultWindowColor": "#E1BEE7", + "partialWindowColor": "#F3E5F5", + "player": { + "enabled": true, + "autoStart": false, + "segmentEditor": true + }, + "source": { + "$type": "UNCSource", + "filter": "avi,wav,mxf", + "foldersAutoExpand": true, + "local": { + "address": "file://c:/x" + } + }, + "metadatas": [ + { + "$type": "OctopusMetadata", + "disableStoryCheck": true, + "server": { + "address": "http://10.10.1.27/services/rest/octopus/", + "timeout": 1000 + }, + "projectSettings": { + "templateRoot": { + "address": "file://10.10.1.100/BRAAVOS/.MAESTRO", + "userName": "mediacube", + "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy", + "timeout": 1000 + }, + "templateName": "ALAPTIMELINE.ezp", + "target": { + "label": "Projekt létrehozása", + "processor": "UNCTargetProcessor", + "outputFormat": "%ID%-%TEXT%", + "subFolderFormat": "%IDROOT%-%TEXT%/PROJECT", + "disableFileVersioning": true, + "remote": { + "address": "file://10.10.1.100/BRAAVOS/OCTOPUS", + "userName": "mediacube", + "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy", + "timeout": 1000 + } + }, + "disableOpenProject": false, + "disableOpenSourceFolder": false + } + }, + { + "$type": "TrafficMetadata", + "server": { + "address": "Data Source=10.10.1.45\\sql16;Initial Catalog=PA_Echo;Persist Security Info=True;", + "userName": "MAM", + "password": "7RKZYBzumKjL40SJwuwiFCvX57xuCN8zay6OttUm2wbrgImyYZBHyZTUUYrXX31Ge2Uwew07HYsqh2uzdJeDBDwcVntxaHg3nIpv9Dyq/odVoiC4tUF/K+lgvKWANcrZ", + "timeout": 1000 + }, + "local": { + "address": "file://10.10.1.100/OCTOPUS", + "userName": "mediacube", + "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy", + "timeout": 1000 + } + }, + { + "$type": "MediaCubeMetadata", + "server": { + "address": "http://10.10.1.27/services/rest/jobengine/", + "timeout": 1000 + } + } + ], + "targets": [ + { + "label": "Stúdióba küldés", + "processor": "FTPTargetProcessor", + "outputFormat": "%ID%", + "tag": "Betöltés", + "nexioServer": true, + "nexioFileExistsMessage": "A feltöltéshez új 'placeholder' generálása szükséges az Octopus rendszerben, az anyagon belül az ALT+1 billenytűkombináció segítségével.", + "killDateDays": 7, + "disableFileVersioning": true, + "agency": "MAESTRO-NLE", + "reference": [ "Napi megtekintőbe","Online archívba" ], + "remote": { + "address": "ftp://10.10.1.55:2098", + "userName": "administrator", + "password": "+QtkeQdCTiOvZOgK/kUND4pO4/D+//r7ZIyluwMMdiqMEgO8iJErAG10ooWhPfiljQeXrdeyMzo7gWEZtcWpNSomGeDIbdMyQwtpqmMo1VEM3A27ZfzigY09YD46ECRh", + "timeout": 1000 + } + }, + { + "label": "Napi megtekintőbe", + "processor": "FTPTargetProcessor", + "outputFormat": "%ID%", + "tag": "Online", + "disableFileVersioning": true, + "killDateDays": 2, + "saveArchiveMetadata": false, + "remote": { + "address": "ftp://10.10.1.100/OCTOPUS/_NAPI_MEGTEKINTO", + "userName": "mediacube", + "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy", + "timeout": 1000 + } + }, + { + "label": "Online archívba", + "processor": "FTPTargetProcessor", + "subFolderFormat": "%DATESTAMP%", + "outputFormat": "%ID%-%TEXT%", + "tag": "Online", + "disableFileVersioning": true, + "killDateDays": 0, + "saveArchiveMetadata": false, + "remote": { + "address": "ftp://10.10.1.100/MEGTEKINTO_ARCHIVE", + "userName": "mediacube", + "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy", + "timeout": 1000 + } + }, + { + "label": "TQC check", + "processor": "FTPTargetProcessor", + "outputFormat": "%ID%-%SOURCENAME%", + "tag": "Betöltés", + "killDateDays": 7, + "saveArchiveMetadata": false, + "remote": { + "address": "ftp://10.10.1.100/TQC/CHECK", + "userName": "mediacube", + "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy", + "timeout": 1000 + } + }, + { + "label": "TQC promo", + "processor": "FTPTargetProcessor", + "outputFormat": "%ID%-%SOURCENAME%", + "tag": "Betöltés", + "killDateDays": 7, + "saveArchiveMetadata": false, + "remote": { + "address": "ftp://10.10.1.100/TQC/PROMO", + "userName": "mediacube", + "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy", + "timeout": 1000 + } + }, + { + "label": "TQC reklám", + "processor": "FTPTargetProcessor", + "outputFormat": "%ID%-%SOURCENAME%", + "tag": "Betöltés", + "killDateDays": 7, + "saveArchiveMetadata": false, + "remote": { + "address": "ftp://10.10.1.100/TQC/REKLAM", + "userName": "mediacube", + "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy", + "timeout": 1000 + } + }, + { + "label": "Archiválás", + "processor": "FTPTargetProcessor", + "outputFormat": "%ID%", + "tag": "Archiválás", + "saveArchiveMetadata": true, + "remote": { + "address": "ftp://10.10.1.100/ARCHIVE", + "userName": "mediacube", + "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy", + "timeout": 1000 + } + } + ] +} diff --git a/client/Maestro/Configuration/configuration-archive.json b/client/Maestro/Configuration/configuration-archive.json index 47daba99..784321bb 100644 --- a/client/Maestro/Configuration/configuration-archive.json +++ b/client/Maestro/Configuration/configuration-archive.json @@ -1,6 +1,6 @@ { "title": "Archiválás", - "active": true, + "active": false, "startInTray": false, "enableCustomMetadataId": true, "player": { @@ -11,9 +11,9 @@ "source": { "$type": "UNCSource", "filter": "mov,wav,mxf", - "foldersAutoExpand": true, + "foldersAutoExpand": false, "local": { - "address": "file://10.10.1.100/BRAAVOS", + "address": "file://10.10.1.100/BRAAVOS/MEGTEKINTO_ARCHIVE", "userName": "mediacube", "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy", "timeout": 1000 @@ -22,6 +22,7 @@ "metadatas": [ { "$type": "OctopusMetadata", + "disableStoryCheck": true, "server": { "address": "http://10.10.1.27/services/rest/octopus/", "timeout": 1000 diff --git a/client/Maestro/Configuration/configuration-studio.json b/client/Maestro/Configuration/configuration-studio.json index d1b924fe..8a9e20f8 100644 --- a/client/Maestro/Configuration/configuration-studio.json +++ b/client/Maestro/Configuration/configuration-studio.json @@ -1,6 +1,6 @@ { "title": "Stúdió", - "active": true, + "active": false, "startInTray": false, "enableCustomMetadataId": true, "filter": "avi", @@ -9,7 +9,7 @@ "source": { "$type": "NEXIOSource", "local": { - "address": "ws://10.10.1.28/services/nexio" + "address": "ws://10.10.1.27/services/nexio" }, "remote": { "address": "ftp://10.10.1.55:2098", diff --git a/client/Maestro/Configuration/configuration-sxs.json b/client/Maestro/Configuration/configuration-sxs.json index 7d6ab651..03fa1bfa 100644 --- a/client/Maestro/Configuration/configuration-sxs.json +++ b/client/Maestro/Configuration/configuration-sxs.json @@ -12,7 +12,7 @@ "$type": "UNCSource", "filter": "mov,wav,mxf", "local": { - "address": "file://c:/x" + "address": "file://c:/" } }, "metadatas": [ diff --git a/client/Maestro/FolderScanner.cs b/client/Maestro/FolderScanner.cs index 557f8289..3d260606 100644 --- a/client/Maestro/FolderScanner.cs +++ b/client/Maestro/FolderScanner.cs @@ -1,10 +1,12 @@ -using System; +using NLog; +using System; using System.Collections.Concurrent; using System.IO; namespace Maestro { public class FolderScanner { + private static readonly Logger logger = LogManager.GetCurrentClassLogger(); public delegate void FoundFileSystemEntry(T parent, string entry, string label, bool isDirectory); public event FoundFileSystemEntry OnFoundFileSystemEntry; private ConcurrentDictionary cache; @@ -12,14 +14,31 @@ namespace Maestro { public void EnumerateDirectories(string path) { if (!Directory.Exists(path)) return; - foreach (var entry in Directory.EnumerateDirectories(path, "*", SearchOption.AllDirectories)) { - OnFoundFileSystemEntry?.Invoke( - Get(Path.GetDirectoryName(entry)), - entry, - Uri.UnescapeDataString(Path.GetFileName(entry)), - true - ); + try { + foreach (string entry in Directory.GetDirectories(path)) { + logger.Info(entry); + T parent = Get(Path.GetDirectoryName(entry)); + string label = Uri.UnescapeDataString(Path.GetFileName(entry)); + OnFoundFileSystemEntry?.Invoke(parent, entry, label, true); + EnumerateDirectories(entry); + } } + catch (Exception e) { + logger.Error(e); + } + + //var directories = Directory.EnumerateDirectories(path, "*", SearchOption.AllDirectories); + //try { + // foreach (var entry in directories) { + // logger.Info(entry); + // T parent = Get(Path.GetDirectoryName(entry)); + // string label = Uri.UnescapeDataString(Path.GetFileName(entry)); + // OnFoundFileSystemEntry?.Invoke(parent, entry, label, true); + // } + //} + //catch (Exception e) { + // logger.Error(e); + //} } public void Put(string key, T value) { @@ -29,7 +48,7 @@ namespace Maestro { } private string GetLastSegment(string path) { - + return Uri.UnescapeDataString(Path.GetFileName(path)); } diff --git a/client/Maestro/Installer/installforge-installer-project.ifp b/client/Maestro/Installer/installforge-installer-project.ifp index 2745a096..1e50aabd 100644 Binary files a/client/Maestro/Installer/installforge-installer-project.ifp and b/client/Maestro/Installer/installforge-installer-project.ifp differ diff --git a/client/Maestro/Maestro.csproj b/client/Maestro/Maestro.csproj index 483fae64..510b101f 100644 --- a/client/Maestro/Maestro.csproj +++ b/client/Maestro/Maestro.csproj @@ -249,6 +249,9 @@ Always + + Always + Always diff --git a/client/Maestro/MaestroForm.Source.cs b/client/Maestro/MaestroForm.Source.cs index 54e27ad8..ae7a66ae 100644 --- a/client/Maestro/MaestroForm.Source.cs +++ b/client/Maestro/MaestroForm.Source.cs @@ -93,63 +93,56 @@ namespace Maestro { } Uri address = Configuration.Source.Local.Address; - - TreeNode rootNode = treeFolders.Nodes.Add(Path.GetFileName(address.LocalPath)); - - FolderScanner scanner = new FolderScanner(); - scanner.Put(address.LocalPath, rootNode); - scanner.OnFoundFileSystemEntry += (parent, entry, label, isDirectory) => { - //logger.Trace($"{parent} *** {entry}"); - TreeNode node = parent.Nodes.Add(label); - scanner.Put(entry, node); - }; - - treeFolders.BeginUpdate(); - scanner.EnumerateDirectories(address.LocalPath); - if ((Configuration.Source as UNCSource).FoldersAutoExpand) - treeFolders.ExpandAll(); - rootNode.EnsureVisible(); - treeFolders.EndUpdate(); - //if (!Directory.Exists(address.LocalPath)) - // return; - //string[] folders = Directory.GetDirectories(address.LocalPath); - //TreeNode rootNode = treeFolders.Nodes.Add(GetLastSegment(Configuration.Source.Local.Address.ToString())); - //var orderedFolders = folders.OrderBy(n => n); - //foreach (var folder in orderedFolders) { - // TreeNode folderNode = rootNode.Nodes.Add(GetLastSegment(folder)); - // folderNode.Nodes.Add(".."); - //} - } - private void HideFolders() { - dgSource.Visible = true; - treeFolders.Visible = false; - treeFolders.Nodes.Clear(); + if (!Directory.Exists(address.LocalPath)) + return; + string label = Path.GetFileName(address.LocalPath); + label = String.IsNullOrEmpty(label) ? address.LocalPath : label; + TreeNode rootNode = treeFolders.Nodes.Add(label); + //FolderScanner scanner = new FolderScanner(); + //scanner.Put(address.LocalPath, rootNode); + //scanner.OnFoundFileSystemEntry += (parent, entry, label, isDirectory) => { + // //logger.Trace($"{parent} *** {entry}"); + // TreeNode node = parent.Nodes.Add(label); + // scanner.Put(entry, node); + //}; + + //treeFolders.BeginUpdate(); + //scanner.EnumerateDirectories(address.LocalPath); + //if ((Configuration.Source as UNCSource).FoldersAutoExpand) + // treeFolders.ExpandAll(); + //rootNode.EnsureVisible(); + //treeFolders.Sort(); + //treeFolders.EndUpdate(); + AddFolders(address, rootNode); } - private string GetPath(TreeNode node) { - TreeNode treeNode = node; - StringBuilder sb = new StringBuilder(); - sb.Append(treeNode.Text); - while (treeNode.Level != 1) { - treeNode = treeNode.Parent; - sb.Insert(0, "/"); - sb.Insert(0, treeNode.Text); + private void AddFolders(Uri address, TreeNode parent) { + string[] folders = null; + try { + folders = Directory.GetDirectories(address.LocalPath); } - return sb.ToString(); + catch (Exception ex) { + MsgBox.Error(ex.Message); + } + if (folders == null) + return; + treeFolders.BeginUpdate(); + foreach (var folder in folders) { + TreeNode folderNode = parent.Nodes.Add(GetLastSegment(folder)); + folderNode.Nodes.Add(".."); + } + treeFolders.Sort(); + parent.EnsureVisible(); + treeFolders.EndUpdate(); } private void OnBeforeExpandFolder(object sender, TreeViewCancelEventArgs e) { - //if (e.Node.Nodes.Count != 1 || !"..".Equals(e.Node.Nodes[0].Text)) - // return; - //e.Node.Nodes.Clear(); - //Uri address = new Uri(Path.Combine(Configuration.Source.Local.Address.LocalPath, GetPath(e.Node))); - //string[] folders = Directory.GetDirectories(address.LocalPath); - //var orderedFolders = folders.OrderBy(n => n); - //foreach (var folder in orderedFolders) { - // TreeNode folderNode = e.Node.Nodes.Add(GetLastSegment(folder)); - // folderNode.Nodes.Add(".."); - //} + if (e.Node.Nodes.Count != 1 || !"..".Equals(e.Node.Nodes[0].Text)) + return; + e.Node.Nodes.Clear(); + Uri address = new Uri(Path.Combine(Configuration.Source.Local.Address.LocalPath, GetPath(e.Node))); + AddFolders(address, e.Node); } private void OnAfterSelectFolder(object sender, TreeViewEventArgs e) { @@ -172,6 +165,24 @@ namespace Maestro { HideFolders(); } + private void HideFolders() { + dgSource.Visible = true; + treeFolders.Visible = false; + treeFolders.Nodes.Clear(); + } + + private string GetPath(TreeNode node) { + TreeNode treeNode = node; + StringBuilder sb = new StringBuilder(); + sb.Append(treeNode.Text); + while (treeNode.Level != 1) { + treeNode = treeNode.Parent; + sb.Insert(0, "/"); + sb.Insert(0, treeNode.Text); + } + return sb.ToString(); + } + private void OnShowFolders(object sender, EventArgs e) { if (btnShowFolders.CheckState == CheckState.Checked) { HideFolders(); diff --git a/client/Maestro/MaestroForm.Target.cs b/client/Maestro/MaestroForm.Target.cs index 986dbd69..92282781 100644 --- a/client/Maestro/MaestroForm.Target.cs +++ b/client/Maestro/MaestroForm.Target.cs @@ -163,7 +163,7 @@ namespace Maestro { MessageBus = MessageBus }; - if (SelectedMetadata.Kind == MetadataType.MediaCube) { + if (SelectedMetadata.Kind == MetadataType.MediaCube && result.ArchiveMetadata != null) { result.ArchiveMetadata.itemHouseId = PatternNameMaker.Get(result.ArchiveMetadata.itemHouseId, result.ID, result.InputFileName, result.MetadataText); result.ArchiveMetadata.itemTitle = PatternNameMaker.Get(result.ArchiveMetadata.itemTitle, result.ID, result.InputFileName, result.MetadataText); result.ArchiveMetadata.mediaHouseId = PatternNameMaker.Get(result.ArchiveMetadata.mediaHouseId, result.ID, result.InputFileName, result.MetadataText); diff --git a/client/Maestro/Properties/AssemblyInfo.cs b/client/Maestro/Properties/AssemblyInfo.cs index 12eaceb3..af91e83c 100644 --- a/client/Maestro/Properties/AssemblyInfo.cs +++ b/client/Maestro/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.0.5.7")] -[assembly: AssemblyFileVersion("2.0.5.7")] +[assembly: AssemblyVersion("2.0.5.8")] +[assembly: AssemblyFileVersion("2.0.5.8")] diff --git a/client/Maestro/Sources/NexioRESTSource.cs b/client/Maestro/Sources/NexioRESTSource.cs index 524ddbfe..8fc6d2b5 100644 --- a/client/Maestro/Sources/NexioRESTSource.cs +++ b/client/Maestro/Sources/NexioRESTSource.cs @@ -30,6 +30,7 @@ namespace Maestro.Sources { private NexioAPI nexioAPI; private string filter; private string path; + private volatile bool initialized; public DataGridViewColumn[] Columns { get { @@ -68,7 +69,7 @@ namespace Maestro.Sources { }; foreach (DataGridViewColumn column in result) column.HeaderCell.Style.Font = new Font(parent.Font, FontStyle.Regular); - + return result; } } @@ -186,12 +187,18 @@ namespace Maestro.Sources { OnList(d); break; case NexioAPI.CREATE: + if (!initialized) + return; OnCreated(d); break; case NexioAPI.DELETE: + if (!initialized) + return; OnDeleted(d); break; case NexioAPI.UPDATE: + if (!initialized) + return; OnChanged(d); break; } @@ -222,19 +229,22 @@ namespace Maestro.Sources { if (l == null) return; l.Children().ToList().Select(t => CreateItem(t, false)).Where(x => x.CanHandle(acceptableAgencies)).OrderByDescending(i => i.Created).ToList().ForEach(i => parent.SafeCall(() => Add(i))); + initialized = true; } private void OnChanged(JToken token) { if (!String.IsNullOrEmpty(filter)) return; string id = token[ID].ToString(); - var item = Items.Where(x => x.ID == id).SingleOrDefault(); + var item = Items.Where(x => x.ID == id).FirstOrDefault(); if (item == null) { - item = CreateItem(token, true); + item = CreateItem(token, initialized); if (!item.CanHandle(acceptableAgencies)) return; parent.SafeCall(() => { Add(item); + if (!initialized) + return; messageBus.Send(new ModifyFileActionMsg() { FileName = item.Name, Source = parent @@ -243,10 +253,12 @@ namespace Maestro.Sources { } else { parent.SafeCall(() => { SetItem(ref item, token); - item.IsHighlighted = true; + item.IsHighlighted = initialized; if (item.CanHandle(acceptableAgencies)) return; Remove(item); + if (!initialized) + return; messageBus.Send(new RemoveFileActionMsg() { FileName = item.Name, Source = parent @@ -276,7 +288,7 @@ namespace Maestro.Sources { if (!String.IsNullOrEmpty(filter)) return; string id = d[ID].ToString(); - var item = this.Where(i => i.ID != null && i.ID.Equals(id)).SingleOrDefault(); + var item = this.Where(i => i.ID != null && i.ID.Equals(id)).FirstOrDefault(); if (item == null) return; parent.SafeCall(() => { diff --git a/client/MaestroShared/Controls/CheckableTreeView.cs b/client/MaestroShared/Controls/CheckableTreeView.cs new file mode 100644 index 00000000..8b1ac6e9 --- /dev/null +++ b/client/MaestroShared/Controls/CheckableTreeView.cs @@ -0,0 +1,52 @@ +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace MaestroShared.Controls { + class CheckableTreeView : TreeView { + public delegate void OnNodeDoubleClick(object sender, TreeNodeMouseClickEventArgs args); + + public OnNodeDoubleClick NodeDoubleClick; + private readonly bool[] disableCheckBoxLevels; + + public CheckableTreeView(bool[] disableCheckBoxLevels) { + DrawMode = TreeViewDrawMode.OwnerDrawText; + DrawNode += OnDrawNode; + this.disableCheckBoxLevels = disableCheckBoxLevels; + } + + void OnDrawNode(object sender, DrawTreeNodeEventArgs e) { + Graphics g = e.Graphics; + if ((e.State & TreeNodeStates.Selected) == TreeNodeStates.Selected || (e.State & TreeNodeStates.Focused) == TreeNodeStates.Focused) { + using (SolidBrush brush = new SolidBrush(Color.Gainsboro)) { + e.Graphics.FillRectangle(brush, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height); + } + bool disableHack = false; + if (disableCheckBoxLevels.Length > e.Node.Level && disableCheckBoxLevels[e.Node.Level]) + disableHack = true; + + if (!disableHack) { + using (Pen pen = new Pen(Color.Black)) { + pen.Width = 1; + e.Graphics.DrawLine(pen, e.Bounds.X, e.Bounds.Y + 2, e.Bounds.X, e.Bounds.Y + e.Bounds.Height - 4); + } + } + } + TextRenderer.DrawText(e.Graphics, e.Node.Text, Font, e.Bounds, ForeColor, TextFormatFlags.Left | TextFormatFlags.Top); + } + + protected override void WndProc(ref Message m) { + // Suppress WM_LBUTTONDBLCLK + if (m.Msg == 0x203) { + var point = PointToClient(Cursor.Position); + TreeNode node = GetNodeAt(point); + TreeNodeMouseClickEventArgs args = new TreeNodeMouseClickEventArgs(node, MouseButtons.Left, 2, point.X, point.Y); + NodeDoubleClick?.Invoke(this, args); + m.Result = IntPtr.Zero; + } else + base.WndProc(ref m); + } + + } + +} diff --git a/client/MaestroShared/MaestroShared.csproj b/client/MaestroShared/MaestroShared.csproj index 2bb82374..4ac948d8 100644 --- a/client/MaestroShared/MaestroShared.csproj +++ b/client/MaestroShared/MaestroShared.csproj @@ -90,6 +90,9 @@ + + Component + Component diff --git a/client/MediaCubeClient/NexioAPI.cs b/client/MediaCubeClient/NexioAPI.cs index 546617b7..55319e34 100644 --- a/client/MediaCubeClient/NexioAPI.cs +++ b/client/MediaCubeClient/NexioAPI.cs @@ -40,7 +40,7 @@ namespace NexioClient { }; ws.OnMessage += (sender, e) => { - Debug.WriteLine("OnMessage: " + e.Data); + //Debug.WriteLine("OnMessage: " + e.Data); }; ws.OnMessage += p; diff --git a/client/OctopusClient/CheckableTreeView.cs b/client/OctopusClient/CheckableTreeView.cs index 60773a37..338691af 100644 --- a/client/OctopusClient/CheckableTreeView.cs +++ b/client/OctopusClient/CheckableTreeView.cs @@ -1,4 +1,5 @@ using System; +using System.Drawing; using System.Windows.Forms; namespace OctopusClient { @@ -7,6 +8,33 @@ namespace OctopusClient { public OnNodeDoubleClick NodeDoubleClick; + public bool[] DisableCheckBoxLevels { get; set; } + + public CheckableTreeView() { + DrawMode = TreeViewDrawMode.OwnerDrawText; + DrawNode += OnDrawNode; + } + + void OnDrawNode(object sender, DrawTreeNodeEventArgs e) { + Graphics g = e.Graphics; + if ((e.State & TreeNodeStates.Selected) == TreeNodeStates.Selected || (e.State & TreeNodeStates.Focused) == TreeNodeStates.Focused) { + using (SolidBrush brush = new SolidBrush(Color.Gainsboro)) { + e.Graphics.FillRectangle(brush, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height); + } + bool disableHack = false; + if (DisableCheckBoxLevels.Length > e.Node.Level && DisableCheckBoxLevels[e.Node.Level]) + disableHack = true; + + if (!disableHack) { + using (Pen pen = new Pen(Color.Black)) { + pen.Width = 1; + e.Graphics.DrawLine(pen, e.Bounds.X, e.Bounds.Y + 2, e.Bounds.X, e.Bounds.Y + e.Bounds.Height - 4); + } + } + } + TextRenderer.DrawText(e.Graphics, e.Node.Text, Font, e.Bounds, ForeColor, TextFormatFlags.Left | TextFormatFlags.Top); + } + protected override void WndProc(ref Message m) { // Suppress WM_LBUTTONDBLCLK if (m.Msg == 0x203) { diff --git a/client/OctopusClient/OctopusIDSelector.Designer.cs b/client/OctopusClient/OctopusIDSelector.Designer.cs index 8d0617be..17c36687 100644 --- a/client/OctopusClient/OctopusIDSelector.Designer.cs +++ b/client/OctopusClient/OctopusIDSelector.Designer.cs @@ -1,4 +1,6 @@ -namespace OctopusClient { +using MaestroShared.Controls; + +namespace OctopusClient { partial class OctopusIDSelector { /// /// Required designer variable. @@ -23,7 +25,7 @@ /// the contents of this method with the code editor. /// private void InitializeComponent() { - this.treeOctopus = new OctopusClient.CheckableTreeView(); + this.treeOctopus = new CheckableTreeView(); this.pSeparator = new System.Windows.Forms.Panel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.cbFolders = new System.Windows.Forms.ComboBox(); diff --git a/client/OctopusClient/OctopusIDSelector.cs b/client/OctopusClient/OctopusIDSelector.cs index 79f8f646..8a505086 100644 --- a/client/OctopusClient/OctopusIDSelector.cs +++ b/client/OctopusClient/OctopusIDSelector.cs @@ -30,6 +30,7 @@ namespace OctopusClient { public OctopusParameters Parameters { set { parameters = value; + treeOctopus.DisableCheckBoxLevels = new[] { parameters.Configuration.DisableStoryCheck, parameters.Configuration.DisablePlaceHolderCheck }; client = new OctopusAPI(value.Configuration.Server.Address.OriginalString, value.Configuration.Server.UserName, value.Configuration.Server.Password, value.Configuration.Server.Timeout, value.MessageBus); rbRundown.Checked = true; RefreshFolders(); @@ -63,26 +64,7 @@ namespace OctopusClient { InitializeComponent(); InitializeControls(); treeOctopus.AfterCheck += OnTreeAfterCheck; - treeOctopus.DrawMode = TreeViewDrawMode.OwnerDrawText; - treeOctopus.DrawNode += OnDrawNode; - treeOctopus.NodeDoubleClick += OnNodeDoubleClick; - } - - void OnDrawNode(object sender, DrawTreeNodeEventArgs e) { - Graphics g = e.Graphics; - if ((e.State & TreeNodeStates.Selected) == TreeNodeStates.Selected || (e.State & TreeNodeStates.Focused) == TreeNodeStates.Focused) { - using (SolidBrush brush = new SolidBrush(Color.Gainsboro)) { - e.Graphics.FillRectangle(brush, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height); - } - if ((e.Node.Level == 0 && !parameters.Configuration.DisableStoryCheck) || - e.Node.Level == 1 && !parameters.Configuration.DisablePlaceHolderCheck) { - using (Pen pen = new Pen(Color.Black)) { - pen.Width = 1; - e.Graphics.DrawLine(pen, e.Bounds.X, e.Bounds.Y + 2, e.Bounds.X, e.Bounds.Y + e.Bounds.Height - 4); - } - } - } - TextRenderer.DrawText(e.Graphics, e.Node.Text, treeOctopus.Font, e.Bounds, treeOctopus.ForeColor, TextFormatFlags.Left | TextFormatFlags.Top); + treeOctopus.NodeDoubleClick = OnNodeDoubleClick; } private void InitializeControls() { diff --git a/server/user.jobengine.osgi.server/src/user/jobengine/server/IJobStepExecutor.java b/server/user.jobengine.osgi.server/src/user/jobengine/server/IJobStepExecutor.java index a6266894..991accaa 100644 --- a/server/user.jobengine.osgi.server/src/user/jobengine/server/IJobStepExecutor.java +++ b/server/user.jobengine.osgi.server/src/user/jobengine/server/IJobStepExecutor.java @@ -8,15 +8,23 @@ import user.jobengine.server.steps.IJobStep; * Folyamat l�p�s v�grehajt� interface. */ public interface IJobStepExecutor { + void changePriority(IJobRuntime runtime); + + boolean containsRuntime(IJobRuntime runtime); + + void create(String name, int maxConcurrent) throws JobEngineException; + + int getMaxConcurrent(); + + PriorityBlockingQueue getQueue(); + /** * V�grehajt� l�p�s implement�ci�j�nak lek�rdez�se. - * + * * @return L�p�s implement�ci�. */ Class getStepClass(); - void create(String name, int maxConcurrent) throws JobEngineException; - void revoke(IJobRuntime jobRuntime); /** @@ -31,18 +39,12 @@ public interface IJobStepExecutor { /** * Folyamat elhelyez�se a v�grehajt� v�rakoz�si sor�ba. - * + * * @param job * Folyamat. */ void submit(IJobRuntime job); - int getMaxConcurrent(); - - PriorityBlockingQueue getQueue(); - - boolean containsRuntime(IJobRuntime runtime); - - void changePriority(IJobRuntime runtime); + void waitShutdown(); } diff --git a/server/user.jobengine.osgi.server/src/user/jobengine/server/JobEngine.java b/server/user.jobengine.osgi.server/src/user/jobengine/server/JobEngine.java index e573a2eb..5b0d9c2a 100644 --- a/server/user.jobengine.osgi.server/src/user/jobengine/server/JobEngine.java +++ b/server/user.jobengine.osgi.server/src/user/jobengine/server/JobEngine.java @@ -742,11 +742,17 @@ public class JobEngine implements IJobEngine { } private void shutdownExecutors() { - if (executors != null) - for (IJobStepExecutor executor : executors.values()) { - logger.info("Stopping executor {}", executor.getStepClass()); - executor.shutdown(); - } + if (executors == null) + return; + for (IJobStepExecutor executor : executors.values()) { + logger.trace("Notify executor {}", executor.getStepClass()); + executor.shutdown(); + } + for (IJobStepExecutor executor : executors.values()) { + logger.info("Stopping executor {}", executor.getStepClass()); + executor.shutdown(); + } + } @Override diff --git a/server/user.jobengine.osgi.server/src/user/jobengine/server/JobRuntime.java b/server/user.jobengine.osgi.server/src/user/jobengine/server/JobRuntime.java index 2dfdf493..4ccf2d88 100644 --- a/server/user.jobengine.osgi.server/src/user/jobengine/server/JobRuntime.java +++ b/server/user.jobengine.osgi.server/src/user/jobengine/server/JobRuntime.java @@ -525,7 +525,7 @@ public class JobRuntime extends Job implements IJobRuntime { @Override public String toString() { - return String.format("!%s! %d", getName(), getId()); + return String.format("#%s - %d - %s#", getName(), getId(), status); } } diff --git a/server/user.jobengine.osgi.server/src/user/jobengine/server/JobStepExecutor.java b/server/user.jobengine.osgi.server/src/user/jobengine/server/JobStepExecutor.java index 993105f1..25790905 100644 --- a/server/user.jobengine.osgi.server/src/user/jobengine/server/JobStepExecutor.java +++ b/server/user.jobengine.osgi.server/src/user/jobengine/server/JobStepExecutor.java @@ -72,6 +72,9 @@ public class JobStepExecutor implements IJobStepExecutor { public void shutdown() { this.shutdown = true; + } + + public void waitShutdown() { try { this.join(); } catch (InterruptedException e) { @@ -216,4 +219,10 @@ public class JobStepExecutor implements IJobStepExecutor { //logger.info("Executor got ! {}", jobRuntime); } + @Override + public void waitShutdown() { + for (Worker w : workers) + w.waitShutdown(); + } + } diff --git a/server/user.jobengine.osgi.server/src/user/jobengine/zk/model/JobListModel.java b/server/user.jobengine.osgi.server/src/user/jobengine/zk/model/JobListModel.java index 0f610d28..ed757984 100644 --- a/server/user.jobengine.osgi.server/src/user/jobengine/zk/model/JobListModel.java +++ b/server/user.jobengine.osgi.server/src/user/jobengine/zk/model/JobListModel.java @@ -24,9 +24,11 @@ import user.jobengine.server.JobChangedEvent; import user.jobengine.server.JobEngine; public class JobListModel extends BaseModel implements IJobChangedListener { + private class EnableServerStart { + } private static final Logger logger = LogManager.getLogger(); - private List jobEvents = new ArrayList(); + private List jobEvents = new ArrayList(); //protected CachedListModel searchResult = null; private ListModelList jobList = new ListModelList(); private IJobRuntime selectedJob = null; @@ -136,16 +138,23 @@ public class JobListModel extends BaseModel implements IJobChangedListener { synchronized (jobEvents) { if (jobEvents.size() > 0) { boolean mustRefreshList = false; - for (JobChangedEvent event : jobEvents) { - IJobRuntime job = event.getJob(); - if (event.getSignalType().equals(SignalType.DELETE)) { - this.jobList.remove(event.getJob()); - mustRefreshList = true; - } else if (event.getSignalType().equals(SignalType.CREATE)) { - this.jobList.add(event.getJob()); - mustRefreshList = true; - } else if (event.getSignalType().equals(SignalType.UPDATE)) { - this.jobList.notifyChange(job); + for (Object event : jobEvents) { + if (event instanceof JobChangedEvent) { + JobChangedEvent jobEvent = (JobChangedEvent) event; + IJobRuntime job = jobEvent.getJob(); + if (jobEvent.getSignalType().equals(SignalType.DELETE)) { + this.jobList.remove(jobEvent.getJob()); + mustRefreshList = true; + } else if (jobEvent.getSignalType().equals(SignalType.CREATE)) { + this.jobList.add(jobEvent.getJob()); + mustRefreshList = true; + } else if (jobEvent.getSignalType().equals(SignalType.UPDATE)) { + this.jobList.notifyChange(job); + } + } + if (event instanceof EnableServerStart) { + setStartupDisabled(false); + BindUtils.postNotifyChange(null, null, this, "startupDisabled"); } } if (mustRefreshList) { @@ -192,8 +201,9 @@ public class JobListModel extends BaseModel implements IJobChangedListener { @Override public void run() { jobEngine.shutdown(); - setStartupDisabled(false); - BindUtils.postNotifyChange(null, null, this, "startupDisabled"); + synchronized (jobEvents) { + jobEvents.add(new EnableServerStart()); + } } }; Thread t = new Thread(r); diff --git a/server/user.jobengine.osgi.server/src/user/jobengine/zk/model/JobSelectorModel.java b/server/user.jobengine.osgi.server/src/user/jobengine/zk/model/JobSelectorModel.java index cb3fb00c..17d8c81e 100644 --- a/server/user.jobengine.osgi.server/src/user/jobengine/zk/model/JobSelectorModel.java +++ b/server/user.jobengine.osgi.server/src/user/jobengine/zk/model/JobSelectorModel.java @@ -44,7 +44,7 @@ public class JobSelectorModel extends BaseModel { SchedulerService scheduler = jobEngine.getScheduler(); ScheduledJob scheduledJob = scheduler.createScheduledJob(selectedJobElement.getDbObject()); scheduledJob.setJobEngine(jobEngine); - for (int i = 0; i < 10; i++) { + for (int i = 0; i < 1; i++) { try { if (!scheduledJob.isActive())