- Timestamp:
- 10/18/18 14:07:32 (6 years ago)
- Location:
- branches/2931_OR-Tools_LP_MIP
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2931_OR-Tools_LP_MIP
- Property svn:mergeinfo changed
/branches/2916_IndexedDataTableSerialization (added) merged: 15918 /trunk merged: 16168-16169,16177,16179,16184-16187,16202-16209,16211,16213,16216,16218-16219,16221,16223-16224,16232
- Property svn:mergeinfo changed
-
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Clients.Hive.JobManager
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Clients.Hive.JobManager merged: 16187,16202,16205,16209,16219
- Property svn:mergeinfo changed
-
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.cs
r16139 r16235 26 26 using System.Windows.Forms; 27 27 using HeuristicLab.Collections; 28 using HeuristicLab.Common; 28 29 using HeuristicLab.Common.Resources; 29 30 using HeuristicLab.Core; … … 263 264 var node = resourcesTreeView.GetNodeAt(new Point(e.X, e.Y)); 264 265 265 if (node == null || node == additionalNode) {266 if (node == null && e.Button == MouseButtons.Left) { 266 267 resourcesTreeView.SelectedNode = null; 267 268 ExtractStatistics(); 268 } else {269 var r = (Resource)node.Tag;270 if (!HiveClient.Instance.DisabledParentResources.Contains(r)) {271 ExtractStatistics((Resource)node.Tag);272 } else {273 resourcesTreeView.SelectedNode = null;274 ExtractStatistics();275 }276 269 } 277 270 } 278 271 279 272 private void resourcesTreeView_BeforeSelect(object sender, TreeViewCancelEventArgs e) { 280 if(e.Node == null || e.Node == additionalNode) { 273 if(e.Node == null) { 274 e.Cancel = true; 275 resourcesTreeView.SelectedNode = null; 276 ExtractStatistics(); 277 } else if (e.Node == additionalNode) { 281 278 e.Cancel = true; 282 279 } else { 283 280 var r = (Resource)e.Node.Tag; 284 if(r == null || HiveClient.Instance.DisabledParentResources.Contains(r)) { 281 if(r != null && !HiveClient.Instance.DisabledParentResources.Contains(r)) { 282 ExtractStatistics(r); 283 } else { 285 284 e.Cancel = true; 286 285 } 287 286 } 288 289 287 } 290 288 … … 299 297 || newIncludedResources.Contains(checkedResource)) { 300 298 e.Cancel = true; 301 302 var selectedNode = resourcesTreeView.SelectedNode;303 var selectedResource = (Resource)(selectedNode != null ? selectedNode.Tag : null);304 305 ExtractStatistics(selectedResource);306 299 } 307 300 } … … 317 310 318 311 UpdateResourceTreeAfterCheck(); 319 ExtractStatistics(); 312 if(resourcesTreeView.SelectedNode == null) 313 ExtractStatistics(); 320 314 OnAssignedResourcesChanged(); 321 315 } … … 548 542 resourcesTreeView.AfterCheck -= resourcesTreeView_AfterCheck; 549 543 550 var disabledParentResources = HiveClient.Instance.DisabledParentResources; 544 //var disabledParentResources = HiveClient.Instance.DisabledParentResources; 545 var disabledParentResources = HiveClient.Instance.GetDisabledResourceAncestors(resources); 551 546 var mainResources = new HashSet<Resource>(resources.OfType<SlaveGroup>().Where(x => x.ParentResourceId == null)); 552 547 //var parentedMainResources = new HashSet<Resource>(resources.OfType<SlaveGroup>() … … 643 638 additionalNode = new TreeNode(additionalSlavesGroupName) { 644 639 ForeColor = SystemColors.GrayText, 640 ImageIndex = slaveGroupImageIndex, 645 641 Tag = new SlaveGroup() { 646 642 Name = additionalSlavesGroupName, … … 651 647 foreach (var slave in singleSlaves.OrderBy(x => x.Name)) { 652 648 var slaveNode = new TreeNode(slave.Name) { Tag = slave }; 649 650 if (newAssignedResources.Select(x => x.Id).Contains(slave.Id)) { 651 slaveNode.Checked = true; 652 if (!addedAssignments.Select(x => x.Id).Contains(slave.Id) && 653 !removedAssignments.Select(x => x.Id).Contains(slave.Id)) { 654 slaveNode.Text += SELECTED_TAG; 655 } 656 } 657 658 if (addedAssignments.Select(x => x.Id).Contains(slave.Id)) { 659 slaveNode.BackColor = addedAssignmentColor; 660 slaveNode.ForeColor = controlTextColor; 661 slaveNode.Text += ADDED_SELECTION_TAG; 662 } else if (removedAssignments.Select(x => x.Id).Contains(slave.Id)) { 663 slaveNode.BackColor = removedAssignmentColor; 664 slaveNode.ForeColor = controlTextColor; 665 slaveNode.Text += REMOVED_SELECTION_TAG; 666 } 667 653 668 additionalNode.Nodes.Add(slaveNode); 654 669 } … … 667 682 Resource r = (Resource)n.Tag; 668 683 if(n.Nodes.Count > 0) { 669 if(HiveClient.Instance.GetAvailableResourceDescendants(r.Id).OfType<SlaveGroup>().Any() 670 || HiveClient.Instance.GetAvailableResourceDescendants(r.Id).OfType<Slave>().Intersect(assignedResources.Union(newAssignedResources)).Any()) { 684 if(HiveClient.Instance.GetAvailableResourceDescendants(r.Id).OfType<SlaveGroup>().Any() 685 || HiveClient.Instance.GetAvailableResourceDescendants(r.Id).OfType<Slave>().Intersect(assignedResources.Union(newAssignedResources)).Any() 686 || (n == additionalNode && additionalNode.Nodes.Count > 0 && additionalNode.Nodes.Cast<TreeNode>().Any(x => x.Checked))) { 671 687 n.Expand(); 672 688 ExpandResourceNodesOfInterest(n.Nodes); -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobListView.cs
r16139 r16235 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq; 24 25 using System.Threading.Tasks; 25 26 using System.Windows.Forms; … … 46 47 this.itemsListView.FullRowSelect = true; 47 48 48 this.itemsListView.ListViewItemSorter = new ListViewItemComparer(new int[] { 2, 0 }, new SortOrder[] { SortOrder.Ascending, SortOrder.Ascending }); 49 this.itemsListView.ListViewItemSorter = new ListViewItemComparer(new int[] { 2, 0 }, new SortOrder[] { SortOrder.Ascending, SortOrder.Ascending }); 49 50 50 51 foreach (ColumnHeader c in this.itemsListView.Columns) { … … 63 64 itemsListView.Sorting = sortOrder; 64 65 itemsListView.Sort(); 65 //AdjustListViewColumnSizes();66 AdjustListViewColumnSizes(); 66 67 } 67 68 -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
r16139 r16235 139 139 } 140 140 141 // project look up 141 142 if (Content.Job != null && Content.Job.ProjectId == Guid.Empty) { 143 projectNameTextBox.Text = string.Empty; 142 144 if (HiveClient.Instance != null && HiveClient.Instance.Projects != null && HiveClient.Instance.Projects.Count == 1) { 143 145 var p = HiveClient.Instance.Projects.FirstOrDefault(); … … 145 147 hiveResourceSelectorDialog = new HiveResourceSelectorDialog(Content.Job.Id, Content.Job.ProjectId); 146 148 Content.Job.ProjectId = p.Id; 147 Content.Job.ResourceIds = HiveClient.Instance.GetAvailableResourcesForProject(p.Id).Select(x => x.Id).ToList(); 149 var resources = HiveClient.Instance.GetAvailableResourcesForProject(p.Id).ToList(); 150 Content.Job.ResourceIds = resources.Select(x => x.Id).ToList(); 148 151 hiveResourceSelectorDialog.SelectedProjectId = Content.Job.ProjectId; 149 152 hiveResourceSelectorDialog.SelectedResourceIds = Content.Job.ResourceIds; 153 154 var cores = resources.Union(resources.SelectMany(x => HiveClient.Instance.GetAvailableResourceDescendants(x.Id))) 155 .OfType<Slave>() 156 .Distinct() 157 .Sum(x => x.Cores); 158 159 projectNameTextBox.Text = HiveClient.Instance.GetProjectAncestry(Content.Job.ProjectId); 160 projectNameTextBox.Text += " (" + (cores.HasValue ? cores.Value.ToString() : "0") + " cores)"; 150 161 } 151 162 } 152 } 153 154 155 nameTextBox.Text = Content.Job.Name; 156 descriptionTextBox.Text = Content.Job.Description; 157 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 158 refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically; 159 160 // project look up 161 if(Content.Job.ProjectId != null && Content.Job.ProjectId != Guid.Empty) { 162 if(selectedProject == null || selectedProject.Id != Content.Job.ProjectId) { 163 } else if (Content.Job != null && Content.Job.ProjectId != Guid.Empty) { 164 if (selectedProject == null || selectedProject.Id != Content.Job.ProjectId) { 163 165 selectedProject = GetProject(Content.Job.ProjectId); 164 if (selectedProject != null) { 165 projectNameTextBox.Text = selectedProject.Name; 166 } else { 167 projectNameTextBox.Text = string.Empty; 168 } 166 hiveResourceSelectorDialog = null; 169 167 } 168 169 if(hiveResourceSelectorDialog == null) 170 hiveResourceSelectorDialog = new HiveResourceSelectorDialog(Content.Job.Id, Content.Job.ProjectId); 171 172 if (selectedProject != null) { 173 projectNameTextBox.Text = HiveClient.Instance.GetProjectAncestry(selectedProject.Id); 174 } else { 175 projectNameTextBox.Text = string.Empty; 176 } 177 178 List<Resource> resources = null; 179 if (Content.Job.ResourceIds == null) 180 resources = HiveClient.Instance.GetAssignedResourcesForJob(Content.Job.Id).ToList(); 181 else 182 resources = HiveClient.Instance.Resources.Where(x => Content.Job.ResourceIds.Contains(x.Id)).ToList(); 183 184 Content.Job.ResourceIds = resources.Select(x => x.Id).ToList(); 185 hiveResourceSelectorDialog.SelectedResourceIds = Content.Job.ResourceIds; 186 187 var cores = resources.Union(resources.SelectMany(x => HiveClient.Instance.GetAvailableResourceDescendants(x.Id))) 188 .OfType<Slave>() 189 .Distinct() 190 .Sum(x => x.Cores); 191 192 projectNameTextBox.Text += " (" + (cores.HasValue ? cores.Value.ToString() : "0") + " cores)"; 193 170 194 } else { 171 195 selectedProject = null; … … 173 197 Content.Job.ResourceIds = null; 174 198 } 199 200 201 nameTextBox.Text = Content.Job.Name; 202 descriptionTextBox.Text = Content.Job.Description; 203 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 204 refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically; 175 205 176 206 logView.Content = Content.Log; … … 182 212 SuppressEvents = false; 183 213 } 184 hiveExperimentPermissionListView.Content = null; // has to be filled by refresh button214 hiveExperimentPermissionListView.Content = null; // has to be filled by refresh 185 215 Content_JobStatisticsChanged(this, EventArgs.Empty); 186 216 Content_HiveExperimentChanged(this, EventArgs.Empty); … … 400 430 if (hiveResourceSelectorDialog.ShowDialog(this) == DialogResult.OK) { 401 431 selectedProject = hiveResourceSelectorDialog.SelectedProject; 402 if(selectedProject != null) { 403 projectNameTextBox.Text = selectedProject.Name; 432 if(selectedProject != null) { 404 433 Content.Job.ProjectId = selectedProject.Id; 405 434 Content.Job.ResourceIds = hiveResourceSelectorDialog.SelectedResources.Select(x => x.Id).ToList(); 435 436 var cores = hiveResourceSelectorDialog.SelectedResources 437 .Union(hiveResourceSelectorDialog.SelectedResources 438 .SelectMany(x => HiveClient.Instance.GetAvailableResourceDescendants(x.Id))) 439 .OfType<Slave>() 440 .Distinct() 441 .Sum(x => x.Cores); 442 443 projectNameTextBox.Text = HiveClient.Instance.GetProjectAncestry(selectedProject.Id) + ""; 444 projectNameTextBox.Text += " (" + (cores.HasValue ? cores.Value.ToString() : "0") + " cores)"; 445 406 446 } else { 407 447 selectedProject = null; … … 501 541 } 502 542 503 private void updateButton_Click2(object sender, EventArgs e) {504 if (Content.ExecutionState == ExecutionState.Stopped) {505 MessageBox.Show("Job cannot be updated once it stopped.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);506 return;507 }508 509 HiveClient.UpdateJob(510 (Exception ex) => ErrorHandling.ShowErrorDialog(this, "Update failed.", ex),511 Content,512 new CancellationToken());513 UpdateSelectorDialog();514 }515 516 543 private void updateButton_Click(object sender, EventArgs e) { 517 544 if (Content.ExecutionState == ExecutionState.Stopped) { … … 556 583 } else { 557 584 startButton.Enabled = Content.IsControllable && Content.HiveTasks != null && Content.HiveTasks.Count > 0 558 && Content.Job.ProjectId != null && Content.Job.ProjectId !=Guid.Empty && Content.Job.ResourceIds != null && Content.Job.ResourceIds.Any()585 && Content.Job.ProjectId != Guid.Empty && Content.Job.ResourceIds != null && Content.Job.ResourceIds.Any() 559 586 && (Content.ExecutionState == ExecutionState.Prepared || Content.ExecutionState == ExecutionState.Paused) && !Content.IsProgressing; 560 587 pauseButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started && !Content.IsProgressing;
Note: See TracChangeset
for help on using the changeset viewer.