- Timestamp:
- 07/04/19 14:45:47 (5 years ago)
- Location:
- stable
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Clients.Hive.Administrator
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Clients.Hive.Administrator merged: 16356,16389,16430
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectJobsView.cs
r17059 r17062 75 75 progress = new Progress(); 76 76 77 removeButton.Enabled = false; 77 removeButton.Enabled = false; 78 78 } 79 79 … … 81 81 base.RegisterContentEvents(); 82 82 matrixView.DataGridView.SelectionChanged += DataGridView_SelectionChanged; 83 MainForm Manager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, progress);83 MainForm.Progress.Show(this, progress); 84 84 } 85 85 86 86 protected override void DeregisterContentEvents() { 87 87 matrixView.DataGridView.SelectionChanged -= DataGridView_SelectionChanged; 88 MainForm Manager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this, false);88 MainForm.Progress.Hide(this, false); 89 89 base.DeregisterContentEvents(); 90 90 } … … 114 114 var jobs = GetSelectedJobs().ToList(); 115 115 if (jobs.Any()) { 116 116 117 117 startButton.Enabled = jobs.All(x => 118 118 !x.IsProgressing && HiveAdminClient.Instance.Tasks.ContainsKey(x.Id) && HiveAdminClient.Instance.Tasks[x.Id].Count > 0 … … 135 135 #region Event Handlers 136 136 private void ProjectJobsView_Load(object sender, EventArgs e) { 137 137 138 138 } 139 139 140 140 private void refreshButton_Click(object sender, EventArgs e) { 141 progress.Start("Refreshing jobs..." );141 progress.Start("Refreshing jobs...", ProgressMode.Indeterminate); 142 142 SetEnabledStateOfControls(); 143 143 var task = System.Threading.Tasks.Task.Factory.StartNew(RefreshJobsAsync); 144 144 145 145 task.ContinueWith((t) => { 146 progress.Finish(); 146 progress.Finish(); 147 147 SetEnabledStateOfControls(); 148 148 }); … … 160 160 161 161 if (result == DialogResult.Yes) { 162 progress.Start("Removing job(s)..." );162 progress.Start("Removing job(s)...", ProgressMode.Indeterminate); 163 163 SetEnabledStateOfControls(); 164 164 var task = System.Threading.Tasks.Task.Factory.StartNew(RemoveJobsAsync, jobs); … … 191 191 192 192 if (result == DialogResult.Yes) { 193 progress.Start("Resuming job(s)..." );193 progress.Start("Resuming job(s)...", ProgressMode.Indeterminate); 194 194 SetEnabledStateOfControls(); 195 195 var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeJobsAsync, jobs); 196 196 197 197 task.ContinueWith((t) => { 198 RefreshJobs(); 198 RefreshJobs(); 199 199 progress.Finish(); 200 200 SetEnabledStateOfControls(); … … 227 227 228 228 task.ContinueWith((t) => { 229 RefreshJobs(); 229 RefreshJobs(); 230 230 progress.Finish(); 231 231 SetEnabledStateOfControls(); … … 253 253 254 254 if (result == DialogResult.Yes) { 255 progress.Start("Stopping job(s)..." );255 progress.Start("Stopping job(s)...", ProgressMode.Indeterminate); 256 256 SetEnabledStateOfControls(); 257 257 var task = System.Threading.Tasks.Task.Factory.StartNew(StopJobsAsync, jobs); … … 267 267 progress.Finish(); 268 268 SetEnabledStateOfControls(); 269 MessageBox.Show("An error occured stopping the job(s).", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 269 MessageBox.Show("An error occured stopping the job(s).", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 270 270 }, TaskContinuationOptions.OnlyOnFaulted); 271 271 } … … 284 284 private IEnumerable<RefreshableJob> GetSelectedJobs() { 285 285 if (Content == null || matrixView.DataGridView.SelectedRows == null || matrixView.DataGridView.SelectedRows.Count == 0) 286 return Enumerable.Empty<RefreshableJob>() 286 return Enumerable.Empty<RefreshableJob>(); 287 287 288 288 var jobs = new List<RefreshableJob>(); 289 289 foreach (DataGridViewRow r in matrixView.DataGridView.SelectedRows) { 290 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) 291 jobs.Add(HiveAdminClient.Instance.Jobs[Content.Id].FirstOrDefault(x => x.Id == Guid.Parse((string)r.Cells[11].Value))); 292 292 } 293 293 } … … 310 310 string[,] values = new string[jobs.Count, 13]; 311 311 312 for (int i = 0; i < jobs.Count; i++) {313 var job = jobs.ElementAt(i); 312 for (int i = 0; i < jobs.Count; i++) { 313 var job = jobs.ElementAt(i); 314 314 values[i, 0] = job.Job.State.ToString(); 315 315 values[i, 1] = job.ExecutionState.ToString(); … … 322 322 values[i, 8] = job.Job.CalculatingCount.ToString(); 323 323 values[i, 9] = job.Job.FinishedCount.ToString(); 324 values[i, 10] = job.Job.Description; 324 values[i, 10] = job.Job.Description; 325 325 values[i, 11] = job.Job.Id.ToString(); 326 326 values[i, 12] = job.Job.OwnerUserId.ToString(); 327 327 } 328 328 329 329 var matrix = new StringMatrix(values); 330 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 }; … … 332 332 return matrix; 333 333 } 334 334 335 335 private void UpdateJobs() { 336 336 if (InvokeRequired) Invoke((Action)UpdateJobs); 337 337 else { 338 if (Content != null && Content.Id != null && Content.Id != Guid.Empty) {338 if (Content != null && Content.Id != null && Content.Id != Guid.Empty) { 339 339 var matrix = CreateValueMatrix(); 340 340 matrixView.Content = matrix; 341 if (matrix != null) {341 if (matrix != null) { 342 342 foreach (DataGridViewRow row in matrixView.DataGridView.Rows) { 343 343 string val = ((string)row.Cells[0].Value); … … 355 355 matrixView.DataGridView.Columns[1].MinimumWidth = 108; 356 356 } 357 } 357 } 358 358 } 359 359 } … … 367 367 var jobList = (IEnumerable<RefreshableJob>)jobs; 368 368 foreach (var job in jobList) { 369 progress. Status= "Resuming job \"" + job.Job.Name + "\"...";369 progress.Message = "Resuming job \"" + job.Job.Name + "\"..."; 370 370 HiveAdminClient.ResumeJob(job); 371 371 } … … 375 375 var jobList = (IEnumerable<RefreshableJob>)jobs; 376 376 foreach (var job in jobList) { 377 progress. Status= "Pausing job \"" + job.Job.Name + "\"...";377 progress.Message = "Pausing job \"" + job.Job.Name + "\"..."; 378 378 HiveAdminClient.PauseJob(job); 379 379 } … … 381 381 382 382 private void StopJobsAsync(object jobs) { 383 var jobList = (IEnumerable<RefreshableJob>) 384 foreach (var job in jobList) { 385 progress. Status= "Stopping job \"" + job.Job.Name + "\"...";383 var jobList = (IEnumerable<RefreshableJob>)jobs; 384 foreach (var job in jobList) { 385 progress.Message = "Stopping job \"" + job.Job.Name + "\"..."; 386 386 HiveAdminClient.StopJob(job); 387 387 } … … 390 390 private void RemoveJobsAsync(object jobs) { 391 391 var jobList = (IEnumerable<RefreshableJob>)jobs; 392 progress.Start( );392 progress.Start("", ProgressMode.Indeterminate); 393 393 foreach (var job in jobList) { 394 progress. Status= "Removing job \"" + job.Job.Name + "\"...";394 progress.Message = "Removing job \"" + job.Job.Name + "\"..."; 395 395 HiveAdminClient.RemoveJob(job); 396 396 } -
stable/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.cs
r17060 r17062 126 126 bool enabled = Content != null && !Locked && !ReadOnly; 127 127 nameTextBox.Enabled = enabled; 128 descriptionTextBox.Enabled = enabled; 128 descriptionTextBox.Enabled = enabled; 129 129 ownerComboBox.Enabled = enabled; 130 130 createdTextBox.Enabled = enabled; … … 160 160 if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshing, sender, e); 161 161 else { 162 var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>(); 163 mainForm.AddOperationProgressToView(this, "Refreshing ..."); 162 Progress.Show(this, "Refreshing ...", ProgressMode.Indeterminate); 164 163 SetEnabledStateOfControls(); 165 164 } … … 169 168 if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshed, sender, e); 170 169 else { 171 var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>(); 172 mainForm.RemoveOperationProgressFromView(this); 170 Progress.Hide(this); 173 171 SetEnabledStateOfControls(); 174 172 } -
stable/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs
r17059 r17062 43 43 private const string NOT_STORED_TAG = "*"; // " [not stored]"; 44 44 private const string CHANGES_NOT_STORED_TAG = "*"; // " [changes not stored]"; 45 private const string INACTIVE_TAG = " [inactive]"; 45 private const string INACTIVE_TAG = " [inactive]"; 46 46 47 47 private readonly Color selectedBackColor = Color.DodgerBlue; … … 111 111 112 112 protected override void SetEnabledStateOfControls() { 113 base.SetEnabledStateOfControls(); 114 115 bool locked = Content == null || Locked || ReadOnly; 113 base.SetEnabledStateOfControls(); 114 115 bool locked = Content == null || Locked || ReadOnly; 116 116 bool parentOwner = selectedProject != null && HiveAdminClient.Instance.CheckOwnershipOfParentProject(selectedProject, UserInformation.Instance.User.Id); 117 bool selectedProjectDisabled = selectedProject == null 117 bool selectedProjectDisabled = selectedProject == null 118 118 || selectedProject != null && selectedProject.Id == Guid.Empty; 119 119 … … 183 183 if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshing, sender, e); 184 184 else { 185 var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>(); 186 mainForm.AddOperationProgressToView(this, "Refreshing ..."); 185 Progress.Show(this, "Refreshing ...", ProgressMode.Indeterminate); 187 186 SetEnabledStateOfControls(); 188 187 } … … 192 191 if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshed, sender, e); 193 192 else { 194 var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>(); 195 mainForm.RemoveOperationProgressFromView(this); 193 Progress.Hide(this); 196 194 SetEnabledStateOfControls(); 197 195 } … … 201 199 if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshing, sender, e); 202 200 else { 203 var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>(); 204 mainForm.AddOperationProgressToView(this, "Refreshing ..."); 201 Progress.Show(this, "Refreshing ...", ProgressMode.Indeterminate); 205 202 SetEnabledStateOfControls(); 206 203 } … … 210 207 if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshed, sender, e); 211 208 else { 212 var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>(); 213 mainForm.RemoveOperationProgressFromView(this); 209 Progress.Hide(this); 214 210 SetEnabledStateOfControls(); 215 211 } … … 234 230 } 235 231 236 private void addButton_Click(object sender, EventArgs e) { 232 private void addButton_Click(object sender, EventArgs e) { 237 233 238 234 if (selectedProject == null && !IsAdmin()) { … … 244 240 return; 245 241 } 246 242 247 243 if (selectedProject != null && selectedProject.Id == Guid.Empty) { 248 244 MessageBox.Show( … … 256 252 var project = new Project { 257 253 Name = "New Project", 258 OwnerUserId = UserInformation.Instance.User.Id, 254 OwnerUserId = UserInformation.Instance.User.Id, 259 255 }; 260 if (selectedProject != null) {256 if (selectedProject != null) { 261 257 project.ParentProjectId = selectedProject.Id; 262 258 project.EndDate = selectedProject.EndDate; … … 285 281 await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions( 286 282 action: () => { 287 RemoveProject(selectedProject); 283 RemoveProject(selectedProject); 288 284 }); 289 285 } … … 304 300 foreach (var project in projectsToSave) 305 301 project.Store(); 306 302 307 303 UpdateProjects(); 308 304 }, … … 316 312 if (node == null) return; 317 313 var p = (Project)node.Tag; 318 if (!HiveAdminClient.Instance.DisabledParentProjects.Contains(p)) ChangeSelectedProjectNode(node);314 if (!HiveAdminClient.Instance.DisabledParentProjects.Contains(p)) ChangeSelectedProjectNode(node); 319 315 } 320 316 … … 357 353 if (targetNode == null) { 358 354 treeView.Nodes.Add(sourceNode); 359 } else if (targetProject.Id != Guid.Empty) {355 } else if (targetProject.Id != Guid.Empty) { 360 356 targetNode.Nodes.Add(sourceNode); 361 357 sourceProject.ParentProjectId = targetProject.Id; … … 422 418 var newNode = new TreeNode(newProject.Name) { Tag = newProject }; 423 419 StyleTreeNode(newNode, newProject); 424 420 425 421 if (selectedProject == null && !disabledParentProjects.Contains(newProject)) { 426 422 SelectedProject = newProject; … … 533 529 if (project.Id != Guid.Empty) { 534 530 SelectedProject = HiveAdminClient.Instance.GetAvailableProjectAncestors(project.Id).LastOrDefault(); 535 HiveAdminClient.Delete(project); 531 HiveAdminClient.Delete(project); 536 532 UpdateProjects(); 537 } else { 533 } else { 538 534 SelectedProject = Content.FirstOrDefault(x => x.Id == project.ParentProjectId); 539 535 Content.Remove(project); -
stable/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs
r17059 r17062 185 185 if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshing, sender, e); 186 186 else { 187 var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>(); 188 mainForm.AddOperationProgressToView(this, "Refreshing ..."); 187 Progress.Show(this, "Refreshing ...", ProgressMode.Indeterminate); 189 188 SetEnabledStateOfControls(); 190 189 } … … 194 193 if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshed, sender, e); 195 194 else { 196 var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>(); 197 mainForm.RemoveOperationProgressFromView(this); 195 Progress.Hide(this); 198 196 SetEnabledStateOfControls(); 199 197 } … … 203 201 if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshing, sender, e); 204 202 else { 205 var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>(); 206 mainForm.AddOperationProgressToView(this, "Refreshing ..."); 203 Progress.Show(this, "Refreshing ...", ProgressMode.Indeterminate); 207 204 SetEnabledStateOfControls(); 208 205 } … … 212 209 if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshed, sender, e); 213 210 else { 214 var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>(); 215 mainForm.RemoveOperationProgressFromView(this); 211 Progress.Hide(this); 216 212 SetEnabledStateOfControls(); 217 213 } … … 247 243 } 248 244 249 private async void btnRemoveGroup_Click(object sender, EventArgs e) { 245 private async void btnRemoveGroup_Click(object sender, EventArgs e) { 250 246 var nodes = GetCheckedNodes(treeView.Nodes).ToList(); 251 247 var checkedResources = nodes.Select(x => x.Tag).OfType<Resource>().ToList(); … … 574 570 foreach (var nr in newResources) Content.Remove(nr); 575 571 576 HiveAdminClient.Delete(resource); 572 HiveAdminClient.Delete(resource); 577 573 UpdateResources(); 578 574 } else { … … 588 584 if (resources == null || !resources.Any()) return; 589 585 590 var ids = resources.Select(x => x.Id).ToList(); 586 var ids = resources.Select(x => x.Id).ToList(); 591 587 try { 592 588 bool update = false; 593 foreach (var r in resources) { 594 if (r.Id != Guid.Empty) 595 if (r.Id == SelectedResource.Id)589 foreach (var r in resources) { 590 if (r.Id != Guid.Empty) { 591 if (r.Id == SelectedResource.Id) 596 592 SelectedResource = HiveAdminClient.Instance.GetAvailableResourceAncestors(r.Id).LastOrDefault(); 597 593 … … 751 747 752 748 foreach (var r in resources) { 753 if (!resourceDescendants.ContainsKey(r.Id))749 if (!resourceDescendants.ContainsKey(r.Id)) 754 750 resourceDescendants.Add(r.Id, new HashSet<Resource>()); 755 751 }
Note: See TracChangeset
for help on using the changeset viewer.