From: Bellai Ádám Date: Fri, 13 Oct 2017 14:46:27 +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=7095458da9e2dee1442831b7fc3adc1dcd3054aa;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C30617 --- diff --git a/client/Maestro/MaestroForm.Designer.cs b/client/Maestro/MaestroForm.Designer.cs index aaebcbcf..603ec587 100644 --- a/client/Maestro/MaestroForm.Designer.cs +++ b/client/Maestro/MaestroForm.Designer.cs @@ -74,6 +74,7 @@ namespace Maestro { this.tabControl2 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.dataGridJobs = new System.Windows.Forms.DataGridView(); + this.columnLabel = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnID = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnStatus = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnProgress = new Maestro.Commons.DataGridViewProgressColumn(); @@ -81,6 +82,7 @@ namespace Maestro { this.columnFinished = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnInput = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnOutput = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.columnKillDate = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.bindingSourceJobs = new System.Windows.Forms.BindingSource(this.components); this.tabPage2 = new System.Windows.Forms.TabPage(); this.dataGridMessages = new System.Windows.Forms.DataGridView(); @@ -608,13 +610,15 @@ namespace Maestro { this.dataGridJobs.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; this.dataGridJobs.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridJobs.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.columnLabel, this.columnID, this.columnStatus, this.columnProgress, this.columnStarted, this.columnFinished, this.columnInput, - this.columnOutput}); + this.columnOutput, + this.columnKillDate}); this.dataGridJobs.DataSource = this.bindingSourceJobs; dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Window; @@ -644,6 +648,16 @@ namespace Maestro { this.dataGridJobs.Size = new System.Drawing.Size(988, 92); this.dataGridJobs.TabIndex = 0; this.dataGridJobs.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridJobs_CellEnter); + this.dataGridJobs.MouseClick += new System.Windows.Forms.MouseEventHandler(this.dataGridJobs_MouseClick); + // + // columnLabel + // + this.columnLabel.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.columnLabel.DataPropertyName = "Label"; + this.columnLabel.Frozen = true; + this.columnLabel.HeaderText = "Label"; + this.columnLabel.Name = "columnLabel"; + this.columnLabel.Width = 63; // // columnID // @@ -713,6 +727,14 @@ namespace Maestro { this.columnOutput.Name = "columnOutput"; this.columnOutput.Width = 68; // + // columnKillDate + // + this.columnKillDate.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.columnKillDate.DataPropertyName = "KillDate"; + this.columnKillDate.HeaderText = "KillDate"; + this.columnKillDate.Name = "columnKillDate"; + this.columnKillDate.Width = 75; + // // tabPage2 // this.tabPage2.Controls.Add(this.dataGridMessages); @@ -898,13 +920,6 @@ namespace Maestro { private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private TrafficClient.TrafficIDSelector trafficIDSelector; private System.Windows.Forms.Button buttonMetadata; - private System.Windows.Forms.DataGridViewTextBoxColumn columnID; - private System.Windows.Forms.DataGridViewTextBoxColumn columnStatus; - private Commons.DataGridViewProgressColumn columnProgress; - private System.Windows.Forms.DataGridViewTextBoxColumn columnStarted; - private System.Windows.Forms.DataGridViewTextBoxColumn columnFinished; - private System.Windows.Forms.DataGridViewTextBoxColumn columnInput; - private System.Windows.Forms.DataGridViewTextBoxColumn columnOutput; private System.Windows.Forms.TabControl tabControl2; private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.TabPage tabPage2; @@ -916,6 +931,15 @@ namespace Maestro { private System.Windows.Forms.DataGridViewTextBoxColumn timeDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn Level; private System.Windows.Forms.DataGridViewTextBoxColumn messageDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn columnLabel; + private System.Windows.Forms.DataGridViewTextBoxColumn columnID; + private System.Windows.Forms.DataGridViewTextBoxColumn columnStatus; + private Commons.DataGridViewProgressColumn columnProgress; + private System.Windows.Forms.DataGridViewTextBoxColumn columnStarted; + private System.Windows.Forms.DataGridViewTextBoxColumn columnFinished; + private System.Windows.Forms.DataGridViewTextBoxColumn columnInput; + private System.Windows.Forms.DataGridViewTextBoxColumn columnOutput; + private System.Windows.Forms.DataGridViewTextBoxColumn columnKillDate; } } diff --git a/client/Maestro/MaestroForm.cs b/client/Maestro/MaestroForm.cs index 815bda0f..1b30c2a2 100644 --- a/client/Maestro/MaestroForm.cs +++ b/client/Maestro/MaestroForm.cs @@ -13,8 +13,7 @@ using System.Threading; using TrafficClient; using OctopusClient; using System.Linq; -using System.Collections.Generic; -using System.ComponentModel; +using System.IO; namespace Maestro { @@ -66,6 +65,7 @@ namespace Maestro { columnOutput.HeaderText = StringResources.CEL; columnProgress.HeaderText = StringResources.ALLAPOT; columnStatus.HeaderText = StringResources.STATUSZ; + columnLabel.HeaderText = StringResources.CIM; ctxiDefineSegments.Text = StringResources.SZEGMENS_LETREHOZASA; ctxiModifyArchiveMetadata.Text = StringResources.ARCHÍV_METAADATOK_MODOSITASA; } @@ -120,6 +120,8 @@ namespace Maestro { if (jobsQueue.TryTake(out job)) { (this).SafeCall(() => { int position = jobs.IndexOf(job); + if (position == -1) + return; bindingSourceJobs.Position = position; dataGridJobs.FirstDisplayedScrollingRowIndex = position; }); @@ -289,5 +291,49 @@ namespace Maestro { txtSorceFilter.Text = string.Empty; } } + + private void dataGridJobs_MouseClick(object sender, MouseEventArgs e) { + if (e.Button == MouseButtons.Right && dataGridJobs.SelectedRows.Count == 1) { + ContextMenu popupMenu = new ContextMenu(); + MenuItem makeFileToProtected = new MenuItem(StringResources.ALLOMANY_VEDETTE_TETELE); + makeFileToProtected.Click += MakeFileToProtected_click; + MenuItem deleteProcess = new MenuItem(StringResources.TORLES); + deleteProcess.Click += DeleteProcess_click; + popupMenu.MenuItems.Add(makeFileToProtected); + popupMenu.MenuItems.Add(deleteProcess); + popupMenu.Show(dataGridJobs, new Point(e.X, e.Y)); + } + } + + private void MakeFileToProtected_click(object sender, EventArgs e) { + ITargetProcessor current = bindingSourceJobs.Current as ITargetProcessor; + if (current == null) + return; + if (File.Exists(current.KillDatePath)) { + File.Delete(current.KillDatePath); + //kell? + current.KillDate = new DateTime(); + } + } + + private void DeleteProcess_click(object sender, EventArgs e) { + ITargetProcessor current = bindingSourceJobs.Current as ITargetProcessor; + if (current == null) + return; + //ha van státusza, már nem törölhető + if (current.Status != null) + return; + BackgroundWorker worker = new BackgroundWorker(); + worker.DoWork += (s, r) => { + ITargetProcessor outJob; + while (jobsQueue.TryTake(out outJob)) { + if (!outJob.Equals(current)) { + jobsQueue.TryAdd(outJob); + } + } + }; + var actualRow = dataGridJobs.SelectedRows[0]; + dataGridJobs.Rows.Remove(actualRow); + } } } diff --git a/client/Maestro/MaestroForm.resx b/client/Maestro/MaestroForm.resx index fca8800d..065969d1 100644 --- a/client/Maestro/MaestroForm.resx +++ b/client/Maestro/MaestroForm.resx @@ -123,6 +123,9 @@ 512, 17 + + True + True @@ -144,6 +147,9 @@ True + + True + 154, 17 diff --git a/client/Maestro/StringResources.Designer.cs b/client/Maestro/StringResources.Designer.cs index b55133b3..4bfe1385 100644 --- a/client/Maestro/StringResources.Designer.cs +++ b/client/Maestro/StringResources.Designer.cs @@ -78,6 +78,15 @@ namespace Maestro { } } + /// + /// Looks up a localized string similar to Állomány védetté tétele. + /// + internal static string ALLOMANY_VEDETTE_TETELE { + get { + return ResourceManager.GetString("ALLOMANY_VEDETTE_TETELE", resourceCulture); + } + } + /// /// Looks up a localized string similar to Archív metaadatok módosítása. /// @@ -123,6 +132,15 @@ namespace Maestro { } } + /// + /// Looks up a localized string similar to Cím. + /// + internal static string CIM { + get { + return ResourceManager.GetString("CIM", resourceCulture); + } + } + /// /// Looks up a localized string similar to Felvétel dátuma. /// @@ -276,6 +294,15 @@ namespace Maestro { } } + /// + /// Looks up a localized string similar to Törlés. + /// + internal static string TORLES { + get { + return ResourceManager.GetString("TORLES", resourceCulture); + } + } + /// /// Looks up a localized string similar to Ügynökség. /// diff --git a/client/Maestro/StringResources.resx b/client/Maestro/StringResources.resx index 1f3a0cc5..6ba10450 100644 --- a/client/Maestro/StringResources.resx +++ b/client/Maestro/StringResources.resx @@ -123,6 +123,9 @@ Állapot + + Állomány védetté tétele + Archive @@ -138,6 +141,9 @@ Cél akció + + Cím + Felvétel dátuma @@ -189,6 +195,9 @@ Szegmens létrehozása + + Törlés + Ügynökség diff --git a/client/Maestro/Targets/ITargetProcessor.cs b/client/Maestro/Targets/ITargetProcessor.cs index 7da7a2d0..8e268b04 100644 --- a/client/Maestro/Targets/ITargetProcessor.cs +++ b/client/Maestro/Targets/ITargetProcessor.cs @@ -20,6 +20,12 @@ namespace Maestro.Targets { int Progress { get; set; } + DateTime KillDate { get; set; } + + string Label { get; set; } + + string KillDatePath { get; set; } + bool Execute(); } } \ No newline at end of file diff --git a/client/Maestro/Targets/TargetProcessor.cs b/client/Maestro/Targets/TargetProcessor.cs index a6fe6e5c..42a8a038 100644 --- a/client/Maestro/Targets/TargetProcessor.cs +++ b/client/Maestro/Targets/TargetProcessor.cs @@ -16,6 +16,9 @@ namespace Maestro.Targets { private string inputName; private string outputName; private int progress; + private DateTime killDate; + private string label; + private string killDatePath; protected Control parent; public TargetProcessor(Control parent) { @@ -155,5 +158,39 @@ namespace Maestro.Targets { } } + public DateTime KillDate { + get { + return killDate; + } + set { + if (killDate != value) { + killDate = value; + NotifyPropertyChanged(); + } + } + } + + + public string Label { + get { return label; } + set { + //label != value biztos jó stringeknél? + if (label != value) { + label = value; + NotifyPropertyChanged(); + } + } + } + + public string KillDatePath { + get { return killDatePath; } + set { + //label != value biztos jó stringeknél? + if (killDatePath != value) { + killDatePath = value; + NotifyPropertyChanged(); + } + } + } } } \ No newline at end of file diff --git a/client/Maestro/Targets/UNCTargetProcessor.cs b/client/Maestro/Targets/UNCTargetProcessor.cs index f24bac73..7d751ab8 100644 --- a/client/Maestro/Targets/UNCTargetProcessor.cs +++ b/client/Maestro/Targets/UNCTargetProcessor.cs @@ -36,6 +36,7 @@ namespace Maestro.Targets { inputFile = new FileInfo(Input); ID = parameters.ID; workFlowAction = new WorkflowAction() { houseId = ID, tag = parameters.TargetConfig.Tag, touched = DateTime.Now }; + Label = parameters.TargetConfig.Label; } protected virtual void BeforeExecute() { @@ -81,6 +82,8 @@ namespace Maestro.Targets { workFlowAction.successful = true; if (parameters.TargetConfig.KillDateDays > 0) UploadKillDateFile(); + else + KillDate = new DateTime(); if (parameters.TargetConfig.CreateMetadata && parameters.ArchiveMetadata != null) CreateMetadata(); if (parameters.TargetConfig.SaveSegments && parameters.Segments != null) { @@ -145,7 +148,9 @@ namespace Maestro.Targets { date = date.AddDays(parameters.TargetConfig.KillDateDays); string fileName = String.Format(KILLDATE_FILE, OutputName, date.ToString("yyyyMMdd")); logger.Debug("Creating KILLDATE status file {0}", fileName); - UploadContent(Path.Combine(statusWorkDir, fileName), new byte[] { }); + KillDatePath = Path.Combine(statusWorkDir, fileName); + UploadContent(KillDatePath, new byte[] { }); + KillDate = date; } private void CreateMetadata() {