Changeset 8086 for branches/ScatterSearch (trunk integration)/HeuristicLab.Clients.Hive.Administrator
- Timestamp:
- 06/22/12 11:11:38 (12 years ago)
- Location:
- branches/ScatterSearch (trunk integration)
- Files:
-
- 12 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/ScatterSearch (trunk integration)
- Property svn:ignore
-
old new 20 20 bin 21 21 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/ScatterSearch (trunk integration)/HeuristicLab.Clients.Hive.Administrator/3.3
- Property svn:ignore
-
old new 2 2 obj 3 3 *.vs10x 4 *.user
-
- Property svn:ignore
-
branches/ScatterSearch (trunk integration)/HeuristicLab.Clients.Hive.Administrator/3.3/HeuristicLab.Clients.Hive.Administrator-3.3.csproj
r7257 r8086 97 97 </ItemGroup> 98 98 <ItemGroup> 99 <Compile Include="HiveRoles.cs" /> 99 100 <Compile Include="Views\HiveAdministratorView.cs"> 100 101 <SubType>UserControl</SubType> … … 141 142 </ItemGroup> 142 143 <ItemGroup> 144 <ProjectReference Include="..\..\HeuristicLab.Clients.Access.Views\3.3\HeuristicLab.Clients.Access.Views-3.3.csproj"> 145 <Project>{FE856595-64CD-46DA-9CD2-FFF3E6B0D4F2}</Project> 146 <Name>HeuristicLab.Clients.Access.Views-3.3</Name> 147 </ProjectReference> 148 <ProjectReference Include="..\..\HeuristicLab.Clients.Access\3.3\HeuristicLab.Clients.Access-3.3.csproj"> 149 <Project>{494F87F4-0F25-4D33-A382-10CDB2174D48}</Project> 150 <Name>HeuristicLab.Clients.Access-3.3</Name> 151 </ProjectReference> 143 152 <ProjectReference Include="..\..\HeuristicLab.Clients.Common\3.3\HeuristicLab.Clients.Common-3.3.csproj"> 144 153 <Project>{730A9104-D4D1-4360-966B-E49B7571DDA3}</Project> -
branches/ScatterSearch (trunk integration)/HeuristicLab.Clients.Hive.Administrator/3.3/HiveRoles.cs
r8052 r8086 31 31 32 32 public static bool CheckAdminUserPermissions() { 33 UserInformation.Instance.Refresh();34 33 return UserInformation.Instance.UserExists && UserInformation.Instance.User.Roles.Any(x => x.Name == HiveRoles.Administrator); 35 34 } -
branches/ScatterSearch (trunk integration)/HeuristicLab.Clients.Hive.Administrator/3.3/Plugin.cs.frame
r7259 r8086 25 25 [Plugin("HeuristicLab.Clients.Hive.Administrator", "3.3.6.$WCREV$")] 26 26 [PluginFile("HeuristicLab.Clients.Hive.Administrator-3.3.dll", PluginFileType.Assembly)] 27 [PluginDependency("HeuristicLab.Clients.Access", "3.3")] 28 [PluginDependency("HeuristicLab.Clients.Access.Views", "3.3")] 27 29 [PluginDependency("HeuristicLab.Collections", "3.3")] 28 30 [PluginDependency("HeuristicLab.Common", "3.3")] … … 32 34 [PluginDependency("HeuristicLab.Clients.Hive", "3.3")] 33 35 [PluginDependency("HeuristicLab.Clients.Hive.Views", "3.3")] 36 [PluginDependency("HeuristicLab.DayView", "1.0.0.0")] 34 37 [PluginDependency("HeuristicLab.Optimizer", "3.3")] 35 38 [PluginDependency("HeuristicLab.MainForm", "3.3")] -
branches/ScatterSearch (trunk integration)/HeuristicLab.Clients.Hive.Administrator/3.3/Views/HiveAdministratorView.Designer.cs
r7259 r8086 81 81 // 82 82 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 83 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode. Font;83 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 84 84 this.Controls.Add(this.tabAdmin); 85 85 this.Name = "HiveAdministrationView"; -
branches/ScatterSearch (trunk integration)/HeuristicLab.Clients.Hive.Administrator/3.3/Views/Recurrence.Designer.cs
r7257 r8086 235 235 // 236 236 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 237 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode. Font;237 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 238 238 this.ClientSize = new System.Drawing.Size(393, 243); 239 239 this.Controls.Add(this.gbWeekly); -
branches/ScatterSearch (trunk integration)/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.Designer.cs
r7259 r8086 21 21 22 22 23 using System; 23 24 namespace HeuristicLab.Clients.Hive.Administrator.Views { 24 25 partial class ResourcesView { … … 36 37 components.Dispose(); 37 38 } 39 HiveAdminClient.Instance.Refreshing -= new EventHandler(Instance_Refreshing); 40 HiveAdminClient.Instance.Refreshed -= new EventHandler(Instance_Refreshed); 41 42 Access.AccessClient.Instance.Refreshing -= new EventHandler(AccessClient_Refreshing); 43 Access.AccessClient.Instance.Refreshed -= new EventHandler(AccessClient_Refreshed); 38 44 base.Dispose(disposing); 39 45 } … … 54 60 this.btnRemoveGroup = new System.Windows.Forms.Button(); 55 61 this.btnAddGroup = new System.Windows.Forms.Button(); 62 this.btnPermissionsSave = new System.Windows.Forms.Button(); 56 63 this.treeSlaveGroup = new System.Windows.Forms.TreeView(); 57 64 this.tabSlaveGroup = new System.Windows.Forms.TabControl(); … … 61 68 this.scheduleView = new HeuristicLab.Clients.Hive.Administrator.Views.ScheduleView(); 62 69 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 70 this.tabPermissions = new System.Windows.Forms.TabPage(); 71 this.permissionView = new HeuristicLab.Clients.Access.Views.RefreshableLightweightUserView(); 63 72 ((System.ComponentModel.ISupportInitialize)(this.splitSlaves)).BeginInit(); 64 73 this.splitSlaves.Panel1.SuspendLayout(); … … 68 77 this.tabDetails.SuspendLayout(); 69 78 this.tabSchedule.SuspendLayout(); 79 this.tabPermissions.SuspendLayout(); 70 80 this.SuspendLayout(); 71 81 // … … 79 89 // 80 90 this.splitSlaves.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 81 82 91 | System.Windows.Forms.AnchorStyles.Left) 92 | System.Windows.Forms.AnchorStyles.Right))); 83 93 this.splitSlaves.Location = new System.Drawing.Point(3, 3); 84 94 this.splitSlaves.Name = "splitSlaves"; … … 156 166 this.treeSlaveGroup.AllowDrop = true; 157 167 this.treeSlaveGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 158 159 168 | System.Windows.Forms.AnchorStyles.Left) 169 | System.Windows.Forms.AnchorStyles.Right))); 160 170 this.treeSlaveGroup.ImageIndex = 0; 161 171 this.treeSlaveGroup.ImageList = this.imageListSlaveGroups; … … 166 176 this.treeSlaveGroup.TabIndex = 0; 167 177 this.treeSlaveGroup.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeSlaveGroup_ItemDrag); 168 this.treeSlaveGroup. NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeSlaveGroup_NodeMouseClick);178 this.treeSlaveGroup.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeSlaveGroup_AfterSelect); 169 179 this.treeSlaveGroup.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeSlaveGroup_DragDrop); 170 180 this.treeSlaveGroup.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeSlaveGroup_DragEnter); … … 175 185 // 176 186 this.tabSlaveGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 177 178 187 | System.Windows.Forms.AnchorStyles.Left) 188 | System.Windows.Forms.AnchorStyles.Right))); 179 189 this.tabSlaveGroup.Controls.Add(this.tabDetails); 180 190 this.tabSlaveGroup.Controls.Add(this.tabSchedule); 191 this.tabSlaveGroup.Controls.Add(this.tabPermissions); 181 192 this.tabSlaveGroup.Location = new System.Drawing.Point(3, 3); 182 193 this.tabSlaveGroup.Name = "tabSlaveGroup"; … … 200 211 // 201 212 this.slaveView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 202 203 213 | System.Windows.Forms.AnchorStyles.Left) 214 | System.Windows.Forms.AnchorStyles.Right))); 204 215 this.slaveView.Caption = "SlaveView"; 205 216 this.slaveView.Content = null; 206 this.slaveView.Location = new System.Drawing.Point( 7, 7);217 this.slaveView.Location = new System.Drawing.Point(6, 6); 207 218 this.slaveView.Name = "slaveView"; 208 219 this.slaveView.ReadOnly = false; 209 this.slaveView.Size = new System.Drawing.Size(56 4, 502);220 this.slaveView.Size = new System.Drawing.Size(565, 503); 210 221 this.slaveView.TabIndex = 0; 211 222 // … … 224 235 // 225 236 this.scheduleView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 226 227 237 | System.Windows.Forms.AnchorStyles.Left) 238 | System.Windows.Forms.AnchorStyles.Right))); 228 239 this.scheduleView.Caption = "ScheduleView"; 229 240 this.scheduleView.Content = null; 230 this.scheduleView.Location = new System.Drawing.Point( 3, 8);241 this.scheduleView.Location = new System.Drawing.Point(6, 6); 231 242 this.scheduleView.Name = "scheduleView"; 232 243 this.scheduleView.ReadOnly = false; 233 this.scheduleView.Size = new System.Drawing.Size(56 8, 501);244 this.scheduleView.Size = new System.Drawing.Size(565, 503); 234 245 this.scheduleView.TabIndex = 0; 235 246 // 247 // tabPermissions 248 // 249 this.tabPermissions.Controls.Add(this.btnPermissionsSave); 250 this.tabPermissions.Controls.Add(this.permissionView); 251 this.tabPermissions.Location = new System.Drawing.Point(4, 22); 252 this.tabPermissions.Name = "tabPermissions"; 253 this.tabPermissions.Padding = new System.Windows.Forms.Padding(3); 254 this.tabPermissions.Size = new System.Drawing.Size(577, 515); 255 this.tabPermissions.TabIndex = 2; 256 this.tabPermissions.Text = "Permissions"; 257 this.tabPermissions.UseVisualStyleBackColor = true; 258 // 259 // btnPermissionsSave 260 // 261 this.btnPermissionsSave.Enabled = false; 262 this.btnPermissionsSave.Image = HeuristicLab.Common.Resources.VSImageLibrary.PublishToWeb; 263 this.btnPermissionsSave.Location = new System.Drawing.Point(39, 9); 264 this.btnPermissionsSave.Name = "btnPermissionsSave"; 265 this.btnPermissionsSave.Size = new System.Drawing.Size(24, 24); 266 this.btnPermissionsSave.TabIndex = 1; 267 this.toolTip.SetToolTip(this.btnPermissionsSave, "Store slave and group sharing permissions on the server"); 268 this.btnPermissionsSave.UseVisualStyleBackColor = true; 269 this.btnPermissionsSave.Click += new System.EventHandler(this.btnPermissionsSave_Click); 270 // 271 // permissionView 272 // 273 this.permissionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 274 | System.Windows.Forms.AnchorStyles.Left) 275 | System.Windows.Forms.AnchorStyles.Right))); 276 this.permissionView.Caption = "RefreshableLightweightUser View"; 277 this.permissionView.Content = null; 278 this.permissionView.FetchSelectedUsers = null; 279 this.permissionView.Location = new System.Drawing.Point(6, 6); 280 this.permissionView.Name = "permissionView"; 281 this.permissionView.ReadOnly = false; 282 this.permissionView.Size = new System.Drawing.Size(565, 503); 283 this.permissionView.TabIndex = 0; 284 // 236 285 // ResourcesView 237 286 // 238 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 239 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 287 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 240 288 this.Controls.Add(this.splitSlaves); 241 289 this.Name = "ResourcesView"; … … 249 297 this.tabDetails.ResumeLayout(false); 250 298 this.tabSchedule.ResumeLayout(false); 299 this.tabPermissions.ResumeLayout(false); 251 300 this.ResumeLayout(false); 252 301 … … 269 318 private System.Windows.Forms.Button btnRefresh; 270 319 private System.Windows.Forms.ToolTip toolTip; 320 private System.Windows.Forms.TabPage tabPermissions; 321 private Access.Views.RefreshableLightweightUserView permissionView; 322 private System.Windows.Forms.Button btnPermissionsSave; 271 323 } 272 324 } -
branches/ScatterSearch (trunk integration)/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs
r7259 r8086 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Drawing; 24 25 using System.Linq; … … 27 28 using System.Threading.Tasks; 28 29 using System.Windows.Forms; 30 using HeuristicLab.Clients.Access; 29 31 using HeuristicLab.Clients.Hive.Views; 30 32 using HeuristicLab.Core; … … 35 37 namespace HeuristicLab.Clients.Hive.Administrator.Views { 36 38 [View("Resources View")] 37 [Content(typeof(IItemList<Resource>), IsDefaultView = true)]39 [Content(typeof(IItemList<Resource>), false)] 38 40 public partial class ResourcesView : ItemView, IDisposable { 39 41 public new IItemList<Resource> Content { … … 45 47 private const int slaveImageIndex = 0; 46 48 private const int slaveGroupImageIndex = 1; 49 private readonly Color ownedResourceColor = Color.LightGreen; 47 50 private TS.Task progressTask; 48 51 private bool stopProgressTask; 52 private bool currentlyAuthorized; 49 53 50 54 … … 56 60 HiveAdminClient.Instance.Refreshing += new EventHandler(Instance_Refreshing); 57 61 HiveAdminClient.Instance.Refreshed += new EventHandler(Instance_Refreshed); 58 } 59 60 public new void Dispose() { 61 HiveAdminClient.Instance.Refreshing -= new EventHandler(Instance_Refreshing); 62 HiveAdminClient.Instance.Refreshed -= new EventHandler(Instance_Refreshed); 62 63 Access.AccessClient.Instance.Refreshing += new EventHandler(AccessClient_Refreshing); 64 Access.AccessClient.Instance.Refreshed += new EventHandler(AccessClient_Refreshed); 63 65 } 64 66 … … 87 89 progressTask = new TS.Task(UpdateProgress); 88 90 progressTask.Start(); 91 SetEnabledStateOfControls(); 89 92 } 90 93 91 94 void Instance_Refreshed(object sender, EventArgs e) { 92 95 stopProgressTask = true; 96 SetEnabledStateOfControls(); 97 } 98 99 void AccessClient_Refreshing(object sender, EventArgs e) { 100 stopProgressTask = false; 101 progressTask = new TS.Task(UpdateProgress); 102 progressTask.Start(); 103 SetEnabledStateOfControls(); 104 } 105 106 void AccessClient_Refreshed(object sender, EventArgs e) { 107 stopProgressTask = true; 108 SetEnabledStateOfControls(); 93 109 } 94 110 … … 110 126 if (Content == null) { 111 127 slaveView.Content = null; 128 scheduleView.Content = null; 129 permissionView.Content = null; 130 permissionView.FetchSelectedUsers = null; 112 131 treeSlaveGroup.Nodes.Clear(); 113 132 } else { 133 permissionView.Content = Access.AccessClient.Instance; 114 134 treeSlaveGroup.Nodes.Clear(); 115 135 … … 134 154 tn.Tag = g; 135 155 tn.Text = g.Name; 156 if (g.OwnerUserId == Access.UserInformation.Instance.User.Id) tn.BackColor = ownedResourceColor; 136 157 137 158 BuildSlaveGroupTree(g, tn); … … 144 165 stn.SelectedImageIndex = stn.ImageIndex; 145 166 stn.Tag = g; 167 if (g.OwnerUserId == Access.UserInformation.Instance.User.Id) stn.BackColor = ownedResourceColor; 146 168 ungrp.Nodes.Add(stn); 147 169 } … … 162 184 stn.SelectedImageIndex = stn.ImageIndex; 163 185 stn.Tag = r; 186 if (r.OwnerUserId == Access.UserInformation.Instance.User.Id) stn.BackColor = ownedResourceColor; 164 187 tn.Nodes.Add(stn); 165 188 … … 174 197 btnRemoveGroup.Enabled = false; 175 198 btnSave.Enabled = false; 199 btnPermissionsSave.Enabled = false; 200 permissionView.Enabled = false; 201 scheduleView.SetEnabledStateOfSchedule(false); 202 btnPermissionsSave.Enabled = false; 203 permissionView.Enabled = false; 176 204 } else { 177 205 btnAddGroup.Enabled = true; 178 206 btnRemoveGroup.Enabled = true; 179 207 btnSave.Enabled = true; 180 } 181 } 182 183 private void treeSlaveGroup_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { 184 if (slaveView.Content != null && slaveView.Content is SlaveGroup) { 185 slaveView.Content.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(SlaveViewContent_PropertyChanged); 186 } 187 188 slaveView.Content = (Resource)e.Node.Tag; 189 HiveAdminClient.Instance.DowntimeForResourceId = ((Resource)e.Node.Tag).Id; 190 191 if (e.Node.Tag is SlaveGroup) { 192 slaveView.Content.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(SlaveViewContent_PropertyChanged); 193 } 194 195 if (tabSlaveGroup.SelectedIndex == 1) { 196 UpdateScheduleAsync(); 208 scheduleView.SetEnabledStateOfSchedule(IsAuthorized(slaveView.Content)); 209 btnPermissionsSave.Enabled = permissionView.FetchSelectedUsers != null; 210 permissionView.Enabled = permissionView.FetchSelectedUsers != null; 211 } 212 } 213 214 private bool IsAuthorized(Resource resource) { 215 return resource != null 216 && resource.Name != UngroupedGroupName 217 && resource.Id != Guid.Empty 218 && UserInformation.Instance.UserExists 219 && (resource.OwnerUserId == UserInformation.Instance.User.Id || HiveRoles.CheckAdminUserPermissions()); 220 } 221 222 private void treeSlaveGroup_AfterSelect(object sender, TreeViewEventArgs e) { 223 if (e.Action != TreeViewAction.Unknown) { 224 Resource selectedResource = ((Resource)e.Node.Tag); 225 currentlyAuthorized = IsAuthorized(selectedResource); 226 if (currentlyAuthorized) { 227 permissionView.FetchSelectedUsers = new Func<List<Guid>>(() => { 228 return HiveServiceLocator.Instance.CallHiveService<List<ResourcePermission>>(service => { 229 return service.GetResourcePermissions(selectedResource.Id); 230 }).Select(x => x.GrantedUserId).ToList(); 231 }); 232 if (!tabSlaveGroup.TabPages.Contains(tabPermissions)) tabSlaveGroup.TabPages.Add(tabPermissions); 233 } else { 234 permissionView.FetchSelectedUsers = null; 235 btnPermissionsSave.Enabled = false; 236 if (selectedResource.Id == Guid.Empty) { 237 if (!tabSlaveGroup.TabPages.Contains(tabPermissions)) tabSlaveGroup.TabPages.Add(tabPermissions); 238 } else tabSlaveGroup.TabPages.Remove(tabPermissions); 239 } 240 241 if (slaveView.Content != null && slaveView.Content is SlaveGroup) { 242 slaveView.Content.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(SlaveViewContent_PropertyChanged); 243 } 244 245 slaveView.Content = selectedResource; 246 HiveAdminClient.Instance.DowntimeForResourceId = selectedResource.Id; 247 248 if (selectedResource is SlaveGroup) { 249 slaveView.Content.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(SlaveViewContent_PropertyChanged); 250 } 251 252 if (tabSlaveGroup.SelectedIndex == 1) { 253 UpdateScheduleAsync(); 254 } else if (tabSlaveGroup.SelectedIndex == 2) { 255 UpdatePermissionsAsync(); 256 } 197 257 } 198 258 } … … 217 277 SlaveGroup newGroup = new SlaveGroup(); 218 278 newGroup.Name = "New Group"; 279 newGroup.OwnerUserId = UserInformation.Instance.User.Id; 219 280 Content.Add(newGroup); 220 281 } … … 269 330 if (destNode.TreeView == newNode.TreeView) { 270 331 if (destNode.Text == UngroupedGroupName || (destNode.Parent != null && destNode.Parent.Text == UngroupedGroupName)) { 271 MessageBox.Show( String.Format("You can't drag items to the {0} group.{1}This group only contains slaves which haven't yet been assigned to a real group.",332 MessageBox.Show(string.Format("You can't drag items to the group \"{0}\".{1}This group only contains slaves which haven't yet been assigned to a real group.", 272 333 UngroupedGroupName, Environment.NewLine), "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Information); 273 334 return; … … 285 346 286 347 if (newNode.Tag is SlaveGroup && CheckParentsEqualsMovedNode(parentNode, newNode)) { 348 return; 349 } 350 351 SlaveGroup parent = (SlaveGroup)parentNode.Tag; 352 353 if (parent.OwnerUserId != null && !IsAuthorized(parent)) { 354 MessageBox.Show(string.Format("You don't have the permissions to drag items to the group \"{0}\".", ((Resource)parentNode.Tag).Name), 355 "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 287 356 return; 288 357 } … … 330 399 private void treeSlaveGroup_ItemDrag(object sender, ItemDragEventArgs e) { 331 400 TreeNode sourceNode = (TreeNode)e.Item; 332 DoDragDrop(sourceNode, DragDropEffects.All); 401 if (IsAuthorized((Resource)sourceNode.Tag)) 402 DoDragDrop(sourceNode, DragDropEffects.All); 333 403 } 334 404 … … 403 473 private void UpdateSchedule() { 404 474 HiveAdminClient.Instance.RefreshCalendar(); 405 scheduleView.Invoke(new Action(() => scheduleView.Content = HiveAdminClient.Instance.Downtimes)); 475 scheduleView.Invoke(new Action(() => { 476 scheduleView.Content = HiveAdminClient.Instance.Downtimes; 477 SetEnabledStateOfControls(); 478 })); 406 479 } 407 480 … … 412 485 } 413 486 487 private void UpdatePermissions() { 488 if (permissionView.Content != null && permissionView.FetchSelectedUsers != null) 489 permissionView.Invoke(new Action(() => permissionView.ManualRefresh())); 490 } 491 492 private void UpdatePermissionsAsync() { 493 TS.Task.Factory.StartNew(UpdatePermissions).ContinueWith((t) => { 494 DisplayError(t.Exception); 495 }, TaskContinuationOptions.OnlyOnFaulted); 496 } 497 498 414 499 private void DisplayError(Exception ex) { 415 500 MessageBox.Show(string.Format("An error occured while updating: {0} {1}", Environment.NewLine, ex.Message), "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); … … 419 504 if (tabSlaveGroup.SelectedIndex == 1) { 420 505 UpdateScheduleAsync(); 506 } else if (tabSlaveGroup.SelectedIndex == 2) { 507 UpdatePermissionsAsync(); 421 508 } 422 509 } … … 429 516 UpdateResourcesAsync(); 430 517 } 518 519 private void btnPermissionsSave_Click(object sender, EventArgs e) { 520 SetEnabledStateOfControls(); 521 HiveServiceLocator.Instance.CallHiveService(service => { 522 service.GrantResourcePermissions(((Resource)treeSlaveGroup.SelectedNode.Tag).Id, permissionView.GetAddedUsers().Select(x => x.Id).ToList()); 523 service.RevokeResourcePermissions(((Resource)treeSlaveGroup.SelectedNode.Tag).Id, permissionView.GetDeletedUsers().Select(x => x.Id).ToList()); 524 }); 525 SetEnabledStateOfControls(); 526 } 431 527 } 432 528 } -
branches/ScatterSearch (trunk integration)/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.Designer.cs
r7259 r8086 71 71 this.dvOnline.ActiveTool = drawTool1; 72 72 this.dvOnline.AmPmDisplay = false; 73 this.dvOnline.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 74 | System.Windows.Forms.AnchorStyles.Left))); 73 this.dvOnline.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 74 | System.Windows.Forms.AnchorStyles.Left) 75 | System.Windows.Forms.AnchorStyles.Right))); 75 76 this.dvOnline.AppointmentDuration = Calendar.AppointmentSlotDuration.SixtyMinutes; 76 77 this.dvOnline.AppointmentHeightMode = Calendar.AppHeightDrawMode.TrueHeightAll; … … 83 84 this.dvOnline.EnableTimeIndicator = false; 84 85 this.dvOnline.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F); 85 this.dvOnline.Location = new System.Drawing.Point( 9, 176);86 this.dvOnline.Location = new System.Drawing.Point(3, 183); 86 87 this.dvOnline.MinHalfHourApp = false; 87 88 this.dvOnline.Name = "dvOnline"; 88 89 this.dvOnline.SelectionEnd = new System.DateTime(((long)(0))); 89 90 this.dvOnline.SelectionStart = new System.DateTime(((long)(0))); 90 this.dvOnline.Size = new System.Drawing.Size(8 23, 354);91 this.dvOnline.Size = new System.Drawing.Size(836, 354); 91 92 this.dvOnline.StartDate = new System.DateTime(((long)(0))); 92 93 this.dvOnline.TabIndex = 54; … … 123 124 // groupBox1 124 125 // 126 this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 125 127 this.groupBox1.Controls.Add(this.txttimeTo); 126 128 this.groupBox1.Controls.Add(this.txttimeFrom); … … 133 135 this.groupBox1.Controls.Add(this.label1); 134 136 this.groupBox1.Controls.Add(this.btCreate); 135 this.groupBox1.Location = new System.Drawing.Point(37 3, 4);137 this.groupBox1.Location = new System.Drawing.Point(375, 3); 136 138 this.groupBox1.Name = "groupBox1"; 137 this.groupBox1.Size = new System.Drawing.Size(25 4, 161);139 this.groupBox1.Size = new System.Drawing.Size(259, 168); 138 140 this.groupBox1.TabIndex = 56; 139 141 this.groupBox1.TabStop = false; … … 217 219 // btnSaveCal 218 220 // 221 this.btnSaveCal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 219 222 this.btnSaveCal.Image = HeuristicLab.Common.Resources.VSImageLibrary.PublishToWeb; 220 223 this.btnSaveCal.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; 221 this.btnSaveCal.Location = new System.Drawing.Point(6 33, 41);224 this.btnSaveCal.Location = new System.Drawing.Point(640, 41); 222 225 this.btnSaveCal.Name = "btnSaveCal"; 223 226 this.btnSaveCal.Size = new System.Drawing.Size(199, 26); … … 230 233 // btnClearCal 231 234 // 235 this.btnClearCal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 232 236 this.btnClearCal.Image = HeuristicLab.Common.Resources.VSImageLibrary.Document; 233 237 this.btnClearCal.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; 234 this.btnClearCal.Location = new System.Drawing.Point(6 33, 9);238 this.btnClearCal.Location = new System.Drawing.Point(640, 9); 235 239 this.btnClearCal.Name = "btnClearCal"; 236 240 this.btnClearCal.Size = new System.Drawing.Size(199, 26); … … 243 247 // mcOnline 244 248 // 249 this.mcOnline.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 250 | System.Windows.Forms.AnchorStyles.Right))); 245 251 this.mcOnline.CalendarDimensions = new System.Drawing.Size(2, 1); 246 this.mcOnline.Location = new System.Drawing.Point( 4, 9);252 this.mcOnline.Location = new System.Drawing.Point(3, 9); 247 253 this.mcOnline.Name = "mcOnline"; 248 254 this.mcOnline.TabIndex = 55; … … 251 257 // ScheduleView 252 258 // 253 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 254 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 259 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 255 260 this.Controls.Add(this.dvOnline); 256 261 this.Controls.Add(this.groupBox1); -
branches/ScatterSearch (trunk integration)/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.cs
r7259 r8086 228 228 protected override void SetEnabledStateOfControls() { 229 229 base.SetEnabledStateOfControls(); 230 if (Content == null) { 231 btnSaveCal.Enabled = false; 230 } 231 232 public virtual void SetEnabledStateOfSchedule(bool state) { 233 if (InvokeRequired) { 234 Invoke(new Action(() => SetEnabledStateOfSchedule(state))); 232 235 } else { 233 btnSaveCal.Enabled = true; 236 if (Content == null) state = false; 237 groupBox1.Enabled = state; 238 btnClearCal.Enabled = state; 239 btnSaveCal.Enabled = state; 234 240 } 235 241 } -
branches/ScatterSearch (trunk integration)/HeuristicLab.Clients.Hive.Administrator/3.3/Views/SlaveView.Designer.cs
r7259 r8086 65 65 this.label3 = new System.Windows.Forms.Label(); 66 66 this.txtHbIntervall = new System.Windows.Forms.TextBox(); 67 this.cbxDisposable = new System.Windows.Forms.CheckBox(); 68 this.label4 = new System.Windows.Forms.Label(); 69 this.cbxPublic = new System.Windows.Forms.CheckBox(); 70 this.label5 = new System.Windows.Forms.Label(); 67 71 this.SuspendLayout(); 68 72 // … … 70 74 // 71 75 this.txtSlaveState.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 72 76 | System.Windows.Forms.AnchorStyles.Right))); 73 77 this.txtSlaveState.Enabled = false; 74 this.txtSlaveState.Location = new System.Drawing.Point(146, 2 16);78 this.txtSlaveState.Location = new System.Drawing.Point(146, 242); 75 79 this.txtSlaveState.Name = "txtSlaveState"; 76 80 this.txtSlaveState.Size = new System.Drawing.Size(390, 20); … … 80 84 // 81 85 this.txtOS.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 82 86 | System.Windows.Forms.AnchorStyles.Right))); 83 87 this.txtOS.Enabled = false; 84 this.txtOS.Location = new System.Drawing.Point(146, 190);88 this.txtOS.Location = new System.Drawing.Point(146, 216); 85 89 this.txtOS.Name = "txtOS"; 86 90 this.txtOS.Size = new System.Drawing.Size(390, 20); … … 90 94 // 91 95 this.label15.AutoSize = true; 92 this.label15.Location = new System.Drawing.Point(3, 2 19);96 this.label15.Location = new System.Drawing.Point(3, 245); 93 97 this.label15.Name = "label15"; 94 98 this.label15.Size = new System.Drawing.Size(35, 13); … … 99 103 // 100 104 this.label14.AutoSize = true; 101 this.label14.Location = new System.Drawing.Point(3, 193);105 this.label14.Location = new System.Drawing.Point(3, 219); 102 106 this.label14.Name = "label14"; 103 107 this.label14.Size = new System.Drawing.Size(93, 13); … … 108 112 // 109 113 this.txtDetailsDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 110 114 | System.Windows.Forms.AnchorStyles.Right))); 111 115 this.txtDetailsDescription.Enabled = false; 112 this.txtDetailsDescription.Location = new System.Drawing.Point(146, 86);116 this.txtDetailsDescription.Location = new System.Drawing.Point(146, 112); 113 117 this.txtDetailsDescription.Name = "txtDetailsDescription"; 114 118 this.txtDetailsDescription.Size = new System.Drawing.Size(390, 20); … … 118 122 // 119 123 this.label13.AutoSize = true; 120 this.label13.Location = new System.Drawing.Point(3, 89);124 this.label13.Location = new System.Drawing.Point(3, 115); 121 125 this.label13.Name = "label13"; 122 126 this.label13.Size = new System.Drawing.Size(63, 13); … … 127 131 // 128 132 this.txtName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 129 133 | System.Windows.Forms.AnchorStyles.Right))); 130 134 this.txtName.Location = new System.Drawing.Point(146, 8); 131 135 this.txtName.Name = "txtName"; … … 137 141 // 138 142 this.txtCPU.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 139 143 | System.Windows.Forms.AnchorStyles.Right))); 140 144 this.txtCPU.Enabled = false; 141 this.txtCPU.Location = new System.Drawing.Point(146, 1 12);145 this.txtCPU.Location = new System.Drawing.Point(146, 138); 142 146 this.txtCPU.Name = "txtCPU"; 143 147 this.txtCPU.Size = new System.Drawing.Size(390, 20); … … 147 151 // 148 152 this.txtMemory.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 149 153 | System.Windows.Forms.AnchorStyles.Right))); 150 154 this.txtMemory.Enabled = false; 151 this.txtMemory.Location = new System.Drawing.Point(146, 1 38);155 this.txtMemory.Location = new System.Drawing.Point(146, 164); 152 156 this.txtMemory.Name = "txtMemory"; 153 157 this.txtMemory.Size = new System.Drawing.Size(390, 20); … … 157 161 // 158 162 this.txtLastHeartbeat.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 159 163 | System.Windows.Forms.AnchorStyles.Right))); 160 164 this.txtLastHeartbeat.Enabled = false; 161 this.txtLastHeartbeat.Location = new System.Drawing.Point(146, 2 42);165 this.txtLastHeartbeat.Location = new System.Drawing.Point(146, 268); 162 166 this.txtLastHeartbeat.Name = "txtLastHeartbeat"; 163 167 this.txtLastHeartbeat.Size = new System.Drawing.Size(390, 20); … … 167 171 // 168 172 this.label12.AutoSize = true; 169 this.label12.Location = new System.Drawing.Point(3, 2 45);173 this.label12.Location = new System.Drawing.Point(3, 271); 170 174 this.label12.Name = "label12"; 171 175 this.label12.Size = new System.Drawing.Size(80, 13); … … 176 180 // 177 181 this.label11.AutoSize = true; 178 this.label11.Location = new System.Drawing.Point(3, 1 41);182 this.label11.Location = new System.Drawing.Point(3, 167); 179 183 this.label11.Name = "label11"; 180 184 this.label11.Size = new System.Drawing.Size(47, 13); … … 185 189 // 186 190 this.label10.AutoSize = true; 187 this.label10.Location = new System.Drawing.Point(3, 1 15);191 this.label10.Location = new System.Drawing.Point(3, 141); 188 192 this.label10.Name = "label10"; 189 193 this.label10.Size = new System.Drawing.Size(32, 13); … … 203 207 // 204 208 this.label1.AutoSize = true; 205 this.label1.Location = new System.Drawing.Point(3, 1 67);209 this.label1.Location = new System.Drawing.Point(3, 193); 206 210 this.label1.Name = "label1"; 207 211 this.label1.Size = new System.Drawing.Size(70, 13); … … 212 216 // 213 217 this.txtFreeMemory.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 214 218 | System.Windows.Forms.AnchorStyles.Right))); 215 219 this.txtFreeMemory.Enabled = false; 216 this.txtFreeMemory.Location = new System.Drawing.Point(146, 1 64);220 this.txtFreeMemory.Location = new System.Drawing.Point(146, 190); 217 221 this.txtFreeMemory.Name = "txtFreeMemory"; 218 222 this.txtFreeMemory.Size = new System.Drawing.Size(390, 20); … … 222 226 // 223 227 this.txtId.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 224 228 | System.Windows.Forms.AnchorStyles.Right))); 225 229 this.txtId.Enabled = false; 226 this.txtId.Location = new System.Drawing.Point(146, 60);230 this.txtId.Location = new System.Drawing.Point(146, 86); 227 231 this.txtId.Name = "txtId"; 228 232 this.txtId.Size = new System.Drawing.Size(390, 20); … … 232 236 // 233 237 this.label2.AutoSize = true; 234 this.label2.Location = new System.Drawing.Point(3, 63);238 this.label2.Location = new System.Drawing.Point(3, 89); 235 239 this.label2.Name = "label2"; 236 240 this.label2.Size = new System.Drawing.Size(19, 13); … … 250 254 // 251 255 this.txtHbIntervall.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 252 256 | System.Windows.Forms.AnchorStyles.Right))); 253 257 this.txtHbIntervall.Location = new System.Drawing.Point(146, 34); 254 258 this.txtHbIntervall.Name = "txtHbIntervall"; … … 257 261 this.txtHbIntervall.TextChanged += new System.EventHandler(this.txtHbIntervall_TextChanged); 258 262 // 263 // cbxDisposable 264 // 265 this.cbxDisposable.AutoSize = true; 266 this.cbxDisposable.Enabled = false; 267 this.cbxDisposable.Location = new System.Drawing.Point(146, 297); 268 this.cbxDisposable.Name = "cbxDisposable"; 269 this.cbxDisposable.Size = new System.Drawing.Size(15, 14); 270 this.cbxDisposable.TabIndex = 34; 271 this.cbxDisposable.UseVisualStyleBackColor = true; 272 this.cbxDisposable.CheckedChanged += new System.EventHandler(this.cbxDisposable_CheckedChanged); 273 // 274 // label4 275 // 276 this.label4.AutoSize = true; 277 this.label4.Location = new System.Drawing.Point(3, 297); 278 this.label4.Name = "label4"; 279 this.label4.Size = new System.Drawing.Size(62, 13); 280 this.label4.TabIndex = 35; 281 this.label4.Text = "Disposable:"; 282 // 283 // cbxPublic 284 // 285 this.cbxPublic.AutoSize = true; 286 this.cbxPublic.Enabled = false; 287 this.cbxPublic.Location = new System.Drawing.Point(146, 63); 288 this.cbxPublic.Name = "cbxPublic"; 289 this.cbxPublic.Size = new System.Drawing.Size(15, 14); 290 this.cbxPublic.TabIndex = 36; 291 this.cbxPublic.UseVisualStyleBackColor = true; 292 this.cbxPublic.CheckedChanged += new System.EventHandler(this.cbxPublic_CheckedChanged); 293 // 294 // label5 295 // 296 this.label5.AutoSize = true; 297 this.label5.Location = new System.Drawing.Point(3, 63); 298 this.label5.Name = "label5"; 299 this.label5.Size = new System.Drawing.Size(39, 13); 300 this.label5.TabIndex = 37; 301 this.label5.Text = "Public:"; 302 // 259 303 // SlaveView 260 304 // 261 305 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 262 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 306 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 307 this.Controls.Add(this.label5); 308 this.Controls.Add(this.cbxPublic); 309 this.Controls.Add(this.label4); 310 this.Controls.Add(this.cbxDisposable); 263 311 this.Controls.Add(this.txtHbIntervall); 264 312 this.Controls.Add(this.label3); … … 282 330 this.Controls.Add(this.label9); 283 331 this.Name = "SlaveView"; 284 this.Size = new System.Drawing.Size(539, 267);332 this.Size = new System.Drawing.Size(539, 407); 285 333 this.ResumeLayout(false); 286 334 this.PerformLayout(); … … 310 358 private System.Windows.Forms.Label label3; 311 359 private System.Windows.Forms.TextBox txtHbIntervall; 360 private System.Windows.Forms.CheckBox cbxDisposable; 361 private System.Windows.Forms.Label label4; 362 private System.Windows.Forms.CheckBox cbxPublic; 363 private System.Windows.Forms.Label label5; 312 364 } 313 365 } -
branches/ScatterSearch (trunk integration)/HeuristicLab.Clients.Hive.Administrator/3.3/Views/SlaveView.cs
r7259 r8086 22 22 using System; 23 23 using System.Windows.Forms; 24 using HeuristicLab.Clients.Access; 24 25 using HeuristicLab.Core.Views; 25 26 using HeuristicLab.MainForm; … … 62 63 txtId.Clear(); 63 64 txtHbIntervall.Clear(); 65 cbxDisposable.Checked = false; 66 cbxPublic.Checked = false; 64 67 } else { 65 68 if (Content.GetType() == typeof(Slave)) { 66 69 ShowSlaveUI(true); 67 70 Slave ct = (Slave)Content; 71 bool authorized = UserInformation.Instance.UserExists && (ct.OwnerUserId == UserInformation.Instance.User.Id || HiveRoles.CheckAdminUserPermissions()); 68 72 txtName.Text = ct.Name; 69 73 txtHbIntervall.Text = ct.HbInterval.ToString(); 74 cbxPublic.Enabled = authorized; 75 cbxPublic.CheckedChanged -= new EventHandler(cbxPublic_CheckedChanged); 76 cbxPublic.Checked = ct.OwnerUserId == null; 77 cbxPublic.CheckedChanged += new EventHandler(cbxPublic_CheckedChanged); 70 78 txtCPU.Text = string.Format("{0} Cores @ {1} Mhz, Arch.: {2}", ct.Cores.ToString(), ct.CpuSpeed.ToString(), ct.CpuArchitecture.ToString()); 71 79 txtDetailsDescription.Text = ct.Description; … … 76 84 txtFreeMemory.Text = ct.FreeMemory.ToString(); 77 85 txtId.Text = ct.Id.ToString(); 86 cbxDisposable.Enabled = authorized; 87 cbxDisposable.Checked = ct.IsDisposable.GetValueOrDefault(); 78 88 } else if (Content.GetType() == typeof(SlaveGroup)) { 79 89 SlaveGroup ct = (SlaveGroup)Content; 80 90 txtName.Text = ct.Name; 81 91 txtHbIntervall.Text = ct.HbInterval.ToString(); 92 cbxPublic.Enabled = ct.Name != "UNGROUPED" && HiveRoles.CheckAdminUserPermissions(); 93 cbxPublic.CheckedChanged -= new EventHandler(cbxPublic_CheckedChanged); 94 cbxPublic.Checked = ct.OwnerUserId == null; 95 cbxPublic.CheckedChanged += new EventHandler(cbxPublic_CheckedChanged); 82 96 ShowSlaveUI(false); 83 97 } else { … … 88 102 89 103 private void ShowSlaveUI(bool show) { 104 label1.Visible = show; 90 105 label2.Visible = show; 91 label 1.Visible = show;106 label4.Visible = show; 92 107 label10.Visible = show; 93 108 label11.Visible = show; … … 105 120 txtId.Visible = show; 106 121 txtName.Enabled = !show; 122 cbxDisposable.Visible = show; 107 123 } 108 124 … … 131 147 } 132 148 } 149 150 private void cbxDisposable_CheckedChanged(object sender, EventArgs e) { 151 if (Content != null) { 152 ((Slave)Content).IsDisposable = cbxDisposable.Checked; 153 } 154 } 155 156 private void cbxPublic_CheckedChanged(object sender, EventArgs e) { 157 if (Content != null) { 158 Content.OwnerUserId = cbxPublic.Checked ? null : new Guid?(UserInformation.Instance.User.Id); 159 } 160 } 133 161 } 134 162 }
Note: See TracChangeset
for help on using the changeset viewer.