- Timestamp:
- 07/04/19 14:28:13 (5 years ago)
- Location:
- stable
- Files:
-
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Clients.Hive.Administrator
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator merged eligible /trunk/HeuristicLab.Clients.Hive.Administrator merged eligible /branches/1721-RandomForestPersistence/HeuristicLab.Clients.Hive.Administrator 10321-10322 /branches/2916_IndexedDataTableSerialization/HeuristicLab.Clients.Hive.Administrator 15918 /branches/2947_ConfigurableIndexedDataTable/HeuristicLab.Clients.Hive.Administrator 16148-16526 /branches/2972_PDPRowSelect/HeuristicLab.Clients.Hive.Administrator 16444-16518 /branches/Algorithms.GradientDescent/HeuristicLab.Clients.Hive.Administrator 5516-5520 /branches/Async/HeuristicLab.Clients.Hive.Administrator 13329-15286 /branches/Benchmarking/sources/HeuristicLab.Clients.Hive.Administrator 6917-7005 /branches/CloningRefactoring/HeuristicLab.Clients.Hive.Administrator 4656-4721 /branches/CodeEditor/HeuristicLab.Clients.Hive.Administrator 11700-11806 /branches/DataAnalysis Refactoring/HeuristicLab.Clients.Hive.Administrator 5471-5808 /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Clients.Hive.Administrator 5815-6180 /branches/DataAnalysis/HeuristicLab.Clients.Hive.Administrator 4458-4459,4462,4464 /branches/DataPreprocessing/HeuristicLab.Clients.Hive.Administrator 10085-11101 /branches/GP.Grammar.Editor/HeuristicLab.Clients.Hive.Administrator 6284-6795 /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Clients.Hive.Administrator 5060 /branches/HLScript/HeuristicLab.Clients.Hive.Administrator 10331-10358 /branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Clients.Hive.Administrator 11570-12508 /branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Clients.Hive.Administrator 6123-9799 /branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Clients.Hive.Administrator 11130-12721 /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator 15377-15760 /branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.Administrator 12440-12877 /branches/LogResidualEvaluator/HeuristicLab.Clients.Hive.Administrator 10202-10483 /branches/NET40/sources/HeuristicLab.Clients.Hive.Administrator 5138-5162 /branches/NSGA-II Changes/HeuristicLab.Clients.Hive.Administrator 12033-12122 /branches/ParallelEngine/HeuristicLab.Clients.Hive.Administrator 5175-5192 /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Clients.Hive.Administrator 7568-7810 /branches/QAPAlgorithms/HeuristicLab.Clients.Hive.Administrator 6350-6627 /branches/Restructure trunk solution/HeuristicLab.Clients.Hive.Administrator 6828 /branches/RuntimeOptimizer/HeuristicLab.Clients.Hive.Administrator 8943-9078 /branches/ScatterSearch (trunk integration)/HeuristicLab.Clients.Hive.Administrator 7787-8333 /branches/SlaveShutdown/HeuristicLab.Clients.Hive.Administrator 8944-8956 /branches/SpectralKernelForGaussianProcesses/HeuristicLab.Clients.Hive.Administrator 10204-10479 /branches/SuccessProgressAnalysis/HeuristicLab.Clients.Hive.Administrator 5370-5682 /branches/Trunk/HeuristicLab.Clients.Hive.Administrator 6829-6865 /branches/UnloadJobs/HeuristicLab.Clients.Hive.Administrator 9168-9215 /branches/VNS/HeuristicLab.Clients.Hive.Administrator 5594-5752 /branches/crossvalidation-2434/HeuristicLab.Clients.Hive.Administrator 12948-12950 /branches/histogram/HeuristicLab.Clients.Hive.Administrator 5959-6341 /branches/symbreg-factors-2650/HeuristicLab.Clients.Hive.Administrator 14232-14825 /trunk/sources/HeuristicLab.Clients.Hive.Administrator 9493,9496,9498,9504-9506,9515-9517,9520-9521,9523,9530-9531,9534-9537,9540,9542-9544,9552-9555,9568-9569,9587,9590-9592,9600,9607-9608,9610-9611,9613,9618,9623-9624,9626,9647-9649,9652,9657-9660,9664-9666,9675,9692,9695,9699,9702,9710,9714,9718-9720,9740-9741,9751-9752,9755,9762,9764-9775,9777-9778,9782-9786,9792,9794-9795,9803-9812,9816-9822,9824-9825,9828,9830,9833,9837-9841,9845,9848-9851,9855,9859-9860,9863,9865-9868,9871,9893-9897,9900-9902,9905-9907,9910,9915-9916,9919-9921,9928,9930,9934-9935,9938-9941,9944,9946,9949,9955-9956,9958-9959,9964-9965,9973-9975,9978,9980-9982,9988-9989,9991-9992,9994-9995,9997,10000-10005,10009-10010,10015,10130,10149-10150,10154,10170-10171,10173-10176,10195-10196,10212-10213,10231,10261,10273,10291-10292,10295,10298,10323-10324,10346,10348,10355,10359-10360,10362-10363,10365-10366,10368,10375,10378,10391,10401,10406-10407,10414,10417-10418,10428,10432-10433,10435,10440,10448,10453,10460,10465-10466,10469-10470,10472,10474-10477,10480,10484,10486,10488-10500,10503-10504,10506,10510-10512,10519-10523,10526,10531,10540-10541,10543,10545,10561-10566,10575-10578,10596-10597,10599,10601-10607,10639,10642-10643,10646,10651-10653,10727,10731,10745,10747,10761,10767,10774,10787-10791,10793-10794,10796,10799-10800,10826,10857-10862,10865,10885,10889,10894-10896,10924,10926-10927,10937,10941,10953,10955-10956,10958-10961,10963,10975,10983-10986,10988-10989,10996,11007-11008,11012-11014,11019,11024-11027,11031,11034-11035,11048,11050-11052,11056-11058,11060,11065-11067,11071,11074-11082,11086-11088,11091-11093,11095-11097,11099-11100,11102,11108,11111-11117,11123-11128,11131,11135,11153,11156,11161,11214,11241,11243,11248-11251,11256,11263,11274,11280,11282-11283,11285-11287,11290,11292,11294-11296,11298,11300,11302,11306,11308-11309,11313,11315,11317,11324,11326,11330-11332,11337-11348,11352-11353,11361-11362,11364-11367,11380-11382,11384,11389,11391-11392,11394,11403-11404,11410-11411,11417-11420,11422,11426-11430,11432,11434-11437,11439-11448,11450,11453,11455-11457,11464,11466-11467,11469-11472,11474,11477-11480,11483,11494-11498,11504,11514-11515,11523-11525,11532-11533,11536,11540-11542,11544-11545,11547-11549,11555,11557,11581,11592,11596-11597,11599-11600,11605,11608,11610,11615-11616,11618,11623,11631,11634,11650-11652,11657,11675,11679-11680,11703-11706,11715,11717,11721,11723-11725,11734-11736,11756-11758,11762-11764,11766,11771-11772,11781-11782,11784,11787-11790,11794,11807-11811,11815-11816,11818-11819,11822,11825-11831,11833-11837,11839-11840,11853-11854,11856,11877-11879,11882,11890,11909,11912-11918,11921,11930,11933-11934,11936,11938-11939,11942,11945,11948,11950-11951,11955-11956,11958-11961,11963,11967,11970-11971,11978,11982-11984,11987-11994,11996,11998-12004,12015-12744,12755,12770,12772,12787,12790-12798,12801,12807,12810-12812,12816-12819,12835-12837,12839,12844-12846,12851,12855,12868,12873,12875,12878-12879,12883,12885-12886,12889,12894-12907,12911-12918,12920-12921,12925-12927,12932,12934,12936-12938,12940,12946-12948,12953-12954,12959-12961,12971-12973,12975-12978,12981-12983,12986-12987,13000-13005,13008,13014,13016,13024-13027,13030,13033-13034,13036,13038-13040,13051,13054-13060,13064-13066,13078,13080,13087,13093-13094,13100-13104,13109,13116,13118-13121,13131,13133,13136-13143,13154,13157-13160,13162-13165,13167-13169,13173,13180-13181,13183,13186,13198,13200-13201,13203-13205,13209-13210,13212,13214,13217-13219,13222-13228,13230-13239,13241-13245,13247-13257,13260-13261,13266-13271,13288,13300,13307-13309,13311,13313-13315,13318,13392-13393,13395,13402,13406,13411,13413-13415,13419-13420,13425,13427-13430,13433-13434,13438-13442,13445-13447,13450,13458,13471,13473-13474,13484,13491,13494,13498-13504,13507-13514,13516-13517,13525-13526,13529,13534-13535,13539-13540,13549-13550,13552,13560,13566-13567,13570-13573,13579-13582,13584-13586,13592-13593,13597,13614,13616,13621,13626-13629,13635,13644-13646,13648,13650-13655,13657-13662,13666,13669-13671,13675-13684,13690-13693,13695,13697-13705,13707-13709,13711,13715,13721,13724,13746,13760-13761,13764-13766,13779,13784-13786,13796,13800-13802,13807,13813,13826,13838,13863,13869,13889-13891,13895,13898-13901,13916-13917,13921-13922,13925,13932-13935,13938-13939,13941-13942,13958,13963-13964,13975,13978,13983-13987,13992-13993,13998,14000-14001,14007-14008,14011,14014-14017,14024-14026,14032,14034,14036-14037,14056-14057,14071,14082-14083,14095-14096,14098-14100,14102-14103,14107,14109-14110,14118-14122,14124-14127,14130-14132,14135-14136,14140,14142,14144,14150,14152,14155-14160,14162-14164,14167-14169,14174-14175,14177-14179,14181,14189,14191,14196,14198,14200,14202-14207,14209,14221-14224,14226-14230,14234-14236,14244-14247,14250,14255-14258,14260,14267-14268,14270-14273,14282,14284-14300,14307,14314-14316,14319,14322,14332,14340-14350,14352-14358,14367-14369,14371-14372,14376,14378,14381-14382,14384,14388,14390-14391,14393-14394,14396,14400,14405,14407-14408,14412,14418,14422-14423,14425,14432-14439,14443,14457-14458,14463-14465,14468-14469,14475-14476,14478-14479,14481-14483,14486,14493-14494,14504,14506-14509,14516-14517,14519,14522-14523,14527-14529,14531-14533,14548,14553,14561,14582,14597,14623,14630,14647,14651-14652,14654,14656,14659-14660,14662-14663,14672,14685,14687,14692,14697,14706,14708-14709,14718,14721-14722,14726,14732,14734,14737-14738,14740,14748-14750,14769-14770,14772-14775,14779-14781,14786,14789-14791,14793,14805,14809-14810,14817,14819-14820,14826-14832,14839-14843,14845-14847,14851-14854,14857,14860-14865,14871,14877,14882,14886,14889-14890,14899,14901,14904,14911-14912,14916,14918,14936-14938,14940,14943-14951,14955,14971,14978-14979,14982,14984,14987,14992,14995,15002-15010,15013,15015-15016,15023-15024,15026,15029,15040,15042,15044,15046-15054,15058,15067-15077,15079-15080,15083-15088,15091-15096,15098-15099,15102-15107,15110-15114,15119-15126,15129,15135,15139,15156-15158,15160,15162-15169,15172-15173,15178-15181,15184-15185,15187,15191-15192,15194,15198,15201,15203,15205-15211,15213-15214,15221-15228,15230,15233-15236,15240-15241,15246-15248,15264-15266,15271,15276,15287-15288,15300-15302,15312,15325-15327,15329,15335-15336,15339,15357-15358,15361,15367-15368,15370-15372,15376,15383,15388,15390,15393,15395-15398,15400,15402,15408-15409,15419,15427,15447-15448,15452,15461,15464,15478,15480-15481,15483,15486,15498-15499,15502,15505,15513,15517-15518,15532,15534,15545,15548,15551,15556,15560,15570,15591,15594,15596,15598,15607,15610-15611,15621-15623,15626,15637-15638,15645,15665,15667,15672-15674 /trunk/sources/HeuristicLab.Problems.TestFunctions.MultiObjective/HeuristicLab.Clients.Hive.Administrator 14175
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
stable/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectJobsView.cs
r16117 r17059 24 24 using System.Drawing; 25 25 using System.Linq; 26 using System.Threading.Tasks; 26 27 using System.Windows.Forms; 27 28 using HeuristicLab.MainForm; … … 30 31 using HeuristicLab.Data; 31 32 using HeuristicLab.Clients.Hive.Views; 33 using HeuristicLab.Core; 32 34 33 35 namespace HeuristicLab.Clients.Hive.Administrator.Views { … … 41 43 private const string JOB_DATECREATED = "Date Created"; 42 44 private const string JOB_STATE = "State"; 45 private const string JOB_EXECUTIONSTATE = "Execution State"; 46 private const string JOB_EXECUTIONTIME = "Execution Time"; 43 47 private const string JOB_DESCRIPTION = "Description"; 44 48 private const string JOB_TASKCOUNT = "Tasks"; 49 private const string JOB_WAITINGTASKCOUNT = "Waiting"; 45 50 private const string JOB_CALCULATINGTASKCOUNT = "Calculating"; 46 51 private const string JOB_FINISHEDTASKCOUNT = "Finished"; 47 48 52 49 53 private readonly Color onlineStatusColor = Color.FromArgb(255, 189, 249, 143); // #bdf98f … … 53 57 private readonly Color deletionPendingStatusColor2 = Color.FromArgb(255, 249, 149, 143); // #f9958f 54 58 59 private IProgress progress; 60 public IProgress Progress { 61 get { return progress; } 62 set { 63 this.progress = value; 64 OnIsProgressingChanged(); 65 } 66 } 67 55 68 public new Project Content { 56 69 get { return (Project)base.Content; } … … 60 73 public ProjectJobsView() { 61 74 InitializeComponent(); 62 63 removeButton.Enabled = false; 75 progress = new Progress(); 76 77 removeButton.Enabled = false; 78 } 79 80 protected override void RegisterContentEvents() { 81 base.RegisterContentEvents(); 64 82 matrixView.DataGridView.SelectionChanged += DataGridView_SelectionChanged; 83 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, progress); 84 } 85 86 protected override void DeregisterContentEvents() { 87 matrixView.DataGridView.SelectionChanged -= DataGridView_SelectionChanged; 88 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this, false); 89 base.DeregisterContentEvents(); 65 90 } 66 91 67 92 private void DataGridView_SelectionChanged(object sender, EventArgs e) { 68 if (matrixView.DataGridView.SelectedRows == null || matrixView.DataGridView.SelectedRows.Count == 0) return; 69 70 bool anyDeletable = false; 71 foreach (DataGridViewRow r in matrixView.DataGridView.SelectedRows) { 72 if (((string)r.Cells[0].Value) == JobState.Online.ToString()) anyDeletable = true; 73 } 74 75 removeButton.Enabled = anyDeletable; 93 SetEnabledStateOfControls(); 76 94 } 77 95 … … 81 99 removeButton.Enabled = false; 82 100 UpdateJobs(); 83 } 101 SetEnabledStateOfControls(); 102 } 103 84 104 protected override void SetEnabledStateOfControls() { 85 105 base.SetEnabledStateOfControls(); 86 106 bool enabled = Content != null && !Locked && !ReadOnly; 87 107 88 refreshButton.Enabled = enabled;89 removeButton.Enabled = false;90 108 matrixView.Enabled = enabled; 91 } 109 110 // Buttons (start/resume, pause, stop, remove) 111 refreshButton.Enabled = startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = removeButton.Enabled = false; 112 113 if (enabled && progress.ProgressState != ProgressState.Started) { 114 var jobs = GetSelectedJobs().ToList(); 115 if (jobs.Any()) { 116 117 startButton.Enabled = jobs.All(x => 118 !x.IsProgressing && HiveAdminClient.Instance.Tasks.ContainsKey(x.Id) && HiveAdminClient.Instance.Tasks[x.Id].Count > 0 119 && x.Job.ProjectId != Guid.Empty //&& x.Job.ResourceIds != null && x.Job.ResourceIds.Any() 120 && (x.ExecutionState == ExecutionState.Prepared || x.ExecutionState == ExecutionState.Paused)); 121 pauseButton.Enabled = jobs.All(x => !x.IsProgressing && x.ExecutionState == ExecutionState.Started); 122 stopButton.Enabled = jobs.All(x => !x.IsProgressing && (x.ExecutionState == ExecutionState.Started || x.ExecutionState == ExecutionState.Paused)); 123 removeButton.Enabled = jobs.All(x => !x.IsProgressing && x.Job.State == JobState.Online); 124 } 125 } 126 127 // refresh Button 128 if (Content != null && !Locked && progress.ProgressState != ProgressState.Started) { 129 refreshButton.Enabled = true; 130 } 131 } 132 92 133 #endregion Overrides 93 134 … … 98 139 99 140 private void refreshButton_Click(object sender, EventArgs e) { 100 RefreshJobs(); 101 } 102 103 private async void removeButton_Click(object sender, EventArgs e) { 104 if (matrixView.DataGridView.SelectedRows == null || matrixView.DataGridView.SelectedRows.Count == 0) return; 105 106 var jobNamesToDelete = new List<string>(); 107 var jobIdsToDelete = new List<Guid>(); 108 foreach (DataGridViewRow r in matrixView.DataGridView.SelectedRows) { 109 if(((string)r.Cells[0].Value) == JobState.Online.ToString()) { 110 jobNamesToDelete.Add(" - " + ((string)r.Cells[3].Value)); 111 jobIdsToDelete.Add(Guid.Parse((string)r.Cells[8].Value)); 112 } 113 } 114 115 if(jobIdsToDelete.Any()) { 141 progress.Start("Refreshing jobs..."); 142 SetEnabledStateOfControls(); 143 var task = System.Threading.Tasks.Task.Factory.StartNew(RefreshJobsAsync); 144 145 task.ContinueWith((t) => { 146 progress.Finish(); 147 SetEnabledStateOfControls(); 148 }); 149 } 150 151 private void removeButton_Click(object sender, EventArgs e) { 152 var jobs = GetSelectedJobs(); 153 154 if (jobs.Any()) { 116 155 var result = MessageBox.Show("Do you really want to remove following job(s):\n\n" 117 + String.Join("\n", jobNamesToDelete),156 + String.Join("\n", jobs.Select(x => x.Job.Name)), 118 157 "HeuristicLab Hive Administrator", 119 158 MessageBoxButtons.YesNo, … … 121 160 122 161 if (result == DialogResult.Yes) { 123 await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions( 124 action: () => { 125 DeleteJobs(jobIdsToDelete); 126 }, 127 finallyCallback: () => { 128 matrixView.DataGridView.ClearSelection(); 129 removeButton.Enabled = false; 130 RefreshJobs(); 131 }); 132 } 133 } 134 } 135 162 progress.Start("Removing job(s)..."); 163 SetEnabledStateOfControls(); 164 var task = System.Threading.Tasks.Task.Factory.StartNew(RemoveJobsAsync, jobs); 165 166 task.ContinueWith((t) => { 167 RefreshJobs(); 168 progress.Finish(); 169 SetEnabledStateOfControls(); 170 }, TaskContinuationOptions.NotOnFaulted); 171 172 task.ContinueWith((t) => { 173 RefreshJobs(); 174 progress.Finish(); 175 SetEnabledStateOfControls(); 176 MessageBox.Show("An error occured removing the job(s).", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 177 }, TaskContinuationOptions.OnlyOnFaulted); 178 } 179 } 180 } 181 182 private void startButton_Click(object sender, EventArgs e) { 183 var jobs = GetSelectedJobs(); 184 185 if (jobs.Any()) { 186 var result = MessageBox.Show("Do you really want to resume following job(s):\n\n" 187 + String.Join("\n", jobs.Select(x => x.Job.Name)), 188 "HeuristicLab Hive Administrator", 189 MessageBoxButtons.YesNo, 190 MessageBoxIcon.Question); 191 192 if (result == DialogResult.Yes) { 193 progress.Start("Resuming job(s)..."); 194 SetEnabledStateOfControls(); 195 var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeJobsAsync, jobs); 196 197 task.ContinueWith((t) => { 198 RefreshJobs(); 199 progress.Finish(); 200 SetEnabledStateOfControls(); 201 }, TaskContinuationOptions.NotOnFaulted); 202 203 task.ContinueWith((t) => { 204 RefreshJobs(); 205 progress.Finish(); 206 SetEnabledStateOfControls(); 207 MessageBox.Show("An error occured resuming the job(s).", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 208 }, TaskContinuationOptions.OnlyOnFaulted); 209 } 210 } 211 } 212 213 private void pauseButton_Click(object sender, EventArgs e) { 214 var jobs = GetSelectedJobs(); 215 216 if (jobs.Any()) { 217 var result = MessageBox.Show("Do you really want to pause following job(s):\n\n" 218 + String.Join("\n", jobs.Select(x => x.Job.Name)), 219 "HeuristicLab Hive Administrator", 220 MessageBoxButtons.YesNo, 221 MessageBoxIcon.Question); 222 223 if (result == DialogResult.Yes) { 224 progress.Start("Pausing job(s)..."); 225 SetEnabledStateOfControls(); 226 var task = System.Threading.Tasks.Task.Factory.StartNew(PauseJobsAsync, jobs); 227 228 task.ContinueWith((t) => { 229 RefreshJobs(); 230 progress.Finish(); 231 SetEnabledStateOfControls(); 232 }, TaskContinuationOptions.NotOnFaulted); 233 234 task.ContinueWith((t) => { 235 RefreshJobs(); 236 progress.Finish(); 237 SetEnabledStateOfControls(); 238 MessageBox.Show("An error occured pausing the job(s).", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 239 }, TaskContinuationOptions.OnlyOnFaulted); 240 } 241 } 242 } 243 244 private void stopButton_Click(object sender, EventArgs e) { 245 var jobs = GetSelectedJobs(); 246 247 if (jobs.Any()) { 248 var result = MessageBox.Show("Do you really want to stop following job(s):\n\n" 249 + String.Join("\n", jobs.Select(x => x.Job.Name)), 250 "HeuristicLab Hive Administrator", 251 MessageBoxButtons.YesNo, 252 MessageBoxIcon.Question); 253 254 if (result == DialogResult.Yes) { 255 progress.Start("Stopping job(s)..."); 256 SetEnabledStateOfControls(); 257 var task = System.Threading.Tasks.Task.Factory.StartNew(StopJobsAsync, jobs); 258 259 task.ContinueWith((t) => { 260 RefreshJobs(); 261 progress.Finish(); 262 SetEnabledStateOfControls(); 263 }, TaskContinuationOptions.NotOnFaulted); 264 265 task.ContinueWith((t) => { 266 RefreshJobs(); 267 progress.Finish(); 268 SetEnabledStateOfControls(); 269 MessageBox.Show("An error occured stopping the job(s).", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 270 }, TaskContinuationOptions.OnlyOnFaulted); 271 } 272 } 273 } 274 275 public event EventHandler IsProgressingChanged; 276 private void OnIsProgressingChanged() { 277 var handler = IsProgressingChanged; 278 if (handler != null) handler(this, EventArgs.Empty); 279 } 136 280 #endregion Event Handlers 137 281 138 282 #region Helpers 283 284 private IEnumerable<RefreshableJob> GetSelectedJobs() { 285 if (Content == null || matrixView.DataGridView.SelectedRows == null || matrixView.DataGridView.SelectedRows.Count == 0) 286 return Enumerable.Empty<RefreshableJob>() ; 287 288 var jobs = new List<RefreshableJob>(); 289 foreach (DataGridViewRow r in matrixView.DataGridView.SelectedRows) { 290 if (((string)r.Cells[0].Value) == JobState.Online.ToString()) { 291 jobs.Add(HiveAdminClient.Instance.Jobs[Content.Id].FirstOrDefault(x => x.Id == Guid.Parse((string) r.Cells[11].Value))); 292 } 293 } 294 295 return jobs; 296 } 297 139 298 private void RefreshJobs() { 140 299 HiveAdminClient.Instance.RefreshJobs(); 141 300 UpdateJobs(); 301 SetEnabledStateOfControls(); 142 302 } 143 303 … … 148 308 var jobs = HiveAdminClient.Instance.Jobs[Content.Id]; 149 309 var resources = HiveAdminClient.Instance.Resources; 150 string[,] values = new string[jobs.Count, 1 0];310 string[,] values = new string[jobs.Count, 13]; 151 311 152 312 for(int i = 0; i < jobs.Count; i++) { 153 var job = jobs.ElementAt(i); 154 155 values[i, 0] = job.State.ToString(); 156 values[i, 1] = job.DateCreated.ToString(); 157 values[i, 2] = job.OwnerUsername; 158 values[i, 3] = job.Name; 159 values[i, 4] = job.JobCount.ToString(); 160 values[i, 5] = job.CalculatingCount.ToString(); 161 values[i, 6] = job.FinishedCount.ToString(); 162 values[i, 7] = job.Description; 163 values[i, 8] = job.Id.ToString(); 164 values[i, 9] = job.OwnerUserId.ToString(); 313 var job = jobs.ElementAt(i); 314 values[i, 0] = job.Job.State.ToString(); 315 values[i, 1] = job.ExecutionState.ToString(); 316 values[i, 2] = job.ExecutionTime.ToString(); 317 values[i, 3] = job.Job.DateCreated.ToString(); 318 values[i, 4] = job.Job.OwnerUsername; 319 values[i, 5] = job.Job.Name; 320 values[i, 6] = job.Job.JobCount.ToString(); 321 values[i, 7] = (job.Job.JobCount - job.Job.CalculatingCount - job.Job.FinishedCount).ToString(); 322 values[i, 8] = job.Job.CalculatingCount.ToString(); 323 values[i, 9] = job.Job.FinishedCount.ToString(); 324 values[i, 10] = job.Job.Description; 325 values[i, 11] = job.Job.Id.ToString(); 326 values[i, 12] = job.Job.OwnerUserId.ToString(); 165 327 } 166 328 167 329 var matrix = new StringMatrix(values); 168 matrix.ColumnNames = new string[] { JOB_STATE, JOB_ DATECREATED, JOB_OWNER, JOB_NAME, JOB_TASKCOUNT, JOB_CALCULATINGTASKCOUNT, JOB_FINISHEDTASKCOUNT, JOB_DESCRIPTION, JOB_ID, JOB_OWNERID };330 matrix.ColumnNames = new string[] { JOB_STATE, JOB_EXECUTIONSTATE, JOB_EXECUTIONTIME, JOB_DATECREATED, JOB_OWNER, JOB_NAME, JOB_TASKCOUNT, JOB_WAITINGTASKCOUNT, JOB_CALCULATINGTASKCOUNT, JOB_FINISHEDTASKCOUNT, JOB_DESCRIPTION, JOB_ID, JOB_OWNERID }; 169 331 matrix.SortableView = true; 170 332 return matrix; … … 193 355 matrixView.DataGridView.Columns[1].MinimumWidth = 108; 194 356 } 195 } else { 196 refreshButton.Enabled = false; 197 removeButton.Enabled = false; 198 matrixView.Content = null; 199 } 200 } 201 } 202 203 private void DeleteJobs(List<Guid> jobIds) { 204 try { 205 HiveAdminClient.DeleteJobs(jobIds); 206 } catch (AnonymousUserException) { 207 ShowHiveInformationDialog(); 208 } 357 } 358 } 359 } 360 361 private void RefreshJobsAsync() { 362 HiveAdminClient.Instance.RefreshJobs(); 363 UpdateJobs(); 364 } 365 366 private void ResumeJobsAsync(object jobs) { 367 var jobList = (IEnumerable<RefreshableJob>)jobs; 368 foreach (var job in jobList) { 369 progress.Status = "Resuming job \"" + job.Job.Name + "\"..."; 370 HiveAdminClient.ResumeJob(job); 371 } 372 } 373 374 private void PauseJobsAsync(object jobs) { 375 var jobList = (IEnumerable<RefreshableJob>)jobs; 376 foreach (var job in jobList) { 377 progress.Status = "Pausing job \"" + job.Job.Name + "\"..."; 378 HiveAdminClient.PauseJob(job); 379 } 380 } 381 382 private void StopJobsAsync(object jobs) { 383 var jobList = (IEnumerable<RefreshableJob>) jobs; 384 foreach (var job in jobList) { 385 progress.Status = "Stopping job \"" + job.Job.Name + "\"..."; 386 HiveAdminClient.StopJob(job); 387 } 388 } 389 390 private void RemoveJobsAsync(object jobs) { 391 var jobList = (IEnumerable<RefreshableJob>)jobs; 392 progress.Start(); 393 foreach (var job in jobList) { 394 progress.Status = "Removing job \"" + job.Job.Name + "\"..."; 395 HiveAdminClient.RemoveJob(job); 396 } 397 progress.Finish(); 209 398 } 210 399
Note: See TracChangeset
for help on using the changeset viewer.