Changeset 16072
- Timestamp:
- 08/10/18 11:35:25 (6 years ago)
- Location:
- branches/2839_HiveProjectManagement
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectJobsView.cs
r15978 r16072 28 28 using HeuristicLab.MainForm.WindowsForms; 29 29 using HeuristicLab.Core.Views; 30 using HeuristicLab.Data.Views;31 30 using HeuristicLab.Data; 32 31 using HeuristicLab.Clients.Hive.Views; -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs
r16043 r16072 102 102 projectResourcesView.Content = null; 103 103 projectJobsView.Content = null; 104 selectedProject = null; 104 105 } else { 105 106 BuildProjectTree(Content); … … 109 110 protected override void SetEnabledStateOfControls() { 110 111 base.SetEnabledStateOfControls(); 111 bool enabled = Content != null && !Locked && !ReadOnly; 112 refreshButton.Enabled = enabled; 113 //addButton.Enabled = enabled; 114 //removeButton.Enabled = enabled; 115 //saveProjectButton.Enabled = enabled; 116 projectView.Enabled = enabled; 117 projectPermissionsView.Enabled = enabled; 118 projectResourcesView.Enabled = enabled; 119 projectJobsView.Enabled = enabled; 112 bool selectedProjectExists = selectedProject != null && selectedProject.Id != Guid.Empty && Content.Contains(selectedProject); 113 bool locked = Content == null || selectedProject == null || Locked || ReadOnly; 114 bool parentOwner = HiveAdminClient.Instance.CheckOwnershipOfParentProject(selectedProject, UserInformation.Instance.User.Id); 115 bool saveLocked = locked || (!IsAdmin() && selectedProject.OwnerUserId != UserInformation.Instance.User.Id && !parentOwner); 116 bool addLocked = saveLocked || selectedProject.Id == Guid.Empty; 117 bool deleteLocked = locked || (!IsAdmin() && !parentOwner) || Content.Where(x => x.ParentProjectId == selectedProject.Id).Any(); 118 119 addButton.Enabled = !addLocked; 120 removeButton.Enabled = !deleteLocked; 121 saveProjectButton.Enabled = !saveLocked; 122 projectView.Enabled = !locked; 123 projectPermissionsView.Enabled = !locked; 124 projectResourcesView.Enabled = !locked; 125 projectJobsView.Enabled = !locked; 120 126 } 121 127 #endregion … … 265 271 && HiveAdminClient.Instance.Jobs[selectedProject.Id].Any()) { 266 272 MessageBox.Show( 267 "There are " + HiveAdminClient.Instance.Jobs[selectedProject.Id].Count + " job susing this project and/or child-projects. It is necessary to delete them before the project.",273 "There are " + HiveAdminClient.Instance.Jobs[selectedProject.Id].Count + " job(s) using this project and/or child-projects. It is necessary to delete them before the project.", 268 274 "HeuristicLab Hive Administrator", 269 275 MessageBoxButtons.OK, … … 286 292 removeButton.Enabled = true; 287 293 }); 294 } else { 295 removeButton.Enabled = true; 288 296 } 289 297 } … … 297 305 await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions( 298 306 action: () => { 307 //if (selectedProject != null && selectedProject.Id == Guid.Empty) 308 // SelectedProject = HiveAdminClient.Instance.GetAvailableProjectAncestors(selectedProject.Id).LastOrDefault(); 299 309 var projectsToSave = Content.Where(x => x.Id == Guid.Empty || x.Modified); 300 310 foreach (var project in projectsToSave) 301 311 project.Store(); 312 302 313 UpdateProjects(); 303 314 }, … … 552 563 foreach (var p in projectsToSave) 553 564 p.Store(); 554 HiveAdminClient.Delete(project); 565 566 SelectedProject = HiveAdminClient.Instance.GetAvailableProjectAncestors(project.Id).LastOrDefault(); 567 HiveAdminClient.Delete(project); 555 568 UpdateProjects(); 556 569 } else { -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.Designer.cs
r16057 r16072 106 106 this.btnRefresh.Size = new System.Drawing.Size(24, 24); 107 107 this.btnRefresh.TabIndex = 8; 108 this.toolTip.SetToolTip(this.btnRefresh, "Fetch list from server ");108 this.toolTip.SetToolTip(this.btnRefresh, "Fetch list from server."); 109 109 this.btnRefresh.UseVisualStyleBackColor = true; 110 110 this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click); … … 117 117 this.btnSave.Size = new System.Drawing.Size(24, 24); 118 118 this.btnSave.TabIndex = 5; 119 this.toolTip.SetToolTip(this.btnSave, "Store slave and group configuration on the server ");119 this.toolTip.SetToolTip(this.btnSave, "Store slave and group configuration on the server."); 120 120 this.btnSave.UseVisualStyleBackColor = true; 121 121 this.btnSave.Click += new System.EventHandler(this.btnSave_Click); … … 128 128 this.btnRemoveGroup.Size = new System.Drawing.Size(24, 24); 129 129 this.btnRemoveGroup.TabIndex = 2; 130 this.toolTip.SetToolTip(this.btnRemoveGroup, "Remove a slave or a group ");130 this.toolTip.SetToolTip(this.btnRemoveGroup, "Remove a slave or a group."); 131 131 this.btnRemoveGroup.UseVisualStyleBackColor = true; 132 132 this.btnRemoveGroup.Click += new System.EventHandler(this.btnRemoveGroup_Click); … … 139 139 this.btnAddGroup.Size = new System.Drawing.Size(24, 24); 140 140 this.btnAddGroup.TabIndex = 1; 141 this.toolTip.SetToolTip(this.btnAddGroup, "Add a new group ");141 this.toolTip.SetToolTip(this.btnAddGroup, "Add a new group."); 142 142 this.btnAddGroup.UseVisualStyleBackColor = true; 143 143 this.btnAddGroup.Click += new System.EventHandler(this.btnAddGroup_Click); -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs
r16064 r16072 117 117 base.SetEnabledStateOfControls(); 118 118 119 bool locked = Content == null || Locked || ReadOnly || !IsAdmin(); 120 bool scheduleLocked = locked || (selectedResource != null && selectedResource.Id == Guid.Empty); 121 bool addLocked = locked || (selectedResource != null && selectedResource.Id == Guid.Empty) || selectedResource is Slave; 119 bool locked = Content == null || selectedResource == null || Locked || ReadOnly; 120 bool adminLocked = locked || !IsAdmin(); 121 bool addLocked = adminLocked || selectedResource.Id == Guid.Empty || selectedResource is Slave; 122 bool deleteLocked = adminLocked || HiveAdminClient.Instance.ResourceDescendants[selectedResource.Id].Any(); 122 123 123 124 btnAddGroup.Enabled = !addLocked; 124 btnRemoveGroup.Enabled = ! locked;125 btnRemoveGroup.Enabled = !deleteLocked; 125 126 btnSave.Enabled = !locked; 126 viewHost.Enabled = true; 127 //viewHost.Locked = locked; 128 viewHost.Locked = false; 129 viewHost.ReadOnly = false; 130 scheduleView.Locked = locked; 131 //scheduleView.SetEnabledStateOfSchedule(!scheduleLocked); 127 scheduleView.Locked = adminLocked; 132 128 } 133 129 #endregion … … 228 224 } 229 225 230 if (selectedResource != null && selectedResource is SlaveGroup) parentResourceId = selectedResource.Id; 226 if (selectedResource != null && selectedResource is SlaveGroup) { 227 parentResourceId = selectedResource.Id; 228 } else { 229 MessageBox.Show( 230 "You cannot add a resource group to a slave.", 231 "HeuristicLab Hive Administrator", 232 MessageBoxButtons.OK, 233 MessageBoxIcon.Information); 234 return; 235 } 236 231 237 var group = new SlaveGroup { 232 238 Name = "New Group", … … 250 256 if (!IsAdmin()) { 251 257 MessageBox.Show( 252 "You have no permission to delete resource s.",258 "You have no permission to delete resource groups.", 253 259 "HeuristicLab Hive Administrator", 254 260 MessageBoxButtons.OK, … … 259 265 if (Content.Any(x => x.ParentResourceId == selectedResource.Id)) { 260 266 MessageBox.Show( 261 "Only empty resource s can be deleted.",267 "Only empty resource groups can be deleted.", 262 268 "HeuristicLab Hive Administrator", 263 269 MessageBoxButtons.OK, … … 279 285 btnRemoveGroup.Enabled = true; 280 286 }); 287 } else { 288 btnRemoveGroup.Enabled = true; 281 289 } 282 290 } … … 559 567 foreach (var r in resourcesToSave) 560 568 r.Store(); 569 570 SelectedResource = HiveAdminClient.Instance.GetAvailableResourceAncestors(resource.Id).LastOrDefault(); 561 571 HiveAdminClient.Delete(resource); 562 572 UpdateResources(); -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive/3.3/HiveAdminClient.cs
r16057 r16072 163 163 var unsortedJobs = service.GetJobsByProjectIds(projectIds) 164 164 .OrderBy(x => x.DateCreated).ToList(); 165 165 166 166 unsortedJobs.Where(j => j.State == JobState.DeletionPending).ToList().ForEach(j => jobs[j.ProjectId].Add(j)); 167 167 unsortedJobs.Where(j => j.State == JobState.StatisticsPending).ToList().ForEach(j => jobs[j.ProjectId].Add(j));
Note: See TracChangeset
for help on using the changeset viewer.