- Timestamp:
- 06/19/12 12:06:18 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.Designer.cs
r7967 r8051 54 54 this.btnRemoveGroup = new System.Windows.Forms.Button(); 55 55 this.btnAddGroup = new System.Windows.Forms.Button(); 56 this.btnPermissionsSave = new System.Windows.Forms.Button(); 56 57 this.treeSlaveGroup = new System.Windows.Forms.TreeView(); 57 58 this.tabSlaveGroup = new System.Windows.Forms.TabControl(); … … 61 62 this.scheduleView = new HeuristicLab.Clients.Hive.Administrator.Views.ScheduleView(); 62 63 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 64 this.tabPermissions = new System.Windows.Forms.TabPage(); 65 this.permissionView = new HeuristicLab.Clients.Access.Views.RefreshableLightweightUserView(); 63 66 ((System.ComponentModel.ISupportInitialize)(this.splitSlaves)).BeginInit(); 64 67 this.splitSlaves.Panel1.SuspendLayout(); … … 68 71 this.tabDetails.SuspendLayout(); 69 72 this.tabSchedule.SuspendLayout(); 73 this.tabPermissions.SuspendLayout(); 70 74 this.SuspendLayout(); 71 75 // … … 75 79 this.imageListSlaveGroups.ImageSize = new System.Drawing.Size(16, 16); 76 80 this.imageListSlaveGroups.TransparentColor = System.Drawing.Color.Transparent; 77 //78 // splitSlaves79 //80 this.splitSlaves.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)81 | System.Windows.Forms.AnchorStyles.Left)82 | System.Windows.Forms.AnchorStyles.Right)));83 this.splitSlaves.Location = new System.Drawing.Point(3, 3);84 this.splitSlaves.Name = "splitSlaves";85 //86 // splitSlaves.Panel187 //88 this.splitSlaves.Panel1.Controls.Add(this.btnRefresh);89 this.splitSlaves.Panel1.Controls.Add(this.progressBar);90 this.splitSlaves.Panel1.Controls.Add(this.btnSave);91 this.splitSlaves.Panel1.Controls.Add(this.btnRemoveGroup);92 this.splitSlaves.Panel1.Controls.Add(this.btnAddGroup);93 this.splitSlaves.Panel1.Controls.Add(this.treeSlaveGroup);94 //95 // splitSlaves.Panel296 //97 this.splitSlaves.Panel2.Controls.Add(this.tabSlaveGroup);98 this.splitSlaves.Size = new System.Drawing.Size(847, 547);99 this.splitSlaves.SplitterDistance = 249;100 this.splitSlaves.TabIndex = 3;101 81 // 102 82 // btnRefresh … … 111 91 this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click); 112 92 // 113 // progressBar114 //115 this.progressBar.Location = new System.Drawing.Point(123, 4);116 this.progressBar.Name = "progressBar";117 this.progressBar.Size = new System.Drawing.Size(123, 23);118 this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;119 this.progressBar.TabIndex = 7;120 //121 93 // btnSave 122 94 // … … 152 124 this.btnAddGroup.Click += new System.EventHandler(this.btnAddGroup_Click); 153 125 // 126 // btnPermissionsSave 127 // 128 this.btnPermissionsSave.Enabled = false; 129 this.btnPermissionsSave.Image = HeuristicLab.Common.Resources.VSImageLibrary.PublishToWeb; 130 this.btnPermissionsSave.Location = new System.Drawing.Point(36, 6); 131 this.btnPermissionsSave.Name = "btnPermissionsSave"; 132 this.btnPermissionsSave.Size = new System.Drawing.Size(24, 24); 133 this.btnPermissionsSave.TabIndex = 1; 134 this.toolTip.SetToolTip(this.btnPermissionsSave, "Store slave and group sharing permissions on the server"); 135 this.btnPermissionsSave.UseVisualStyleBackColor = true; 136 this.btnPermissionsSave.Click += new System.EventHandler(this.btnPermissionsSave_Click); 137 // 138 // splitSlaves 139 // 140 this.splitSlaves.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 141 | System.Windows.Forms.AnchorStyles.Left) 142 | System.Windows.Forms.AnchorStyles.Right))); 143 this.splitSlaves.Location = new System.Drawing.Point(3, 3); 144 this.splitSlaves.Name = "splitSlaves"; 145 // 146 // splitSlaves.Panel1 147 // 148 this.splitSlaves.Panel1.Controls.Add(this.btnRefresh); 149 this.splitSlaves.Panel1.Controls.Add(this.progressBar); 150 this.splitSlaves.Panel1.Controls.Add(this.btnSave); 151 this.splitSlaves.Panel1.Controls.Add(this.btnRemoveGroup); 152 this.splitSlaves.Panel1.Controls.Add(this.btnAddGroup); 153 this.splitSlaves.Panel1.Controls.Add(this.treeSlaveGroup); 154 // 155 // splitSlaves.Panel2 156 // 157 this.splitSlaves.Panel2.Controls.Add(this.tabSlaveGroup); 158 this.splitSlaves.Size = new System.Drawing.Size(847, 547); 159 this.splitSlaves.SplitterDistance = 249; 160 this.splitSlaves.TabIndex = 3; 161 // 162 // progressBar 163 // 164 this.progressBar.Location = new System.Drawing.Point(123, 4); 165 this.progressBar.Name = "progressBar"; 166 this.progressBar.Size = new System.Drawing.Size(123, 23); 167 this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous; 168 this.progressBar.TabIndex = 7; 169 // 154 170 // treeSlaveGroup 155 171 // 156 172 this.treeSlaveGroup.AllowDrop = true; 157 173 this.treeSlaveGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 158 159 174 | System.Windows.Forms.AnchorStyles.Left) 175 | System.Windows.Forms.AnchorStyles.Right))); 160 176 this.treeSlaveGroup.ImageIndex = 0; 161 177 this.treeSlaveGroup.ImageList = this.imageListSlaveGroups; … … 166 182 this.treeSlaveGroup.TabIndex = 0; 167 183 this.treeSlaveGroup.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeSlaveGroup_ItemDrag); 168 this.treeSlaveGroup. NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeSlaveGroup_NodeMouseClick);184 this.treeSlaveGroup.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeSlaveGroup_AfterSelect); 169 185 this.treeSlaveGroup.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeSlaveGroup_DragDrop); 170 186 this.treeSlaveGroup.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeSlaveGroup_DragEnter); … … 175 191 // 176 192 this.tabSlaveGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 177 178 193 | System.Windows.Forms.AnchorStyles.Left) 194 | System.Windows.Forms.AnchorStyles.Right))); 179 195 this.tabSlaveGroup.Controls.Add(this.tabDetails); 180 196 this.tabSlaveGroup.Controls.Add(this.tabSchedule); 197 this.tabSlaveGroup.Controls.Add(this.tabPermissions); 181 198 this.tabSlaveGroup.Location = new System.Drawing.Point(3, 3); 182 199 this.tabSlaveGroup.Name = "tabSlaveGroup"; … … 200 217 // 201 218 this.slaveView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 202 203 219 | System.Windows.Forms.AnchorStyles.Left) 220 | System.Windows.Forms.AnchorStyles.Right))); 204 221 this.slaveView.Caption = "SlaveView"; 205 222 this.slaveView.Content = null; 206 this.slaveView.Location = new System.Drawing.Point( 7, 7);223 this.slaveView.Location = new System.Drawing.Point(6, 6); 207 224 this.slaveView.Name = "slaveView"; 208 225 this.slaveView.ReadOnly = false; 209 this.slaveView.Size = new System.Drawing.Size(56 4, 502);226 this.slaveView.Size = new System.Drawing.Size(565, 503); 210 227 this.slaveView.TabIndex = 0; 211 228 // … … 224 241 // 225 242 this.scheduleView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 226 227 243 | System.Windows.Forms.AnchorStyles.Left) 244 | System.Windows.Forms.AnchorStyles.Right))); 228 245 this.scheduleView.Caption = "ScheduleView"; 229 246 this.scheduleView.Content = null; 230 this.scheduleView.Location = new System.Drawing.Point( 3, 8);247 this.scheduleView.Location = new System.Drawing.Point(6, 6); 231 248 this.scheduleView.Name = "scheduleView"; 232 249 this.scheduleView.ReadOnly = false; 233 this.scheduleView.Size = new System.Drawing.Size(56 8, 501);250 this.scheduleView.Size = new System.Drawing.Size(565, 503); 234 251 this.scheduleView.TabIndex = 0; 252 // 253 // tabPermissions 254 // 255 this.tabPermissions.Controls.Add(this.btnPermissionsSave); 256 this.tabPermissions.Controls.Add(this.permissionView); 257 this.tabPermissions.Location = new System.Drawing.Point(4, 22); 258 this.tabPermissions.Name = "tabPermissions"; 259 this.tabPermissions.Padding = new System.Windows.Forms.Padding(3); 260 this.tabPermissions.Size = new System.Drawing.Size(577, 515); 261 this.tabPermissions.TabIndex = 2; 262 this.tabPermissions.Text = "Permissions"; 263 this.tabPermissions.UseVisualStyleBackColor = true; 264 // 265 // permissionView 266 // 267 this.permissionView.Caption = "RefreshableLightweightUser View"; 268 this.permissionView.Content = null; 269 this.permissionView.FetchSelectedUsers = null; 270 this.permissionView.Location = new System.Drawing.Point(6, 6); 271 this.permissionView.Name = "permissionView"; 272 this.permissionView.ReadOnly = false; 273 this.permissionView.Size = new System.Drawing.Size(565, 503); 274 this.permissionView.TabIndex = 0; 235 275 // 236 276 // ResourcesView … … 249 289 this.tabDetails.ResumeLayout(false); 250 290 this.tabSchedule.ResumeLayout(false); 291 this.tabPermissions.ResumeLayout(false); 251 292 this.ResumeLayout(false); 252 293 … … 269 310 private System.Windows.Forms.Button btnRefresh; 270 311 private System.Windows.Forms.ToolTip toolTip; 312 private System.Windows.Forms.TabPage tabPermissions; 313 private Access.Views.RefreshableLightweightUserView permissionView; 314 private System.Windows.Forms.Button btnPermissionsSave; 271 315 } 272 316 } -
trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs
r7928 r8051 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; … … 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); 62 63 Access.AccessClient.Instance.Refreshing += new EventHandler(Content_Refreshing); 64 Access.AccessClient.Instance.Refreshed += new EventHandler(Content_Refreshed); 58 65 } 59 66 … … 61 68 HiveAdminClient.Instance.Refreshing -= new EventHandler(Instance_Refreshing); 62 69 HiveAdminClient.Instance.Refreshed -= new EventHandler(Instance_Refreshed); 70 71 Access.AccessClient.Instance.Refreshing -= new EventHandler(Content_Refreshing); 72 Access.AccessClient.Instance.Refreshed -= new EventHandler(Content_Refreshed); 63 73 } 64 74 … … 87 97 progressTask = new TS.Task(UpdateProgress); 88 98 progressTask.Start(); 99 SetEnabledStateOfControls(false); 89 100 } 90 101 91 102 void Instance_Refreshed(object sender, EventArgs e) { 92 103 stopProgressTask = true; 104 SetEnabledStateOfControls(true); 105 } 106 107 void Content_Refreshing(object sender, EventArgs e) { 108 stopProgressTask = false; 109 progressTask = new TS.Task(UpdateProgress); 110 progressTask.Start(); 111 SetEnabledStateOfControls(false); 112 } 113 114 void Content_Refreshed(object sender, EventArgs e) { 115 stopProgressTask = true; 116 SetEnabledStateOfControls(true); 93 117 } 94 118 … … 110 134 if (Content == null) { 111 135 slaveView.Content = null; 136 scheduleView.Content = null; 137 permissionView.Content = null; 138 permissionView.FetchSelectedUsers = null; 112 139 treeSlaveGroup.Nodes.Clear(); 113 140 } else { 141 permissionView.Content = Access.AccessClient.Instance; 114 142 treeSlaveGroup.Nodes.Clear(); 115 143 … … 134 162 tn.Tag = g; 135 163 tn.Text = g.Name; 164 if (g.OwnerUserId == Access.UserInformation.Instance.User.Id) tn.BackColor = ownedResourceColor; 136 165 137 166 BuildSlaveGroupTree(g, tn); … … 144 173 stn.SelectedImageIndex = stn.ImageIndex; 145 174 stn.Tag = g; 175 if (g.OwnerUserId == Access.UserInformation.Instance.User.Id) stn.BackColor = ownedResourceColor; 146 176 ungrp.Nodes.Add(stn); 147 177 } … … 162 192 stn.SelectedImageIndex = stn.ImageIndex; 163 193 stn.Tag = r; 194 if (r.OwnerUserId == Access.UserInformation.Instance.User.Id) stn.BackColor = ownedResourceColor; 164 195 tn.Nodes.Add(stn); 165 196 … … 174 205 btnRemoveGroup.Enabled = false; 175 206 btnSave.Enabled = false; 207 btnPermissionsSave.Enabled = false; 208 permissionView.Enabled = false; 176 209 } else { 177 210 btnAddGroup.Enabled = true; … … 181 214 } 182 215 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(); 216 public virtual void SetEnabledStateOfControls(bool state) { 217 if (InvokeRequired) { 218 Invoke(new Action(() => SetEnabledStateOfControls(state))); 219 } else { 220 if (Content == null) state = false; 221 btnAddGroup.Enabled = state; 222 btnRemoveGroup.Enabled = state; 223 btnSave.Enabled = state; 224 scheduleView.SetEnabledStateOfControls(state && IsAuthorized(slaveView.Content)); 225 btnPermissionsSave.Enabled = state && permissionView.FetchSelectedUsers != null && Content != null; 226 permissionView.Enabled = state && permissionView.FetchSelectedUsers != null && Content != null; 227 } 228 } 229 230 private bool IsAuthorized(Resource resource) { 231 return resource != null 232 && resource.Name != UngroupedGroupName 233 && resource.Id != Guid.Empty 234 && HiveServiceLocator.Instance.CallHiveService<bool>(service => { return service.AuthorizesForResourceAdministration(resource.Id); }); 235 } 236 237 private void treeSlaveGroup_AfterSelect(object sender, TreeViewEventArgs e) { 238 if (e.Action != TreeViewAction.Unknown) { 239 Resource selectedResource = ((Resource)e.Node.Tag); 240 currentlyAuthorized = IsAuthorized(selectedResource); 241 if (currentlyAuthorized) { 242 permissionView.FetchSelectedUsers = new Func<List<Guid>>(() => { 243 return HiveServiceLocator.Instance.CallHiveService<List<ResourcePermission>>(service => { 244 return service.GetResourcePermissions(selectedResource.Id); 245 }).Select(x => x.GrantedUserId).ToList(); 246 }); 247 if (!tabSlaveGroup.TabPages.Contains(tabPermissions)) tabSlaveGroup.TabPages.Add(tabPermissions); 248 } else { 249 permissionView.FetchSelectedUsers = null; 250 btnPermissionsSave.Enabled = false; 251 if (selectedResource.Id == Guid.Empty) { 252 if (!tabSlaveGroup.TabPages.Contains(tabPermissions)) tabSlaveGroup.TabPages.Add(tabPermissions); 253 } else tabSlaveGroup.TabPages.Remove(tabPermissions); 254 } 255 256 if (slaveView.Content != null && slaveView.Content is SlaveGroup) { 257 slaveView.Content.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(SlaveViewContent_PropertyChanged); 258 } 259 260 slaveView.Content = selectedResource; 261 HiveAdminClient.Instance.DowntimeForResourceId = selectedResource.Id; 262 263 if (selectedResource is SlaveGroup) { 264 slaveView.Content.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(SlaveViewContent_PropertyChanged); 265 } 266 267 if (tabSlaveGroup.SelectedIndex == 1) { 268 UpdateScheduleAsync(); 269 } else if (tabSlaveGroup.SelectedIndex == 2) { 270 UpdatePermissionsAsync(); 271 } 197 272 } 198 273 } … … 217 292 SlaveGroup newGroup = new SlaveGroup(); 218 293 newGroup.Name = "New Group"; 294 newGroup.OwnerUserId = UserInformation.Instance.User.Id; 219 295 Content.Add(newGroup); 220 296 } … … 269 345 if (destNode.TreeView == newNode.TreeView) { 270 346 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.",347 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 348 UngroupedGroupName, Environment.NewLine), "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Information); 273 349 return; … … 285 361 286 362 if (newNode.Tag is SlaveGroup && CheckParentsEqualsMovedNode(parentNode, newNode)) { 363 return; 364 } 365 366 SlaveGroup parent = (SlaveGroup)parentNode.Tag; 367 368 if (parent.OwnerUserId != null && !IsAuthorized(parent)) { 369 MessageBox.Show(string.Format("You don't have the permissions to drag items to the group \"{0}\".", ((Resource)parentNode.Tag).Name), 370 "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 287 371 return; 288 372 } … … 330 414 private void treeSlaveGroup_ItemDrag(object sender, ItemDragEventArgs e) { 331 415 TreeNode sourceNode = (TreeNode)e.Item; 332 DoDragDrop(sourceNode, DragDropEffects.All); 416 if (IsAuthorized((Resource)sourceNode.Tag)) 417 DoDragDrop(sourceNode, DragDropEffects.All); 333 418 } 334 419 … … 403 488 private void UpdateSchedule() { 404 489 HiveAdminClient.Instance.RefreshCalendar(); 405 scheduleView.Invoke(new Action(() => scheduleView.Content = HiveAdminClient.Instance.Downtimes)); 490 scheduleView.Invoke(new Action(() => { 491 scheduleView.Content = HiveAdminClient.Instance.Downtimes; 492 SetEnabledStateOfControls(currentlyAuthorized); 493 })); 406 494 } 407 495 … … 412 500 } 413 501 502 private void UpdatePermissions() { 503 if (permissionView.Content != null && permissionView.FetchSelectedUsers != null) 504 permissionView.Invoke(new Action(() => permissionView.ManualRefresh())); 505 } 506 507 private void UpdatePermissionsAsync() { 508 TS.Task.Factory.StartNew(UpdatePermissions).ContinueWith((t) => { 509 DisplayError(t.Exception); 510 }, TaskContinuationOptions.OnlyOnFaulted); 511 } 512 513 414 514 private void DisplayError(Exception ex) { 415 515 MessageBox.Show(string.Format("An error occured while updating: {0} {1}", Environment.NewLine, ex.Message), "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); … … 419 519 if (tabSlaveGroup.SelectedIndex == 1) { 420 520 UpdateScheduleAsync(); 521 } else if (tabSlaveGroup.SelectedIndex == 2) { 522 UpdatePermissionsAsync(); 421 523 } 422 524 } … … 429 531 UpdateResourcesAsync(); 430 532 } 533 534 private void btnPermissionsSave_Click(object sender, EventArgs e) { 535 SetEnabledStateOfControls(false); 536 HiveServiceLocator.Instance.CallHiveService(service => { 537 service.GrantResourcePermissions(((Resource)treeSlaveGroup.SelectedNode.Tag).Id, permissionView.GetAddedUsers().Select(x => x.Id).ToList()); 538 service.RevokeResourcePermissions(((Resource)treeSlaveGroup.SelectedNode.Tag).Id, permissionView.GetDeletedUsers().Select(x => x.Id).ToList()); 539 }); 540 SetEnabledStateOfControls(true); 541 } 431 542 } 432 543 } -
trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.Designer.cs
r7967 r8051 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.Left) 74 | System.Windows.Forms.AnchorStyles.Right))); 75 75 this.dvOnline.AppointmentDuration = Calendar.AppointmentSlotDuration.SixtyMinutes; 76 76 this.dvOnline.AppointmentHeightMode = Calendar.AppHeightDrawMode.TrueHeightAll; … … 83 83 this.dvOnline.EnableTimeIndicator = false; 84 84 this.dvOnline.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F); 85 this.dvOnline.Location = new System.Drawing.Point( 9, 176);85 this.dvOnline.Location = new System.Drawing.Point(3, 183); 86 86 this.dvOnline.MinHalfHourApp = false; 87 87 this.dvOnline.Name = "dvOnline"; 88 88 this.dvOnline.SelectionEnd = new System.DateTime(((long)(0))); 89 89 this.dvOnline.SelectionStart = new System.DateTime(((long)(0))); 90 this.dvOnline.Size = new System.Drawing.Size(8 23, 354);90 this.dvOnline.Size = new System.Drawing.Size(836, 354); 91 91 this.dvOnline.StartDate = new System.DateTime(((long)(0))); 92 92 this.dvOnline.TabIndex = 54; … … 123 123 // groupBox1 124 124 // 125 this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 125 126 this.groupBox1.Controls.Add(this.txttimeTo); 126 127 this.groupBox1.Controls.Add(this.txttimeFrom); … … 133 134 this.groupBox1.Controls.Add(this.label1); 134 135 this.groupBox1.Controls.Add(this.btCreate); 135 this.groupBox1.Location = new System.Drawing.Point(37 3, 4);136 this.groupBox1.Location = new System.Drawing.Point(375, 3); 136 137 this.groupBox1.Name = "groupBox1"; 137 this.groupBox1.Size = new System.Drawing.Size(25 4, 161);138 this.groupBox1.Size = new System.Drawing.Size(259, 168); 138 139 this.groupBox1.TabIndex = 56; 139 140 this.groupBox1.TabStop = false; … … 217 218 // btnSaveCal 218 219 // 220 this.btnSaveCal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 219 221 this.btnSaveCal.Image = HeuristicLab.Common.Resources.VSImageLibrary.PublishToWeb; 220 222 this.btnSaveCal.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; 221 this.btnSaveCal.Location = new System.Drawing.Point(6 33, 41);223 this.btnSaveCal.Location = new System.Drawing.Point(640, 41); 222 224 this.btnSaveCal.Name = "btnSaveCal"; 223 225 this.btnSaveCal.Size = new System.Drawing.Size(199, 26); … … 230 232 // btnClearCal 231 233 // 234 this.btnClearCal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 232 235 this.btnClearCal.Image = HeuristicLab.Common.Resources.VSImageLibrary.Document; 233 236 this.btnClearCal.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; 234 this.btnClearCal.Location = new System.Drawing.Point(6 33, 9);237 this.btnClearCal.Location = new System.Drawing.Point(640, 9); 235 238 this.btnClearCal.Name = "btnClearCal"; 236 239 this.btnClearCal.Size = new System.Drawing.Size(199, 26); … … 243 246 // mcOnline 244 247 // 248 this.mcOnline.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 249 | System.Windows.Forms.AnchorStyles.Right))); 245 250 this.mcOnline.CalendarDimensions = new System.Drawing.Size(2, 1); 246 this.mcOnline.Location = new System.Drawing.Point( 4, 9);251 this.mcOnline.Location = new System.Drawing.Point(3, 9); 247 252 this.mcOnline.Name = "mcOnline"; 248 253 this.mcOnline.TabIndex = 55; -
trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.cs
r7259 r8051 228 228 protected override void SetEnabledStateOfControls() { 229 229 base.SetEnabledStateOfControls(); 230 if (Content == null) { 231 btnSaveCal.Enabled = false; 230 } 231 232 public virtual void SetEnabledStateOfControls(bool state) { 233 if (InvokeRequired) { 234 Invoke(new Action(() => SetEnabledStateOfControls(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 } -
trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/SlaveView.Designer.cs
r7967 r8051 67 67 this.cbxDisposable = new System.Windows.Forms.CheckBox(); 68 68 this.label4 = new System.Windows.Forms.Label(); 69 this.cbxPublic = new System.Windows.Forms.CheckBox(); 70 this.label5 = new System.Windows.Forms.Label(); 69 71 this.SuspendLayout(); 70 72 // 71 73 // txtSlaveState 72 74 // 73 this.txtSlaveState.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 75 this.txtSlaveState.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 74 76 | System.Windows.Forms.AnchorStyles.Right))); 75 77 this.txtSlaveState.Enabled = false; 76 this.txtSlaveState.Location = new System.Drawing.Point(146, 2 16);78 this.txtSlaveState.Location = new System.Drawing.Point(146, 242); 77 79 this.txtSlaveState.Name = "txtSlaveState"; 78 80 this.txtSlaveState.Size = new System.Drawing.Size(390, 20); … … 81 83 // txtOS 82 84 // 83 this.txtOS.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 85 this.txtOS.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 84 86 | System.Windows.Forms.AnchorStyles.Right))); 85 87 this.txtOS.Enabled = false; 86 this.txtOS.Location = new System.Drawing.Point(146, 190);88 this.txtOS.Location = new System.Drawing.Point(146, 216); 87 89 this.txtOS.Name = "txtOS"; 88 90 this.txtOS.Size = new System.Drawing.Size(390, 20); … … 92 94 // 93 95 this.label15.AutoSize = true; 94 this.label15.Location = new System.Drawing.Point(3, 2 19);96 this.label15.Location = new System.Drawing.Point(3, 245); 95 97 this.label15.Name = "label15"; 96 98 this.label15.Size = new System.Drawing.Size(35, 13); … … 101 103 // 102 104 this.label14.AutoSize = true; 103 this.label14.Location = new System.Drawing.Point(3, 193);105 this.label14.Location = new System.Drawing.Point(3, 219); 104 106 this.label14.Name = "label14"; 105 107 this.label14.Size = new System.Drawing.Size(93, 13); … … 109 111 // txtDetailsDescription 110 112 // 111 this.txtDetailsDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 113 this.txtDetailsDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 112 114 | System.Windows.Forms.AnchorStyles.Right))); 113 115 this.txtDetailsDescription.Enabled = false; 114 this.txtDetailsDescription.Location = new System.Drawing.Point(146, 86);116 this.txtDetailsDescription.Location = new System.Drawing.Point(146, 112); 115 117 this.txtDetailsDescription.Name = "txtDetailsDescription"; 116 118 this.txtDetailsDescription.Size = new System.Drawing.Size(390, 20); … … 120 122 // 121 123 this.label13.AutoSize = true; 122 this.label13.Location = new System.Drawing.Point(3, 89);124 this.label13.Location = new System.Drawing.Point(3, 115); 123 125 this.label13.Name = "label13"; 124 126 this.label13.Size = new System.Drawing.Size(63, 13); … … 128 130 // txtName 129 131 // 130 this.txtName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 132 this.txtName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 131 133 | System.Windows.Forms.AnchorStyles.Right))); 132 134 this.txtName.Location = new System.Drawing.Point(146, 8); … … 138 140 // txtCPU 139 141 // 140 this.txtCPU.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 142 this.txtCPU.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 141 143 | System.Windows.Forms.AnchorStyles.Right))); 142 144 this.txtCPU.Enabled = false; 143 this.txtCPU.Location = new System.Drawing.Point(146, 1 12);145 this.txtCPU.Location = new System.Drawing.Point(146, 138); 144 146 this.txtCPU.Name = "txtCPU"; 145 147 this.txtCPU.Size = new System.Drawing.Size(390, 20); … … 148 150 // txtMemory 149 151 // 150 this.txtMemory.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 152 this.txtMemory.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 151 153 | System.Windows.Forms.AnchorStyles.Right))); 152 154 this.txtMemory.Enabled = false; 153 this.txtMemory.Location = new System.Drawing.Point(146, 1 38);155 this.txtMemory.Location = new System.Drawing.Point(146, 164); 154 156 this.txtMemory.Name = "txtMemory"; 155 157 this.txtMemory.Size = new System.Drawing.Size(390, 20); … … 158 160 // txtLastHeartbeat 159 161 // 160 this.txtLastHeartbeat.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 162 this.txtLastHeartbeat.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 161 163 | System.Windows.Forms.AnchorStyles.Right))); 162 164 this.txtLastHeartbeat.Enabled = false; 163 this.txtLastHeartbeat.Location = new System.Drawing.Point(146, 2 42);165 this.txtLastHeartbeat.Location = new System.Drawing.Point(146, 268); 164 166 this.txtLastHeartbeat.Name = "txtLastHeartbeat"; 165 167 this.txtLastHeartbeat.Size = new System.Drawing.Size(390, 20); … … 169 171 // 170 172 this.label12.AutoSize = true; 171 this.label12.Location = new System.Drawing.Point(3, 2 45);173 this.label12.Location = new System.Drawing.Point(3, 271); 172 174 this.label12.Name = "label12"; 173 175 this.label12.Size = new System.Drawing.Size(80, 13); … … 178 180 // 179 181 this.label11.AutoSize = true; 180 this.label11.Location = new System.Drawing.Point(3, 1 41);182 this.label11.Location = new System.Drawing.Point(3, 167); 181 183 this.label11.Name = "label11"; 182 184 this.label11.Size = new System.Drawing.Size(47, 13); … … 187 189 // 188 190 this.label10.AutoSize = true; 189 this.label10.Location = new System.Drawing.Point(3, 1 15);191 this.label10.Location = new System.Drawing.Point(3, 141); 190 192 this.label10.Name = "label10"; 191 193 this.label10.Size = new System.Drawing.Size(32, 13); … … 205 207 // 206 208 this.label1.AutoSize = true; 207 this.label1.Location = new System.Drawing.Point(3, 1 67);209 this.label1.Location = new System.Drawing.Point(3, 193); 208 210 this.label1.Name = "label1"; 209 211 this.label1.Size = new System.Drawing.Size(70, 13); … … 213 215 // txtFreeMemory 214 216 // 215 this.txtFreeMemory.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 217 this.txtFreeMemory.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 216 218 | System.Windows.Forms.AnchorStyles.Right))); 217 219 this.txtFreeMemory.Enabled = false; 218 this.txtFreeMemory.Location = new System.Drawing.Point(146, 1 64);220 this.txtFreeMemory.Location = new System.Drawing.Point(146, 190); 219 221 this.txtFreeMemory.Name = "txtFreeMemory"; 220 222 this.txtFreeMemory.Size = new System.Drawing.Size(390, 20); … … 223 225 // txtId 224 226 // 225 this.txtId.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 227 this.txtId.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 226 228 | System.Windows.Forms.AnchorStyles.Right))); 227 229 this.txtId.Enabled = false; 228 this.txtId.Location = new System.Drawing.Point(146, 60);230 this.txtId.Location = new System.Drawing.Point(146, 86); 229 231 this.txtId.Name = "txtId"; 230 232 this.txtId.Size = new System.Drawing.Size(390, 20); … … 234 236 // 235 237 this.label2.AutoSize = true; 236 this.label2.Location = new System.Drawing.Point(3, 63);238 this.label2.Location = new System.Drawing.Point(3, 89); 237 239 this.label2.Name = "label2"; 238 240 this.label2.Size = new System.Drawing.Size(19, 13); … … 251 253 // txtHbIntervall 252 254 // 253 this.txtHbIntervall.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 255 this.txtHbIntervall.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 254 256 | System.Windows.Forms.AnchorStyles.Right))); 255 257 this.txtHbIntervall.Location = new System.Drawing.Point(146, 34); … … 262 264 // 263 265 this.cbxDisposable.AutoSize = true; 264 this.cbxDisposable.Location = new System.Drawing.Point(146, 268); 266 this.cbxDisposable.Enabled = false; 267 this.cbxDisposable.Location = new System.Drawing.Point(146, 297); 265 268 this.cbxDisposable.Name = "cbxDisposable"; 266 269 this.cbxDisposable.Size = new System.Drawing.Size(15, 14); 267 270 this.cbxDisposable.TabIndex = 34; 268 271 this.cbxDisposable.UseVisualStyleBackColor = true; 269 this.cbxDisposable.CheckedChanged += new System.EventHandler(this.c heckBox1_CheckedChanged);272 this.cbxDisposable.CheckedChanged += new System.EventHandler(this.cbxDisposable_CheckedChanged); 270 273 // 271 274 // label4 272 275 // 273 276 this.label4.AutoSize = true; 274 this.label4.Location = new System.Drawing.Point(3, 2 69);277 this.label4.Location = new System.Drawing.Point(3, 297); 275 278 this.label4.Name = "label4"; 276 279 this.label4.Size = new System.Drawing.Size(62, 13); … … 278 281 this.label4.Text = "Disposable:"; 279 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 // 280 303 // SlaveView 281 304 // 282 305 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 283 306 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 307 this.Controls.Add(this.label5); 308 this.Controls.Add(this.cbxPublic); 284 309 this.Controls.Add(this.label4); 285 310 this.Controls.Add(this.cbxDisposable); … … 305 330 this.Controls.Add(this.label9); 306 331 this.Name = "SlaveView"; 307 this.Size = new System.Drawing.Size(539, 285);332 this.Size = new System.Drawing.Size(539, 407); 308 333 this.ResumeLayout(false); 309 334 this.PerformLayout(); … … 335 360 private System.Windows.Forms.CheckBox cbxDisposable; 336 361 private System.Windows.Forms.Label label4; 362 private System.Windows.Forms.CheckBox cbxPublic; 363 private System.Windows.Forms.Label label5; 337 364 } 338 365 } -
trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/SlaveView.cs
r7862 r8051 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; … … 63 64 txtHbIntervall.Clear(); 64 65 cbxDisposable.Checked = false; 66 cbxPublic.Checked = false; 65 67 } else { 66 68 if (Content.GetType() == typeof(Slave)) { 67 69 ShowSlaveUI(true); 68 70 Slave ct = (Slave)Content; 71 bool authorized = HiveServiceLocator.Instance.CallHiveService<bool>(service => service.AuthorizesForResourceAdministration(ct.Id)); 69 72 txtName.Text = ct.Name; 70 73 txtHbIntervall.Text = ct.HbInterval.ToString(); 71 cbxDisposable.Checked = ct.IsDisposable.GetValueOrDefault(); 74 cbxPublic.Enabled = authorized; 75 cbxPublic.CheckedChanged -= new EventHandler(cbxPublic_CheckedChanged); 76 cbxPublic.Checked = ct.OwnerUserId == null; 77 cbxPublic.CheckedChanged += new EventHandler(cbxPublic_CheckedChanged); 72 78 txtCPU.Text = string.Format("{0} Cores @ {1} Mhz, Arch.: {2}", ct.Cores.ToString(), ct.CpuSpeed.ToString(), ct.CpuArchitecture.ToString()); 73 79 txtDetailsDescription.Text = ct.Description; … … 78 84 txtFreeMemory.Text = ct.FreeMemory.ToString(); 79 85 txtId.Text = ct.Id.ToString(); 86 cbxDisposable.Enabled = authorized; 87 cbxDisposable.Checked = ct.IsDisposable.GetValueOrDefault(); 80 88 } else if (Content.GetType() == typeof(SlaveGroup)) { 81 89 SlaveGroup ct = (SlaveGroup)Content; 82 90 txtName.Text = ct.Name; 83 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); 84 96 ShowSlaveUI(false); 85 97 } else { … … 136 148 } 137 149 138 private void c heckBox1_CheckedChanged(object sender, EventArgs e) {150 private void cbxDisposable_CheckedChanged(object sender, EventArgs e) { 139 151 if (Content != null) { 140 152 ((Slave)Content).IsDisposable = cbxDisposable.Checked; 141 153 } 142 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 } 143 161 } 144 162 }
Note: See TracChangeset
for help on using the changeset viewer.